WebKit Bugzilla
Attachment 346345 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 SVGGradientElement
186751-61.patch (text/plain), 9.64 KB, created by
Said Abou-Hallawa
on 2018-08-01 17:59:34 PDT
(
hide
)
Description:
Remove SVG macros from SVGGradientElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 17:59:34 PDT
Size:
9.64 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 16d33a4536a..9c602a5d678 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [61] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGGradientElement. >+ >+ * svg/SVGGradientElement.cpp: >+ (WebCore::SVGGradientElement::SVGGradientElement): >+ (WebCore::SVGGradientElement::registerAttributes): >+ (WebCore::SVGGradientElement::parseAttribute): >+ (WebCore::SVGGradientElement::svgAttributeChanged): >+ (WebCore::SVGGradientElement::isSupportedAttribute): Deleted. >+ * svg/SVGGradientElement.h: >+ (WebCore::SVGGradientElement::attributeRegistry): >+ (WebCore::SVGGradientElement::spreadMethod const): >+ (WebCore::SVGGradientElement::gradientUnits const): >+ (WebCore::SVGGradientElement::gradientTransform const): >+ (WebCore::SVGGradientElement::spreadMethodAnimated): >+ (WebCore::SVGGradientElement::gradientUnitsAnimated): >+ (WebCore::SVGGradientElement::gradientTransformAnimated): >+ (WebCore::SVGGradientElement::isKnownAttribute): >+ > 2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> > > [60] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGGradientElement.cpp b/Source/WebCore/svg/SVGGradientElement.cpp >index bb2b0b69309..66acfb42aea 100644 >--- a/Source/WebCore/svg/SVGGradientElement.cpp >+++ b/Source/WebCore/svg/SVGGradientElement.cpp >@@ -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) Research In Motion Limited 2010. 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 >@@ -39,40 +40,22 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGradientElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGSpreadMethodType) >-DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform) >-DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(spreadMethod) >- REGISTER_LOCAL_ANIMATED_PROPERTY(gradientUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_spreadMethod(SVGSpreadMethodPad) >- , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) >+ , SVGURIReference(*this) >+ , SVGExternalResourcesRequired(*this) > { >- registerAnimatedPropertiesForSVGGradientElement(); >+ registerAttributes(); > } > >-bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGGradientElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGURIReference::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::gradientUnitsAttr.get(), SVGNames::gradientTransformAttr.get(), SVGNames::spreadMethodAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::spreadMethodAttr, SVGSpreadMethodType, &SVGGradientElement::m_spreadMethod>(); >+ registry.registerAttribute<SVGNames::gradientUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGGradientElement::m_gradientUnits>(); >+ registry.registerAttribute<SVGNames::gradientTransformAttr, &SVGGradientElement::m_gradientTransform>(); > } > > void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -80,22 +63,22 @@ void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS > if (name == SVGNames::gradientUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setGradientUnitsBaseValue(propertyValue); >+ m_gradientUnits.setValue(propertyValue); > return; > } > > if (name == SVGNames::gradientTransformAttr) { > SVGTransformListValues newList; > newList.parse(value); >- detachAnimatedGradientTransformListWrappers(newList.size()); >- setGradientTransformBaseValue(newList); >+ m_gradientTransform.detachAnimatedListWrappers(newList.size()); >+ m_gradientTransform.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::spreadMethodAttr) { > auto propertyValue = SVGPropertyTraits<SVGSpreadMethodType>::fromString(value); > if (propertyValue > 0) >- setSpreadMethodBaseValue(propertyValue); >+ m_spreadMethod.setValue(propertyValue); > return; > } > >@@ -106,15 +89,14 @@ void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGGradientElement::childrenChanged(const ChildChange& change) >diff --git a/Source/WebCore/svg/SVGGradientElement.h b/Source/WebCore/svg/SVGGradientElement.h >index a5dced65023..46150270c6d 100644 >--- a/Source/WebCore/svg/SVGGradientElement.h >+++ b/Source/WebCore/svg/SVGGradientElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 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 >@@ -83,26 +84,36 @@ public: > }; > > Vector<Gradient::ColorStop> buildStops(); >- >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGradientElement, SVGElement, SVGURIReference, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ SVGSpreadMethodType spreadMethod() const { return m_spreadMethod.currentValue(); } >+ SVGUnitTypes::SVGUnitType gradientUnits() const { return m_gradientUnits.currentValue(); } >+ const SVGTransformListValues& gradientTransform() const { return m_gradientTransform.currentValue(); } >+ >+ RefPtr<SVGAnimatedEnumeration> spreadMethodAnimated() { return m_spreadMethod.animatedProperty(); } >+ RefPtr<SVGAnimatedEnumeration> gradientUnitsAnimated() { return m_gradientUnits.animatedProperty(); } >+ RefPtr<SVGAnimatedTransformList> gradientTransformAnimated() { return m_gradientTransform.animatedProperty(); } >+ > protected: > SVGGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > > private: > bool needsPendingResourceHandling() const override { return false; } >- > void childrenChanged(const ChildChange&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement) >- DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType) >- DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ static void registerAttributes(); >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedEnumerationAttribute<SVGSpreadMethodType> m_spreadMethod { m_attributeOwnerProxy, SVGSpreadMethodPad }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_gradientUnits { m_attributeOwnerProxy, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedTransformListAttribute m_gradientTransform { 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