Commit 36c964bd authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

SVGAnimatedNumber initial values

This implements initial values for SVGAnimatedNumber properties (which
includes SVGAnimatedNumberOptionalNumber since it is a reverse proxy to
the former.)

Bug: 225807
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Icb62d7383cacf7df122fc56af0977015b5adf9b7
Reviewed-on: https://chromium-review.googlesource.com/1209705
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589219}
parent 54d36f8e
......@@ -7,12 +7,21 @@ const objects = {
SVGFEColorMatrixElement: 'feColorMatrix',
SVGFECompositeElement: 'feComposite',
SVGFEConvolveMatrixElement: 'feConvolveMatrix',
SVGFEDiffuseLightingElement: 'feDiffuseLighting',
SVGFEDisplacementMapElement: 'feDisplacementMap',
SVGFEDistantLightElement: 'feDistantLight',
SVGFEDropShadowElement: 'feDropShadow',
SVGFEGaussianBlurElement: 'feGaussianBlur',
SVGFEMorphologyElement: 'feMorphology',
SVGFEOffsetElement: 'feOffset',
SVGFEPointLightElement: 'fePointLight',
SVGFESpecularLightingElement: 'feSpecularLighting',
SVGFESpotLightElement: 'feSpotLight',
SVGFETurbulenceElement: 'feTurbulence',
SVGFilterElement: 'filter',
SVGFilterPrimitiveStandardAttributes: 'feBlend',
SVGForeignObjectElement: 'foreignObject',
SVGGeometryElement: 'rect',
SVGGradientElement: 'linearGradient',
SVGImageElement: 'image',
SVGLineElement: 'line',
......@@ -23,6 +32,7 @@ const objects = {
SVGRadialGradientElement: 'radialGradient',
SVGRectElement: 'rect',
SVGSVGElement: 'svg',
SVGStopElement: 'stop',
SVGTextContentElement: 'text',
SVGTextPathElement: 'textPath',
SVGUseElement: 'use',
......
<!DOCTYPE html>
<title>SVGAnimatedNumber, initial values</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/initial-value-helper.js"></script>
<script>
// Map from IDL attribute to content attribute:
const propertyToAttributeMap = {
kernelUnitLengthX: 'kernelUnitLength',
kernelUnitLengthY: 'kernelUnitLength',
baseFrequencyX: 'baseFrequency',
baseFrequencyY: 'baseFrequency',
stdDeviationX: 'stdDeviation',
stdDeviationY: 'stdDeviation',
radiusX: 'radius',
radiusY: 'radius',
};
assert_initial_values([
{ interface: 'SVGComponentTransferFunctionElement',
attributes: [ 'slope', 'intercept', 'amplitude', 'exponent', 'offset' ],
slope: { initial: 1 }, amplitude: { initial: 1 }, exponent: { initial: 1 } },
{ interface: 'SVGFECompositeElement', attributes: [ 'k1', 'k2', 'k3', 'k4' ] },
{ interface: 'SVGFEConvolveMatrixElement',
attributes: [ 'divisor', 'bias', 'kernelUnitLengthX', 'kernelUnitLengthY' ],
divisor: { initial: 1 } },
{ interface: 'SVGFEDiffuseLightingElement',
attributes: [ 'surfaceScale', 'diffuseConstant', 'kernelUnitLengthX', 'kernelUnitLengthY' ],
diffuseConstant: { initial: 1 }, surfaceScale: { initial: 1 } },
{ interface: 'SVGFEDisplacementMapElement', attributes: [ 'scale' ] },
{ interface: 'SVGFEDistantLightElement', attributes: [ 'azimuth', 'elevation' ] },
{ interface: 'SVGFEDropShadowElement',
attributes: [ 'dx', 'dy', 'stdDeviationX', 'stdDeviationY' ],
dx: { initial: 2 }, dy: { initial: 2 }, stdDeviationX: { initial: 2 }, stdDeviationY: { initial: 2 } },
{ interface: 'SVGFEGaussianBlurElement', attributes: [ 'stdDeviationX', 'stdDeviationY' ] },
{ interface: 'SVGFEMorphologyElement', attributes: [ 'radiusX', 'radiusY' ] },
{ interface: 'SVGFEOffsetElement', attributes: [ 'dx', 'dy' ] },
{ interface: 'SVGFEPointLightElement', attributes: [ 'x', 'y', 'z' ] },
{ interface: 'SVGFESpecularLightingElement',
attributes: [ 'surfaceScale', 'specularConstant', 'specularExponent', 'kernelUnitLengthX', 'kernelUnitLengthY' ],
specularConstant: { initial: 1 }, specularExponent: { initial: 1 }, surfaceScale: { initial: 1 } },
{ interface: 'SVGFESpotLightElement',
attributes: [ 'x', 'y', 'z', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'specularExponent', 'limitingConeAngle' ],
specularExponent: { initial: 1 } },
{ interface: 'SVGFETurbulenceElement', attributes: [ 'baseFrequencyX', 'baseFrequencyY', 'seed' ] },
{ interface: 'SVGGeometryElement', attributes: [ 'pathLength' ] },
{ interface: 'SVGStopElement', attributes: [ 'offset' ] },
], { initial: 0, valid: '42', mapProperty: propertyToAttributeMap });
</script>
......@@ -47,6 +47,13 @@ class SVGAnimatedNumber : public ScriptWrappable,
USING_GARBAGE_COLLECTED_MIXIN(SVGAnimatedNumber);
public:
static SVGAnimatedNumber* Create(SVGElement* context_element,
const QualifiedName& attribute_name,
float initial_number) {
SVGNumber* initial_value = SVGNumber::Create(initial_number);
return new SVGAnimatedNumber(context_element, attribute_name,
initial_value);
}
static SVGAnimatedNumber* Create(SVGElement* context_element,
const QualifiedName& attribute_name,
SVGNumber* initial_value) {
......@@ -67,9 +74,12 @@ class SVGAnimatedNumber : public ScriptWrappable,
SVGAnimatedNumber(SVGElement* context_element,
const QualifiedName& attribute_name,
SVGNumber* initial_value)
: SVGAnimatedProperty<SVGNumber>(context_element,
attribute_name,
initial_value),
: SVGAnimatedProperty<SVGNumber>(
context_element,
attribute_name,
initial_value,
CSSPropertyInvalid,
static_cast<unsigned>(initial_value->Value())),
parent_number_optional_number_(nullptr) {}
Member<SVGAnimatedNumberOptionalNumber> parent_number_optional_number_;
......
......@@ -24,14 +24,14 @@ namespace blink {
SVGAnimatedNumberOptionalNumber::SVGAnimatedNumberOptionalNumber(
SVGElement* context_element,
const QualifiedName& attribute_name,
float initial_first_value,
float initial_second_value)
float initial_value)
: SVGAnimatedPropertyCommon<SVGNumberOptionalNumber>(
context_element,
attribute_name,
SVGNumberOptionalNumber::Create(
SVGNumber::Create(initial_first_value),
SVGNumber::Create(initial_second_value))),
SVGNumberOptionalNumber::Create(SVGNumber::Create(initial_value),
SVGNumber::Create(initial_value)),
CSSPropertyInvalid,
static_cast<unsigned>(initial_value)),
first_number_(SVGAnimatedNumber::Create(context_element,
attribute_name,
BaseValue()->FirstNumber())),
......
......@@ -52,11 +52,9 @@ class SVGAnimatedNumberOptionalNumber
static SVGAnimatedNumberOptionalNumber* Create(
SVGElement* context_element,
const QualifiedName& attribute_name,
float initial_first_value = 0,
float initial_second_value = 0) {
float initial_value) {
return new SVGAnimatedNumberOptionalNumber(context_element, attribute_name,
initial_first_value,
initial_second_value);
initial_value);
}
void SetAnimatedValue(SVGPropertyBase*) override;
......@@ -71,8 +69,7 @@ class SVGAnimatedNumberOptionalNumber
protected:
SVGAnimatedNumberOptionalNumber(SVGElement* context_element,
const QualifiedName& attribute_name,
float initial_first_value,
float initial_second_value);
float initial_value);
Member<SVGAnimatedNumber> first_number_;
Member<SVGAnimatedNumber> second_number_;
......
......@@ -50,21 +50,12 @@ SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(
: SVGElement(tag_name, document),
table_values_(
SVGAnimatedNumberList::Create(this, SVGNames::tableValuesAttr)),
slope_(SVGAnimatedNumber::Create(this,
SVGNames::slopeAttr,
SVGNumber::Create(1))),
intercept_(SVGAnimatedNumber::Create(this,
SVGNames::interceptAttr,
SVGNumber::Create())),
amplitude_(SVGAnimatedNumber::Create(this,
SVGNames::amplitudeAttr,
SVGNumber::Create(1))),
exponent_(SVGAnimatedNumber::Create(this,
SVGNames::exponentAttr,
SVGNumber::Create(1))),
offset_(SVGAnimatedNumber::Create(this,
SVGNames::offsetAttr,
SVGNumber::Create())),
slope_(SVGAnimatedNumber::Create(this, SVGNames::slopeAttr, 1)),
intercept_(
SVGAnimatedNumber::Create(this, SVGNames::interceptAttr, 0.0f)),
amplitude_(SVGAnimatedNumber::Create(this, SVGNames::amplitudeAttr, 1)),
exponent_(SVGAnimatedNumber::Create(this, SVGNames::exponentAttr, 1)),
offset_(SVGAnimatedNumber::Create(this, SVGNames::offsetAttr, 0.0f)),
type_(SVGAnimatedEnumeration<ComponentTransferType>::Create(
this,
SVGNames::typeAttr,
......
......@@ -49,18 +49,10 @@ unsigned short GetMaxExposedEnumValue<CompositeOperationType>() {
inline SVGFECompositeElement::SVGFECompositeElement(Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feCompositeTag, document),
k1_(SVGAnimatedNumber::Create(this,
SVGNames::k1Attr,
SVGNumber::Create())),
k2_(SVGAnimatedNumber::Create(this,
SVGNames::k2Attr,
SVGNumber::Create())),
k3_(SVGAnimatedNumber::Create(this,
SVGNames::k3Attr,
SVGNumber::Create())),
k4_(SVGAnimatedNumber::Create(this,
SVGNames::k4Attr,
SVGNumber::Create())),
k1_(SVGAnimatedNumber::Create(this, SVGNames::k1Attr, 0.0f)),
k2_(SVGAnimatedNumber::Create(this, SVGNames::k2Attr, 0.0f)),
k3_(SVGAnimatedNumber::Create(this, SVGNames::k3Attr, 0.0f)),
k4_(SVGAnimatedNumber::Create(this, SVGNames::k4Attr, 0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)),
in2_(SVGAnimatedString::Create(this, SVGNames::in2Attr)),
svg_operator_(SVGAnimatedEnumeration<CompositeOperationType>::Create(
......
......@@ -78,12 +78,8 @@ inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(
Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feConvolveMatrixTag,
document),
bias_(SVGAnimatedNumber::Create(this,
SVGNames::biasAttr,
SVGNumber::Create())),
divisor_(SVGAnimatedNumber::Create(this,
SVGNames::divisorAttr,
SVGNumber::Create())),
bias_(SVGAnimatedNumber::Create(this, SVGNames::biasAttr, 0.0f)),
divisor_(SVGAnimatedNumber::Create(this, SVGNames::divisorAttr, 1)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)),
edge_mode_(
SVGAnimatedEnumeration<EdgeModeType>::Create(this,
......@@ -93,7 +89,8 @@ inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(
SVGAnimatedNumberList::Create(this, SVGNames::kernelMatrixAttr)),
kernel_unit_length_(SVGAnimatedNumberOptionalNumber::Create(
this,
SVGNames::kernelUnitLengthAttr)),
SVGNames::kernelUnitLengthAttr,
0.0f)),
order_(SVGAnimatedOrder::Create(this)),
preserve_alpha_(
SVGAnimatedBoolean::Create(this, SVGNames::preserveAlphaAttr)),
......@@ -151,6 +148,17 @@ IntPoint SVGFEConvolveMatrixElement::TargetPoint() const {
return target;
}
float SVGFEConvolveMatrixElement::ComputeDivisor() const {
if (divisor_->IsSpecified())
return divisor_->CurrentValue()->Value();
float divisor_value = 0;
SVGNumberList* kernel_matrix = kernel_matrix_->CurrentValue();
size_t kernel_matrix_size = kernel_matrix->length();
for (size_t i = 0; i < kernel_matrix_size; ++i)
divisor_value += kernel_matrix->at(i)->Value();
return divisor_value ? divisor_value : 1;
}
bool SVGFEConvolveMatrixElement::SetFilterEffectAttribute(
FilterEffect* effect,
const QualifiedName& attr_name) {
......@@ -159,7 +167,7 @@ bool SVGFEConvolveMatrixElement::SetFilterEffectAttribute(
return convolve_matrix->SetEdgeMode(
edge_mode_->CurrentValue()->EnumValue());
if (attr_name == SVGNames::divisorAttr)
return convolve_matrix->SetDivisor(divisor_->CurrentValue()->Value());
return convolve_matrix->SetDivisor(ComputeDivisor());
if (attr_name == SVGNames::biasAttr)
return convolve_matrix->SetBias(bias_->CurrentValue()->Value());
if (attr_name == SVGNames::targetXAttr || attr_name == SVGNames::targetYAttr)
......@@ -200,18 +208,8 @@ FilterEffect* SVGFEConvolveMatrixElement::Build(
AtomicString(in1_->CurrentValue()->Value()));
DCHECK(input1);
float divisor_value = divisor_->CurrentValue()->Value();
if (!divisor_->IsSpecified()) {
SVGNumberList* kernel_matrix = kernel_matrix_->CurrentValue();
size_t kernel_matrix_size = kernel_matrix->length();
for (size_t i = 0; i < kernel_matrix_size; ++i)
divisor_value += kernel_matrix->at(i)->Value();
if (!divisor_value)
divisor_value = 1;
}
FilterEffect* effect = FEConvolveMatrix::Create(
filter, MatrixOrder(), divisor_value, bias_->CurrentValue()->Value(),
filter, MatrixOrder(), ComputeDivisor(), bias_->CurrentValue()->Value(),
TargetPoint(), edge_mode_->CurrentValue()->EnumValue(),
preserve_alpha_->CurrentValue()->Value(),
kernel_matrix_->CurrentValue()->ToFloatVector());
......
......@@ -67,6 +67,7 @@ class SVGFEConvolveMatrixElement final
IntSize MatrixOrder() const;
IntPoint TargetPoint() const;
float ComputeDivisor() const;
bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
void SvgAttributeChanged(const QualifiedName&) override;
......
......@@ -31,15 +31,14 @@ inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(
Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feDiffuseLightingTag,
document),
diffuse_constant_(SVGAnimatedNumber::Create(this,
SVGNames::diffuseConstantAttr,
SVGNumber::Create(1))),
surface_scale_(SVGAnimatedNumber::Create(this,
SVGNames::surfaceScaleAttr,
SVGNumber::Create(1))),
diffuse_constant_(
SVGAnimatedNumber::Create(this, SVGNames::diffuseConstantAttr, 1)),
surface_scale_(
SVGAnimatedNumber::Create(this, SVGNames::surfaceScaleAttr, 1)),
kernel_unit_length_(SVGAnimatedNumberOptionalNumber::Create(
this,
SVGNames::kernelUnitLengthAttr)),
SVGNames::kernelUnitLengthAttr,
0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)) {
AddToPropertyMap(diffuse_constant_);
AddToPropertyMap(surface_scale_);
......
......@@ -41,9 +41,7 @@ inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(
Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feDisplacementMapTag,
document),
scale_(SVGAnimatedNumber::Create(this,
SVGNames::scaleAttr,
SVGNumber::Create(0))),
scale_(SVGAnimatedNumber::Create(this, SVGNames::scaleAttr, 0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)),
in2_(SVGAnimatedString::Create(this, SVGNames::in2Attr)),
x_channel_selector_(SVGAnimatedEnumeration<ChannelSelectorType>::Create(
......
......@@ -30,16 +30,11 @@ namespace blink {
inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document),
dx_(SVGAnimatedNumber::Create(this,
SVGNames::dxAttr,
SVGNumber::Create(2))),
dy_(SVGAnimatedNumber::Create(this,
SVGNames::dyAttr,
SVGNumber::Create(2))),
dx_(SVGAnimatedNumber::Create(this, SVGNames::dxAttr, 2)),
dy_(SVGAnimatedNumber::Create(this, SVGNames::dyAttr, 2)),
std_deviation_(
SVGAnimatedNumberOptionalNumber::Create(this,
SVGNames::stdDeviationAttr,
2,
2)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)) {
AddToPropertyMap(dx_);
......
......@@ -32,8 +32,7 @@ inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(Document& document)
std_deviation_(
SVGAnimatedNumberOptionalNumber::Create(this,
SVGNames::stdDeviationAttr,
0,
0)),
0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)) {
AddToPropertyMap(std_deviation_);
AddToPropertyMap(in1_);
......
......@@ -32,32 +32,24 @@ namespace blink {
SVGFELightElement::SVGFELightElement(const QualifiedName& tag_name,
Document& document)
: SVGElement(tag_name, document),
azimuth_(SVGAnimatedNumber::Create(this,
SVGNames::azimuthAttr,
SVGNumber::Create())),
elevation_(SVGAnimatedNumber::Create(this,
SVGNames::elevationAttr,
SVGNumber::Create())),
x_(SVGAnimatedNumber::Create(this, SVGNames::xAttr, SVGNumber::Create())),
y_(SVGAnimatedNumber::Create(this, SVGNames::yAttr, SVGNumber::Create())),
z_(SVGAnimatedNumber::Create(this, SVGNames::zAttr, SVGNumber::Create())),
points_at_x_(SVGAnimatedNumber::Create(this,
SVGNames::pointsAtXAttr,
SVGNumber::Create())),
points_at_y_(SVGAnimatedNumber::Create(this,
SVGNames::pointsAtYAttr,
SVGNumber::Create())),
points_at_z_(SVGAnimatedNumber::Create(this,
SVGNames::pointsAtZAttr,
SVGNumber::Create())),
azimuth_(SVGAnimatedNumber::Create(this, SVGNames::azimuthAttr, 0.0f)),
elevation_(
SVGAnimatedNumber::Create(this, SVGNames::elevationAttr, 0.0f)),
x_(SVGAnimatedNumber::Create(this, SVGNames::xAttr, 0.0f)),
y_(SVGAnimatedNumber::Create(this, SVGNames::yAttr, 0.0f)),
z_(SVGAnimatedNumber::Create(this, SVGNames::zAttr, 0.0f)),
points_at_x_(
SVGAnimatedNumber::Create(this, SVGNames::pointsAtXAttr, 0.0f)),
points_at_y_(
SVGAnimatedNumber::Create(this, SVGNames::pointsAtYAttr, 0.0f)),
points_at_z_(
SVGAnimatedNumber::Create(this, SVGNames::pointsAtZAttr, 0.0f)),
specular_exponent_(
SVGAnimatedNumber::Create(this,
SVGNames::specularExponentAttr,
SVGNumber::Create(1))),
SVGAnimatedNumber::Create(this, SVGNames::specularExponentAttr, 1)),
limiting_cone_angle_(
SVGAnimatedNumber::Create(this,
SVGNames::limitingConeAngleAttr,
SVGNumber::Create())) {
0.0f)) {
AddToPropertyMap(azimuth_);
AddToPropertyMap(elevation_);
AddToPropertyMap(x_);
......
......@@ -37,8 +37,9 @@ GetStaticStringEntries<MorphologyOperatorType>() {
inline SVGFEMorphologyElement::SVGFEMorphologyElement(Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feMorphologyTag, document),
radius_(
SVGAnimatedNumberOptionalNumber::Create(this, SVGNames::radiusAttr)),
radius_(SVGAnimatedNumberOptionalNumber::Create(this,
SVGNames::radiusAttr,
0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)),
svg_operator_(SVGAnimatedEnumeration<MorphologyOperatorType>::Create(
this,
......
......@@ -28,12 +28,8 @@ namespace blink {
inline SVGFEOffsetElement::SVGFEOffsetElement(Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feOffsetTag, document),
dx_(SVGAnimatedNumber::Create(this,
SVGNames::dxAttr,
SVGNumber::Create())),
dy_(SVGAnimatedNumber::Create(this,
SVGNames::dyAttr,
SVGNumber::Create())),
dx_(SVGAnimatedNumber::Create(this, SVGNames::dxAttr, 0.0f)),
dy_(SVGAnimatedNumber::Create(this, SVGNames::dyAttr, 0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)) {
AddToPropertyMap(dx_);
AddToPropertyMap(dy_);
......
......@@ -34,19 +34,15 @@ inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(
: SVGFilterPrimitiveStandardAttributes(SVGNames::feSpecularLightingTag,
document),
specular_constant_(
SVGAnimatedNumber::Create(this,
SVGNames::specularConstantAttr,
SVGNumber::Create(1))),
SVGAnimatedNumber::Create(this, SVGNames::specularConstantAttr, 1)),
specular_exponent_(
SVGAnimatedNumber::Create(this,
SVGNames::specularExponentAttr,
SVGNumber::Create(1))),
surface_scale_(SVGAnimatedNumber::Create(this,
SVGNames::surfaceScaleAttr,
SVGNumber::Create(1))),
SVGAnimatedNumber::Create(this, SVGNames::specularExponentAttr, 1)),
surface_scale_(
SVGAnimatedNumber::Create(this, SVGNames::surfaceScaleAttr, 1)),
kernel_unit_length_(SVGAnimatedNumberOptionalNumber::Create(
this,
SVGNames::kernelUnitLengthAttr)),
SVGNames::kernelUnitLengthAttr,
0.0f)),
in1_(SVGAnimatedString::Create(this, SVGNames::inAttr)) {
AddToPropertyMap(specular_constant_);
AddToPropertyMap(specular_exponent_);
......
......@@ -50,10 +50,9 @@ inline SVGFETurbulenceElement::SVGFETurbulenceElement(Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feTurbulenceTag, document),
base_frequency_(
SVGAnimatedNumberOptionalNumber::Create(this,
SVGNames::baseFrequencyAttr)),
seed_(SVGAnimatedNumber::Create(this,
SVGNames::seedAttr,
SVGNumber::Create(0))),
SVGNames::baseFrequencyAttr,
0.0f)),
seed_(SVGAnimatedNumber::Create(this, SVGNames::seedAttr, 0.0f)),
stitch_tiles_(SVGAnimatedEnumeration<SVGStitchOptions>::Create(
this,
SVGNames::stitchTilesAttr,
......
......@@ -67,6 +67,9 @@ class SVGNumber : public SVGPropertyHelper<SVGNumber> {
static AnimatedPropertyType ClassType() { return kAnimatedNumber; }
void SetInitial(unsigned value) { SetValue(value); }
static constexpr int kInitialValueBits = 2;
protected:
explicit SVGNumber(float);
......
......@@ -83,6 +83,12 @@ SVGParsingError SVGNumberOptionalNumber::SetValueAsString(const String& value) {
return parse_status;
}
void SVGNumberOptionalNumber::SetInitial(unsigned value) {
// Propagate the value to the split representation.
first_number_->SetInitial(value);
second_number_->SetInitial(value);
}
void SVGNumberOptionalNumber::Add(SVGPropertyBase* other, SVGElement*) {
SVGNumberOptionalNumber* other_number_optional_number =
ToSVGNumberOptionalNumber(other);
......
......@@ -53,6 +53,8 @@ class SVGNumberOptionalNumber final : public SVGPropertyBase {
String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&);
void SetInitial(unsigned);
static constexpr int kInitialValueBits = SVGNumber::kInitialValueBits;
void Add(SVGPropertyBase*, SVGElement*) override;
void CalculateAnimatedValue(SVGAnimationElement*,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment