WebKit Bugzilla
Attachment 356810 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]
17-BaseTypes
17-BaseTypes.patch (text/plain), 72.00 KB, created by
Said Abou-Hallawa
on 2018-12-07 07:47:21 PST
(
hide
)
Description:
17-BaseTypes
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-12-07 07:47:21 PST
Size:
72.00 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e1b1ae0ad0d..e49fa89b1b6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,158 @@ >+2018-12-06 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!). >+ >+ This patch re-factors the code of the base types of the SVGELements. The >+ changes in the base class SVGElement are: >+ >+ -- The destructor will detach itself from all its properties through >+ the propertyRegistry. The properties can outlive the SVGElement. >+ >+ -- synchronizeAttribute() will basically serialize the baseValAsString >+ to the attribute only if it has been dirtied. >+ >+ -- commitPropertyChange() will be called when an SVGProperty changes. >+ Its function it is to update the renderer. >+ >+ -- createAnimator() will create a new SVGAnimator for an attributeName. >+ For the SVGAnimatedproperties, the propertyRegistry will be used to >+ create SVGAnimator using the SVGAccessor. createAnimator() will also >+ set the animVal of the animated property as the animVal of all its >+ instances. This will make all instances animate as well. For the >+ style SVGProperties propertyAnimatorCreator() will be used instead. >+ >+ * svg/SVGElement.cpp: >+ (WebCore::SVGElement::SVGElement): >+ (WebCore::SVGElement::~SVGElement): >+ (WebCore::SVGElement::parseAttribute): >+ (WebCore::SVGElement::haveLoadedRequiredResources const): >+ (WebCore::SVGElement::synchronizeAttribute): >+ (WebCore::SVGElement::synchronizeAllAttributes): >+ (WebCore::SVGElement::commitPropertyChange): >+ (WebCore::SVGElement::isAnimatedPropertyAttribute const): >+ (WebCore::SVGElement::isAnimatedAttribute const): >+ (WebCore::SVGElement::isAnimatedStyleAttribute const): >+ (WebCore::SVGElement::createAnimator): >+ (WebCore::SVGElement::svgAttributeChanged): >+ (WebCore::createAttributeNameToAnimatedPropertyTypeMap): Deleted. >+ (WebCore::attributeNameToAnimatedPropertyTypeMap): Deleted. >+ (WebCore::createCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): Deleted. >+ (WebCore::cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): Deleted. >+ (WebCore::SVGElement::registerAttributes): Deleted. >+ (WebCore::SVGElement::animatedPropertyTypesForAttribute): Deleted. >+ (WebCore::SVGElement::haveLoadedRequiredResources): Deleted. >+ (WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute): Deleted. >+ (WebCore::SVGElement::synchronizeAnimatedSVGAttribute const): Deleted. >+ (WebCore::SVGElement::isAnimatableAttribute const): Deleted. >+ (WebCore::SVGElement::filterOutAnimatableAttribute const): Deleted. >+ (WebCore::SVGElement::isAnimatableCSSProperty): Deleted. >+ (WebCore::SVGElement::isPresentationAttributeWithSVGDOM): Deleted. >+ * svg/SVGElement.h: >+ (WebCore::SVGElement::propertyRegistry const): >+ (WebCore::SVGElement::propertyAnimatorCreator): >+ (WebCore::SVGElement::className const): >+ (WebCore::SVGElement::className): >+ (WebCore::SVGElement::attributeRegistry): Deleted. >+ (WebCore::SVGElement::isKnownAttribute): Deleted. >+ (WebCore::SVGElement::attributeOwnerProxy const): Deleted. >+ (WebCore::SVGElement::synchronizeAttribute): Deleted. >+ (WebCore::SVGElement::synchronizeAttributes): Deleted. >+ (WebCore::SVGElement::animatedTypes const): Deleted. >+ (WebCore::SVGElement::lookupAnimatedProperty const): Deleted. >+ (WebCore::SVGElement::lookupOrCreateAnimatedProperty): Deleted. >+ (WebCore::SVGElement::lookupOrCreateAnimatedProperties): Deleted. >+ (WebCore::SVGElement::classNameAnimated): Deleted. >+ * svg/SVGExternalResourcesRequired.h: >+ (WebCore::SVGExternalResourcesRequired::externalResourcesRequired const): >+ (WebCore::SVGExternalResourcesRequired::externalResourcesRequired): >+ (WebCore::SVGExternalResourcesRequired::isKnownAttribute): >+ (WebCore::SVGExternalResourcesRequired::attributeRegistry): Deleted. >+ (WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated): Deleted. >+ (WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired): Deleted. >+ (WebCore::SVGExternalResourcesRequired::attributeOwnerProxy): Deleted. >+ * svg/SVGFitToViewBox.cpp: >+ (WebCore::SVGFitToViewBox::SVGFitToViewBox): >+ (WebCore::SVGFitToViewBox::setViewBox): >+ (WebCore::SVGFitToViewBox::resetViewBox): >+ (WebCore::SVGFitToViewBox::parseViewBox): >+ (WebCore::SVGFitToViewBox::registerAttributes): Deleted. >+ * svg/SVGFitToViewBox.h: >+ (WebCore::SVGFitToViewBox::viewBox const): >+ (WebCore::SVGFitToViewBox::preserveAspectRatio const): >+ (WebCore::SVGFitToViewBox::viewBox): >+ (WebCore::SVGFitToViewBox::preserveAspectRatio): >+ (WebCore::SVGFitToViewBox::setPreserveAspectRatio): >+ (WebCore::SVGFitToViewBox::resetPreserveAspectRatio): >+ (WebCore::SVGFitToViewBox::viewBoxString const): >+ (WebCore::SVGFitToViewBox::preserveAspectRatioString const): >+ (WebCore::SVGFitToViewBox::isKnownAttribute): >+ (WebCore::SVGFitToViewBox::attributeRegistry): Deleted. >+ (WebCore::SVGFitToViewBox::viewBoxAnimated): Deleted. >+ (WebCore::SVGFitToViewBox::preserveAspectRatioAnimated): Deleted. >+ * svg/SVGGeometryElement.cpp: >+ (WebCore::SVGGeometryElement::SVGGeometryElement): >+ (WebCore::SVGGeometryElement::parseAttribute): >+ (WebCore::SVGGeometryElement::registerAttributes): Deleted. >+ * svg/SVGGeometryElement.h: >+ (WebCore::SVGGeometryElement::pathLength const): >+ (WebCore::SVGGeometryElement::pathLength): >+ (WebCore::SVGGeometryElement::attributeRegistry): Deleted. >+ (WebCore::SVGGeometryElement::pathLengthAnimated): Deleted. >+ (WebCore::SVGGeometryElement::isKnownAttribute): Deleted. >+ * svg/SVGLangSpace.cpp: >+ (WebCore::SVGLangSpace::SVGLangSpace): >+ (WebCore::SVGLangSpace::isKnownAttribute): >+ (WebCore::SVGLangSpace::xmlspace const): >+ (WebCore::SVGLangSpace::svgAttributeChanged): >+ (WebCore::SVGLangSpace::registerAttributes): Deleted. >+ * svg/SVGLangSpace.h: >+ (WebCore::SVGLangSpace::xmllang const): >+ (WebCore::SVGLangSpace::setXmllang): >+ (WebCore::SVGLangSpace::setXmlspace): >+ (WebCore::SVGLangSpace::attributeRegistry): Deleted. >+ (WebCore::SVGLangSpace::isKnownAttribute): Deleted. >+ * svg/SVGTests.cpp: >+ (WebCore::SVGTests::SVGTests): >+ (WebCore::SVGTests::isKnownAttribute): >+ (WebCore::SVGTests::isValid const): >+ (WebCore::SVGTests::parseAttribute): >+ (WebCore::SVGTests::registerAttributes): Deleted. >+ (WebCore::SVGTests::attributeRegistry): Deleted. >+ (WebCore::SVGTests::requiredFeatures): Deleted. >+ (WebCore::SVGTests::requiredExtensions): Deleted. >+ (WebCore::SVGTests::systemLanguage): Deleted. >+ * svg/SVGTests.h: >+ (WebCore::SVGTests::requiredFeatures): >+ (WebCore::SVGTests::requiredExtensions): >+ (WebCore::SVGTests::systemLanguage): >+ (): Deleted. >+ * svg/SVGURIReference.cpp: >+ (WebCore::SVGURIReference::SVGURIReference): >+ (WebCore::SVGURIReference::parseAttribute): >+ (WebCore::SVGURIReference::registerAttributes): Deleted. >+ (WebCore::SVGURIReference::attributeRegistry): Deleted. >+ (WebCore::SVGURIReference::isKnownAttribute): Deleted. >+ (WebCore::SVGURIReference::href const): Deleted. >+ (WebCore::SVGURIReference::hrefAnimated): Deleted. >+ * svg/SVGURIReference.h: >+ (WebCore::SVGURIReference::href const): >+ (WebCore::SVGURIReference::href): >+ (WebCore::SVGURIReference::isKnownAttribute): >+ * svg/SVGZoomAndPan.cpp: >+ (WebCore::SVGZoomAndPan::parseZoomAndPan): >+ (WebCore::SVGZoomAndPan::parseAttribute): >+ (WebCore::SVGZoomAndPan::SVGZoomAndPan): Deleted. >+ (WebCore::SVGZoomAndPan::registerAttributes): Deleted. >+ * svg/SVGZoomAndPan.h: >+ (WebCore::SVGZoomAndPan::zoomAndPan const): >+ (WebCore::SVGZoomAndPan::setZoomAndPan): >+ (WebCore::SVGZoomAndPan::reset): >+ (WebCore::SVGZoomAndPan::attributeRegistry): Deleted. >+ (WebCore::SVGZoomAndPan::isKnownAttribute): Deleted. >+ > 2018-12-06 Said Abou-Hallawa <sabouhallawa@apple.com> > > Remove SVG properties tear-off objects >diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp >index 025b96bbcb4..ec38febcd61 100644 >--- a/Source/WebCore/svg/SVGElement.cpp >+++ b/Source/WebCore/svg/SVGElement.cpp >@@ -44,6 +44,7 @@ > #include "SVGGraphicsElement.h" > #include "SVGImageElement.h" > #include "SVGNames.h" >+#include "SVGPropertyAnimatorCreator.h" > #include "SVGRenderStyle.h" > #include "SVGRenderSupport.h" > #include "SVGSVGElement.h" >@@ -157,126 +158,15 @@ static NEVER_INLINE HashMap<AtomicStringImpl*, CSSPropertyID> createAttributeNam > return map; > } > >-static NEVER_INLINE HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType> createAttributeNameToAnimatedPropertyTypeMap() >-{ >- using namespace HTMLNames; >- using namespace SVGNames; >- >- struct TableEntry { >- const QualifiedName& attributeName; >- AnimatedPropertyType type; >- }; >- >- static const TableEntry table[] = { >- { alignment_baselineAttr, AnimatedString }, >- { baseline_shiftAttr, AnimatedString }, >- { buffered_renderingAttr, AnimatedString }, >- { clipAttr, AnimatedRect }, >- { clip_pathAttr, AnimatedString }, >- { clip_ruleAttr, AnimatedString }, >- { SVGNames::colorAttr, AnimatedColor }, >- { color_interpolationAttr, AnimatedString }, >- { color_interpolation_filtersAttr, AnimatedString }, >- { color_profileAttr, AnimatedString }, >- { color_renderingAttr, AnimatedString }, >- { cursorAttr, AnimatedString }, >- { displayAttr, AnimatedString }, >- { dominant_baselineAttr, AnimatedString }, >- { fillAttr, AnimatedColor }, >- { fill_opacityAttr, AnimatedNumber }, >- { fill_ruleAttr, AnimatedString }, >- { filterAttr, AnimatedString }, >- { flood_colorAttr, AnimatedColor }, >- { flood_opacityAttr, AnimatedNumber }, >- { font_familyAttr, AnimatedString }, >- { font_sizeAttr, AnimatedLength }, >- { font_stretchAttr, AnimatedString }, >- { font_styleAttr, AnimatedString }, >- { font_variantAttr, AnimatedString }, >- { font_weightAttr, AnimatedString }, >- { image_renderingAttr, AnimatedString }, >- { kerningAttr, AnimatedLength }, >- { letter_spacingAttr, AnimatedLength }, >- { lighting_colorAttr, AnimatedColor }, >- { marker_endAttr, AnimatedString }, >- { marker_midAttr, AnimatedString }, >- { marker_startAttr, AnimatedString }, >- { maskAttr, AnimatedString }, >- { mask_typeAttr, AnimatedString }, >- { opacityAttr, AnimatedNumber }, >- { overflowAttr, AnimatedString }, >- { paint_orderAttr, AnimatedString }, >- { pointer_eventsAttr, AnimatedString }, >- { shape_renderingAttr, AnimatedString }, >- { stop_colorAttr, AnimatedColor }, >- { stop_opacityAttr, AnimatedNumber }, >- { strokeAttr, AnimatedColor }, >- { stroke_dasharrayAttr, AnimatedLengthList }, >- { stroke_dashoffsetAttr, AnimatedLength }, >- { stroke_linecapAttr, AnimatedString }, >- { stroke_linejoinAttr, AnimatedString }, >- { stroke_miterlimitAttr, AnimatedNumber }, >- { stroke_opacityAttr, AnimatedNumber }, >- { stroke_widthAttr, AnimatedLength }, >- { text_anchorAttr, AnimatedString }, >- { text_decorationAttr, AnimatedString }, >- { text_renderingAttr, AnimatedString }, >- { vector_effectAttr, AnimatedString }, >- { visibilityAttr, AnimatedString }, >- { word_spacingAttr, AnimatedLength }, >- }; >- >- HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType> map; >- for (auto& entry : table) >- map.add(entry.attributeName.impl(), entry.type); >- return map; >-} >- >-static const HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>& attributeNameToAnimatedPropertyTypeMap() >-{ >- static const auto map = makeNeverDestroyed(createAttributeNameToAnimatedPropertyTypeMap()); >- return map; >-} >- >-static NEVER_INLINE HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType> createCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap() >-{ >- using namespace HTMLNames; >- using namespace SVGNames; >- >- struct TableEntry { >- const QualifiedName& attributeName; >- AnimatedPropertyType type; >- }; >- >- static const TableEntry table[] = { >- { cxAttr, AnimatedLength }, >- { cyAttr, AnimatedLength }, >- { rAttr, AnimatedLength }, >- { rxAttr, AnimatedLength }, >- { ryAttr, AnimatedLength }, >- { SVGNames::heightAttr, AnimatedLength }, >- { SVGNames::widthAttr, AnimatedLength }, >- { xAttr, AnimatedLength }, >- { yAttr, AnimatedLength }, >- }; >- >- HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType> map; >- for (auto& entry : table) >- map.add(entry.attributeName.impl(), entry.type); >- return map; >-} >- >-static inline const HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>& cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap() >-{ >- static const auto map = makeNeverDestroyed(createCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap()); >- return map; >-} >- > SVGElement::SVGElement(const QualifiedName& tagName, Document& document) > : StyledElement(tagName, document, CreateSVGElement) > , SVGLangSpace(this) >+ , m_propertyAnimatorCreator(std::make_unique<SVGPropertyAnimatorCreator>()) > { >- registerAttributes(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<HTMLNames::classAttr, &SVGElement::m_className>(); >+ }); > } > > SVGElement::~SVGElement() >@@ -289,8 +179,14 @@ SVGElement::~SVGElement() > > m_svgRareData = nullptr; > } >+ > document().accessSVGExtensions().rebuildAllElementReferencesForTarget(*this); > document().accessSVGExtensions().removeAllElementReferencesForTarget(this); >+ >+ // Now it is time to detach this SVGElement from all its properties. These properties >+ // may outlive the SVGElement. The only difference after the detach is no commit will >+ // be carried out unless these properties are attached to another owner. >+ propertyRegistry().detachAllProperties(); > } > > int SVGElement::tabIndex() const >@@ -451,18 +347,10 @@ void SVGElement::setCorrespondingElement(SVGElement* correspondingElement) > correspondingElement->ensureSVGRareData().instances().add(this); > } > >-void SVGElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<HTMLNames::classAttr, &SVGElement::m_className>(); >-} >- > void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == HTMLNames::classAttr) { >- m_className.setValue(value); >+ m_className->setBaseValInternal(value); > return; > } > >@@ -483,34 +371,7 @@ void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& v > SVGLangSpace::parseAttribute(name, value); > } > >-Vector<AnimatedPropertyType> SVGElement::animatedPropertyTypesForAttribute(const QualifiedName& attributeName) >-{ >- auto types = animatedTypes(attributeName); >- if (!types.isEmpty()) >- return types; >- >- { >- auto& map = attributeNameToAnimatedPropertyTypeMap(); >- auto it = map.find(attributeName.impl()); >- if (it != map.end()) { >- types.append(it->value); >- return types; >- } >- } >- >- { >- auto& map = cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap(); >- auto it = map.find(attributeName.impl()); >- if (it != map.end()) { >- types.append(it->value); >- return types; >- } >- } >- >- return types; >-} >- >-bool SVGElement::haveLoadedRequiredResources() >+bool SVGElement::haveLoadedRequiredResources() const > { > for (auto& child : childrenOfType<SVGElement>(*this)) { > if (!child.haveLoadedRequiredResources()) >@@ -691,25 +552,77 @@ void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& > svgAttributeChanged(name); > } > >-void SVGElement::synchronizeAllAnimatedSVGAttribute(SVGElement* svgElement) >+void SVGElement::synchronizeAttribute(const QualifiedName& attributeName) > { >- ASSERT(svgElement->elementData()); >- ASSERT(svgElement->elementData()->animatedSVGAttributesAreDirty()); >+ // If the value of the property has changed, serialize the new value to the attribute. >+ if (auto value = propertyRegistry().synchronize(attributeName)) >+ setSynchronizedLazyAttribute(attributeName, *value); >+} > >- svgElement->synchronizeAttributes(); >- svgElement->elementData()->setAnimatedSVGAttributesAreDirty(false); >+void SVGElement::synchronizeAllAttributes() >+{ >+ // SVGPropertyRegistry::synchronizeAllAttributes() returns the new values of >+ // the properties which have changed but not committed yet. >+ auto map = propertyRegistry().synchronizeAllAttributes(); >+ for (const auto& entry : map) >+ setSynchronizedLazyAttribute(entry.key, entry.value); > } > >-void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) const >+void SVGElement::commitPropertyChange(const QualifiedName& attributeName) > { >- if (!elementData() || !elementData()->animatedSVGAttributesAreDirty()) >- return; >+ invalidateSVGAttributes(); >+ svgAttributeChanged(attributeName); >+} > >- SVGElement* nonConstThis = const_cast<SVGElement*>(this); >- if (name == anyQName()) >- synchronizeAllAnimatedSVGAttribute(nonConstThis); >+void SVGElement::commitPropertyChange(SVGProperty* property) >+{ >+ commitPropertyChange(propertyRegistry().propertyAttributeName(*property)); >+ >+ // We want to dirty the top-level property when a descendant changes. For example >+ // a change in an SVGLength item in SVGLengthList should set the dirty flag on >+ // SVGLengthList and not the SVGLength. >+ property->setDirty(); >+} >+ >+void SVGElement::commitPropertyChange(SVGAnimatedProperty* animatedProperty) >+{ >+ QualifiedName attributeName = propertyRegistry().animatedPropertyAttributeName(*animatedProperty); >+ commitPropertyChange(attributeName); >+ >+ // A change in a style property, e.g SVGRectElement::x should be serialized to >+ // the attribute immediately. Otherwise it is okay to be lazy in this regard. >+ if (!propertyRegistry().isAnimatedStylePropertyAttribute(attributeName)) >+ animatedProperty->setDirty(); > else >- nonConstThis->synchronizeAttribute(name); >+ setSynchronizedLazyAttribute(attributeName, animatedProperty->baseValAsString()); >+} >+ >+bool SVGElement::isAnimatedPropertyAttribute(const QualifiedName& attributeName) const >+{ >+ return propertyRegistry().isAnimatedPropertyAttribute(attributeName); >+} >+ >+bool SVGElement::isAnimatedAttribute(const QualifiedName& attributeName) const >+{ >+ return SVGPropertyAnimatorCreator::isKnownAttribute(attributeName) || propertyRegistry().isAnimatedPropertyAttribute(attributeName); >+} >+ >+bool SVGElement::isAnimatedStyleAttribute(const QualifiedName& attributeName) const >+{ >+ return SVGPropertyAnimatorCreator::isKnownAttribute(attributeName) || propertyRegistry().isAnimatedStylePropertyAttribute(attributeName); >+} >+ >+RefPtr<SVGAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) >+{ >+ // Style property >+ if (auto animator = propertyAnimatorCreator().createAnimator(attributeName, animationMode, calcMode, isAccumulated, isAdditive)) >+ return animator; >+ >+ // Animated property >+ auto animator = propertyRegistry().createAnimator(attributeName, animationMode, calcMode, isAccumulated, isAdditive); >+ for (auto* instance : instances()) >+ instance->propertyRegistry().appendAnimatedInstance(attributeName, animator); >+ return animator; > } > > std::optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) >@@ -864,22 +777,6 @@ QualifiedName SVGElement::animatableAttributeForName(const AtomicString& localNa > return animatableAttributes.get().get(localName); > } > >-#ifndef NDEBUG >- >-bool SVGElement::isAnimatableAttribute(const QualifiedName& name) const >-{ >- if (animatableAttributeForName(name.localName()) == name) >- return !filterOutAnimatableAttribute(name); >- return false; >-} >- >-bool SVGElement::filterOutAnimatableAttribute(const QualifiedName&) const >-{ >- return false; >-} >- >-#endif >- > String SVGElement::title() const > { > // According to spec, for stand-alone SVG documents we should not return a title when >@@ -913,17 +810,6 @@ CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName& > return properties.get().get(attrName.localName().impl()); > } > >-bool SVGElement::isAnimatableCSSProperty(const QualifiedName& attributeName) >-{ >- return attributeNameToAnimatedPropertyTypeMap().contains(attributeName.impl()) >- || cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap().contains(attributeName.impl()); >-} >- >-bool SVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attributeName) >-{ >- return !animatedTypes(attributeName).isEmpty(); >-} >- > bool SVGElement::isPresentationAttribute(const QualifiedName& name) const > { > if (cssPropertyIdForSVGAttributeName(name) > 0) >@@ -947,7 +833,7 @@ void SVGElement::svgAttributeChanged(const QualifiedName& attrName) > } > > if (attrName == HTMLNames::classAttr) { >- classAttributeChanged(className()); >+ classAttributeChanged(className()->currentValue()); > invalidateInstances(); > return; > } >diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h >index 34bd9e08743..5d523886215 100644 >--- a/Source/WebCore/svg/SVGElement.h >+++ b/Source/WebCore/svg/SVGElement.h >@@ -22,12 +22,13 @@ > > #pragma once > >-#include "SVGAnimatedString.h" >-#include "SVGAttributeOwnerProxy.h" >+#include "SVGAnimatedPropertyImpl.h" >+#include "SVGAnimator.h" > #include "SVGLangSpace.h" > #include "SVGLocatable.h" > #include "SVGNames.h" > #include "SVGParsingError.h" >+#include "SVGPropertyOwnerRegistry.h" > #include "StyledElement.h" > #include <wtf/HashMap.h> > #include <wtf/HashSet.h> >@@ -35,17 +36,17 @@ > namespace WebCore { > > class AffineTransform; >-class CSSStyleDeclaration; > class DeprecatedCSSOMValue; > class Document; > class SVGDocumentExtensions; > class SVGElementRareData; >+class SVGPropertyAnimatorCreator; > class SVGSVGElement; > class SVGUseElement; > > void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName); > >-class SVGElement : public StyledElement, public SVGLangSpace { >+class SVGElement : public StyledElement, public SVGLangSpace, public SVGPropertyOwner { > WTF_MAKE_ISO_ALLOCATED(SVGElement); > public: > bool isOutermostSVGSVGElement() const; >@@ -54,8 +55,6 @@ public: > SVGElement* viewportElement() const; > > String title() const override; >- static bool isAnimatableCSSProperty(const QualifiedName&); >- bool isPresentationAttributeWithSVGDOM(const QualifiedName&); > RefPtr<DeprecatedCSSOMValue> getPresentationAttribute(const String& name); > virtual bool supportsMarkers() const { return false; } > bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } >@@ -76,8 +75,6 @@ public: > > virtual void svgAttributeChanged(const QualifiedName&); > >- Vector<AnimatedPropertyType> animatedPropertyTypesForAttribute(const QualifiedName&); >- > void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false); > void sendSVGLoadEventIfPossibleAsynchronously(); > void svgLoadEventTimerFired(); >@@ -103,21 +100,15 @@ public: > > void setCorrespondingElement(SVGElement*); > >- void synchronizeAnimatedSVGAttribute(const QualifiedName&) const; >- static void synchronizeAllAnimatedSVGAttribute(SVGElement*); >- > std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > > static QualifiedName animatableAttributeForName(const AtomicString&); >-#ifndef NDEBUG >- bool isAnimatableAttribute(const QualifiedName&) const; >-#endif > > MutableStyleProperties* animatedSMILStyleProperties() const; > MutableStyleProperties& ensureAnimatedSMILStyleProperties(); > void setUseOverrideComputedStyle(bool); > >- virtual bool haveLoadedRequiredResources(); >+ virtual bool haveLoadedRequiredResources() const; > > bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) override; > bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) override; >@@ -132,26 +123,27 @@ public: > class InstanceInvalidationGuard; > > // The definition of the owner proxy has to match the class inheritance but we are interested in the SVG objects only. >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGElement, SVGLangSpace>; >- static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static void registerAttributes(); >- >- // A super class will override this function to return its owner proxy. The attributes of the super class will >- // be accessible through the registry of the owner proxy. >- virtual const SVGAttributeOwnerProxy& attributeOwnerProxy() const { return m_attributeOwnerProxy; } >- >- // Helper functions which return info for the super class' attributes. >- void synchronizeAttribute(const QualifiedName& name) { attributeOwnerProxy().synchronizeAttribute(name); } >- void synchronizeAttributes() { attributeOwnerProxy().synchronizeAttributes(); } >- Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const { return attributeOwnerProxy().animatedTypes(attributeName); } >- RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute& attribute) const { return attributeOwnerProxy().lookupAnimatedProperty(attribute); } >- RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute& attribute) { return attributeOwnerProxy().lookupOrCreateAnimatedProperty(attribute); } >- Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName& name) { return attributeOwnerProxy().lookupOrCreateAnimatedProperties(name); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGElement>; >+ virtual const SVGPropertyRegistry& propertyRegistry() const { return m_propertyRegistry; } >+ >+ bool isAnimatedPropertyAttribute(const QualifiedName&) const; >+ bool isAnimatedAttribute(const QualifiedName&) const; >+ bool isAnimatedStyleAttribute(const QualifiedName&) const; >+ >+ void synchronizeAttribute(const QualifiedName&); >+ void synchronizeAllAttributes(); >+ >+ void commitPropertyChange(const QualifiedName&); >+ void commitPropertyChange(SVGProperty*) override; >+ void commitPropertyChange(SVGAnimatedProperty*); >+ >+ const SVGElement* attributeContextElement() const override { return this; } >+ SVGPropertyAnimatorCreator& propertyAnimatorCreator() { return *m_propertyAnimatorCreator; } >+ RefPtr<SVGAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive); > > // These are needed for the RenderTree, animation and DOM. >- const auto& className() const { return m_className.currentValue(attributeOwnerProxy()); } >- auto classNameAnimated() { return m_className.animatedProperty(attributeOwnerProxy()); } >+ String className() const { return m_className->currentValue(); } >+ Ref<SVGAnimatedString>& className() { return m_className; } > > protected: > SVGElement(const QualifiedName&, Document&); >@@ -191,18 +183,16 @@ private: > void buildPendingResourcesIfNeeded(); > void accessKeyAction(bool sendMouseEvents) override; > >-#ifndef NDEBUG >- virtual bool filterOutAnimatableAttribute(const QualifiedName&) const; >-#endif >- > void invalidateInstances(); > > std::unique_ptr<SVGElementRareData> m_svgRareData; > > HashSet<SVGElement*> m_elementsWithRelativeLengths; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedStringAttribute m_className; >+ std::unique_ptr<SVGPropertyAnimatorCreator> m_propertyAnimatorCreator; >+ >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedString> m_className { SVGAnimatedString::create(this) }; > }; > > class SVGElement::InstanceInvalidationGuard { >diff --git a/Source/WebCore/svg/SVGExternalResourcesRequired.cpp b/Source/WebCore/svg/SVGExternalResourcesRequired.cpp >index 3a1e56dd623..a817adfcb27 100644 >--- a/Source/WebCore/svg/SVGExternalResourcesRequired.cpp >+++ b/Source/WebCore/svg/SVGExternalResourcesRequired.cpp >@@ -22,6 +22,8 @@ > #include "config.h" > #include "SVGExternalResourcesRequired.h" > >+#include "RenderSVGResource.h" >+#include "RenderSVGShape.h" > #include "SVGElement.h" > #include "SVGNames.h" > >@@ -29,22 +31,18 @@ namespace WebCore { > > SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement) > : m_contextElement(*contextElement) >+ , m_externalResourcesRequired(SVGAnimatedBoolean::create(contextElement)) > { >- registerAttributes(); >-} >- >-void SVGExternalResourcesRequired::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::externalResourcesRequiredAttr, &SVGEllipseElement::m_externalResourcesRequired>(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::externalResourcesRequiredAttr, &SVGExternalResourcesRequired::m_externalResourcesRequired>(); >+ }); > } > > void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::externalResourcesRequiredAttr) >- setExternalResourcesRequired(value == "true"); >+ m_externalResourcesRequired->setBaseValInternal(value == "true"); > } > > void SVGExternalResourcesRequired::svgAttributeChanged(const QualifiedName& attrName) >@@ -57,7 +55,7 @@ void SVGExternalResourcesRequired::svgAttributeChanged(const QualifiedName& attr > // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false' > // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element > // in the document, the SVGLoad event has already been dispatched. >- if (!externalResourcesRequired() && !haveFiredLoadEvent() && !isParserInserted()) { >+ if (!m_externalResourcesRequired->currentValue() && !haveFiredLoadEvent() && !isParserInserted()) { > setHaveFiredLoadEvent(true); > > ASSERT(m_contextElement.haveLoadedRequiredResources()); >@@ -79,7 +77,7 @@ void SVGExternalResourcesRequired::addSupportedAttributes(HashSet<QualifiedName> > void SVGExternalResourcesRequired::dispatchLoadEvent() > { > if (isParserInserted()) >- ASSERT(externalResourcesRequired() != haveFiredLoadEvent()); >+ ASSERT(m_externalResourcesRequired->currentValue() != haveFiredLoadEvent()); > else if (haveFiredLoadEvent()) > return; > >@@ -87,7 +85,7 @@ void SVGExternalResourcesRequired::dispatchLoadEvent() > // HTML fires the 'load' event after it sucessfully loaded a remote resource, otherwise an error event. > // SVG fires the SVGLoad event immediately after parsing the <script> element, if externalResourcesRequired > // is set to 'false', otherwise it dispatches the 'SVGLoad' event just after loading the remote resource. >- if (!externalResourcesRequired()) >+ if (!m_externalResourcesRequired->currentValue()) > return; > > ASSERT(!haveFiredLoadEvent()); >@@ -105,7 +103,7 @@ void SVGExternalResourcesRequired::insertedIntoDocument() > return; > > // Eventually send SVGLoad event now for the dynamically inserted script element. >- if (externalResourcesRequired()) >+ if (m_externalResourcesRequired->currentValue()) > return; > setHaveFiredLoadEvent(true); > m_contextElement.sendSVGLoadEventIfPossibleAsynchronously(); >@@ -114,13 +112,13 @@ void SVGExternalResourcesRequired::insertedIntoDocument() > void SVGExternalResourcesRequired::finishParsingChildren() > { > // A SVGLoad event has been fired by SVGElement::finishParsingChildren. >- if (!externalResourcesRequired()) >+ if (!m_externalResourcesRequired->currentValue()) > setHaveFiredLoadEvent(true); > } > > bool SVGExternalResourcesRequired::haveLoadedRequiredResources() const > { >- return !externalResourcesRequired() || haveFiredLoadEvent(); >+ return !m_externalResourcesRequired->currentValue() || haveFiredLoadEvent(); > } > > } >diff --git a/Source/WebCore/svg/SVGExternalResourcesRequired.h b/Source/WebCore/svg/SVGExternalResourcesRequired.h >index d25507ad07e..303edbeadcd 100644 >--- a/Source/WebCore/svg/SVGExternalResourcesRequired.h >+++ b/Source/WebCore/svg/SVGExternalResourcesRequired.h >@@ -22,7 +22,7 @@ > #pragma once > > #include "QualifiedName.h" >-#include "SVGAttributeOwnerProxyImpl.h" >+#include "SVGPropertyOwnerRegistry.h" > #include <wtf/HashSet.h> > > namespace WebCore { >@@ -44,18 +44,15 @@ public: > > static void addSupportedAttributes(HashSet<QualifiedName>&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGExternalResourcesRequired>; >- static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGExternalResourcesRequired>; > >- auto externalResourcesRequiredAnimated() { return m_externalResourcesRequired.animatedProperty(attributeOwnerProxy()); } >- >- bool externalResourcesRequired() const { return m_externalResourcesRequired.value(); } >- void setExternalResourcesRequired(bool externalResourcesRequired) { m_externalResourcesRequired.setValue(externalResourcesRequired); } >+ bool externalResourcesRequired() const { return m_externalResourcesRequired->currentValue(); } >+ Ref<SVGAnimatedBoolean>& externalResourcesRequired() { return m_externalResourcesRequired; } > > protected: > SVGExternalResourcesRequired(SVGElement* contextElement); > >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return PropertyRegistry::isKnownAttribute(attributeName); } > > virtual void setHaveFiredLoadEvent(bool) { } > virtual bool isParserInserted() const { return false; } >@@ -67,11 +64,10 @@ protected: > bool haveLoadedRequiredResources() const; > > private: >- static void registerAttributes(); >- AttributeOwnerProxy attributeOwnerProxy() { return { *this, m_contextElement }; } >- > SVGElement& m_contextElement; >- SVGAnimatedBooleanAttribute m_externalResourcesRequired; >+ >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedBoolean> m_externalResourcesRequired; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFitToViewBox.cpp b/Source/WebCore/svg/SVGFitToViewBox.cpp >index b769e5b0ccf..d15e3546c12 100644 >--- a/Source/WebCore/svg/SVGFitToViewBox.cpp >+++ b/Source/WebCore/svg/SVGFitToViewBox.cpp >@@ -34,30 +34,26 @@ > > namespace WebCore { > >-SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState animatedState) >- : m_attributeOwnerProxy(*this, *contextElement, animatedState) >+SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, SVGPropertyAccess access) >+ : m_viewBox(SVGAnimatedRect::create(contextElement, access)) >+ , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(contextElement, access)) > { >- registerAttributes(); >-} >- >-void SVGFitToViewBox::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>(); >- registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFitToViewBox::m_preserveAspectRatio>(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>(); >+ PropertyRegistry::registerProperty<SVGNames::preserveAspectRatioAttr, &SVGFitToViewBox::m_preserveAspectRatio>(); >+ }); > } > > void SVGFitToViewBox::setViewBox(const FloatRect& viewBox) > { >- m_viewBox.setValue(viewBox); >+ m_viewBox->setBaseValInternal(viewBox); > m_isViewBoxValid = true; > } > > void SVGFitToViewBox::resetViewBox() > { >- m_viewBox.resetValue(); >+ m_viewBox->setBaseValInternal({ }); > m_isViewBoxValid = false; > } > >@@ -108,7 +104,7 @@ bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, FloatRect& > bool valid = parseNumber(c, end, x) && parseNumber(c, end, y) && parseNumber(c, end, width) && parseNumber(c, end, height, false); > > if (validate) { >- Document& document = m_attributeOwnerProxy.element().document(); >+ Document& document = m_viewBox->contextElement()->document(); > > if (!valid) { > document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >diff --git a/Source/WebCore/svg/SVGFitToViewBox.h b/Source/WebCore/svg/SVGFitToViewBox.h >index f51a7e9cada..a4bdd8f31af 100644 >--- a/Source/WebCore/svg/SVGFitToViewBox.h >+++ b/Source/WebCore/svg/SVGFitToViewBox.h >@@ -23,9 +23,9 @@ > > #include "FloatRect.h" > #include "QualifiedName.h" >-#include "SVGAttributeRegistry.h" > #include "SVGNames.h" > #include "SVGPreserveAspectRatio.h" >+#include "SVGPropertyOwnerRegistry.h" > #include <wtf/HashSet.h> > > namespace WebCore { >@@ -37,31 +37,30 @@ class SVGFitToViewBox { > public: > static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatioValue&, float viewWidth, float viewHeight); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFitToViewBox>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFitToViewBox>; > >- const FloatRect& viewBox() const { return m_viewBox.currentValue(m_attributeOwnerProxy); } >- const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(m_attributeOwnerProxy); } >+ const FloatRect& viewBox() const { return m_viewBox->currentValue(); } >+ const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio->currentValue(); } > >- RefPtr<SVGAnimatedRect> viewBoxAnimated() { return m_viewBox.animatedProperty(m_attributeOwnerProxy); } >- RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(m_attributeOwnerProxy); } >+ Ref<SVGAnimatedRect>& viewBox() { return m_viewBox; } >+ Ref<SVGAnimatedPreserveAspectRatio>& preserveAspectRatio() { return m_preserveAspectRatio; } > > void setViewBox(const FloatRect&); > void resetViewBox(); > >- void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio.setValue(preserveAspectRatio); } >- void resetPreserveAspectRatio() { m_preserveAspectRatio.resetValue(); } >+ void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio->baseVal()->setValue(preserveAspectRatio); } >+ void resetPreserveAspectRatio() { m_preserveAspectRatio->baseVal()->setValue({ }); } > >- String viewBoxString() const { return m_viewBox.toString(); } >- String preserveAspectRatioString() const { return m_preserveAspectRatio.toString(); } >+ String viewBoxString() const { return SVGPropertyTraits<FloatRect>::toString(viewBox()); } >+ String preserveAspectRatioString() const { return preserveAspectRatio().valueAsString(); } > > bool hasValidViewBox() const { return m_isViewBoxValid; } > bool hasEmptyViewBox() const { return m_isViewBoxValid && viewBox().isEmpty(); } > > protected: >- SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState = PropertyIsReadWrite); >+ SVGFitToViewBox(SVGElement* contextElement, SVGPropertyAccess = SVGPropertyAccess::ReadWrite); > >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return PropertyRegistry::isKnownAttribute(attributeName); } > > void reset(); > bool parseAttribute(const QualifiedName&, const AtomicString&); >@@ -69,11 +68,9 @@ protected: > bool parseViewBox(const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); > > private: >- static void registerAttributes(); >- >- AttributeOwnerProxy m_attributeOwnerProxy; >- SVGAnimatedRectAttribute m_viewBox; >- SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedRect> m_viewBox; >+ Ref<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; > bool m_isViewBoxValid { false }; > }; > >diff --git a/Source/WebCore/svg/SVGGeometryElement.cpp b/Source/WebCore/svg/SVGGeometryElement.cpp >index 72dd3f13598..bdd7a02754a 100644 >--- a/Source/WebCore/svg/SVGGeometryElement.cpp >+++ b/Source/WebCore/svg/SVGGeometryElement.cpp >@@ -24,6 +24,8 @@ > #include "SVGGeometryElement.h" > > #include "DOMPoint.h" >+#include "RenderSVGResource.h" >+#include "RenderSVGShape.h" > #include "SVGDocumentExtensions.h" > #include "SVGPathUtilities.h" > #include "SVGPoint.h" >@@ -36,7 +38,10 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGeometryElement); > SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) > { >- registerAttributes(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::pathLengthAttr, &SVGGeometryElement::m_pathLength>(); >+ }); > } > > float SVGGeometryElement::getTotalLength() const >@@ -87,19 +92,11 @@ bool SVGGeometryElement::isPointInStroke(DOMPointInit&& pointInit) > return renderer->isPointInStroke(point); > } > >-void SVGGeometryElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::pathLengthAttr, &SVGGeometryElement::m_pathLength>(); >-} >- > void SVGGeometryElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::pathLengthAttr) { >- m_pathLength.setValue(value.toFloat()); >- if (m_pathLength.value() < 0) >+ m_pathLength->setBaseValInternal(value.toFloat()); >+ if (m_pathLength->baseVal() < 0) > document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed"); > return; > } >diff --git a/Source/WebCore/svg/SVGGeometryElement.h b/Source/WebCore/svg/SVGGeometryElement.h >index 824fefc50fb..f12e1f3ef26 100644 >--- a/Source/WebCore/svg/SVGGeometryElement.h >+++ b/Source/WebCore/svg/SVGGeometryElement.h >@@ -23,7 +23,6 @@ > #pragma once > > #include "Path.h" >-#include "SVGAnimatedNumber.h" > #include "SVGGraphicsElement.h" > #include "SVGNames.h" > >@@ -42,10 +41,10 @@ public: > bool isPointInFill(DOMPointInit&&); > bool isPointInStroke(DOMPointInit&&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGeometryElement, SVGGraphicsElement>; >- static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGGeometryElement, SVGGraphicsElement>; > >- auto pathLengthAnimated() { return m_pathLength.animatedProperty(attributeOwnerProxy()); } >+ float pathLength() const { return m_pathLength->currentValue(); } >+ Ref<SVGAnimatedNumber>& pathLength() { return m_pathLength; } > > protected: > SVGGeometryElement(const QualifiedName&, Document&); >@@ -55,13 +54,10 @@ protected: > > private: > bool isSVGGeometryElement() const override { return true; } >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; } > >- static void registerAttributes(); >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedNumberAttribute m_pathLength; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedNumber> m_pathLength { SVGAnimatedNumber::create(this) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGGraphicsElement.cpp b/Source/WebCore/svg/SVGGraphicsElement.cpp >index c59636cf792..fc4ae7157d7 100644 >--- a/Source/WebCore/svg/SVGGraphicsElement.cpp >+++ b/Source/WebCore/svg/SVGGraphicsElement.cpp >@@ -40,9 +40,11 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGraphicsElement); > SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) > , SVGTests(this) >- , m_shouldIsolateBlending(false) > { >- registerAttributes(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::transformAttr, &SVGGraphicsElement::m_transform>(); >+ }); > } > > SVGGraphicsElement::~SVGGraphicsElement() = default; >@@ -120,21 +122,10 @@ AffineTransform* SVGGraphicsElement::supplementalTransform() > return m_supplementalTransform.get(); > } > >-void SVGGraphicsElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::transformAttr, &SVGGraphicsElement::m_transform>(); >-} >- > void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::transformAttr) { >- SVGTransformListValues newList; >- newList.parse(value); >- m_transform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_transform.setValue(newList); >+ m_transform->baseVal()->parse(value); > return; > } > >@@ -144,18 +135,14 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (attrName == SVGNames::transformAttr) { > InstanceInvalidationGuard guard(*this); > >- auto renderer = this->renderer(); >- if (!renderer) >- return; >- >- if (attrName == SVGNames::transformAttr) { >+ if (auto renderer = this->renderer()) { > renderer->setNeedsTransformUpdate(); > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- return; > } >+ return; > } > > SVGElement::svgAttributeChanged(attrName); >@@ -187,7 +174,7 @@ RenderPtr<RenderElement> SVGGraphicsElement::createElementRenderer(RenderStyle&& > return createRenderer<RenderSVGPath>(*this, WTFMove(style)); > } > >-Path SVGGraphicsElement::toClipPath() >+Path SVGGraphicsElement::toClipPath() const > { > Path path = pathFromGraphicsElement(this); > // FIXME: How do we know the element has done a layout? >diff --git a/Source/WebCore/svg/SVGGraphicsElement.h b/Source/WebCore/svg/SVGGraphicsElement.h >index 06ee4b30792..dd78933f7ec 100644 >--- a/Source/WebCore/svg/SVGGraphicsElement.h >+++ b/Source/WebCore/svg/SVGGraphicsElement.h >@@ -21,7 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedTransformList.h" > #include "SVGElement.h" > #include "SVGTests.h" > #include "SVGTransformable.h" >@@ -58,16 +57,15 @@ public: > void setShouldIsolateBlending(bool isolate) { m_shouldIsolateBlending = isolate; } > > // "base class" methods for all the elements which render as paths >- virtual Path toClipPath(); >+ virtual Path toClipPath() const; > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > > size_t approximateMemoryCost() const override { return sizeof(*this); } > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGraphicsElement, SVGElement, SVGTests>; >- static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGGraphicsElement, SVGElement, SVGTests>; > >- const auto& transform() const { return m_transform.currentValue(attributeOwnerProxy()); } >- auto transformAnimated() { return m_transform.animatedProperty(attributeOwnerProxy()); } >+ const SVGTransformList& transform() const { return m_transform->currentValue(); } >+ Ref<SVGAnimatedTransformList>& transform() { return m_transform; } > > protected: > SVGGraphicsElement(const QualifiedName&, Document&); >@@ -80,19 +78,16 @@ protected: > private: > bool isSVGGraphicsElement() const override { return true; } > >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >- >- static void registerAttributes(); >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; } > > // Used by <animateMotion> > std::unique_ptr<AffineTransform> m_supplementalTransform; > > // Used to isolate blend operations caused by masking. >- bool m_shouldIsolateBlending; >+ bool m_shouldIsolateBlending { false }; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedTransformListAttribute m_transform; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedTransformList> m_transform { SVGAnimatedTransformList::create(this) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGLangSpace.cpp b/Source/WebCore/svg/SVGLangSpace.cpp >index 8b9d80df6f5..0eabe3219d0 100644 >--- a/Source/WebCore/svg/SVGLangSpace.cpp >+++ b/Source/WebCore/svg/SVGLangSpace.cpp >@@ -33,25 +33,20 @@ namespace WebCore { > SVGLangSpace::SVGLangSpace(SVGElement* contextElement) > : m_contextElement(*contextElement) > { >- registerAttributes(); > } >- >-void SVGLangSpace::registerAttributes() >+ >+bool SVGLangSpace::isKnownAttribute(const QualifiedName& attributeName) > { >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::langAttr, &SVGLangSpace::m_lang>()); >- registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::spaceAttr, &SVGLangSpace::m_space>()); >+ return attributeName.matches(XMLNames::langAttr) || attributeName.matches(XMLNames::spaceAttr); > } > >-const String& SVGLangSpace::xmlspace() const >+const AtomicString& SVGLangSpace::xmlspace() const > { >- if (!m_space.value()) { >- static NeverDestroyed<String> defaultString("default"); >+ if (!m_space) { >+ static NeverDestroyed<const AtomicString> defaultString("default", AtomicString::ConstructFromLiteral); > return defaultString; > } >- return m_space.value(); >+ return m_space; > } > > void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -62,9 +57,9 @@ void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& > setXmlspace(value); > } > >-void SVGLangSpace::svgAttributeChanged(const QualifiedName& attrName) >+void SVGLangSpace::svgAttributeChanged(const QualifiedName& attributeName) > { >- if (!isKnownAttribute(attrName)) >+ if (!isKnownAttribute(attributeName)) > return; > > auto* renderer = m_contextElement.renderer(); >diff --git a/Source/WebCore/svg/SVGLangSpace.h b/Source/WebCore/svg/SVGLangSpace.h >index 8775822221e..06977b3a1b7 100644 >--- a/Source/WebCore/svg/SVGLangSpace.h >+++ b/Source/WebCore/svg/SVGLangSpace.h >@@ -22,7 +22,6 @@ > #pragma once > > #include "QualifiedName.h" >-#include "SVGAttributeOwnerProxyImpl.h" > #include <wtf/HashSet.h> > > namespace WebCore { >@@ -31,32 +30,25 @@ class SVGElement; > > class SVGLangSpace { > public: >- const String& xmllang() const { return m_lang.value(); } >- void setXmllang(const AtomicString& xmlLang) { m_lang.setValue(xmlLang); } >+ static bool isKnownAttribute(const QualifiedName& attributeName); >+ >+ const AtomicString& xmllang() const { return m_lang; } >+ void setXmllang(const AtomicString& xmlLang) { m_lang = xmlLang; } > >- const String& xmlspace() const; >- void setXmlspace(const AtomicString& xmlSpace) { m_space.setValue(xmlSpace); } >+ const AtomicString& xmlspace() const; >+ void setXmlspace(const AtomicString& xmlSpace) { m_space = xmlSpace; } > > void parseAttribute(const QualifiedName&, const AtomicString&); > > void svgAttributeChanged(const QualifiedName&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLangSpace>; >- using AttributeRegistry = SVGAttributeRegistry<SVGLangSpace>; >- static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return attributeRegistry().isKnownAttribute(attributeName); } >- > protected: > SVGLangSpace(SVGElement* contextElement); > > private: >- using SVGStringAttribute = SVGPropertyAttribute<String>; >- using SVGStringAttributeAccessor = SVGPropertyAttributeAccessor<SVGLangSpace, SVGStringAttribute>; >- static void registerAttributes(); >- > SVGElement& m_contextElement; >- SVGStringAttribute m_lang; >- SVGStringAttribute m_space; >+ AtomicString m_lang; >+ AtomicString m_space; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTests.cpp b/Source/WebCore/svg/SVGTests.cpp >index 7134ce7b8e6..a343b9f2774 100644 >--- a/Source/WebCore/svg/SVGTests.cpp >+++ b/Source/WebCore/svg/SVGTests.cpp >@@ -24,9 +24,9 @@ > > #include "DOMImplementation.h" > #include "HTMLNames.h" >-#include "SVGAttributeOwnerProxy.h" > #include "SVGElement.h" > #include "SVGNames.h" >+#include "SVGPropertyOwnerRegistry.h" > #include "SVGStringList.h" > #include <wtf/Language.h> > #include <wtf/NeverDestroyed.h> >@@ -109,28 +109,21 @@ static const HashSet<String, ASCIICaseInsensitiveHash>& supportedSVGFeatures() > > SVGTests::SVGTests(SVGElement* contextElement) > : m_contextElement(*contextElement) >+ , m_requiredFeatures(SVGStringList::create(contextElement)) >+ , m_requiredExtensions(SVGStringList::create(contextElement)) >+ , m_systemLanguage(SVGStringList::create(contextElement)) > { >- registerAttributes(); >-} >- >-void SVGTests::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>(); >- registry.registerAttribute<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>(); >- registry.registerAttribute<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>(); >-} >- >-SVGTests::AttributeRegistry& SVGTests::attributeRegistry() >-{ >- return AttributeOwnerProxy::attributeRegistry(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>(); >+ PropertyRegistry::registerProperty<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>(); >+ PropertyRegistry::registerProperty<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>(); >+ }); > } > > bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) > { >- return AttributeOwnerProxy::isKnownAttribute(attributeName); >+ return PropertyRegistry::isKnownAttribute(attributeName); > } > > bool SVGTests::hasExtension(const String& extension) >@@ -145,15 +138,15 @@ bool SVGTests::hasExtension(const String& extension) > > bool SVGTests::isValid() const > { >- for (auto& feature : m_requiredFeatures.value()) { >+ for (auto& feature : m_requiredFeatures->items()) { > if (feature.isEmpty() || !supportedSVGFeatures().contains(feature)) > return false; > } >- for (auto& language : m_systemLanguage.value()) { >+ for (auto& language : m_systemLanguage->items()) { > if (language != defaultLanguage().substring(0, 2)) > return false; > } >- for (auto& extension : m_requiredExtensions.value()) { >+ for (auto& extension : m_requiredExtensions->items()) { > if (!hasExtension(extension)) > return false; > } >@@ -163,11 +156,11 @@ bool SVGTests::isValid() const > void SVGTests::parseAttribute(const QualifiedName& attributeName, const AtomicString& value) > { > if (attributeName == requiredFeaturesAttr) >- m_requiredFeatures.value().reset(value); >+ m_requiredFeatures->reset(value); > if (attributeName == requiredExtensionsAttr) >- m_requiredExtensions.value().reset(value); >+ m_requiredExtensions->reset(value); > if (attributeName == systemLanguageAttr) >- m_systemLanguage.value().reset(value); >+ m_systemLanguage->reset(value); > } > > void SVGTests::svgAttributeChanged(const QualifiedName& attrName) >@@ -187,24 +180,6 @@ void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttribute > supportedAttributes.add(systemLanguageAttr); > } > >-Ref<SVGStringList> SVGTests::requiredFeatures() >-{ >- m_requiredFeatures.setShouldSynchronize(true); >- return SVGStringList::create(m_contextElement, m_requiredFeatures.value()); >-} >- >-Ref<SVGStringList> SVGTests::requiredExtensions() >-{ >- m_requiredExtensions.setShouldSynchronize(true); >- return SVGStringList::create(m_contextElement, m_requiredExtensions.value()); >-} >- >-Ref<SVGStringList> SVGTests::systemLanguage() >-{ >- m_systemLanguage.setShouldSynchronize(true); >- return SVGStringList::create(m_contextElement, m_systemLanguage.value()); >-} >- > bool SVGTests::hasFeatureForLegacyBindings(const String& feature, const String& version) > { > // FIXME: This function is here only to be exposed in the Objective-C and GObject bindings for both Node and DOMImplementation. >diff --git a/Source/WebCore/svg/SVGTests.h b/Source/WebCore/svg/SVGTests.h >index 79dde9b60a4..3e34cf04136 100644 >--- a/Source/WebCore/svg/SVGTests.h >+++ b/Source/WebCore/svg/SVGTests.h >@@ -21,8 +21,7 @@ > > #pragma once > >-#include "SVGAttribute.h" >-#include "SVGStringListValues.h" >+#include "SVGStringList.h" > > namespace WebCore { > >@@ -30,10 +29,7 @@ class SVGElement; > class SVGStringList; > > template<typename OwnerType, typename... BaseTypes> >-class SVGAttributeRegistry; >- >-template<typename OwnerType, typename... BaseTypes> >-class SVGAttributeOwnerProxyImpl; >+class SVGPropertyOwnerRegistry; > > class SVGTests { > WTF_MAKE_NONCOPYABLE(SVGTests); >@@ -41,9 +37,8 @@ public: > static bool hasExtension(const String&); > bool isValid() const; > >- using AttributeRegistry = SVGAttributeRegistry<SVGTests>; >- static AttributeRegistry& attributeRegistry(); >- static bool isKnownAttribute(const QualifiedName& attributeName); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTests>; >+ static bool isKnownAttribute(const QualifiedName&); > > void parseAttribute(const QualifiedName&, const AtomicString&); > void svgAttributeChanged(const QualifiedName&); >@@ -53,21 +48,18 @@ public: > WEBCORE_EXPORT static bool hasFeatureForLegacyBindings(const String& feature, const String& version); > > // These methods are called from DOM through the super classes. >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >+ const Ref<SVGStringList>& requiredFeatures() { return m_requiredFeatures; } >+ const Ref<SVGStringList>& requiredExtensions() { return m_requiredExtensions; } >+ const Ref<SVGStringList>& systemLanguage() { return m_systemLanguage; } > > protected: > SVGTests(SVGElement* contextElement); > > private: >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTests>; >- static void registerAttributes(); >- > SVGElement& m_contextElement; >- SVGStringListValuesAttribute m_requiredFeatures { SVGNames::requiredFeaturesAttr }; >- SVGStringListValuesAttribute m_requiredExtensions { SVGNames::requiredExtensionsAttr }; >- SVGStringListValuesAttribute m_systemLanguage { SVGNames::systemLanguageAttr }; >+ Ref<SVGStringList> m_requiredFeatures; >+ Ref<SVGStringList> m_requiredExtensions; >+ Ref<SVGStringList> m_systemLanguage; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGURIReference.cpp b/Source/WebCore/svg/SVGURIReference.cpp >index 2373cb4978d..85fe0e7f802 100644 >--- a/Source/WebCore/svg/SVGURIReference.cpp >+++ b/Source/WebCore/svg/SVGURIReference.cpp >@@ -24,51 +24,25 @@ > > #include "Document.h" > #include "Element.h" >-#include "SVGAttributeOwnerProxy.h" > #include <wtf/URL.h> > #include "XLinkNames.h" > > namespace WebCore { > > SVGURIReference::SVGURIReference(SVGElement* contextElement) >- : m_attributeOwnerProxy(std::make_unique<AttributeOwnerProxy>(*this, *contextElement)) >+ : m_href(SVGAnimatedString::create(contextElement)) > { >- registerAttributes(); >-} >- >-void SVGURIReference::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::hrefAttr, &SVGURIReference::m_href>(); >- registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); >-} >- >-SVGURIReference::AttributeRegistry& SVGURIReference::attributeRegistry() >-{ >- return AttributeOwnerProxy::attributeRegistry(); >-} >- >-bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName) >-{ >- return AttributeOwnerProxy::isKnownAttribute(attributeName); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::hrefAttr, &SVGURIReference::m_href>(); >+ PropertyRegistry::registerProperty<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); >+ }); > } > > void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (isKnownAttribute(name)) >- m_href.setValue(value); >-} >- >-const String& SVGURIReference::href() const >-{ >- return m_href.currentValue(*m_attributeOwnerProxy); >-} >- >-RefPtr<SVGAnimatedString> SVGURIReference::hrefAnimated() >-{ >- return m_href.animatedProperty(*m_attributeOwnerProxy); >+ m_href->setBaseValInternal(value); > } > > String SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const Document& document) >diff --git a/Source/WebCore/svg/SVGURIReference.h b/Source/WebCore/svg/SVGURIReference.h >index f4629e05e0c..7218affba15 100644 >--- a/Source/WebCore/svg/SVGURIReference.h >+++ b/Source/WebCore/svg/SVGURIReference.h >@@ -23,16 +23,11 @@ > > #include "Document.h" > #include "QualifiedName.h" >-#include "SVGAnimatedString.h" >+#include "SVGAnimatedPropertyImpl.h" >+#include "SVGPropertyOwnerRegistry.h" > > namespace WebCore { > >-template<typename OwnerType, typename... BaseTypes> >-class SVGAttributeRegistry; >- >-template<typename OwnerType, typename... BaseTypes> >-class SVGAttributeOwnerProxyImpl; >- > class SVGURIReference { > WTF_MAKE_NONCOPYABLE(SVGURIReference); > public: >@@ -60,23 +55,19 @@ public: > return !equalIgnoringFragmentIdentifier(url, document.url()); > } > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGURIReference>; >- using AttributeRegistry = SVGAttributeRegistry<SVGURIReference>; >- static AttributeRegistry& attributeRegistry(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGURIReference>; > >- const String& href() const; >- RefPtr<SVGAnimatedString> hrefAnimated(); >+ String href() const { return m_href->currentValue(); } >+ Ref<SVGAnimatedString>& href() { return m_href; } > > protected: > SVGURIReference(SVGElement* contextElement); > >- static bool isKnownAttribute(const QualifiedName& attributeName); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return PropertyRegistry::isKnownAttribute(attributeName); } > > private: >- static void registerAttributes(); >- >- std::unique_ptr<AttributeOwnerProxy> m_attributeOwnerProxy; >- SVGAnimatedStringAttribute m_href; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedString> m_href; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGZoomAndPan.cpp b/Source/WebCore/svg/SVGZoomAndPan.cpp >index efadd4b2251..fd8187a1b89 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.cpp >+++ b/Source/WebCore/svg/SVGZoomAndPan.cpp >@@ -24,30 +24,17 @@ > > namespace WebCore { > >-SVGZoomAndPan::SVGZoomAndPan() >-{ >- registerAttributes(); >-} >- >-void SVGZoomAndPan::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>(); >-} >- > bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end) > { > static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' }; > if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) { >- m_zoomAndPan.setValue(SVGZoomAndPanDisable); >+ m_zoomAndPan = SVGZoomAndPanDisable; > return true; > } > > static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' }; > if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) { >- m_zoomAndPan.setValue(SVGZoomAndPanMagnify); >+ m_zoomAndPan = SVGZoomAndPanMagnify; > return true; > } > >@@ -58,7 +45,7 @@ void SVGZoomAndPan::parseAttribute(const QualifiedName& attributeName, const Ato > { > if (attributeName != SVGNames::zoomAndPanAttr) > return; >- m_zoomAndPan.setValue(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value)); >+ m_zoomAndPan = SVGPropertyTraits<SVGZoomAndPanType>::fromString(value); > } > > } >diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h >index 35d8828ec57..7a846e73c37 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.h >+++ b/Source/WebCore/svg/SVGZoomAndPan.h >@@ -37,26 +37,22 @@ public: > SVG_ZOOMANDPAN_MAGNIFY = SVGZoomAndPanMagnify > }; > >- SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan.value(); } >- void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan.setValue(zoomAndPan); } >+ SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } >+ void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan = zoomAndPan; } > ExceptionOr<void> setZoomAndPan(unsigned) { return Exception { NoModificationAllowedError }; } >- void reset() { m_zoomAndPan.setValue(SVGZoomAndPanMagnify); } >- >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGZoomAndPan>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ void reset() { m_zoomAndPan = SVGPropertyTraits<SVGZoomAndPanType>::initialValue(); } > > void parseAttribute(const QualifiedName&, const AtomicString&); > > protected: >- SVGZoomAndPan(); >+ SVGZoomAndPan() = default; > >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > bool parseZoomAndPan(const UChar*&, const UChar*); > > private: >- static void registerAttributes(); >+ static void registerProperties(); > >- SVGPropertyAttribute<SVGZoomAndPanType> m_zoomAndPan; >+ SVGZoomAndPanType m_zoomAndPan { SVGPropertyTraits<SVGZoomAndPanType>::initialValue() }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGList.h b/Source/WebCore/svg/properties/SVGList.h >index 0f353da857f..19ef67b5d7e 100644 >--- a/Source/WebCore/svg/properties/SVGList.h >+++ b/Source/WebCore/svg/properties/SVGList.h >@@ -29,7 +29,7 @@ > #include "SVGProperty.h" > > namespace WebCore { >- >+ > template<typename ItemType> > class SVGList : public SVGProperty { > public: >@@ -37,7 +37,7 @@ public: > { > return m_items.size(); > } >- >+ > ExceptionOr<void> clear() > { > auto result = canAlterList(); >@@ -59,7 +59,7 @@ public: > > return at(index); > } >- >+ > ExceptionOr<ItemType> initialize(ItemType&& newItem) > { > auto result = canAlterList(); >@@ -68,24 +68,24 @@ public: > > // Spec: Clears all existing current items from the list. > clearItems(); >- >+ > auto item = append(WTFMove(newItem)); > commitChange(); > return WTFMove(item); > } >- >+ > ExceptionOr<ItemType> insertItemBefore(ItemType&& newItem, unsigned index) > { > auto result = canAlterList(); > if (result.hasException()) > return result.releaseException(); > ASSERT(result.releaseReturnValue()); >- >+ > // Spec: If the index is greater than or equal to numberOfItems, > // then the new item is appended to the end of the list. > if (index > numberOfItems()) > index = numberOfItems(); >- >+ > auto item = insert(index, WTFMove(newItem)); > commitChange(); > return WTFMove(item); >@@ -102,26 +102,26 @@ public: > commitChange(); > return WTFMove(item); > } >- >+ > ExceptionOr<ItemType> removeItem(unsigned index) > { > auto result = canRemoveItem(index); > if (result.hasException()) > return result.releaseException(); > ASSERT(result.releaseReturnValue()); >- >+ > auto item = remove(index); > commitChange(); > return WTFMove(item); > } >- >+ > ExceptionOr<ItemType> appendItem(ItemType&& newItem) > { > auto result = canAlterList(); > if (result.hasException()) > return result.releaseException(); > ASSERT(result.releaseReturnValue()); >- >+ > auto item = append(WTFMove(newItem)); > commitChange(); > return WTFMove(item); >@@ -162,7 +162,7 @@ protected: > if (result.hasException()) > return result.releaseException(); > ASSERT(result.releaseReturnValue()); >- >+ > if (index >= m_items.size()) > return Exception { IndexSizeError }; > return true; >@@ -174,7 +174,7 @@ protected: > if (result.hasException()) > return result.releaseException(); > ASSERT(result.releaseReturnValue()); >- >+ > if (index >= m_items.size()) > return Exception { IndexSizeError }; > return true; >diff --git a/Source/WebCore/svg/properties/SVGPrimitiveList.h b/Source/WebCore/svg/properties/SVGPrimitiveList.h >index dd67ec38d16..971aa1f4bf9 100644 >--- a/Source/WebCore/svg/properties/SVGPrimitiveList.h >+++ b/Source/WebCore/svg/properties/SVGPrimitiveList.h >@@ -73,5 +73,3 @@ protected: > }; > > } >- >- >diff --git a/Source/WebCore/svg/properties/SVGPropertyList.h b/Source/WebCore/svg/properties/SVGPropertyList.h >index 38b900eff81..c69e24613c6 100644 >--- a/Source/WebCore/svg/properties/SVGPropertyList.h >+++ b/Source/WebCore/svg/properties/SVGPropertyList.h >@@ -47,7 +47,7 @@ protected: > : BaseList(owner, access) > { > } >- >+ > ~SVGPropertyList() > { > // Detach the items from the list before it is deleted. >@@ -96,7 +96,7 @@ protected: > > // Spec: Detach item. > item->detach(); >- >+ > // Spec: if newItem is not a detached object, then set newItem to be > // a clone object of newItem. > if (newItem->isAttached()) >@@ -108,7 +108,7 @@ protected: > item->attach(this, m_access); > return at(index); > } >- >+ > Ref<PropertyType> remove(unsigned index) override > { > ASSERT(index < size()); >@@ -119,19 +119,19 @@ protected: > m_items.remove(index); > return WTFMove(item); > } >- >+ > Ref<PropertyType> append(Ref<PropertyType>&& newItem) override > { > // Spec: if newItem is not a detached object, then set newItem to be > // a clone object of newItem. > if (newItem->isAttached()) > newItem = newItem->clone(); >- >+ > // Spec: Attach newItem to the list object. > newItem->attach(this, m_access); > m_items.append(WTFMove(newItem)); > return at(size() - 1); > } > }; >- >+ > }
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