WebKit Bugzilla
Attachment 346346 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 SVGLinearGradientElement
186751-62.patch (text/plain), 8.80 KB, created by
Said Abou-Hallawa
on 2018-08-01 18:00:06 PDT
(
hide
)
Description:
Remove SVG macros from SVGLinearGradientElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 18:00:06 PDT
Size:
8.80 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9c602a5d678..4ce3f50cc9d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [62] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGLinearGradientElement. >+ >+ * svg/SVGLinearGradientElement.cpp: >+ (WebCore::SVGLinearGradientElement::SVGLinearGradientElement): >+ (WebCore::SVGLinearGradientElement::registerAttributes): >+ (WebCore::SVGLinearGradientElement::parseAttribute): >+ (WebCore::SVGLinearGradientElement::svgAttributeChanged): >+ (WebCore::SVGLinearGradientElement::isSupportedAttribute): Deleted. >+ * svg/SVGLinearGradientElement.h: >+ > 2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> > > [61] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGLinearGradientElement.cpp b/Source/WebCore/svg/SVGLinearGradientElement.cpp >index 58dfe639ed7..951012c2b8c 100644 >--- a/Source/WebCore/svg/SVGLinearGradientElement.cpp >+++ b/Source/WebCore/svg/SVGLinearGradientElement.cpp >@@ -4,6 +4,7 @@ > * Copyright (C) 2008 Eric Seidel <eric@webkit.org> > * Copyright (C) 2008 Dirk Schulze <krit@webkit.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 >@@ -38,30 +39,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLinearGradientElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x1Attr, X1, x1) >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y1Attr, Y1, y1) >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x2Attr, X2, x2) >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y2Attr, Y2, y2) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLinearGradientElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y2) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document) > : SVGGradientElement(tagName, document) >- , m_x1(LengthModeWidth) >- , m_y1(LengthModeHeight) >- , m_x2(LengthModeWidth, "100%") >- , m_y2(LengthModeHeight) > { > // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified. > ASSERT(hasTagName(SVGNames::linearGradientTag)); >- registerAnimatedPropertiesForSVGLinearGradientElement(); >+ registerAttributes(); > } > > Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedName& tagName, Document& document) >@@ -69,12 +52,15 @@ Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedNa > return adoptRef(*new SVGLinearGradientElement(tagName, document)); > } > >-bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGLinearGradientElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { >- SVGNames::x1Attr, SVGNames::x2Attr, SVGNames::y1Attr, SVGNames::y2Attr >- }); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>(); >+ registry.registerAttribute<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>(); >+ registry.registerAttribute<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>(); >+ registry.registerAttribute<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>(); > } > > void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -82,13 +68,13 @@ void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A > SVGParsingError parseError = NoError; > > if (name == SVGNames::x1Attr) >- setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y1Attr) >- setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::x2Attr) >- setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y2Attr) >- setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -97,17 +83,15 @@ void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A > > void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGradientElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ updateRelativeLengthsInformation(); >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- updateRelativeLengthsInformation(); >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGGradientElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGLinearGradientElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGLinearGradientElement.h b/Source/WebCore/svg/SVGLinearGradientElement.h >index cb1bb8c0137..a134c138bda 100644 >--- a/Source/WebCore/svg/SVGLinearGradientElement.h >+++ b/Source/WebCore/svg/SVGLinearGradientElement.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 >@@ -35,10 +36,25 @@ public: > > bool collectGradientAttributes(LinearGradientAttributes&); > >+ const SVGLengthValue& x1() const { return m_x1.currentValue(); } >+ const SVGLengthValue& y1() const { return m_y1.currentValue(); } >+ const SVGLengthValue& x2() const { return m_x2.currentValue(); } >+ const SVGLengthValue& y2() const { return m_y2.currentValue(); } >+ >+ RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(); } >+ > private: > SVGLinearGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>; >+ 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; > >@@ -46,12 +62,11 @@ private: > > bool selfHasRelativeLengths() const override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLinearGradientElement) >- DECLARE_ANIMATED_LENGTH(X1, x1) >- DECLARE_ANIMATED_LENGTH(Y1, y1) >- DECLARE_ANIMATED_LENGTH(X2, x2) >- DECLARE_ANIMATED_LENGTH(Y2, y2) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x1 { m_attributeOwnerProxy, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y1 { m_attributeOwnerProxy, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_x2 { m_attributeOwnerProxy, LengthModeWidth, "100%" }; >+ SVGAnimatedLengthAttribute m_y2 { m_attributeOwnerProxy, LengthModeHeight }; > }; > > } // 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