WebKit Bugzilla
Attachment 346317 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 SVGPolyElement
186751-34.patch (text/plain), 9.87 KB, created by
Said Abou-Hallawa
on 2018-08-01 17:41:29 PDT
(
hide
)
Description:
Remove SVG macros from SVGPolyElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 17:41:29 PDT
Size:
9.87 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a077524c064..505c7bd39f9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [34] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGPolyElement. >+ >+ -- Remove custom handling for the SVGPointListValues type since there is >+ a registered attribute accessor for this type now. >+ -- Use SVGElement::lookupAnimatedProperty() to create the TearOff object. >+ -- Clean up svgAttributeChanged() by calling svgAttributeChanged() of the >+ base classes. >+ >+ * svg/SVGPolyElement.cpp: >+ (WebCore::SVGPolyElement::SVGPolyElement): >+ (WebCore::SVGPolyElement::registerAttributes): >+ (WebCore::SVGPolyElement::parseAttribute): >+ (WebCore::SVGPolyElement::svgAttributeChanged): >+ (WebCore::SVGPolyElement::points): >+ (WebCore::SVGPolyElement::animatedPoints): >+ (WebCore::SVGPolyElement::pointsPropertyInfo): Deleted. >+ (WebCore::SVGPolyElement::synchronizePoints): Deleted. >+ (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper): Deleted. >+ * svg/SVGPolyElement.h: >+ (WebCore::SVGPolyElement::pointList const): >+ (WebCore::SVGPolyElement::attributeRegistry): >+ (WebCore::SVGPolyElement::isKnownAttribute): >+ > 2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> > > [33] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGPolyElement.cpp b/Source/WebCore/svg/SVGPolyElement.cpp >index 628d3cd2160..b1ef42f7beb 100644 >--- a/Source/WebCore/svg/SVGPolyElement.cpp >+++ b/Source/WebCore/svg/SVGPolyElement.cpp >@@ -1,6 +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) 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 >@@ -24,46 +25,27 @@ > #include "Document.h" > #include "RenderSVGPath.h" > #include "RenderSVGResource.h" >-#include "SVGAnimatedPointList.h" > #include "SVGDocumentExtensions.h" >-#include "SVGNames.h" > #include "SVGParserUtilities.h" >-#include "SVGPoint.h" >-#include "SVGPointList.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPolyElement); > >-// Define custom animated property 'points'. >-const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo() >+SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) >+ : SVGGeometryElement(tagName, document) >+ , SVGExternalResourcesRequired(*this) > { >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedPoints, >- PropertyIsReadWrite, >- SVGNames::pointsAttr, >- SVGNames::pointsAttr->localName(), >- &SVGPolyElement::synchronizePoints, >- &SVGPolyElement::lookupOrCreatePointsWrapper); >- } >- return s_propertyInfo; >+ registerAttributes(); > } > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(points) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- >-SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) >- : SVGGeometryElement(tagName, document) >+void SVGPolyElement::registerAttributes() > { >- registerAnimatedPropertiesForSVGPolyElement(); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::pointsAttr, &SVGPolyElement::m_points>(); > } > > void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -73,14 +55,14 @@ void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin > if (!pointsListFromSVGData(newList, value)) > document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\""); > >- if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) >- static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size()); >+ if (auto wrapper = static_pointer_cast<SVGAnimatedPointList>(lookupAnimatedProperty(m_points))) >+ wrapper->detachListWrappers(newList.size()); > >- m_points.value = WTFMove(newList); >+ m_points.setValue(WTFMove(newList)); > return; > } > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > >@@ -95,43 +77,20 @@ void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) > return; > } > >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >- return; >- } >- >- SVGGraphicsElement::svgAttributeChanged(attrName); >-} >- >-void SVGPolyElement::synchronizePoints(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement); >- if (!ownerType.m_points.shouldSynchronize) >- return; >- ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, ownerType.m_points.value.valueAsString()); >-} >- >-Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointListValues>(&ownerType, pointsPropertyInfo(), ownerType.m_points.value); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > Ref<SVGPointList> SVGPolyElement::points() > { >- m_points.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal(); >+ m_points.setShouldSynchronize(true); >+ return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->baseVal(); > } > > Ref<SVGPointList> SVGPolyElement::animatedPoints() > { >- m_points.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal(); >+ m_points.setShouldSynchronize(true); >+ return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->animVal(); > } > > size_t SVGPolyElement::approximateMemoryCost() const >diff --git a/Source/WebCore/svg/SVGPolyElement.h b/Source/WebCore/svg/SVGPolyElement.h >index df760e0b080..d1b9170f562 100644 >--- a/Source/WebCore/svg/SVGPolyElement.h >+++ b/Source/WebCore/svg/SVGPolyElement.h >@@ -1,6 +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) 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 >@@ -20,11 +21,10 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >+#include "SVGAnimatedPointList.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" > #include "SVGNames.h" >-#include "SVGPointListValues.h" > > namespace WebCore { > >@@ -36,7 +36,7 @@ public: > > SVGPointListValues& pointList() const { return m_points.value; } > >- static const SVGPropertyInfo* pointsPropertyInfo(); >+ const SVGPointListValues& pointList() const { return m_points.value(); } > > size_t approximateMemoryCost() const override; > >@@ -44,23 +44,20 @@ protected: > SVGPolyElement(const QualifiedName&, Document&); > > private: >- bool isValid() const override { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >+ bool isValid() const override { return SVGTests::isValid(); } > bool supportsMarkers() const override { return true; } > >- // Custom 'points' property >- static void synchronizePoints(SVGElement* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >-protected: >- mutable SVGSynchronizableAnimatedProperty<SVGPointListValues> m_points; >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedPointListAttribute m_points { 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