WebKit Bugzilla
Attachment 346315 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 SVGEllipseElement
186751-32.patch (text/plain), 9.72 KB, created by
Said Abou-Hallawa
on 2018-08-01 17:40:22 PDT
(
hide
)
Description:
Remove SVG macros from SVGEllipseElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 17:40:22 PDT
Size:
9.72 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c891e154810..0d58f22ec3a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [32] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGEllipseElement. >+ >+ * svg/SVGCircleElement.cpp: >+ (WebCore::SVGCircleElement::SVGCircleElement): >+ * svg/SVGEllipseElement.cpp: >+ (WebCore::SVGEllipseElement::SVGEllipseElement): >+ (WebCore::SVGEllipseElement::registerAttributes): >+ (WebCore::SVGEllipseElement::parseAttribute): >+ (WebCore::SVGEllipseElement::svgAttributeChanged): >+ * svg/SVGEllipseElement.h: >+ * svg/SVGExternalResourcesRequired.cpp: >+ (WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired): >+ * svg/SVGExternalResourcesRequired.h: >+ * svg/SVGRectElement.cpp: >+ (WebCore::SVGRectElement::SVGRectElement): >+ > 2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> > > [31] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGEllipseElement.cpp b/Source/WebCore/svg/SVGEllipseElement.cpp >index 96a6774535e..294429da9c1 100644 >--- a/Source/WebCore/svg/SVGEllipseElement.cpp >+++ b/Source/WebCore/svg/SVGEllipseElement.cpp >@@ -1,6 +1,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) 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 >@@ -21,43 +22,20 @@ > #include "config.h" > #include "SVGEllipseElement.h" > >-#include "FloatPoint.h" > #include "RenderSVGEllipse.h" >-#include "RenderSVGPath.h" > #include "RenderSVGResource.h" >-#include "SVGLengthValue.h" >-#include "SVGNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGEllipseElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx) >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy) >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) >-DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(rx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(ry) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document) > : SVGGeometryElement(tagName, document) >- , m_cx(LengthModeWidth) >- , m_cy(LengthModeHeight) >- , m_rx(LengthModeWidth) >- , m_ry(LengthModeHeight) >+ , SVGExternalResourcesRequired(*this) > { > ASSERT(hasTagName(SVGNames::ellipseTag)); >- registerAnimatedPropertiesForSVGEllipseElement(); >+ registerAttributes(); > } > > Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, Document& document) >@@ -65,42 +43,46 @@ Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, D > return adoptRef(*new SVGEllipseElement(tagName, document)); > } > >+void SVGEllipseElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::cxAttr, &SVGEllipseElement::m_cx>(); >+ registry.registerAttribute<SVGNames::cyAttr, &SVGEllipseElement::m_cy>(); >+ registry.registerAttribute<SVGNames::rxAttr, &SVGEllipseElement::m_rx>(); >+ registry.registerAttribute<SVGNames::ryAttr, &SVGEllipseElement::m_ry>(); >+} >+ > void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::cxAttr) >- setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::cyAttr) >- setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::rxAttr) >- setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::ryAttr) >- setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > > void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); > return; > } > >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >- return; >- } >- >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGEllipseElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGEllipseElement.h b/Source/WebCore/svg/SVGEllipseElement.h >index 2570327ffd6..98951fd63e2 100644 >--- a/Source/WebCore/svg/SVGEllipseElement.h >+++ b/Source/WebCore/svg/SVGEllipseElement.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 >@@ -20,10 +21,10 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedLength.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" >+#include "SVGNames.h" > > namespace WebCore { > >@@ -32,25 +33,39 @@ class SVGEllipseElement final : public SVGGeometryElement, public SVGExternalRes > public: > static Ref<SVGEllipseElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& cx() const { return m_cx.currentValue(); } >+ const SVGLengthValue& cy() const { return m_cy.currentValue(); } >+ const SVGLengthValue& rx() const { return m_rx.currentValue(); } >+ const SVGLengthValue& ry() const { return m_ry.currentValue(); } >+ >+ RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(); } >+ RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(); } >+ > private: > SVGEllipseElement(const QualifiedName&, Document&); >- >- bool isValid() const final { return SVGTests::isValid(); } >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ 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&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGEllipseElement) >- DECLARE_ANIMATED_LENGTH(Cx, cx) >- DECLARE_ANIMATED_LENGTH(Cy, cy) >- DECLARE_ANIMATED_LENGTH(Rx, rx) >- DECLARE_ANIMATED_LENGTH(Ry, ry) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_cx { m_attributeOwnerProxy, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_cy { m_attributeOwnerProxy, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_rx { m_attributeOwnerProxy, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_ry { 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