WebKit Bugzilla
Attachment 346230 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 SVGGraphicsElement
186751-27.patch (text/plain), 8.80 KB, created by
Said Abou-Hallawa
on 2018-07-31 17:06:53 PDT
(
hide
)
Description:
Remove SVG macros from SVGGraphicsElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-31 17:06:53 PDT
Size:
8.80 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 050710796dc..f0e7e23d93d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,35 @@ >+2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [27] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGGraphicsElement. >+ >+ -- Define AttributeOwnerProxy according to the class definition. >+ -- Define m_transform whose type is SVGAnimatedTransformListAttribute. >+ -- Add the method registerAttributes() and call it from the constructor. >+ -- Get rid of the SVGTests methods since they are available form SVGTests. >+ -- Change svgAttributeChanged() such that it handle the changes in its >+ known attribute. Calls the svgAttributeChanged() of the base classes >+ if the changed attribute is not known. >+ >+ * svg/SVGGraphicsElement.cpp: >+ (WebCore::SVGGraphicsElement::SVGGraphicsElement): >+ (WebCore::SVGGraphicsElement::registerAttributes): >+ (WebCore::SVGGraphicsElement::parseAttribute): >+ (WebCore::SVGGraphicsElement::svgAttributeChanged): >+ (WebCore::SVGGraphicsElement::isSupportedAttribute): Deleted. >+ (WebCore::SVGGraphicsElement::requiredFeatures): Deleted. >+ (WebCore::SVGGraphicsElement::requiredExtensions): Deleted. >+ (WebCore::SVGGraphicsElement::systemLanguage): Deleted. >+ * svg/SVGGraphicsElement.h: >+ (WebCore::SVGGraphicsElement::attributeRegistry): >+ (WebCore::SVGGraphicsElement::transform const): >+ (WebCore::SVGGraphicsElement::transformAnimated): >+ (WebCore::SVGGraphicsElement::isKnownAttribute): >+ > 2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> > > [26] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGGraphicsElement.cpp b/Source/WebCore/svg/SVGGraphicsElement.cpp >index 57d5cce184a..b621475a6fa 100644 >--- a/Source/WebCore/svg/SVGGraphicsElement.cpp >+++ b/Source/WebCore/svg/SVGGraphicsElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 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 >@@ -36,20 +37,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGraphicsElement); > >-// Animated property definitions >-DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Transform, transform) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(transform) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >+ , SVGTests(this) > , m_shouldIsolateBlending(false) > { >- registerAnimatedPropertiesForSVGGraphicsElement(); >+ registerAttributes(); > } > > SVGGraphicsElement::~SVGGraphicsElement() = default; >@@ -127,15 +120,12 @@ AffineTransform* SVGGraphicsElement::supplementalTransform() > return m_supplementalTransform.get(); > } > >-bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGGraphicsElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGTests::addSupportedAttributes(set); >- set.add(SVGNames::transformAttr); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::transformAttr, &SVGGraphicsElement::m_transform>(); > } > > void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -143,8 +133,8 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS > if (name == SVGNames::transformAttr) { > SVGTransformListValues newList; > newList.parse(value); >- detachAnimatedTransformListWrappers(newList.size()); >- setTransformBaseValue(newList); >+ m_transform.detachAnimatedListWrappers(newList.size()); >+ m_transform.setValue(newList); > return; > } > >@@ -154,27 +144,22 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >- return; >- } >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- InstanceInvalidationGuard guard(*this); >+ auto renderer = this->renderer(); >+ if (!renderer) >+ return; > >- if (SVGTests::handleAttributeChange(this, attrName)) >- return; >- >- auto renderer = this->renderer(); >- if (!renderer) >- return; >- >- if (attrName == SVGNames::transformAttr) { >- renderer->setNeedsTransformUpdate(); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- return; >+ if (attrName == SVGNames::transformAttr) { >+ renderer->setNeedsTransformUpdate(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ return; >+ } > } > >- ASSERT_NOT_REACHED(); >+ SVGElement::svgAttributeChanged(attrName); >+ SVGTests::handleAttributeChange(attrName); > } > > SVGElement* SVGGraphicsElement::nearestViewportElement() const >@@ -210,19 +195,4 @@ Path SVGGraphicsElement::toClipPath() > return path; > } > >-Ref<SVGStringList> SVGGraphicsElement::requiredFeatures() >-{ >- return SVGTests::requiredFeatures(*this); >-} >- >-Ref<SVGStringList> SVGGraphicsElement::requiredExtensions() >-{ >- return SVGTests::requiredExtensions(*this); >-} >- >-Ref<SVGStringList> SVGGraphicsElement::systemLanguage() >-{ >- return SVGTests::systemLanguage(*this); >-} >- > } >diff --git a/Source/WebCore/svg/SVGGraphicsElement.h b/Source/WebCore/svg/SVGGraphicsElement.h >index 8e0fe0a6779..a6b27744ba5 100644 >--- a/Source/WebCore/svg/SVGGraphicsElement.h >+++ b/Source/WebCore/svg/SVGGraphicsElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 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 >@@ -62,10 +63,11 @@ public: > > size_t approximateMemoryCost() const override { return sizeof(*this); } > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGraphicsElement, SVGElement, SVGTests>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ const auto& transform() const { return m_transform.currentValue(); } >+ auto transformAnimated() { return m_transform.animatedProperty(); } > > protected: > SVGGraphicsElement(const QualifiedName&, Document&); >@@ -75,25 +77,22 @@ protected: > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGraphicsElement) >- DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform) >- END_DECLARE_ANIMATED_PROPERTIES >- > private: > bool isSVGGraphicsElement() const override { return true; } > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } > >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > > // Used by <animateMotion> > std::unique_ptr<AffineTransform> m_supplementalTransform; > > // Used to isolate blend operations caused by masking. > bool m_shouldIsolateBlending; >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedTransformListAttribute m_transform { m_attributeOwnerProxy }; > }; > > } // 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 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