diff --git a/third_party/WebKit/LayoutTests/svg/dom/resources/initial-value-helper.js b/third_party/WebKit/LayoutTests/svg/dom/resources/initial-value-helper.js index 722ecf4b2c5507..a27d0df2ef74f3 100644 --- a/third_party/WebKit/LayoutTests/svg/dom/resources/initial-value-helper.js +++ b/third_party/WebKit/LayoutTests/svg/dom/resources/initial-value-helper.js @@ -1,9 +1,19 @@ const objects = { SVGCircleElement: 'circle', + SVGClipPathElement: 'clipPath', + SVGComponentTransferFunctionElement: 'feFuncA', SVGEllipseElement: 'ellipse', + SVGFEBlendElement: 'feBlend', + SVGFEColorMatrixElement: 'feColorMatrix', + SVGFECompositeElement: 'feComposite', + SVGFEConvolveMatrixElement: 'feConvolveMatrix', + SVGFEDisplacementMapElement: 'feDisplacementMap', + SVGFEMorphologyElement: 'feMorphology', + SVGFETurbulenceElement: 'feTurbulence', SVGFilterElement: 'filter', SVGFilterPrimitiveStandardAttributes: 'feBlend', SVGForeignObjectElement: 'foreignObject', + SVGGradientElement: 'linearGradient', SVGImageElement: 'image', SVGLineElement: 'line', SVGLinearGradientElement: 'linearGradient', diff --git a/third_party/WebKit/LayoutTests/svg/dom/svganimatedenumeration-initial-values.html b/third_party/WebKit/LayoutTests/svg/dom/svganimatedenumeration-initial-values.html new file mode 100644 index 00000000000000..bb4a73f6afb851 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/dom/svganimatedenumeration-initial-values.html @@ -0,0 +1,49 @@ + +SVGAnimatedEnumeration, initial values + + + + diff --git a/third_party/blink/renderer/core/svg/svg_animated_enumeration.h b/third_party/blink/renderer/core/svg/svg_animated_enumeration.h index 34d845ad3d34ac..b64f188d34c9e3 100644 --- a/third_party/blink/renderer/core/svg/svg_animated_enumeration.h +++ b/third_party/blink/renderer/core/svg/svg_animated_enumeration.h @@ -44,15 +44,17 @@ class SVGAnimatedEnumeration : public SVGAnimatedEnumerationBase { Enum initial_value) { return new SVGAnimatedEnumeration( context_element, attribute_name, - SVGEnumeration::Create(initial_value)); + SVGEnumeration::Create(initial_value), + static_cast(initial_value)); } static SVGAnimatedEnumeration* Create( SVGElement* context_element, const QualifiedName& attribute_name, SVGEnumeration* initial_value) { - return new SVGAnimatedEnumeration(context_element, attribute_name, - initial_value); + return new SVGAnimatedEnumeration( + context_element, attribute_name, initial_value, + static_cast(initial_value->EnumValue())); } SVGEnumeration* BaseValue() { @@ -73,10 +75,12 @@ class SVGAnimatedEnumeration : public SVGAnimatedEnumerationBase { protected: SVGAnimatedEnumeration(SVGElement* context_element, const QualifiedName& attribute_name, - SVGEnumeration* initial_value) + SVGEnumeration* initial_value, + unsigned initial_enum_value) : SVGAnimatedEnumerationBase(context_element, attribute_name, - initial_value) {} + initial_value, + initial_enum_value) {} }; } // namespace blink diff --git a/third_party/blink/renderer/core/svg/svg_animated_enumeration_base.h b/third_party/blink/renderer/core/svg/svg_animated_enumeration_base.h index 0ada0b5efeff46..d101766a0d77fc 100644 --- a/third_party/blink/renderer/core/svg/svg_animated_enumeration_base.h +++ b/third_party/blink/renderer/core/svg/svg_animated_enumeration_base.h @@ -56,10 +56,13 @@ class SVGAnimatedEnumerationBase protected: SVGAnimatedEnumerationBase(SVGElement* context_element, const QualifiedName& attribute_name, - SVGEnumerationBase* initial_value) + SVGEnumerationBase* initial_value, + unsigned initial_enum_value) : SVGAnimatedProperty(context_element, attribute_name, - initial_value) {} + initial_value, + CSSPropertyInvalid, + initial_enum_value) {} }; } // namespace blink diff --git a/third_party/blink/renderer/core/svg/svg_enumeration.h b/third_party/blink/renderer/core/svg/svg_enumeration.h index db15a85cb4d671..4b4a074931223c 100644 --- a/third_party/blink/renderer/core/svg/svg_enumeration.h +++ b/third_party/blink/renderer/core/svg/svg_enumeration.h @@ -80,6 +80,11 @@ class SVGEnumerationBase : public SVGPropertyBase { // relevant interface. unsigned short MaxExposedEnumValue() const { return max_exposed_; } + void SetInitial(unsigned value) { + SetValue(static_cast(value)); + } + static constexpr int kInitialValueBits = 3; + protected: SVGEnumerationBase(unsigned short value, const StringEntries& entries,