WebKit Bugzilla
Attachment 356732 Details for
Bug 191237
: Remove SVG properties tear-off objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
14-Resources
14-Resources.patch (text/plain), 74.86 KB, created by
Said Abou-Hallawa
on 2018-12-06 08:03:48 PST
(
hide
)
Description:
14-Resources
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-12-06 08:03:48 PST
Size:
74.86 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9c3b66b6399..e987bb71dbd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,81 @@ >+2018-12-05 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Remove SVG properties tear-off objects >+ https://bugs.webkit.org/show_bug.cgi?id=191237 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove the SVG tear-off property references from the SVG resource objects. >+ >+ * svg/SVGClipPathElement.cpp: >+ (WebCore::SVGClipPathElement::SVGClipPathElement): >+ (WebCore::SVGClipPathElement::parseAttribute): >+ (WebCore::SVGClipPathElement::svgAttributeChanged): >+ (WebCore::SVGClipPathElement::registerAttributes): Deleted. >+ * svg/SVGClipPathElement.h: >+ * svg/SVGFontElement.h: >+ * svg/SVGGradientElement.cpp: >+ (WebCore::SVGGradientElement::SVGGradientElement): >+ (WebCore::SVGGradientElement::parseAttribute): >+ (WebCore::SVGGradientElement::buildStops const): >+ (WebCore::SVGGradientElement::registerAttributes): Deleted. >+ (WebCore::SVGGradientElement::buildStops): Deleted. >+ * svg/SVGGradientElement.h: >+ (WebCore::SVGGradientElement::spreadMethod const): >+ (WebCore::SVGGradientElement::gradientUnits const): >+ (WebCore::SVGGradientElement::gradientTransform const): >+ (WebCore::SVGGradientElement::spreadMethod): >+ (WebCore::SVGGradientElement::gradientUnits): >+ (WebCore::SVGGradientElement::gradientTransform): >+ (WebCore::SVGGradientElement::isKnownAttribute): >+ (WebCore::SVGGradientElement::attributeRegistry): Deleted. >+ (WebCore::SVGGradientElement::spreadMethodAnimated): Deleted. >+ (WebCore::SVGGradientElement::gradientUnitsAnimated): Deleted. >+ (WebCore::SVGGradientElement::gradientTransformAnimated): Deleted. >+ * svg/SVGLinearGradientElement.cpp: >+ (WebCore::SVGLinearGradientElement::SVGLinearGradientElement): >+ (WebCore::SVGLinearGradientElement::parseAttribute): >+ (WebCore::SVGLinearGradientElement::svgAttributeChanged): >+ (WebCore::setGradientAttributes): >+ (WebCore::SVGLinearGradientElement::collectGradientAttributes): >+ (WebCore::SVGLinearGradientElement::registerAttributes): Deleted. >+ * svg/SVGLinearGradientElement.h: >+ * svg/SVGMarkerElement.cpp: >+ (WebCore::SVGMarkerElement::SVGMarkerElement): >+ (WebCore::SVGMarkerElement::parseAttribute): >+ (WebCore::SVGMarkerElement::svgAttributeChanged): >+ (WebCore::SVGMarkerElement::setOrient): >+ (WebCore::SVGMarkerElement::setOrientToAngle): >+ (WebCore::SVGMarkerElement::orientTypeIdentifier): Deleted. >+ (WebCore::SVGMarkerElement::orientAngleIdentifier): Deleted. >+ (WebCore::SVGMarkerElement::registerAttributes): Deleted. >+ * svg/SVGMarkerElement.h: >+ * svg/SVGMaskElement.cpp: >+ (WebCore::SVGMaskElement::SVGMaskElement): >+ (WebCore::SVGMaskElement::parseAttribute): >+ (WebCore::SVGMaskElement::svgAttributeChanged): >+ (WebCore::SVGMaskElement::registerAttributes): Deleted. >+ * svg/SVGMaskElement.h: >+ * svg/SVGPatternElement.cpp: >+ (WebCore::SVGPatternElement::SVGPatternElement): >+ (WebCore::SVGPatternElement::parseAttribute): >+ (WebCore::SVGPatternElement::svgAttributeChanged): >+ (WebCore::SVGPatternElement::registerAttributes): Deleted. >+ * svg/SVGPatternElement.h: >+ * svg/SVGRadialGradientElement.cpp: >+ (WebCore::SVGRadialGradientElement::SVGRadialGradientElement): >+ (WebCore::SVGRadialGradientElement::parseAttribute): >+ (WebCore::setGradientAttributes): >+ (WebCore::SVGRadialGradientElement::collectGradientAttributes const): >+ (WebCore::SVGRadialGradientElement::registerAttributes): Deleted. >+ (WebCore::SVGRadialGradientElement::collectGradientAttributes): Deleted. >+ * svg/SVGRadialGradientElement.h: >+ * svg/SVGStopElement.cpp: >+ (WebCore::SVGStopElement::SVGStopElement): >+ (WebCore::SVGStopElement::parseAttribute): >+ (WebCore::SVGStopElement::registerAttributes): Deleted. >+ * svg/SVGStopElement.h: >+ > 2018-12-05 Said Abou-Hallawa <sabouhallawa@apple.com> > > Remove SVG properties tear-off objects >diff --git a/Source/WebCore/svg/SVGClipPathElement.cpp b/Source/WebCore/svg/SVGClipPathElement.cpp >index bdd35d7a808..5974e1bf6f2 100644 >--- a/Source/WebCore/svg/SVGClipPathElement.cpp >+++ b/Source/WebCore/svg/SVGClipPathElement.cpp >@@ -39,7 +39,11 @@ inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu > , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::clipPathTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGClipPathElement::m_clipPathUnits>(); >+ }); > } > > Ref<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document& document) >@@ -47,20 +51,12 @@ Ref<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, > return adoptRef(*new SVGClipPathElement(tagName, document)); > } > >-void SVGClipPathElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGClipPathElement::m_clipPathUnits>(); >-} >- > void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::clipPathUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- m_clipPathUnits.setValue(propertyValue); >+ m_clipPathUnits->setBaseValInternal(propertyValue); > return; > } > >@@ -70,7 +66,7 @@ void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > > if (RenderObject* object = renderer()) >diff --git a/Source/WebCore/svg/SVGClipPathElement.h b/Source/WebCore/svg/SVGClipPathElement.h >index 63b6bde0e24..3085d46b42d 100644 >--- a/Source/WebCore/svg/SVGClipPathElement.h >+++ b/Source/WebCore/svg/SVGClipPathElement.h >@@ -21,8 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedEnumeration.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > #include "SVGUnitTypes.h" >@@ -36,18 +34,15 @@ class SVGClipPathElement final : public SVGGraphicsElement, public SVGExternalRe > public: > static Ref<SVGClipPathElement> create(const QualifiedName&, Document&); > >- SVGUnitTypes::SVGUnitType clipPathUnits() const { return m_clipPathUnits.currentValue(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> clipPathUnitsAnimated() { return m_clipPathUnits.animatedProperty(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType clipPathUnits() const { return m_clipPathUnits->currentValue<SVGUnitTypes::SVGUnitType>(); } >+ Ref<SVGAnimatedEnumeration>& clipPathUnits() { return m_clipPathUnits; } > > private: > SVGClipPathElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGClipPathElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGClipPathElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; >@@ -58,8 +53,8 @@ private: > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_clipPathUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedEnumeration> m_clipPathUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFontElement.h b/Source/WebCore/svg/SVGFontElement.h >index 82a432abf2f..408cbeef233 100644 >--- a/Source/WebCore/svg/SVGFontElement.h >+++ b/Source/WebCore/svg/SVGFontElement.h >@@ -24,7 +24,6 @@ > > #if ENABLE(SVG_FONTS) > >-#include "SVGAnimatedBoolean.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGParserUtilities.h" >@@ -53,10 +52,10 @@ private: > > bool rendererIsNeeded(const RenderStyle&) final { return false; } > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFontElement, SVGElement, SVGExternalResourcesRequired>; >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFontElement, SVGElement, SVGExternalResourcesRequired>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ PropertyRegistry m_propertyRegistry { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGGradientElement.cpp b/Source/WebCore/svg/SVGGradientElement.cpp >index 8c8c2af08ff..f55b77a05a1 100644 >--- a/Source/WebCore/svg/SVGGradientElement.cpp >+++ b/Source/WebCore/svg/SVGGradientElement.cpp >@@ -24,12 +24,8 @@ > #include "SVGGradientElement.h" > > #include "ElementIterator.h" >-#include "RenderSVGHiddenContainer.h" >-#include "RenderSVGResourceLinearGradient.h" >-#include "RenderSVGResourceRadialGradient.h" > #include "SVGNames.h" > #include "SVGStopElement.h" >-#include "SVGTransformListValues.h" > #include "SVGTransformable.h" > #include "StyleResolver.h" > #include <wtf/IsoMallocInlines.h> >@@ -44,17 +40,12 @@ SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& d > , SVGExternalResourcesRequired(this) > , SVGURIReference(this) > { >- registerAttributes(); >-} >- >-void SVGGradientElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::spreadMethodAttr, SVGSpreadMethodType, &SVGGradientElement::m_spreadMethod>(); >- registry.registerAttribute<SVGNames::gradientUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGGradientElement::m_gradientUnits>(); >- registry.registerAttribute<SVGNames::gradientTransformAttr, &SVGGradientElement::m_gradientTransform>(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::spreadMethodAttr, SVGSpreadMethodType, &SVGGradientElement::m_spreadMethod>(); >+ PropertyRegistry::registerProperty<SVGNames::gradientUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGGradientElement::m_gradientUnits>(); >+ PropertyRegistry::registerProperty<SVGNames::gradientTransformAttr, &SVGGradientElement::m_gradientTransform>(); >+ }); > } > > void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -62,22 +53,19 @@ void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS > if (name == SVGNames::gradientUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- m_gradientUnits.setValue(propertyValue); >+ m_gradientUnits->setBaseValInternal(propertyValue); > return; > } > > if (name == SVGNames::gradientTransformAttr) { >- SVGTransformListValues newList; >- newList.parse(value); >- m_gradientTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_gradientTransform.setValue(WTFMove(newList)); >+ m_gradientTransform->baseVal()->parse(value); > return; > } > > if (name == SVGNames::spreadMethodAttr) { > auto propertyValue = SVGPropertyTraits<SVGSpreadMethodType>::fromString(value); > if (propertyValue > 0) >- m_spreadMethod.setValue(propertyValue); >+ m_spreadMethod->setBaseValInternal(propertyValue); > return; > } > >@@ -109,12 +97,12 @@ void SVGGradientElement::childrenChanged(const ChildChange& change) > object->setNeedsLayout(); > } > >-Vector<Gradient::ColorStop> SVGGradientElement::buildStops() >+Vector<Gradient::ColorStop> SVGGradientElement::buildStops() const > { > Vector<Gradient::ColorStop> stops; > float previousOffset = 0.0f; > >- for (auto& stop : childrenOfType<SVGStopElement>(*this)) { >+ for (const auto& stop : childrenOfType<SVGStopElement>(*this)) { > const Color& color = stop.stopColorIncludingOpacity(); > > // Figure out right monotonic offset. >diff --git a/Source/WebCore/svg/SVGGradientElement.h b/Source/WebCore/svg/SVGGradientElement.h >index b4c392b3549..b95debf095a 100644 >--- a/Source/WebCore/svg/SVGGradientElement.h >+++ b/Source/WebCore/svg/SVGGradientElement.h >@@ -22,9 +22,6 @@ > #pragma once > > #include "Gradient.h" >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedEnumeration.h" >-#include "SVGAnimatedTransformList.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGNames.h" >@@ -83,23 +80,23 @@ public: > SVG_SPREADMETHOD_REPEAT = SVGSpreadMethodUnknown > }; > >- Vector<Gradient::ColorStop> buildStops(); >+ Vector<Gradient::ColorStop> buildStops() const; > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGradientElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGGradientElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; >+ >+ SVGSpreadMethodType spreadMethod() const { return m_spreadMethod->currentValue<SVGSpreadMethodType>(); } >+ SVGUnitTypes::SVGUnitType gradientUnits() const { return m_gradientUnits->currentValue<SVGUnitTypes::SVGUnitType>(); } >+ const SVGTransformList& gradientTransform() const { return m_gradientTransform->currentValue(); } > >- SVGSpreadMethodType spreadMethod() const { return m_spreadMethod.currentValue(attributeOwnerProxy()); } >- SVGUnitTypes::SVGUnitType gradientUnits() const { return m_gradientUnits.currentValue(attributeOwnerProxy()); } >- const SVGTransformListValues& gradientTransform() const { return m_gradientTransform.currentValue(attributeOwnerProxy()); } >- >- RefPtr<SVGAnimatedEnumeration> spreadMethodAnimated() { return m_spreadMethod.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> gradientUnitsAnimated() { return m_gradientUnits.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedTransformList> gradientTransformAnimated() { return m_gradientTransform.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedEnumeration>& spreadMethod() { return m_spreadMethod; } >+ Ref<SVGAnimatedEnumeration>& gradientUnits() { return m_gradientUnits; } >+ Ref<SVGAnimatedTransformList>& gradientTransform() { return m_gradientTransform; } > > protected: > SVGGradientElement(const QualifiedName&, Document&); > >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return PropertyRegistry::isKnownAttribute(attributeName); } >+ > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -107,13 +104,12 @@ private: > bool needsPendingResourceHandling() const override { return false; } > void childrenChanged(const ChildChange&) override; > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >- static void registerAttributes(); >+ const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; } > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedEnumerationAttribute<SVGSpreadMethodType> m_spreadMethod { SVGSpreadMethodPad }; >- SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_gradientUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >- SVGAnimatedTransformListAttribute m_gradientTransform; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedEnumeration> m_spreadMethod { SVGAnimatedEnumeration::create(this, SVGSpreadMethodPad) }; >+ Ref<SVGAnimatedEnumeration> m_gradientUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) }; >+ Ref<SVGAnimatedTransformList> m_gradientTransform { SVGAnimatedTransformList::create(this) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGLinearGradientElement.cpp b/Source/WebCore/svg/SVGLinearGradientElement.cpp >index eefdfb542b8..ecef3fc23d3 100644 >--- a/Source/WebCore/svg/SVGLinearGradientElement.cpp >+++ b/Source/WebCore/svg/SVGLinearGradientElement.cpp >@@ -44,7 +44,14 @@ inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& t > { > // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified. > ASSERT(hasTagName(SVGNames::linearGradientTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>(); >+ PropertyRegistry::registerProperty<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>(); >+ PropertyRegistry::registerProperty<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>(); >+ PropertyRegistry::registerProperty<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>(); >+ }); > } > > Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedName& tagName, Document& document) >@@ -52,29 +59,18 @@ Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedNa > return adoptRef(*new SVGLinearGradientElement(tagName, document)); > } > >-void SVGLinearGradientElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>(); >- registry.registerAttribute<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>(); >- registry.registerAttribute<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>(); >- registry.registerAttribute<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>(); >-} >- > void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::x1Attr) >- m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x1->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y1Attr) >- m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y1->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::x2Attr) >- m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x2->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y2Attr) >- m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y2->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -83,7 +79,7 @@ void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A > > void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > updateRelativeLengthsInformation(); > if (RenderObject* object = renderer()) >@@ -99,7 +95,7 @@ RenderPtr<RenderElement> SVGLinearGradientElement::createElementRenderer(RenderS > return createRenderer<RenderSVGResourceLinearGradient>(*this, WTFMove(style)); > } > >-static void setGradientAttributes(SVGGradientElement& element, LinearGradientAttributes& attributes, bool isLinear = true) >+static void setGradientAttributes(const SVGGradientElement& element, LinearGradientAttributes& attributes, bool isLinear = true) > { > if (!attributes.hasSpreadMethod() && element.hasAttribute(SVGNames::spreadMethodAttr)) > attributes.setSpreadMethod(element.spreadMethod()); >@@ -120,7 +116,7 @@ static void setGradientAttributes(SVGGradientElement& element, LinearGradientAtt > } > > if (isLinear) { >- SVGLinearGradientElement& linear = downcast<SVGLinearGradientElement>(element); >+ const SVGLinearGradientElement& linear = downcast<SVGLinearGradientElement>(element); > > if (!attributes.hasX1() && element.hasAttribute(SVGNames::x1Attr)) > attributes.setX1(linear.x1()); >@@ -149,21 +145,22 @@ bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute > > while (true) { > // Respect xlink:href, take attributes from referenced element >- auto target = SVGURIReference::targetElementFromIRIString(current->href(), treeScope()); >- if (is<SVGGradientElement>(target.element)) { >- current = downcast<SVGGradientElement>(*target.element); >- >- // Cycle detection >- if (processedGradients.contains(current)) >- return true; >+ String href = current->href()->currentValue(); >+ auto target = SVGURIReference::targetElementFromIRIString(href, treeScope()); >+ if (!is<SVGGradientElement>(target.element)) >+ return true; > >- if (!current->renderer()) >- return false; >+ current = downcast<SVGGradientElement>(*target.element); > >- setGradientAttributes(current.get(), attributes, current->hasTagName(SVGNames::linearGradientTag)); >- processedGradients.add(current.copyRef()); >- } else >+ // Cycle detection >+ if (processedGradients.contains(current)) > return true; >+ >+ if (!current->renderer()) >+ return false; >+ >+ setGradientAttributes(current.get(), attributes, current->hasTagName(SVGNames::linearGradientTag)); >+ processedGradients.add(current.copyRef()); > } > > ASSERT_NOT_REACHED(); >diff --git a/Source/WebCore/svg/SVGLinearGradientElement.h b/Source/WebCore/svg/SVGLinearGradientElement.h >index 9f670c9daa4..95e3c51aab3 100644 >--- a/Source/WebCore/svg/SVGLinearGradientElement.h >+++ b/Source/WebCore/svg/SVGLinearGradientElement.h >@@ -21,7 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedLength.h" > #include "SVGGradientElement.h" > #include "SVGNames.h" > >@@ -36,25 +35,22 @@ public: > > bool collectGradientAttributes(LinearGradientAttributes&); > >- const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& x1() const { return m_x1->currentValue(); } >+ const SVGLengthValue& y1() const { return m_y1->currentValue(); } >+ const SVGLengthValue& x2() const { return m_x2->currentValue(); } >+ const SVGLengthValue& y2() const { return m_y2->currentValue(); } > >- RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLength>& x1() { return m_x1; } >+ Ref<SVGAnimatedLength>& y1() { return m_y1; } >+ Ref<SVGAnimatedLength>& x2() { return m_x2; } >+ Ref<SVGAnimatedLength>& y2() { return m_y2; } > > private: > SVGLinearGradientElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGLinearGradientElement, SVGGradientElement>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -62,11 +58,11 @@ private: > > bool selfHasRelativeLengths() const override; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedLengthAttribute m_x1 { LengthModeWidth }; >- SVGAnimatedLengthAttribute m_y1 { LengthModeHeight }; >- SVGAnimatedLengthAttribute m_x2 { LengthModeWidth, "100%" }; >- SVGAnimatedLengthAttribute m_y2 { LengthModeHeight }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_x1 { SVGAnimatedLength::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLength> m_y1 { SVGAnimatedLength::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedLength> m_x2 { SVGAnimatedLength::create(this, LengthModeWidth, "100%") }; >+ Ref<SVGAnimatedLength> m_y2 { SVGAnimatedLength::create(this, LengthModeHeight) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGMarkerElement.cpp b/Source/WebCore/svg/SVGMarkerElement.cpp >index 6ab2b7ff22c..5b75a5a0f6d 100644 >--- a/Source/WebCore/svg/SVGMarkerElement.cpp >+++ b/Source/WebCore/svg/SVGMarkerElement.cpp >@@ -40,7 +40,16 @@ inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document > { > // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified. > ASSERT(hasTagName(SVGNames::markerTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::refXAttr, &SVGMarkerElement::m_refX>(); >+ PropertyRegistry::registerProperty<SVGNames::refYAttr, &SVGMarkerElement::m_refY>(); >+ PropertyRegistry::registerProperty<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>(); >+ PropertyRegistry::registerProperty<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>(); >+ PropertyRegistry::registerProperty<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>(); >+ PropertyRegistry::registerProperty<SVGNames::orientAttr, &SVGMarkerElement::m_orientAngle, &SVGMarkerElement::m_orientType>(); >+ }); > } > > Ref<SVGMarkerElement> SVGMarkerElement::create(const QualifiedName& tagName, Document& document) >@@ -48,67 +57,37 @@ Ref<SVGMarkerElement> SVGMarkerElement::create(const QualifiedName& tagName, Doc > return adoptRef(*new SVGMarkerElement(tagName, document)); > } > >-const AtomicString& SVGMarkerElement::orientTypeIdentifier() >-{ >- static NeverDestroyed<AtomicString> s_identifier("SVGOrientType", AtomicString::ConstructFromLiteral); >- return s_identifier; >-} >- >-const AtomicString& SVGMarkerElement::orientAngleIdentifier() >-{ >- static NeverDestroyed<AtomicString> s_identifier("SVGOrientAngle", AtomicString::ConstructFromLiteral); >- return s_identifier; >-} >- > AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const > { > return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight); > } > >-void SVGMarkerElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::refXAttr, &SVGMarkerElement::m_refX>(); >- registry.registerAttribute<SVGNames::refYAttr, &SVGMarkerElement::m_refY>(); >- registry.registerAttribute<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>(); >- registry.registerAttribute<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>(); >- registry.registerAttribute<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>(); >- registry.registerAttribute(SVGAnimatedCustomAngleAttributeAccessor::singleton<SVGNames::orientAttr, >- &SVGMarkerElement::orientAngleIdentifier, &SVGMarkerElement::m_orientAngle, >- &SVGMarkerElement::orientTypeIdentifier, &SVGMarkerElement::m_orientType>()); >-} >- > void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::markerUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value); > if (propertyValue > 0) >- m_markerUnits.setValue(propertyValue); >+ m_markerUnits->setBaseValInternal(propertyValue); > return; > } > > if (name == SVGNames::orientAttr) { >- SVGAngleValue angle; >- auto orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle); >- if (orientType > 0) >- m_orientType.setValue(orientType); >- if (orientType == SVGMarkerOrientAngle) >- m_orientAngle.setValue(angle); >+ auto pair = SVGPropertyTraits<std::pair<SVGAngleValue, SVGMarkerOrientType>>::fromString(value); >+ m_orientAngle->setBaseValInternal(pair.first); >+ m_orientType->setBaseValInternal(pair.second); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::refXAttr) >- m_refX.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_refX->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::refYAttr) >- m_refY.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_refY->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::markerWidthAttr) >- m_markerWidth.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_markerWidth->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::markerHeightAttr) >- m_markerHeight.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_markerHeight->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -119,9 +98,9 @@ void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicStr > > void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- if (isAnimatedLengthAttribute(attrName)) >+ if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) > updateRelativeLengthsInformation(); > if (RenderObject* object = renderer()) > object->setNeedsLayout(); >@@ -151,14 +130,9 @@ void SVGMarkerElement::childrenChanged(const ChildChange& change) > > void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngleValue& angle) > { >- m_orientType.setValue(orientType); >- m_orientAngle.setValue(angle); >- >- // Mark orientAttr dirty - the next XML DOM access of that attribute kicks in synchronization. >- m_orientAngle.setShouldSynchronize(true); >- m_orientType.setShouldSynchronize(true); >- invalidateSVGAttributes(); >- svgAttributeChanged(SVGNames::orientAttr); >+ m_orientType->setBaseValInternal(orientType); >+ m_orientAngle->setBaseValInternal(angle); >+ m_orientAngle->baseVal()->commitChange(); > } > > void SVGMarkerElement::setOrientToAuto() >@@ -168,7 +142,7 @@ void SVGMarkerElement::setOrientToAuto() > > void SVGMarkerElement::setOrientToAngle(SVGAngle& angle) > { >- setOrient(SVGMarkerOrientAngle, angle.propertyReference()); >+ setOrient(SVGMarkerOrientAngle, angle.value()); > } > > RenderPtr<RenderElement> SVGMarkerElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGMarkerElement.h b/Source/WebCore/svg/SVGMarkerElement.h >index 37c180a01fa..1d35087690f 100644 >--- a/Source/WebCore/svg/SVGMarkerElement.h >+++ b/Source/WebCore/svg/SVGMarkerElement.h >@@ -21,12 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedAngle.h" >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedEnumeration.h" >-#include "SVGAnimatedLength.h" >-#include "SVGAnimatedPreserveAspectRatio.h" >-#include "SVGAnimatedRect.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGFitToViewBox.h" >@@ -58,32 +52,28 @@ public: > void setOrientToAuto(); > void setOrientToAngle(SVGAngle&); > >- const SVGLengthValue& refX() const { return m_refX.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& refY() const { return m_refY.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& markerWidth() const { return m_markerWidth.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& markerHeight() const { return m_markerHeight.currentValue(attributeOwnerProxy()); } >- SVGMarkerUnitsType markerUnits() const { return m_markerUnits.currentValue(attributeOwnerProxy()); } >- const SVGAngleValue& orientAngle() const { return m_orientAngle.currentValue(attributeOwnerProxy()); } >- SVGMarkerOrientType orientType() const { return m_orientType.currentValue(attributeOwnerProxy()); } >- >- RefPtr<SVGAnimatedLength> refXAnimated() { return m_refX.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> refYAnimated() { return m_refY.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> markerWidthAnimated() { return m_markerWidth.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> markerHeightAnimated() { return m_markerHeight.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> markerUnitsAnimated() { return m_markerUnits.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedAngle> orientAngleAnimated() { return m_orientAngle.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.animatedProperty(attributeOwnerProxy()); } >+ const SVGLengthValue& refX() const { return m_refX->currentValue(); } >+ const SVGLengthValue& refY() const { return m_refY->currentValue(); } >+ const SVGLengthValue& markerWidth() const { return m_markerWidth->currentValue(); } >+ const SVGLengthValue& markerHeight() const { return m_markerHeight->currentValue(); } >+ SVGMarkerUnitsType markerUnits() const { return m_markerUnits->currentValue<SVGMarkerUnitsType>(); } >+ const SVGAngleValue& orientAngle() const { return m_orientAngle->currentValue(); } >+ SVGMarkerOrientType orientType() const { return m_orientType->currentValue<SVGMarkerOrientType>(); } >+ >+ Ref<SVGAnimatedLength>& refX() { return m_refX; } >+ Ref<SVGAnimatedLength>& refY() { return m_refY; } >+ Ref<SVGAnimatedLength>& markerWidth() { return m_markerWidth; } >+ Ref<SVGAnimatedLength>& markerHeight() { return m_markerHeight; } >+ Ref<SVGAnimatedEnumeration>& markerUnits() { return m_markerUnits; } >+ Ref<SVGAnimatedAngle>& orientAngle() { return m_orientAngle; } >+ Ref<SVGAnimatedEnumeration> orientType() { return m_orientType.copyRef(); } > > private: > SVGMarkerElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > void childrenChanged(const ChildChange&) override; >@@ -97,42 +87,14 @@ private: > > void setOrient(SVGMarkerOrientType, const SVGAngleValue&); > >- static const AtomicString& orientTypeIdentifier(); >- static const AtomicString& orientAngleIdentifier(); >- >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- >- class SVGAnimatedCustomOrientTypeAttribute : public SVGAnimatedEnumerationAttribute<SVGMarkerOrientType> { >- public: >- using Base = SVGAnimatedEnumerationAttribute<SVGMarkerOrientType>; >- >- SVGAnimatedCustomOrientTypeAttribute(SVGMarkerOrientType baseValue) >- : Base(baseValue) >- { >- } >- void synchronize(Element& element, const QualifiedName& attributeName) >- { >- static const NeverDestroyed<String> autoString = MAKE_STATIC_STRING_IMPL("auto"); >- static const NeverDestroyed<String> autoStartReverseString = MAKE_STATIC_STRING_IMPL("auto-start-reverse"); >- >- if (!shouldSynchronize()) >- return; >- if (value() == SVGMarkerOrientAuto) >- element.setSynchronizedLazyAttribute(attributeName, autoString.get()); >- else if (value() == SVGMarkerOrientAutoStartReverse) >- element.setSynchronizedLazyAttribute(attributeName, autoStartReverseString.get()); >- } >- }; >- >- using SVGAnimatedCustomAngleAttributeAccessor = SVGAnimatedPairAttributeAccessor<SVGMarkerElement, SVGAnimatedAngleAttribute, AnimatedAngle, SVGAnimatedCustomOrientTypeAttribute, AnimatedEnumeration>; >- >- SVGAnimatedLengthAttribute m_refX { LengthModeWidth }; >- SVGAnimatedLengthAttribute m_refY { LengthModeHeight }; >- SVGAnimatedLengthAttribute m_markerWidth { LengthModeWidth, "3" }; >- SVGAnimatedLengthAttribute m_markerHeight { LengthModeHeight, "3" }; >- SVGAnimatedEnumerationAttribute<SVGMarkerUnitsType> m_markerUnits { SVGMarkerUnitsStrokeWidth }; >- SVGAnimatedAngleAttribute m_orientAngle; >- SVGAnimatedCustomOrientTypeAttribute m_orientType { SVGMarkerOrientAngle }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_refX { SVGAnimatedLength::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLength> m_refY { SVGAnimatedLength::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedLength> m_markerWidth { SVGAnimatedLength::create(this, LengthModeWidth, "3") }; >+ Ref<SVGAnimatedLength> m_markerHeight { SVGAnimatedLength::create(this, LengthModeHeight, "3") }; >+ Ref<SVGAnimatedEnumeration> m_markerUnits { SVGAnimatedEnumeration::create(this, SVGMarkerUnitsStrokeWidth) }; >+ Ref<SVGAnimatedAngle> m_orientAngle { SVGAnimatedAngle::create(this) }; >+ Ref<SVGAnimatedOrientType> m_orientType { SVGAnimatedOrientType::create(this, SVGMarkerOrientAngle) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGMaskElement.cpp b/Source/WebCore/svg/SVGMaskElement.cpp >index cd43fa630e2..7d53a977a76 100644 >--- a/Source/WebCore/svg/SVGMaskElement.cpp >+++ b/Source/WebCore/svg/SVGMaskElement.cpp >@@ -47,7 +47,16 @@ inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& do > // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. > // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. > ASSERT(hasTagName(SVGNames::maskTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGMaskElement::m_x>(); >+ PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGMaskElement::m_y>(); >+ PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGMaskElement::m_width>(); >+ PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGMaskElement::m_height>(); >+ PropertyRegistry::registerProperty<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>(); >+ PropertyRegistry::registerProperty<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>(); >+ }); > } > > Ref<SVGMaskElement> SVGMaskElement::create(const QualifiedName& tagName, Document& document) >@@ -55,44 +64,31 @@ Ref<SVGMaskElement> SVGMaskElement::create(const QualifiedName& tagName, Documen > return adoptRef(*new SVGMaskElement(tagName, document)); > } > >-void SVGMaskElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::xAttr, &SVGMaskElement::m_x>(); >- registry.registerAttribute<SVGNames::yAttr, &SVGMaskElement::m_y>(); >- registry.registerAttribute<SVGNames::widthAttr, &SVGMaskElement::m_width>(); >- registry.registerAttribute<SVGNames::heightAttr, &SVGMaskElement::m_height>(); >- registry.registerAttribute<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>(); >- registry.registerAttribute<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>(); >-} >- > void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::maskUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- m_maskUnits.setValue(propertyValue); >+ m_maskUnits->setBaseValInternal(propertyValue); > return; > } > if (name == SVGNames::maskContentUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- m_maskContentUnits.setValue(propertyValue); >+ m_maskContentUnits->setBaseValInternal(propertyValue); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::heightAttr) >- m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -103,13 +99,13 @@ void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin > > void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isAnimatedLengthAttribute(attrName)) { >+ if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); > return; > } > >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > if (auto* renderer = this->renderer()) > renderer->setNeedsLayout(); > return; >diff --git a/Source/WebCore/svg/SVGMaskElement.h b/Source/WebCore/svg/SVGMaskElement.h >index 30be77e80ae..1c26249e500 100644 >--- a/Source/WebCore/svg/SVGMaskElement.h >+++ b/Source/WebCore/svg/SVGMaskElement.h >@@ -20,9 +20,6 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedEnumeration.h" >-#include "SVGAnimatedLength.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGNames.h" >@@ -36,30 +33,26 @@ class SVGMaskElement final : public SVGElement, public SVGExternalResourcesRequi > public: > static Ref<SVGMaskElement> create(const QualifiedName&, Document&); > >- const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >- SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits.currentValue(attributeOwnerProxy()); } >- SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& x() const { return m_x->currentValue(); } >+ const SVGLengthValue& y() const { return m_y->currentValue(); } >+ const SVGLengthValue& width() const { return m_width->currentValue(); } >+ const SVGLengthValue& height() const { return m_height->currentValue(); } >+ SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits->currentValue<SVGUnitTypes::SVGUnitType>(); } >+ SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits->currentValue<SVGUnitTypes::SVGUnitType>(); } > >- RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> maskUnitsAnimated() { return m_maskUnits.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> maskContentUnitsAnimated() { return m_maskContentUnits.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLength>& x() { return m_x; } >+ Ref<SVGAnimatedLength>& y() { return m_y; } >+ Ref<SVGAnimatedLength>& width() { return m_width; } >+ Ref<SVGAnimatedLength>& height() { return m_height; } >+ Ref<SVGAnimatedEnumeration>& maskUnits() { return m_maskUnits; } >+ Ref<SVGAnimatedEnumeration>& maskContentUnits() { return m_maskContentUnits; } > > private: > SVGMaskElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; >@@ -70,13 +63,13 @@ private: > bool needsPendingResourceHandling() const final { return false; } > bool selfHasRelativeLengths() const final { return true; } > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" }; >- SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" }; >- SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" }; >- SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" }; >- SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >- SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth, "-10%") }; >+ Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight, "-10%") }; >+ Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth, "120%") }; >+ Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight, "120%") }; >+ Ref<SVGAnimatedEnumeration> m_maskUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) }; >+ Ref<SVGAnimatedEnumeration> m_maskContentUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp >index 700f26b6a1a..91d0bb81e7d 100644 >--- a/Source/WebCore/svg/SVGPatternElement.cpp >+++ b/Source/WebCore/svg/SVGPatternElement.cpp >@@ -53,7 +53,17 @@ inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Docume > , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::patternTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGPatternElement::m_x>(); >+ PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGPatternElement::m_y>(); >+ PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGPatternElement::m_width>(); >+ PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGPatternElement::m_height>(); >+ PropertyRegistry::registerProperty<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>(); >+ PropertyRegistry::registerProperty<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>(); >+ PropertyRegistry::registerProperty<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>(); >+ }); > } > > Ref<SVGPatternElement> SVGPatternElement::create(const QualifiedName& tagName, Document& document) >@@ -61,52 +71,35 @@ Ref<SVGPatternElement> SVGPatternElement::create(const QualifiedName& tagName, D > return adoptRef(*new SVGPatternElement(tagName, document)); > } > >-void SVGPatternElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::xAttr, &SVGPatternElement::m_x>(); >- registry.registerAttribute<SVGNames::yAttr, &SVGPatternElement::m_y>(); >- registry.registerAttribute<SVGNames::widthAttr, &SVGPatternElement::m_width>(); >- registry.registerAttribute<SVGNames::heightAttr, &SVGPatternElement::m_height>(); >- registry.registerAttribute<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>(); >- registry.registerAttribute<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>(); >- registry.registerAttribute<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>(); >-} >- > void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::patternUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- m_patternUnits.setValue(propertyValue); >+ m_patternUnits->setBaseValInternal(propertyValue); > return; > } > if (name == SVGNames::patternContentUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- m_patternContentUnits.setValue(propertyValue); >+ m_patternContentUnits->setBaseValInternal(propertyValue); > return; > } > if (name == SVGNames::patternTransformAttr) { >- SVGTransformListValues newList; >- newList.parse(value); >- m_patternTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_patternTransform.setValue(WTFMove(newList)); >+ m_patternTransform->baseVal()->parse(value); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::heightAttr) >- m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -119,13 +112,13 @@ void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt > > void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isAnimatedLengthAttribute(attrName)) { >+ if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); > return; > } > >- if (isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { > if (RenderObject* object = renderer()) > object->setNeedsLayout(); > return; >diff --git a/Source/WebCore/svg/SVGPatternElement.h b/Source/WebCore/svg/SVGPatternElement.h >index 03a606f0a05..e512aa58cb6 100644 >--- a/Source/WebCore/svg/SVGPatternElement.h >+++ b/Source/WebCore/svg/SVGPatternElement.h >@@ -21,12 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedEnumeration.h" >-#include "SVGAnimatedLength.h" >-#include "SVGAnimatedPreserveAspectRatio.h" >-#include "SVGAnimatedRect.h" >-#include "SVGAnimatedTransformList.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGFitToViewBox.h" >@@ -48,32 +42,28 @@ public: > > AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final; > >- const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >- SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits.currentValue(attributeOwnerProxy()); } >- SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits.currentValue(attributeOwnerProxy()); } >- const SVGTransformListValues& patternTransform() const { return m_patternTransform.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& x() const { return m_x->currentValue(); } >+ const SVGLengthValue& y() const { return m_y->currentValue(); } >+ const SVGLengthValue& width() const { return m_width->currentValue(); } >+ const SVGLengthValue& height() const { return m_height->currentValue(); } >+ SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits->currentValue<SVGUnitTypes::SVGUnitType>(); } >+ SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits->currentValue<SVGUnitTypes::SVGUnitType>(); } >+ const SVGTransformList& patternTransform() const { return m_patternTransform->currentValue(); } > >- RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> patternUnitsAnimated() { return m_patternUnits.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> patternContentUnitsAnimated() { return m_patternContentUnits.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedTransformList> patternTransformAnimated() { return m_patternTransform.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLength>& x() { return m_x; } >+ Ref<SVGAnimatedLength>& y() { return m_y; } >+ Ref<SVGAnimatedLength>& width() { return m_width; } >+ Ref<SVGAnimatedLength>& height() { return m_height; } >+ Ref<SVGAnimatedEnumeration>& patternUnits() { return m_patternUnits; } >+ Ref<SVGAnimatedEnumeration>& patternContentUnits() { return m_patternContentUnits; } >+ Ref<SVGAnimatedTransformList>& patternTransform() { return m_patternTransform; } > > private: > SVGPatternElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; >@@ -84,14 +74,14 @@ private: > bool needsPendingResourceHandling() const final { return false; } > bool selfHasRelativeLengths() const final { return true; } > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >- SVGAnimatedLengthAttribute m_y { LengthModeHeight }; >- SVGAnimatedLengthAttribute m_width { LengthModeWidth }; >- SVGAnimatedLengthAttribute m_height { LengthModeHeight }; >- SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >- SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >- SVGAnimatedTransformListAttribute m_patternTransform; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedEnumeration> m_patternUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) }; >+ Ref<SVGAnimatedEnumeration> m_patternContentUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) }; >+ Ref<SVGAnimatedTransformList> m_patternTransform { SVGAnimatedTransformList::create(this) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGRadialGradientElement.cpp b/Source/WebCore/svg/SVGRadialGradientElement.cpp >index b88dd56bbd0..42f31113f6b 100644 >--- a/Source/WebCore/svg/SVGRadialGradientElement.cpp >+++ b/Source/WebCore/svg/SVGRadialGradientElement.cpp >@@ -44,7 +44,16 @@ inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& t > { > // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified. > ASSERT(hasTagName(SVGNames::radialGradientTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>(); >+ PropertyRegistry::registerProperty<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>(); >+ PropertyRegistry::registerProperty<SVGNames::rAttr, &SVGRadialGradientElement::m_r>(); >+ PropertyRegistry::registerProperty<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>(); >+ PropertyRegistry::registerProperty<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>(); >+ PropertyRegistry::registerProperty<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>(); >+ }); > } > > Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedName& tagName, Document& document) >@@ -52,35 +61,22 @@ Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedNa > return adoptRef(*new SVGRadialGradientElement(tagName, document)); > } > >-void SVGRadialGradientElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>(); >- registry.registerAttribute<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>(); >- registry.registerAttribute<SVGNames::rAttr, &SVGRadialGradientElement::m_r>(); >- registry.registerAttribute<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>(); >- registry.registerAttribute<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>(); >- registry.registerAttribute<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>(); >-} >- > void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::cxAttr) >- m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_cx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::cyAttr) >- m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_cy->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::rAttr) >- m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); >+ m_r->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::fxAttr) >- m_fx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_fx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::fyAttr) >- m_fy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_fy->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::frAttr) >- m_fr.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); >+ m_fr->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -105,7 +101,7 @@ RenderPtr<RenderElement> SVGRadialGradientElement::createElementRenderer(RenderS > return createRenderer<RenderSVGResourceRadialGradient>(*this, WTFMove(style)); > } > >-static void setGradientAttributes(SVGGradientElement& element, RadialGradientAttributes& attributes, bool isRadial = true) >+static void setGradientAttributes(const SVGGradientElement& element, RadialGradientAttributes& attributes, bool isRadial = true) > { > if (!attributes.hasSpreadMethod() && element.hasAttribute(SVGNames::spreadMethodAttr)) > attributes.setSpreadMethod(element.spreadMethod()); >@@ -126,7 +122,7 @@ static void setGradientAttributes(SVGGradientElement& element, RadialGradientAtt > } > > if (isRadial) { >- SVGRadialGradientElement& radial = downcast<SVGRadialGradientElement>(element); >+ const SVGRadialGradientElement& radial = downcast<SVGRadialGradientElement>(element); > > if (!attributes.hasCx() && element.hasAttribute(SVGNames::cxAttr)) > attributes.setCx(radial.cx()); >@@ -148,13 +144,13 @@ static void setGradientAttributes(SVGGradientElement& element, RadialGradientAtt > } > } > >-bool SVGRadialGradientElement::collectGradientAttributes(RadialGradientAttributes& attributes) >+bool SVGRadialGradientElement::collectGradientAttributes(RadialGradientAttributes& attributes) const > { > if (!renderer()) > return false; > >- HashSet<SVGGradientElement*> processedGradients; >- SVGGradientElement* current = this; >+ HashSet<const SVGGradientElement*> processedGradients; >+ const SVGGradientElement* current = this; > > setGradientAttributes(*current, attributes); > processedGradients.add(current); >diff --git a/Source/WebCore/svg/SVGRadialGradientElement.h b/Source/WebCore/svg/SVGRadialGradientElement.h >index f991f3d02d9..85a88abe117 100644 >--- a/Source/WebCore/svg/SVGRadialGradientElement.h >+++ b/Source/WebCore/svg/SVGRadialGradientElement.h >@@ -21,7 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedLength.h" > #include "SVGGradientElement.h" > #include "SVGNames.h" > >@@ -34,30 +33,28 @@ class SVGRadialGradientElement final : public SVGGradientElement { > public: > static Ref<SVGRadialGradientElement> create(const QualifiedName&, Document&); > >- bool collectGradientAttributes(RadialGradientAttributes&); >+ bool collectGradientAttributes(RadialGradientAttributes&) const; > >- const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& fx() const { return m_fx.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& fy() const { return m_fy.currentValue(attributeOwnerProxy()); } >- const SVGLengthValue& fr() const { return m_fr.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& cx() const { return m_cx->currentValue(); } >+ const SVGLengthValue& cy() const { return m_cy->currentValue(); } >+ const SVGLengthValue& r() const { return m_r->currentValue(); } >+ const SVGLengthValue& fx() const { return m_fx->currentValue(); } >+ const SVGLengthValue& fy() const { return m_fy->currentValue(); } >+ const SVGLengthValue& fr() const { return m_fr->currentValue(); } > >- RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> fxAnimated() { return m_fx.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> fyAnimated() { return m_fy.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLength> frAnimated() { return m_fr.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLength>& cx() { return m_cx; } >+ Ref<SVGAnimatedLength>& cy() { return m_cy; } >+ Ref<SVGAnimatedLength>& r() { return m_r; } >+ Ref<SVGAnimatedLength>& fx() { return m_fx; } >+ Ref<SVGAnimatedLength>& fy() { return m_fy; } >+ Ref<SVGAnimatedLength>& fr() { return m_fr; } > > private: > SVGRadialGradientElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRadialGradientElement, SVGGradientElement>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGRadialGradientElement, SVGGradientElement>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -65,13 +62,13 @@ private: > > bool selfHasRelativeLengths() const override; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedLengthAttribute m_cx { LengthModeWidth, "50%" }; >- SVGAnimatedLengthAttribute m_cy { LengthModeHeight, "50%" }; >- SVGAnimatedLengthAttribute m_r { LengthModeOther, "50%" }; >- SVGAnimatedLengthAttribute m_fx { LengthModeWidth }; >- SVGAnimatedLengthAttribute m_fy { LengthModeHeight }; >- SVGAnimatedLengthAttribute m_fr { LengthModeOther, "0%" }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_cx { SVGAnimatedLength::create(this, LengthModeWidth, "50%") }; >+ Ref<SVGAnimatedLength> m_cy { SVGAnimatedLength::create(this, LengthModeHeight, "50%") }; >+ Ref<SVGAnimatedLength> m_r { SVGAnimatedLength::create(this, LengthModeOther, "50%") }; >+ Ref<SVGAnimatedLength> m_fx { SVGAnimatedLength::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLength> m_fy { SVGAnimatedLength::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedLength> m_fr { SVGAnimatedLength::create(this, LengthModeOther, "0%") }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGStopElement.cpp b/Source/WebCore/svg/SVGStopElement.cpp >index 660112190db..3da3576f60d 100644 >--- a/Source/WebCore/svg/SVGStopElement.cpp >+++ b/Source/WebCore/svg/SVGStopElement.cpp >@@ -37,7 +37,11 @@ inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document& do > : SVGElement(tagName, document) > { > ASSERT(hasTagName(SVGNames::stopTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::offsetAttr, &SVGStopElement::m_offset>(); >+ }); > } > > Ref<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Document& document) >@@ -45,21 +49,13 @@ Ref<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Documen > return adoptRef(*new SVGStopElement(tagName, document)); > } > >-void SVGStopElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::offsetAttr, &SVGStopElement::m_offset>(); >-} >- > void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::offsetAttr) { > if (value.endsWith('%')) >- m_offset.setValue(value.string().left(value.length() - 1).toFloat() / 100.0f); >+ m_offset->setBaseValInternal(value.string().left(value.length() - 1).toFloat() / 100.0f); > else >- m_offset.setValue(value.toFloat()); >+ m_offset->setBaseValInternal(value.toFloat()); > return; > } > >diff --git a/Source/WebCore/svg/SVGStopElement.h b/Source/WebCore/svg/SVGStopElement.h >index d843b76afed..f0120aaabe1 100644 >--- a/Source/WebCore/svg/SVGStopElement.h >+++ b/Source/WebCore/svg/SVGStopElement.h >@@ -21,7 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedNumber.h" > #include "SVGElement.h" > > namespace WebCore { >@@ -33,18 +32,15 @@ public: > > Color stopColorIncludingOpacity() const; > >- float offset() { return m_offset.currentValue(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); } >+ float offset() const { return m_offset->currentValue(); } >+ Ref<SVGAnimatedNumber>& offset() { return m_offset; } > > private: > SVGStopElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGStopElement, SVGElement>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGStopElement, SVGElement>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -53,8 +49,8 @@ private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > bool rendererIsNeeded(const RenderStyle&) final; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedNumberAttribute m_offset { 0 }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedNumber> m_offset { SVGAnimatedNumber::create(0) }; > }; > > } // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 191237
:
353808
|
353812
|
353815
|
353817
|
353818
|
353820
|
353824
|
353825
|
355382
|
355386
|
355388
|
355393
|
355568
|
355574
|
355575
|
355577
|
355580
|
355582
|
355585
|
355666
|
355672
|
355693
|
355699
|
355711
|
355752
|
355777
|
355820
|
356333
|
356334
|
356338
|
356340
|
356342
|
356344
|
356346
|
356351
|
356352
|
356358
|
356360
|
356380
|
356497
|
356500
|
356507
|
356579
|
356607
|
356728
|
356729
|
356730
|
356731
|
356732
|
356733
|
356752
|
356810
|
356811
|
356879
|
356880
|
356881
|
356882
|
356883
|
356884
|
356885
|
356887
|
356888
|
356889
|
356892
|
356895
|
356896
|
359721
|
359735
|
359747
|
363581
|
363595
|
363613
|
363690
|
364172
|
364180
|
366512
|
366557
|
366636