WebKit Bugzilla
Attachment 356752 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]
16-Text
16-Text.patch (text/plain), 28.05 KB, created by
Said Abou-Hallawa
on 2018-12-06 14:04:11 PST
(
hide
)
Description:
16-Text
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-12-06 14:04:11 PST
Size:
28.05 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4c02c25b9a8..e1b1ae0ad0d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,64 @@ >+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!). >+ >+ Remove the SVG tear-off property references from the SVG text objects. >+ >+ * svg/SVGAltGlyphElement.h: >+ * svg/SVGTextContentElement.cpp: >+ (WebCore::SVGTextContentElement::SVGTextContentElement): >+ (WebCore::SVGTextContentElement::parseAttribute): >+ (WebCore::SVGTextContentElement::svgAttributeChanged): >+ (WebCore::SVGTextContentElement::textLength): >+ (WebCore::SVGTextContentElement::registerAttributes): Deleted. >+ * svg/SVGTextContentElement.h: >+ (WebCore::SVGTextContentElement::specifiedTextLength const): >+ (WebCore::SVGTextContentElement::textLength const): >+ (WebCore::SVGTextContentElement::lengthAdjust const): >+ (WebCore::SVGTextContentElement::lengthAdjust): >+ (WebCore::SVGTextContentElement::specifiedTextLength): Deleted. >+ (WebCore::SVGTextContentElement::attributeRegistry): Deleted. >+ (WebCore::SVGTextContentElement::textLengthAnimated): Deleted. >+ (WebCore::SVGTextContentElement::lengthAdjustAnimated): Deleted. >+ (WebCore::SVGTextContentElement::isKnownAttribute): Deleted. >+ (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::SVGAnimatedCustomLengthAttribute): Deleted. >+ (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::synchronize): Deleted. >+ (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::animatedProperty): Deleted. >+ * svg/SVGTextElement.cpp: >+ * svg/SVGTextPathElement.cpp: >+ (WebCore::SVGTextPathElement::SVGTextPathElement): >+ (WebCore::SVGTextPathElement::parseAttribute): >+ (WebCore::SVGTextPathElement::svgAttributeChanged): >+ (WebCore::SVGTextPathElement::buildPendingResource): >+ (WebCore::SVGTextPathElement::registerAttributes): Deleted. >+ * svg/SVGTextPathElement.h: >+ * svg/SVGTextPositioningElement.cpp: >+ (WebCore::SVGTextPositioningElement::SVGTextPositioningElement): >+ (WebCore::SVGTextPositioningElement::parseAttribute): >+ (WebCore::SVGTextPositioningElement::svgAttributeChanged): >+ (WebCore::SVGTextPositioningElement::registerAttributes): Deleted. >+ * svg/SVGTextPositioningElement.h: >+ (WebCore::SVGTextPositioningElement::x const): >+ (WebCore::SVGTextPositioningElement::y const): >+ (WebCore::SVGTextPositioningElement::dx const): >+ (WebCore::SVGTextPositioningElement::dy const): >+ (WebCore::SVGTextPositioningElement::rotate const): >+ (WebCore::SVGTextPositioningElement::x): >+ (WebCore::SVGTextPositioningElement::y): >+ (WebCore::SVGTextPositioningElement::dx): >+ (WebCore::SVGTextPositioningElement::dy): >+ (WebCore::SVGTextPositioningElement::rotate): >+ (WebCore::SVGTextPositioningElement::attributeRegistry): Deleted. >+ (WebCore::SVGTextPositioningElement::xAnimated): Deleted. >+ (WebCore::SVGTextPositioningElement::yAnimated): Deleted. >+ (WebCore::SVGTextPositioningElement::dxAnimated): Deleted. >+ (WebCore::SVGTextPositioningElement::dyAnimated): Deleted. >+ (WebCore::SVGTextPositioningElement::rotateAnimated): Deleted. >+ (WebCore::SVGTextPositioningElement::isKnownAttribute): Deleted. >+ > 2018-12-06 Said Abou-Hallawa <sabouhallawa@apple.com> > > Remove SVG properties tear-off objects >diff --git a/Source/WebCore/svg/SVGAltGlyphElement.h b/Source/WebCore/svg/SVGAltGlyphElement.h >index 3b4e861a301..c305eb32cb6 100644 >--- a/Source/WebCore/svg/SVGAltGlyphElement.h >+++ b/Source/WebCore/svg/SVGAltGlyphElement.h >@@ -45,13 +45,13 @@ public: > private: > SVGAltGlyphElement(const QualifiedName&, Document&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAltGlyphElement, SVGTextPositioningElement, SVGURIReference>; >- const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGAltGlyphElement, SVGTextPositioningElement, SVGURIReference>; >+ const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > bool childShouldCreateRenderer(const Node&) const override; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ PropertyRegistry m_propertyRegistry { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTextContentElement.cpp b/Source/WebCore/svg/SVGTextContentElement.cpp >index 8be560528de..d3d5b988fd1 100644 >--- a/Source/WebCore/svg/SVGTextContentElement.cpp >+++ b/Source/WebCore/svg/SVGTextContentElement.cpp >@@ -47,7 +47,11 @@ SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum > : SVGGraphicsElement(tagName, document) > , SVGExternalResourcesRequired(this) > { >- registerAttributes(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>(); >+ PropertyRegistry::registerProperty<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>(); >+ }); > } > > unsigned SVGTextContentElement::getNumberOfChars() >@@ -158,15 +162,6 @@ void SVGTextContentElement::collectStyleForPresentationAttribute(const Qualified > SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style); > } > >-void SVGTextContentElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute(SVGAnimatedCustomLengthAttributeAccessor::singleton<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>()); >- registry.registerAttribute<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>(); >-} >- > void SVGTextContentElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; >@@ -174,9 +169,9 @@ void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom > if (name == SVGNames::lengthAdjustAttr) { > auto propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(value); > if (propertyValue > 0) >- m_lengthAdjust.setValue(propertyValue); >+ m_lengthAdjust->setBaseValInternal<SVGLengthAdjustType>(propertyValue); > } else if (name == SVGNames::textLengthAttr) >- m_textLength.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); >+ m_textLength->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -186,9 +181,9 @@ void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom > > void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > if (attrName == SVGNames::textLengthAttr) >- m_specifiedTextLength = m_textLength.value(); >+ m_specifiedTextLength = m_textLength->baseVal()->value(); > > if (auto renderer = this->renderer()) { > InstanceInvalidationGuard guard(*this); >@@ -200,6 +195,14 @@ void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) > SVGGraphicsElement::svgAttributeChanged(attrName); > SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } >+ >+Ref<SVGAnimatedLength>& SVGTextContentElement::textLength() >+{ >+ static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther); >+ if (m_textLength->baseVal()->value() == defaultTextLength) >+ m_textLength->baseVal()->value().newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength()); >+ return m_textLength; >+} > > bool SVGTextContentElement::selfHasRelativeLengths() const > { >diff --git a/Source/WebCore/svg/SVGTextContentElement.h b/Source/WebCore/svg/SVGTextContentElement.h >index 157c3d7a786..8d16fe2a0e8 100644 >--- a/Source/WebCore/svg/SVGTextContentElement.h >+++ b/Source/WebCore/svg/SVGTextContentElement.h >@@ -21,9 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedEnumeration.h" >-#include "SVGAnimatedLength.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > >@@ -85,16 +82,15 @@ public: > ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars); > > static SVGTextContentElement* elementFromRenderer(RenderObject*); >- const SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; } > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>; > >- const SVGLengthValue& textLength() const { return m_textLength.currentValue(attributeOwnerProxy()); } >- SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& specifiedTextLength() const { return m_specifiedTextLength; } >+ const SVGLengthValue& textLength() const { return m_textLength->currentValue(); } >+ SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust->currentValue<SVGLengthAdjustType>(); } > >- RefPtr<SVGAnimatedLength> textLengthAnimated() { return m_textLength.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> lengthAdjustAnimated() { return m_lengthAdjust.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLength>& textLength(); >+ Ref<SVGAnimatedEnumeration>& lengthAdjust() { return m_lengthAdjust; } > > protected: > SVGTextContentElement(const QualifiedName&, Document&); >@@ -110,48 +106,12 @@ protected: > > private: > bool isTextContent() const final { 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; } > >- class SVGAnimatedCustomLengthAttribute : public SVGAnimatedLengthAttribute { >- public: >- using SVGAnimatedLengthAttribute::operator=; >- >- SVGAnimatedCustomLengthAttribute(SVGTextContentElement& element, SVGLengthMode lengthMode) >- : SVGAnimatedLengthAttribute(lengthMode) >- , m_element(element) >- { >- } >- >- void synchronize(Element&, const QualifiedName& attributeName) >- { >- if (!shouldSynchronize()) >- return; >- String string(SVGPropertyTraits<SVGLengthValue>::toString(m_element.m_specifiedTextLength)); >- static_cast<Element&>(m_element).setSynchronizedLazyAttribute(attributeName, string); >- } >- >- RefPtr<SVGAnimatedLength> animatedProperty(const SVGAttributeOwnerProxy& attributeOwnerProxy) >- { >- static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther); >- if (m_element.m_specifiedTextLength == defaultTextLength) >- m_element.m_textLength.value().newValueSpecifiedUnits(LengthTypeNumber, m_element.getComputedTextLength()); >- >- setShouldSynchronize(true); >- return static_reference_cast<SVGAnimatedLength>(attributeOwnerProxy.lookupOrCreateAnimatedProperty(*this).releaseNonNull()); >- } >- >- private: >- SVGTextContentElement& m_element; >- }; >- >- using SVGAnimatedCustomLengthAttributeAccessor = SVGAnimatedAttributeAccessor<SVGTextContentElement, SVGAnimatedCustomLengthAttribute, AnimatedLength>; >- >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedCustomLengthAttribute m_textLength { *this, LengthModeOther }; >- SVGAnimatedEnumerationAttribute<SVGLengthAdjustType> m_lengthAdjust { SVGLengthAdjustSpacing }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_textLength { SVGAnimatedLength::create(this, LengthModeOther) }; >+ Ref<SVGAnimatedEnumeration> m_lengthAdjust { SVGAnimatedEnumeration::create(this, SVGLengthAdjustSpacing) }; > SVGLengthValue m_specifiedTextLength { LengthModeOther }; > }; > >diff --git a/Source/WebCore/svg/SVGTextElement.cpp b/Source/WebCore/svg/SVGTextElement.cpp >index 6d205e3cf9a..5e59f61cecd 100644 >--- a/Source/WebCore/svg/SVGTextElement.cpp >+++ b/Source/WebCore/svg/SVGTextElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp >index a1191f901a3..3d624cf117b 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.cpp >+++ b/Source/WebCore/svg/SVGTextPathElement.cpp >@@ -38,7 +38,13 @@ inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Docu > , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::textPathTag)); >- registerAttributes(); >+ >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>(); >+ PropertyRegistry::registerProperty<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>(); >+ PropertyRegistry::registerProperty<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>(); >+ }); > } > > Ref<SVGTextPathElement> SVGTextPathElement::create(const QualifiedName& tagName, Document& document) >@@ -56,30 +62,20 @@ void SVGTextPathElement::clearResourceReferences() > document().accessSVGExtensions().removeAllTargetReferencesForElement(this); > } > >-void SVGTextPathElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>(); >- registry.registerAttribute<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>(); >- registry.registerAttribute<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>(); >-} >- > void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::startOffsetAttr) >- m_startOffset.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError)); >+ m_startOffset->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError)); > else if (name == SVGNames::methodAttr) { > SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value); > if (propertyValue > 0) >- m_method.setValue(propertyValue); >+ m_method->setBaseValInternal<SVGTextPathMethodType>(propertyValue); > } else if (name == SVGNames::spacingAttr) { > SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); > if (propertyValue > 0) >- m_spacing.setValue(propertyValue); >+ m_spacing->setBaseValInternal<SVGTextPathSpacingType>(propertyValue); > } > > reportAttributeParsingError(parseError, name, value); >@@ -90,7 +86,7 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > > if (attrName == SVGNames::startOffsetAttr) >@@ -143,7 +139,8 @@ void SVGTextPathElement::buildPendingResource() > if (!isConnected()) > return; > >- auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope()); >+ String href = this->href()->currentValue(); >+ auto target = SVGURIReference::targetElementFromIRIString(href, treeScope()); > if (!target.element) { > // Do not register as pending if we are already pending this resource. > if (document().accessSVGExtensions().isPendingResource(this, target.identifier)) >diff --git a/Source/WebCore/svg/SVGTextPathElement.h b/Source/WebCore/svg/SVGTextPathElement.h >index 69b3855d633..a3d2bc9f2ff 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.h >+++ b/Source/WebCore/svg/SVGTextPathElement.h >@@ -111,13 +111,13 @@ public: > > static Ref<SVGTextPathElement> create(const QualifiedName&, Document&); > >- const SVGLengthValue& startOffset() const { return m_startOffset.currentValue(attributeOwnerProxy()); } >- SVGTextPathMethodType method() const { return m_method.currentValue(attributeOwnerProxy()); } >- SVGTextPathSpacingType spacing() const { return m_spacing.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& startOffset() const { return m_startOffset->currentValue(); } >+ SVGTextPathMethodType method() const { return m_method->currentValue<SVGTextPathMethodType>(); } >+ SVGTextPathSpacingType spacing() const { return m_spacing->currentValue<SVGTextPathSpacingType>(); } > >- RefPtr<SVGAnimatedLength> startOffsetAnimated() { return m_startOffset.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> methodAnimated() { return m_method.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedEnumeration> spacingAnimated() { return m_spacing.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLength>& startOffset() { return m_startOffset; } >+ Ref<SVGAnimatedEnumeration>& method() { return m_method; } >+ Ref<SVGAnimatedEnumeration>& spacing() { return m_spacing; } > > protected: > void didFinishInsertingNode() override; >@@ -126,12 +126,9 @@ private: > SVGTextPathElement(const QualifiedName&, Document&); > virtual ~SVGTextPathElement(); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >- static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >- static void registerAttributes(); >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPathElement, SVGTextContentElement, SVGURIReference>; >+ 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; > >@@ -146,10 +143,10 @@ private: > > bool selfHasRelativeLengths() const override; > >- AttributeOwnerProxy m_attributeOwnerProxy { *this }; >- SVGAnimatedLengthAttribute m_startOffset { LengthModeOther }; >- SVGAnimatedEnumerationAttribute<SVGTextPathMethodType> m_method { SVGTextPathMethodAlign }; >- SVGAnimatedEnumerationAttribute<SVGTextPathSpacingType> m_spacing { SVGTextPathSpacingExact }; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLength> m_startOffset { SVGAnimatedLength::create(this, LengthModeOther) }; >+ Ref<SVGAnimatedEnumeration> m_method { SVGAnimatedEnumeration::create(this, SVGTextPathMethodAlign) }; >+ Ref<SVGAnimatedEnumeration> m_spacing { SVGAnimatedEnumeration::create(this, SVGTextPathSpacingExact) }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTextPositioningElement.cpp b/Source/WebCore/svg/SVGTextPositioningElement.cpp >index 75c4bfe343c..01936503d52 100644 >--- a/Source/WebCore/svg/SVGTextPositioningElement.cpp >+++ b/Source/WebCore/svg/SVGTextPositioningElement.cpp >@@ -27,9 +27,7 @@ > #include "RenderSVGResource.h" > #include "RenderSVGText.h" > #include "SVGAltGlyphElement.h" >-#include "SVGLengthListValues.h" > #include "SVGNames.h" >-#include "SVGNumberListValues.h" > #include "SVGTRefElement.h" > #include "SVGTSpanElement.h" > #include "SVGTextElement.h" >@@ -42,60 +40,40 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPositioningElement); > SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document& document) > : SVGTextContentElement(tagName, document) > { >- registerAttributes(); >-} >- >-void SVGTextPositioningElement::registerAttributes() >-{ >- auto& registry = attributeRegistry(); >- if (!registry.isEmpty()) >- return; >- registry.registerAttribute<SVGNames::xAttr, &SVGTextPositioningElement::m_x>(); >- registry.registerAttribute<SVGNames::yAttr, &SVGTextPositioningElement::m_y>(); >- registry.registerAttribute<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>(); >- registry.registerAttribute<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>(); >- registry.registerAttribute<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>(); >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGTextPositioningElement::m_x>(); >+ PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGTextPositioningElement::m_y>(); >+ PropertyRegistry::registerProperty<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>(); >+ PropertyRegistry::registerProperty<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>(); >+ PropertyRegistry::registerProperty<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>(); >+ }); > } > > void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::xAttr) { >- SVGLengthListValues newList; >- newList.parse(value, LengthModeWidth); >- m_x.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_x.setValue(WTFMove(newList)); >+ m_x->baseVal()->parse(value); > return; > } > > if (name == SVGNames::yAttr) { >- SVGLengthListValues newList; >- newList.parse(value, LengthModeHeight); >- m_y.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_y.setValue(WTFMove(newList)); >+ m_y->baseVal()->parse(value); > return; > } > > if (name == SVGNames::dxAttr) { >- SVGLengthListValues newList; >- newList.parse(value, LengthModeWidth); >- m_dx.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_dx.setValue(WTFMove(newList)); >+ m_dx->baseVal()->parse(value); > return; > } > > if (name == SVGNames::dyAttr) { >- SVGLengthListValues newList; >- newList.parse(value, LengthModeHeight); >- m_dy.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_dy.setValue(WTFMove(newList)); >+ m_dy->baseVal()->parse(value); > return; > } > > if (name == SVGNames::rotateAttr) { >- SVGNumberListValues newList; >- newList.parse(value); >- m_rotate.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >- m_rotate.setValue(WTFMove(newList)); >+ m_rotate->baseVal()->parse(value); > return; > } > >@@ -118,7 +96,7 @@ bool SVGTextPositioningElement::isPresentationAttribute(const QualifiedName& nam > > void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (isKnownAttribute(attrName)) { >+ if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > > if (attrName != SVGNames::rotateAttr) >diff --git a/Source/WebCore/svg/SVGTextPositioningElement.h b/Source/WebCore/svg/SVGTextPositioningElement.h >index 1b1b81bb289..7616f68457a 100644 >--- a/Source/WebCore/svg/SVGTextPositioningElement.h >+++ b/Source/WebCore/svg/SVGTextPositioningElement.h >@@ -21,8 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedLengthList.h" >-#include "SVGAnimatedNumberList.h" > #include "SVGTextContentElement.h" > > namespace WebCore { >@@ -32,20 +30,19 @@ class SVGTextPositioningElement : public SVGTextContentElement { > public: > static SVGTextPositioningElement* elementFromRenderer(RenderBoxModelObject&); > >- using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPositioningElement, SVGTextContentElement>; >- static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPositioningElement, SVGTextContentElement>; > >- const SVGLengthListValues& x() const { return m_x.currentValue(attributeOwnerProxy()); } >- const SVGLengthListValues& y() const { return m_y.currentValue(attributeOwnerProxy()); } >- const SVGLengthListValues& dx() const { return m_dx.currentValue(attributeOwnerProxy()); } >- const SVGLengthListValues& dy() const { return m_dy.currentValue(attributeOwnerProxy()); } >- const SVGNumberListValues& rotate() const { return m_rotate.currentValue(attributeOwnerProxy()); } >+ const SVGLengthList& x() const { return m_x->currentValue(); } >+ const SVGLengthList& y() const { return m_y->currentValue(); } >+ const SVGLengthList& dx() const { return m_dx->currentValue(); } >+ const SVGLengthList& dy() const { return m_dy->currentValue(); } >+ const SVGNumberList& rotate() const { return m_rotate->currentValue(); } > >- RefPtr<SVGAnimatedLengthList> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLengthList> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLengthList> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedLengthList> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } >- RefPtr<SVGAnimatedNumberList> rotateAnimated() { return m_rotate.animatedProperty(attributeOwnerProxy()); } >+ Ref<SVGAnimatedLengthList>& x() { return m_x; } >+ Ref<SVGAnimatedLengthList>& y() { return m_y; } >+ Ref<SVGAnimatedLengthList>& dx() { return m_dx; } >+ Ref<SVGAnimatedLengthList>& dy() { return m_dy; } >+ Ref<SVGAnimatedNumberList>& rotate() { return m_rotate; } > > protected: > SVGTextPositioningElement(const QualifiedName&, Document&); >@@ -57,17 +54,14 @@ private: > bool isPresentationAttribute(const QualifiedName&) const final; > void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final; > >- 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 }; >- SVGAnimatedLengthListAttribute m_x; >- SVGAnimatedLengthListAttribute m_y; >- SVGAnimatedLengthListAttribute m_dx; >- SVGAnimatedLengthListAttribute m_dy; >- SVGAnimatedNumberListAttribute m_rotate; >+ PropertyRegistry m_propertyRegistry { *this }; >+ Ref<SVGAnimatedLengthList> m_x { SVGAnimatedLengthList::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLengthList> m_y { SVGAnimatedLengthList::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedLengthList> m_dx { SVGAnimatedLengthList::create(this, LengthModeWidth) }; >+ Ref<SVGAnimatedLengthList> m_dy { SVGAnimatedLengthList::create(this, LengthModeHeight) }; >+ Ref<SVGAnimatedNumberList> m_rotate { SVGAnimatedNumberList::create(this) }; > }; > > } // 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