WebKit Bugzilla
Attachment 346330 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 SVGFEConvolveMatrixElement
186751-46.patch (text/plain), 16.93 KB, created by
Said Abou-Hallawa
on 2018-08-01 17:48:55 PDT
(
hide
)
Description:
Remove SVG macros from SVGFEConvolveMatrixElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 17:48:55 PDT
Size:
16.93 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 96aae329aa3..b184810e342 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [46] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGFECompositeElement. >+ >+ * svg/SVGFEConvolveMatrixElement.cpp: >+ (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement): >+ (WebCore::SVGFEConvolveMatrixElement::registerAttributes): >+ (WebCore::SVGFEConvolveMatrixElement::parseAttribute): >+ (WebCore::SVGFEConvolveMatrixElement::setFilterEffectAttribute): >+ (WebCore::SVGFEConvolveMatrixElement::setOrder): >+ (WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength): >+ * svg/SVGFEConvolveMatrixElement.h: >+ (WebCore::SVGPropertyTraits<EdgeModeType>::initialValue): >+ > 2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> > > [45] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >index d0fb611057f..d0b3b6ed8dc 100644 >--- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >+++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >@@ -1,5 +1,6 @@ > /* > * 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 >@@ -34,42 +35,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEConvolveMatrixElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEConvolveMatrixElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), OrderX, orderX) >-DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), OrderY, orderY) >-DEFINE_ANIMATED_NUMBER_LIST(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, KernelMatrix, kernelMatrix) >-DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, Divisor, divisor) >-DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::biasAttr, Bias, bias) >-DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, TargetX, targetX) >-DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, TargetY, targetY) >-DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) >-DEFINE_ANIMATED_BOOLEAN(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, PreserveAlpha, preserveAlpha) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(orderX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(orderY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelMatrix) >- REGISTER_LOCAL_ANIMATED_PROPERTY(divisor) >- REGISTER_LOCAL_ANIMATED_PROPERTY(bias) >- REGISTER_LOCAL_ANIMATED_PROPERTY(targetX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(targetY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAlpha) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_edgeMode(EDGEMODE_DUPLICATE) > { > ASSERT(hasTagName(SVGNames::feConvolveMatrixTag)); >- registerAnimatedPropertiesForSVGFEConvolveMatrixElement(); >+ registerAttributes(); > } > > Ref<SVGFEConvolveMatrixElement> SVGFEConvolveMatrixElement::create(const QualifiedName& tagName, Document& document) >@@ -101,18 +71,39 @@ const AtomicString& SVGFEConvolveMatrixElement::orderYIdentifier() > return s_identifier; > } > >+void SVGFEConvolveMatrixElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEConvolveMatrixElement::m_in1>(); >+ registry.registerAttribute<SVGNames::orderAttr, >+ &SVGFEConvolveMatrixElement::orderXIdentifier, &SVGFEConvolveMatrixElement::m_orderX, >+ &SVGFEConvolveMatrixElement::orderYIdentifier, &SVGFEConvolveMatrixElement::m_orderY>(); >+ registry.registerAttribute<SVGNames::kernelMatrixAttr, &SVGFEConvolveMatrixElement::m_kernelMatrix>(); >+ registry.registerAttribute<SVGNames::divisorAttr, &SVGFEConvolveMatrixElement::m_divisor>(); >+ registry.registerAttribute<SVGNames::biasAttr, &SVGFEConvolveMatrixElement::m_bias>(); >+ registry.registerAttribute<SVGNames::targetXAttr, &SVGFEConvolveMatrixElement::m_targetX>(); >+ registry.registerAttribute<SVGNames::targetYAttr, &SVGFEConvolveMatrixElement::m_targetY>(); >+ registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEConvolveMatrixElement::m_edgeMode>(); >+ registry.registerAttribute<SVGNames::kernelUnitLengthAttr, >+ &SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthX, >+ &SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthY>(); >+ registry.registerAttribute<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>(); >+} >+ > void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::orderAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) { >- setOrderXBaseValue(x); >- setOrderYBaseValue(y); >+ m_orderX.setValue(x); >+ m_orderY.setValue(y); > } else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing order=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -121,7 +112,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const > if (name == SVGNames::edgeModeAttr) { > EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value); > if (propertyValue > 0) >- setEdgeModeBaseValue(propertyValue); >+ m_edgeMode.setValue(propertyValue); > else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -130,40 +121,40 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const > if (name == SVGNames::kernelMatrixAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedKernelMatrixListWrappers(newList.size()); >- setKernelMatrixBaseValue(newList); >+ m_kernelMatrix.detachAnimatedListWrappers(newList.size()); >+ m_kernelMatrix.setValue(WYFMove(newList)); > return; > } > > if (name == SVGNames::divisorAttr) { > float divisor = value.toFloat(); > if (divisor) >- setDivisorBaseValue(divisor); >+ m_divisor.setValue(divisor); > else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing divisor=\"" + value + "\". Filtered element will not be displayed."); > return; > } > > if (name == SVGNames::biasAttr) { >- setBiasBaseValue(value.toFloat()); >+ m_bias.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::targetXAttr) { >- setTargetXBaseValue(value.string().toUIntStrict()); >+ m_targetX.setValue(value.string().toUIntStrict()); > return; > } > > if (name == SVGNames::targetYAttr) { >- setTargetYBaseValue(value.string().toUIntStrict()); >+ m_targetY.setValue(value.string().toUIntStrict()); > return; > } > > if (name == SVGNames::kernelUnitLengthAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) { >- setKernelUnitLengthXBaseValue(x); >- setKernelUnitLengthYBaseValue(y); >+ m_kernelUnitLengthX.setValue(x); >+ m_kernelUnitLengthY.setValue(y); > } else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing kernelUnitLength=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -171,9 +162,9 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const > > if (name == SVGNames::preserveAlphaAttr) { > if (value == "true") >- setPreserveAlphaBaseValue(true); >+ m_preserveAlpha.setValue(true); > else if (value == "false") >- setPreserveAlphaBaseValue(false); >+ m_preserveAlpha.setValue(false); > else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -192,11 +183,11 @@ bool SVGFEConvolveMatrixElement::setFilterEffectAttribute(FilterEffect* effect, > if (attrName == SVGNames::biasAttr) > return convolveMatrix->setBias(bias()); > if (attrName == SVGNames::targetXAttr) >- return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); >+ return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); > if (attrName == SVGNames::targetYAttr) >- return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); >+ return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); > if (attrName == SVGNames::kernelUnitLengthAttr) >- return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY())); >+ return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY())); > if (attrName == SVGNames::preserveAlphaAttr) > return convolveMatrix->setPreserveAlpha(preserveAlpha()); > >@@ -206,15 +197,15 @@ bool SVGFEConvolveMatrixElement::setFilterEffectAttribute(FilterEffect* effect, > > void SVGFEConvolveMatrixElement::setOrder(float x, float y) > { >- setOrderXBaseValue(x); >- setOrderYBaseValue(y); >+ m_orderX.setValue(x); >+ m_orderY.setValue(y); > invalidate(); > } > > void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y) > { >- setKernelUnitLengthXBaseValue(x); >- setKernelUnitLengthYBaseValue(y); >+ m_kernelUnitLengthX.setValue(x); >+ m_kernelUnitLengthY.setValue(y); > invalidate(); > } > >diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.h b/Source/WebCore/svg/SVGFEConvolveMatrixElement.h >index 6d25881dd7b..9d65c9c8f1e 100644 >--- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.h >+++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.h >@@ -1,5 +1,6 @@ > /* > * 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 >@@ -32,6 +33,7 @@ namespace WebCore { > template<> > struct SVGPropertyTraits<EdgeModeType> { > static unsigned highestEnumValue() { return EDGEMODE_NONE; } >+ static EdgeModeType initialValue() { return EDGEMODE_NONE; } > > static String toString(EdgeModeType type) > { >@@ -70,12 +72,45 @@ public: > void setOrder(float orderX, float orderY); > void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY); > >+ String in1() const { return m_in1.currentValue(); } >+ int orderX() const { return m_orderX.currentValue(); } >+ int orderY() const { return m_orderY.currentValue(); } >+ const SVGNumberListValues& kernelMatrix() const { return m_kernelMatrix.currentValue(); } >+ float divisor() const { return m_divisor.currentValue(); } >+ float bias() const { return m_bias.currentValue(); } >+ int targetX() const { return m_targetX.currentValue(); } >+ int targetY() const { return m_targetY.currentValue(); } >+ EdgeModeType edgeMode() const { return m_edgeMode.currentValue(); } >+ float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(); } >+ float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(); } >+ bool preserveAlpha() const { return m_preserveAlpha.currentValue(); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(); } >+ RefPtr<SVGAnimatedInteger> orderXAnimated() { return m_orderX.animatedProperty(); } >+ RefPtr<SVGAnimatedInteger> orderYAnimated() { return m_orderY.animatedProperty(); } >+ RefPtr<SVGAnimatedNumberList> kernelMatrixAnimated() { return m_kernelMatrix.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> divisorAnimated() { return m_divisor.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> biasAnimated() { return m_bias.animatedProperty(); } >+ RefPtr<SVGAnimatedInteger> targetXAnimated() { return m_targetX.animatedProperty(); } >+ RefPtr<SVGAnimatedInteger> targetYAnimated() { return m_targetY.animatedProperty(); } >+ RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(); } >+ RefPtr<SVGAnimatedBoolean> preserveAlphaAnimated() { return m_preserveAlpha.animatedProperty(); } >+ > private: > SVGFEConvolveMatrixElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>; >+ 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; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& orderXIdentifier(); >@@ -83,20 +118,19 @@ private: > static const AtomicString& kernelUnitLengthXIdentifier(); > static const AtomicString& kernelUnitLengthYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_INTEGER(OrderX, orderX) >- DECLARE_ANIMATED_INTEGER(OrderY, orderY) >- DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix) >- DECLARE_ANIMATED_NUMBER(Divisor, divisor) >- DECLARE_ANIMATED_NUMBER(Bias, bias) >- DECLARE_ANIMATED_INTEGER(TargetX, targetX) >- DECLARE_ANIMATED_INTEGER(TargetY, targetY) >- DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) >- DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1 { m_attributeOwnerProxy }; >+ SVGAnimatedIntegerAttribute m_orderX { m_attributeOwnerProxy }; >+ SVGAnimatedIntegerAttribute m_orderY { m_attributeOwnerProxy }; >+ SVGAnimatedNumberListAttribute m_kernelMatrix { m_attributeOwnerProxy }; >+ SVGAnimatedNumberAttribute m_divisor { m_attributeOwnerProxy }; >+ SVGAnimatedNumberAttribute m_bias { m_attributeOwnerProxy }; >+ SVGAnimatedIntegerAttribute m_targetX { m_attributeOwnerProxy }; >+ SVGAnimatedIntegerAttribute m_targetY { m_attributeOwnerProxy }; >+ SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { m_attributeOwnerProxy, EDGEMODE_DUPLICATE }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX { m_attributeOwnerProxy }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY { m_attributeOwnerProxy }; >+ SVGAnimatedBooleanAttribute m_preserveAlpha { 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