WebKit Bugzilla
Attachment 346233 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 SVGGeometryElement
186751-28.patch (text/plain), 6.85 KB, created by
Said Abou-Hallawa
on 2018-07-31 17:18:31 PDT
(
hide
)
Description:
Remove SVG macros from SVGGeometryElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-31 17:18:31 PDT
Size:
6.85 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f0e7e23d93d..b6d17a0652e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [28] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGGeometryElement. >+ >+ -- Define AttributeOwnerProxy according to the class definition. >+ -- Define the class attributes. >+ -- Add the method registerAttributes() and call it from the constructor. >+ -- 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. >+ -- Git rid of unnecessary header files. >+ >+ * svg/SVGGeometryElement.cpp: >+ (WebCore::SVGGeometryElement::SVGGeometryElement): >+ (WebCore::SVGGeometryElement::registerAttributes): >+ (WebCore::SVGGeometryElement::parseAttribute): >+ (WebCore::SVGGeometryElement::isSupportedAttribute): Deleted. >+ (WebCore::SVGGeometryElement::svgAttributeChanged): Deleted. >+ * svg/SVGGeometryElement.h: >+ (WebCore::SVGGeometryElement::attributeRegistry): >+ (WebCore::SVGGeometryElement::pathLengthAnimated): >+ (WebCore::SVGGeometryElement::isKnownAttribute): >+ > 2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> > > [27] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGGeometryElement.cpp b/Source/WebCore/svg/SVGGeometryElement.cpp >index 86a4544cd19..5127700d55c 100644 >--- a/Source/WebCore/svg/SVGGeometryElement.cpp >+++ b/Source/WebCore/svg/SVGGeometryElement.cpp >@@ -24,32 +24,19 @@ > #include "SVGGeometryElement.h" > > #include "DOMPoint.h" >-#include "RenderSVGPath.h" >-#include "RenderSVGResource.h" > #include "SVGDocumentExtensions.h" >-#include "SVGMPathElement.h" >-#include "SVGNames.h" > #include "SVGPathUtilities.h" > #include "SVGPoint.h" > #include <wtf/IsoMallocInlines.h> >-#include <wtf/NeverDestroyed.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGeometryElement); > >-// Animated property definitions >-DEFINE_ANIMATED_NUMBER(SVGGeometryElement, SVGNames::pathLengthAttr, PathLength, pathLength) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGeometryElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) > { >- registerAnimatedPropertiesForSVGGeometryElement(); >+ registerAttributes(); > } > > float SVGGeometryElement::getTotalLength() const >@@ -100,23 +87,19 @@ bool SVGGeometryElement::isPointInStroke(DOMPointInit&& pointInit) > return renderer->isPointInStroke(point); > } > >-bool SVGGeometryElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGGeometryElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::pathLengthAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ 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) { >- setPathLengthBaseValue(value.toFloat()); >- if (pathLengthBaseValue() < 0) >+ m_pathLength.setValue(value.toFloat()); >+ if ((m_pathLength.value() < 0) > document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed"); > return; > } >@@ -126,14 +109,14 @@ void SVGGeometryElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGeometryElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ if (attrName == SVGNames::pathLengthAttr) { >+ InstanceInvalidationGuard guard(*this); >+ if (auto* renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- ASSERT_NOT_REACHED(); >+ SVGGraphicsElement::svgAttributeChanged(attrName); > } > > } >diff --git a/Source/WebCore/svg/SVGGeometryElement.h b/Source/WebCore/svg/SVGGeometryElement.h >index 92d86458c54..50af24e20d2 100644 >--- a/Source/WebCore/svg/SVGGeometryElement.h >+++ b/Source/WebCore/svg/SVGGeometryElement.h >@@ -2,6 +2,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) 2018 Adobe Systems Incorporated. All rights reserved. >+ * 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 >@@ -22,9 +23,7 @@ > #pragma once > > #include "Path.h" >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedNumber.h" >-#include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > #include "SVGNames.h" > >@@ -43,16 +42,25 @@ public: > bool isPointInFill(DOMPointInit&&); > bool isPointInStroke(DOMPointInit&&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGeometryElement, SVGGraphicsElement>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ auto pathLengthAnimated() { return m_pathLength.animatedProperty(); } >+ > protected: > SVGGeometryElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGeometryElement) >- DECLARE_ANIMATED_NUMBER(PathLength, pathLength) >- END_DECLARE_ANIMATED_PROPERTIES >+private: >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedNumberAttribute m_pathLength { 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