WebKit Bugzilla
Attachment 346325 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 SVGFilterPrimitiveStandardAttributes
186751-41.patch (text/plain), 11.06 KB, created by
Said Abou-Hallawa
on 2018-08-01 17:46:10 PDT
(
hide
)
Description:
Remove SVG macros from SVGFilterPrimitiveStandardAttributes
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 17:46:10 PDT
Size:
11.06 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ef25d488b0f..33c501d7735 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [41] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGFilterPrimitiveStandardAttributes. >+ >+ * svg/SVGFilterPrimitiveStandardAttributes.cpp: >+ (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::registerAttributes): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged): >+ * svg/SVGFilterPrimitiveStandardAttributes.h: >+ (WebCore::SVGFilterPrimitiveStandardAttributes::attributeRegistry): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::x const): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::y const): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::width const): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::height const): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::result const): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::xAnimated): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::yAnimated): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::widthAnimated): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::heightAnimated): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::resultAnimated): >+ (WebCore::SVGFilterPrimitiveStandardAttributes::isKnownAttribute): >+ > 2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> > > [40] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >index 5b20fe074e3..d11343d6197 100644 >--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2009 Dirk Schulze <krit@webkit.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,11 +25,7 @@ > > #include "FilterEffect.h" > #include "RenderSVGResourceFilterPrimitive.h" >-#include "SVGElement.h" > #include "SVGFilterBuilder.h" >-#include "SVGLengthValue.h" >-#include "SVGNames.h" >-#include "SVGUnitTypes.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >@@ -36,32 +33,10 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterPrimitiveStandardAttributes); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_STRING(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, Result, result) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(result) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_x(LengthModeWidth, "0%") >- , m_y(LengthModeHeight, "0%") >- , m_width(LengthModeWidth, "100%") >- , m_height(LengthModeHeight, "100%") > { >- // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified. >- // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified. >- registerAnimatedPropertiesForSVGFilterPrimitiveStandardAttributes(); >+ registerAttributes(); > } > > bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedName& attrName) >@@ -76,20 +51,32 @@ bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedN > return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); > } > >+void SVGFilterPrimitiveStandardAttributes::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGFilterPrimitiveStandardAttributes::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGFilterPrimitiveStandardAttributes::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGFilterPrimitiveStandardAttributes::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGFilterPrimitiveStandardAttributes::m_height>(); >+ registry.registerAttribute<SVGNames::resultAttr, &SVGFilterPrimitiveStandardAttributes::m_result>(); >+} >+ > void SVGFilterPrimitiveStandardAttributes::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::resultAttr) >- setResultBaseValue(value); >+ m_result.setValue(value); > > reportAttributeParsingError(parseError, name, value); > >@@ -105,13 +92,13 @@ bool SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect > > void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidate(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- invalidate(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGFilterPrimitiveStandardAttributes::childrenChanged(const ChildChange& change) >diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >index 2e1590c1a0b..208dcd665eb 100644 >--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2007 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 >@@ -25,6 +26,7 @@ > #include "SVGAnimatedLength.h" > #include "SVGAnimatedString.h" > #include "SVGElement.h" >+#include "SVGNames.h" > #include <wtf/RefPtr.h> > > namespace WebCore { >@@ -42,6 +44,21 @@ public: > // Returns true, if the new value is different from the old one. > virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterPrimitiveStandardAttributes, SVGElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ const SVGLengthValue& x() const { return m_x.currentValue(); } >+ const SVGLengthValue& y() const { return m_y.currentValue(); } >+ const SVGLengthValue& width() const { return m_width.currentValue(); } >+ const SVGLengthValue& height() const { return m_height.currentValue(); } >+ const String& result() const { return m_result.currentValue(); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(); } >+ RefPtr<SVGAnimatedString> resultAnimated() { return m_result.animatedProperty(); } >+ > protected: > SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&); > >@@ -53,21 +70,26 @@ protected: > void primitiveAttributeChanged(const QualifiedName& attributeName); > > private: >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ > bool isFilterEffect() const override { return true; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > bool rendererIsNeeded(const RenderStyle&) override; > bool childShouldCreateRenderer(const Node&) const override { return false; } > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_STRING(Result, result) >- END_DECLARE_ANIMATED_PROPERTIES >+ // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified. >+ // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified. >+ SVGAnimatedLengthAttribute m_x { m_attributeOwnerProxy, LengthModeWidth, "0%" }; >+ SVGAnimatedLengthAttribute m_y { m_attributeOwnerProxy, LengthModeHeight, "0%" }; >+ SVGAnimatedLengthAttribute m_width { m_attributeOwnerProxy, LengthModeWidth, "100%" }; >+ SVGAnimatedLengthAttribute m_height { m_attributeOwnerProxy, LengthModeHeight, "100%" }; >+ SVGAnimatedStringAttribute m_result { m_attributeOwnerProxy }; > }; > > void invalidateFilterPrimitiveParent(SVGElement*);
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