WebKit Bugzilla
Attachment 346217 Details for
Bug 186751
: Remove the SVG elements' attributes macros
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Remove SVG macros from SVGElement
186751-25.patch (text/plain), 12.40 KB, created by
Said Abou-Hallawa
on 2018-07-31 16:24:29 PDT
(
hide
)
Description:
Remove SVG macros from SVGElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-31 16:24:29 PDT
Size:
12.40 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fdda4738ab2..da54c907386 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [25] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGElement. >+ >+ -- Remove the SVG macros and add the attribute m_className whose type is >+ SVGAnimatedStringAttribute. >+ -- Replace all references to SVGAttributeToPropertyMap by SVGAttributeRegistry. >+ -- Add the virtual function attributeOwnerProxy(). The SVGElement super >+ class will override this function to return its owner proxy. >+ -- Add helper functions which calls the methods in SVGAttributeOwnerProxy >+ given attributeOwnerProxy(). This means these helper functions can be >+ used for a super class to have access to its attributes. >+ >+ * svg/SVGElement.cpp: >+ (WebCore::SVGElement::SVGElement): >+ (WebCore::SVGElement::registerAttributes): >+ (WebCore::SVGElement::parseAttribute): >+ (WebCore::SVGElement::animatedPropertyTypesForAttribute): >+ (WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute): >+ (WebCore::SVGElement::synchronizeAnimatedSVGAttribute const): >+ (WebCore::SVGElement::isPresentationAttributeWithSVGDOM): >+ (WebCore::SVGElement::svgAttributeChanged): >+ (WebCore::SVGElement::synchronizeRequiredFeatures): Deleted. >+ (WebCore::SVGElement::synchronizeRequiredExtensions): Deleted. >+ (WebCore::SVGElement::synchronizeSystemLanguage): Deleted. >+ (WebCore::SVGElement::isKnownAttribute): Deleted. >+ * svg/SVGElement.h: >+ (WebCore::SVGElement::attributeRegistry): >+ (WebCore::SVGElement::isKnownAttribute): >+ (WebCore::SVGElement::attributeOwnerProxy const): >+ (WebCore::SVGElement::synchronizeAttribute): >+ (WebCore::SVGElement::synchronizeAttributes): >+ (WebCore::SVGElement::animatedTypes const): >+ (WebCore::SVGElement::lookupAnimatedProperty const): >+ (WebCore::SVGElement::lookupOrCreateAnimatedProperty): >+ (WebCore::SVGElement::lookupOrCreateAnimatedProperties): >+ (WebCore::SVGElement::className const): >+ (WebCore::SVGElement::classNameAnimated): >+ (WebCore::SVGElement::synchronizeRequiredFeatures): Deleted. >+ (WebCore::SVGElement::synchronizeRequiredExtensions): Deleted. >+ (WebCore::SVGElement::synchronizeSystemLanguage): Deleted. >+ > 2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> > > [24] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp >index 4b59b1f1b77..b474f5d99f1 100644 >--- a/Source/WebCore/svg/SVGElement.cpp >+++ b/Source/WebCore/svg/SVGElement.cpp >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> >- * Copyright (C) 2008-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2008-2018 Apple Inc. All rights reserved. > * Copyright (C) 2008 Alp Toker <alp@atoker.com> > * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> > * Copyright (C) 2013 Samsung Electronics. All rights reserved. >@@ -64,13 +64,6 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGElement, HTMLNames::classAttr, ClassName, className) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(className) >-END_REGISTER_ANIMATED_PROPERTIES >- > static NEVER_INLINE HashMap<AtomicStringImpl*, CSSPropertyID> createAttributeNameToCSSPropertyIDMap() > { > using namespace HTMLNames; >@@ -282,8 +275,9 @@ static inline const HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyT > > SVGElement::SVGElement(const QualifiedName& tagName, Document& document) > : StyledElement(tagName, document, CreateSVGElement) >+ , SVGLangSpace(this) > { >- registerAnimatedPropertiesForSVGElement(); >+ registerAttributes(); > } > > SVGElement::~SVGElement() >@@ -458,10 +452,18 @@ 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) { >- setClassNameBaseValue(value); >+ m_className.setValue(value); > return; > } > >@@ -484,7 +486,7 @@ void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& v > > Vector<AnimatedPropertyType> SVGElement::animatedPropertyTypesForAttribute(const QualifiedName& attributeName) > { >- auto types = localAttributeToPropertyMap().types(attributeName); >+ auto types = animatedTypes(attributeName); > if (!types.isEmpty()) > return types; > >@@ -695,7 +697,7 @@ void SVGElement::synchronizeAllAnimatedSVGAttribute(SVGElement* svgElement) > ASSERT(svgElement->elementData()); > ASSERT(svgElement->elementData()->animatedSVGAttributesAreDirty()); > >- svgElement->localAttributeToPropertyMap().synchronizeProperties(*svgElement); >+ svgElement->synchronizeAttributes(); > svgElement->elementData()->setAnimatedSVGAttributesAreDirty(false); > } > >@@ -708,25 +710,7 @@ void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) cons > if (name == anyQName()) > synchronizeAllAnimatedSVGAttribute(nonConstThis); > else >- nonConstThis->localAttributeToPropertyMap().synchronizeProperty(*nonConstThis, name); >-} >- >-void SVGElement::synchronizeRequiredFeatures(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- contextElement->synchronizeRequiredFeatures(); >-} >- >-void SVGElement::synchronizeRequiredExtensions(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- contextElement->synchronizeRequiredExtensions(); >-} >- >-void SVGElement::synchronizeSystemLanguage(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- contextElement->synchronizeSystemLanguage(); >+ nonConstThis->synchronizeAttribute(*nonConstThis, name); > } > > std::optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) >@@ -939,7 +923,7 @@ bool SVGElement::isAnimatableCSSProperty(const QualifiedName& attributeName) > > bool SVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attributeName) > { >- return !localAttributeToPropertyMap().types(attributeName).isEmpty(); >+ return !animatedTypes(attributeName).isEmpty(); > } > > bool SVGElement::isPresentationAttribute(const QualifiedName& name) const >@@ -956,11 +940,6 @@ void SVGElement::collectStyleForPresentationAttribute(const QualifiedName& name, > addPropertyToPresentationAttributeStyle(style, propertyID, value); > } > >-bool SVGElement::isKnownAttribute(const QualifiedName& attrName) >-{ >- return attrName == HTMLNames::idAttr; >-} >- > void SVGElement::svgAttributeChanged(const QualifiedName& attrName) > { > CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attrName); >@@ -985,6 +964,8 @@ void SVGElement::svgAttributeChanged(const QualifiedName& attrName) > invalidateInstances(); > return; > } >+ >+ SVGLangSpace::svgAttributeChanged(attrName); > } > > Node::InsertedIntoAncestorResult SVGElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree) >diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h >index e3d13587431..58b01f2c0ff 100644 >--- a/Source/WebCore/svg/SVGElement.h >+++ b/Source/WebCore/svg/SVGElement.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >- * Copyright (C) 2009-2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2009-2018 Apple Inc. All rights reserved. > * Copyright (C) 2013 Samsung Electronics. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -23,11 +23,11 @@ > #pragma once > > #include "SVGAnimatedString.h" >+#include "SVGAttributeOwnerProxy.h" > #include "SVGLangSpace.h" > #include "SVGLocatable.h" > #include "SVGNames.h" > #include "SVGParsingError.h" >-#include "SVGPropertyInfo.h" > #include "StyledElement.h" > #include <wtf/HashMap.h> > #include <wtf/HashSet.h> >@@ -38,7 +38,6 @@ class AffineTransform; > class CSSStyleDeclaration; > class DeprecatedCSSOMValue; > class Document; >-class SVGAttributeToPropertyMap; > class SVGDocumentExtensions; > class SVGElementRareData; > class SVGSVGElement; >@@ -57,7 +56,6 @@ public: > String title() const override; > static bool isAnimatableCSSProperty(const QualifiedName&); > bool isPresentationAttributeWithSVGDOM(const QualifiedName&); >- bool isKnownAttribute(const QualifiedName&); > RefPtr<DeprecatedCSSOMValue> getPresentationAttribute(const String& name); > virtual bool supportsMarkers() const { return false; } > bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } >@@ -109,14 +107,6 @@ public: > > std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > >- static void synchronizeRequiredFeatures(SVGElement* contextElement); >- static void synchronizeRequiredExtensions(SVGElement* contextElement); >- static void synchronizeSystemLanguage(SVGElement* contextElement); >- >- virtual void synchronizeRequiredFeatures() { } >- virtual void synchronizeRequiredExtensions() { } >- virtual void synchronizeSystemLanguage() { } >- > static QualifiedName animatableAttributeForName(const AtomicString&); > #ifndef NDEBUG > bool isAnimatableAttribute(const QualifiedName&) const; >@@ -139,6 +129,28 @@ public: > > class InstanceUpdateBlocker; > >+ // 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); } >+ >+ // These are needed for the RenderTree, animation and DOM. >+ const auto& className() const { return m_className.currentValue(); } >+ auto classNameAnimated() { return m_className.animatedProperty(); } >+ > protected: > SVGElement(const QualifiedName&, Document&); > virtual ~SVGElement(); >@@ -189,10 +201,8 @@ private: > > HashSet<SVGElement*> m_elementsWithRelativeLengths; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES_BASE(SVGElement) >- DECLARE_ANIMATED_STRING(ClassName, className) >- END_DECLARE_ANIMATED_PROPERTIES >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_className { m_attributeOwnerProxy }; > }; > > class SVGElement::InstanceInvalidationGuard {
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 186751
:
342916
|
342917
|
342985
|
343001
|
343114
|
343123
|
343124
|
343127
|
343129
|
343162
|
343167
|
343169
|
343171
|
343174
|
343213
|
343217
|
343327
|
343335
|
343338
|
343339
|
343343
|
343415
|
343979
|
343989
|
344002
|
344513
|
344516
|
344523
|
344534
|
344536
|
344988
|
344990
|
346097
|
346103
|
346124
|
346129
|
346177
|
346179
|
346180
|
346182
|
346185
|
346188
|
346190
|
346192
|
346193
|
346197
|
346199
|
346201
|
346202
|
346203
|
346204
|
346205
|
346206
|
346207
|
346211
|
346212
|
346217
|
346224
|
346230
|
346233
|
346241
|
346244
|
346245
|
346315
|
346316
|
346317
|
346318
|
346319
|
346320
|
346322
|
346323
|
346324
|
346325
|
346326
|
346327
|
346328
|
346329
|
346330
|
346331
|
346332
|
346333
|
346334
|
346335
|
346336
|
346337
|
346338
|
346339
|
346340
|
346341
|
346342
|
346343
|
346344
|
346345
|
346346
|
346347
|
346348
|
346349
|
346350
|
346518
|
346519
|
346520
|
346521
|
346522
|
346524
|
346525
|
346526
|
346527
|
346528
|
346529
|
346530
|
346531
|
346532
|
346533
|
346534
|
346535
|
346536
|
346537
|
346538
|
346539
|
346540
|
346541
|
346545
|
346546
|
346549
|
346551
|
346552
|
346601
|
346602
|
346611
|
346636
|
346642