WebKit Bugzilla
Attachment 346522 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 SVGComponentTransferFunctionElement
186751-72.patch (text/plain), 12.71 KB, created by
Said Abou-Hallawa
on 2018-08-03 12:38:52 PDT
(
hide
)
Description:
Remove SVG macros from SVGComponentTransferFunctionElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-03 12:38:52 PDT
Size:
12.71 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7c233a48bca..edffcf24480 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2018-08-02 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [72] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGComponentTransferFunctionElement. >+ >+ * svg/SVGComponentTransferFunctionElement.cpp: >+ (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement): >+ (WebCore::SVGComponentTransferFunctionElement::registerAttributes): >+ (WebCore::SVGComponentTransferFunctionElement::parseAttribute): >+ (WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged): >+ (WebCore::SVGComponentTransferFunctionElement::transferFunction const): >+ (WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Deleted. >+ * svg/SVGComponentTransferFunctionElement.h: >+ (WebCore::SVGComponentTransferFunctionElement::type const): >+ (WebCore::SVGComponentTransferFunctionElement::tableValues const): >+ (WebCore::SVGComponentTransferFunctionElement::slope const): >+ (WebCore::SVGComponentTransferFunctionElement::intercept const): >+ (WebCore::SVGComponentTransferFunctionElement::amplitude const): >+ (WebCore::SVGComponentTransferFunctionElement::exponent const): >+ (WebCore::SVGComponentTransferFunctionElement::offset const): >+ (WebCore::SVGComponentTransferFunctionElement::typeAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::tableValuesAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::slopeAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::interceptAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::amplitudeAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::exponentAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::offsetAnimated): >+ (WebCore::SVGComponentTransferFunctionElement::attributeRegistry): >+ (WebCore::SVGComponentTransferFunctionElement::isKnownAttribute): >+ > 2018-08-02 Said Abou-Hallawa <sabouhallawa@apple.com> > > [71] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >index 198e6352fb7..ccc2f9ed23e 100644 >--- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >+++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 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 >@@ -31,47 +32,24 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGComponentTransferFunctionElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type, ComponentTransferType) >-DEFINE_ANIMATED_NUMBER_LIST(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, TableValues, tableValues) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, Slope, slope) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, Intercept, intercept) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, Amplitude, amplitude) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, Exponent, exponent) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, Offset, offset) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(type) >- REGISTER_LOCAL_ANIMATED_PROPERTY(tableValues) >- REGISTER_LOCAL_ANIMATED_PROPERTY(slope) >- REGISTER_LOCAL_ANIMATED_PROPERTY(intercept) >- REGISTER_LOCAL_ANIMATED_PROPERTY(amplitude) >- REGISTER_LOCAL_ANIMATED_PROPERTY(exponent) >- REGISTER_LOCAL_ANIMATED_PROPERTY(offset) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_type(FECOMPONENTTRANSFER_TYPE_IDENTITY) >- , m_slope(1) >- , m_amplitude(1) >- , m_exponent(1) > { >- registerAnimatedPropertiesForSVGComponentTransferFunctionElement(); >+ registerAttributes(); > } > >-bool SVGComponentTransferFunctionElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGComponentTransferFunctionElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { >- SVGNames::typeAttr, >- SVGNames::tableValuesAttr, >- SVGNames::slopeAttr, >- SVGNames::interceptAttr, >- SVGNames::amplitudeAttr, >- SVGNames::exponentAttr, >- SVGNames::offsetAttr, >- }); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::typeAttr, ComponentTransferType, &SVGComponentTransferFunctionElement::m_type>(); >+ registry.registerAttribute<SVGNames::tableValuesAttr, &SVGComponentTransferFunctionElement::m_tableValues>(); >+ registry.registerAttribute<SVGNames::slopeAttr, &SVGComponentTransferFunctionElement::m_slope>(); >+ registry.registerAttribute<SVGNames::interceptAttr, &SVGComponentTransferFunctionElement::m_intercept>(); >+ registry.registerAttribute<SVGNames::amplitudeAttr, &SVGComponentTransferFunctionElement::m_amplitude>(); >+ registry.registerAttribute<SVGNames::exponentAttr, &SVGComponentTransferFunctionElement::m_exponent>(); >+ registry.registerAttribute<SVGNames::offsetAttr, &SVGComponentTransferFunctionElement::m_offset>(); > } > > void SVGComponentTransferFunctionElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -79,40 +57,40 @@ void SVGComponentTransferFunctionElement::parseAttribute(const QualifiedName& na > if (name == SVGNames::typeAttr) { > ComponentTransferType propertyValue = SVGPropertyTraits<ComponentTransferType>::fromString(value); > if (propertyValue > 0) >- setTypeBaseValue(propertyValue); >+ m_type.setValue(propertyValue); > return; > } > > if (name == SVGNames::tableValuesAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedTableValuesListWrappers(newList.size()); >- setTableValuesBaseValue(newList); >+ m_tableValues.detachAnimatedListWrappers(newList.size()); >+ m_tableValues.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::slopeAttr) { >- setSlopeBaseValue(value.toFloat()); >+ m_slope.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::interceptAttr) { >- setInterceptBaseValue(value.toFloat()); >+ m_intercept.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::amplitudeAttr) { >- setAmplitudeBaseValue(value.toFloat()); >+ m_amplitude.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::exponentAttr) { >- setExponentBaseValue(value.toFloat()); >+ m_exponent.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::offsetAttr) { >- setOffsetBaseValue(value.toFloat()); >+ m_offset.setValue(value.toFloat()); > return; > } > >@@ -121,27 +99,26 @@ void SVGComponentTransferFunctionElement::parseAttribute(const QualifiedName& na > > void SVGComponentTransferFunctionElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidateFilterPrimitiveParent(this); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- invalidateFilterPrimitiveParent(this); >+ SVGElement::svgAttributeChanged(attrName); > } > > ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const > { >- ComponentTransferFunction func; >- func.type = type(); >- func.slope = slope(); >- func.intercept = intercept(); >- func.amplitude = amplitude(); >- func.exponent = exponent(); >- func.offset = offset(); >- func.tableValues = tableValues(); >- return func; >+ return { >+ type(), >+ slope(), >+ intercept(), >+ amplitude(), >+ exponent(), >+ offset(), >+ tableValues() >+ }; > } > > } >diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h >index 701ca05b63a..8a177ddfe7c 100644 >--- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h >+++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 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 >@@ -74,26 +75,45 @@ class SVGComponentTransferFunctionElement : public SVGElement { > public: > ComponentTransferFunction transferFunction() const; > >+ ComponentTransferType type() const { return m_type.currentValue(); } >+ const SVGNumberListValues& tableValues() const { return m_tableValues.currentValue(); } >+ float slope() const { return m_slope.currentValue(); } >+ float auto& intercept() const { return m_intercept.currentValue(); } >+ float auto& amplitude() const { return m_amplitude.currentValue(); } >+ float auto& exponent() const { return m_exponent.currentValue(); } >+ float auto& offset() const { return m_offset.currentValue(); } >+ >+ RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(); } >+ RefPtr<SVGAnimatedNumberList> tableValuesAnimated() { return m_tableValues.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> slopeAnimated() { return m_slope.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> interceptAnimated() { return m_intercept.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> amplitudeAnimated() { return m_amplitude.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> exponentAnimated() { return m_exponent.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(); } >+ > protected: > SVGComponentTransferFunctionElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGComponentTransferFunctionElement, SVGElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > > bool rendererIsNeeded(const RenderStyle&) override { return false; } > > private: >- static bool isSupportedAttribute(const QualifiedName&); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement) >- DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType) >- DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues) >- DECLARE_ANIMATED_NUMBER(Slope, slope) >- DECLARE_ANIMATED_NUMBER(Intercept, intercept) >- DECLARE_ANIMATED_NUMBER(Amplitude, amplitude) >- DECLARE_ANIMATED_NUMBER(Exponent, exponent) >- DECLARE_ANIMATED_NUMBER(Offset, offset) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedEnumerationAttribute<ComponentTransferType> m_type { m_attributeOwnerProxy, FECOMPONENTTRANSFER_TYPE_IDENTITY }; >+ SVGAnimatedNumberListAttribute m_tableValues { m_attributeOwnerProxy }; >+ SVGAnimatedNumberAttribute m_slope { m_attributeOwnerProxy, 1 }; >+ SVGAnimatedNumberAttribute m_intercept { m_attributeOwnerProxy }; >+ SVGAnimatedNumberAttribute m_amplitude { m_attributeOwnerProxy, 1 }; >+ SVGAnimatedNumberAttribute m_exponent { m_attributeOwnerProxy, 1 }; >+ SVGAnimatedNumberAttribute m_offset { 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