WebKit Bugzilla
Attachment 346532 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 SVGTextPathElement
186751-81.patch (text/plain), 9.63 KB, created by
Said Abou-Hallawa
on 2018-08-03 12:44:27 PDT
(
hide
)
Description:
Remove SVG macros from SVGTextPathElement
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-03 12:44:27 PDT
Size:
9.63 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 848884f6fd9..65b75124891 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2018-08-02 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [81] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove SVG macros from SVGTextPathElement. >+ >+ * svg/SVGTextPathElement.cpp: >+ (WebCore::SVGTextPathElement::SVGTextPathElement): >+ (WebCore::SVGTextPathElement::registerAttributes): >+ (WebCore::SVGTextPathElement::parseAttribute): >+ (WebCore::SVGTextPathElement::svgAttributeChanged): >+ (WebCore::SVGTextPathElement::isSupportedAttribute): Deleted. >+ * svg/SVGTextPathElement.h: >+ > 2018-08-02 Said Abou-Hallawa <sabouhallawa@apple.com> > > [80] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp >index ae96a32caeb..08d7f625e2e 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.cpp >+++ b/Source/WebCore/svg/SVGTextPathElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> >+ * 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 >@@ -33,28 +34,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPathElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffset, startOffset) >-DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method, SVGTextPathMethodType) >-DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType) >-DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(startOffset) >- REGISTER_LOCAL_ANIMATED_PROPERTY(method) >- REGISTER_LOCAL_ANIMATED_PROPERTY(spacing) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document) > : SVGTextContentElement(tagName, document) >- , m_startOffset(LengthModeOther) >- , m_method(SVGTextPathMethodAlign) >- , m_spacing(SVGTextPathSpacingExact) >+ , SVGURIReference(*this) > { > ASSERT(hasTagName(SVGNames::textPathTag)); >- registerAnimatedPropertiesForSVGTextPathElement(); >+ registerAttributes(); > } > > Ref<SVGTextPathElement> SVGTextPathElement::create(const QualifiedName& tagName, Document& document) >@@ -72,15 +57,14 @@ void SVGTextPathElement::clearResourceReferences() > document().accessSVGExtensions().removeAllTargetReferencesForElement(this); > } > >-bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGTextPathElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGURIReference::addSupportedAttributes(set); >- set.add({ SVGNames::startOffsetAttr.get(), SVGNames::methodAttr.get(), SVGNames::spacingAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>(); >+ registry.registerAttribute<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>(); >+ registry.registerAttribute<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>(); > } > > void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -88,15 +72,15 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS > SVGParsingError parseError = NoError; > > if (name == SVGNames::startOffsetAttr) >- setStartOffsetBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError)); >+ m_startOffset.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError)); > else if (name == SVGNames::methodAttr) { > SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value); > if (propertyValue > 0) >- setMethodBaseValue(propertyValue); >+ m_method.setValue(propertyValue); > } else if (name == SVGNames::spacingAttr) { > SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); > if (propertyValue > 0) >- setSpacingBaseValue(propertyValue); >+ m_spacing.setValue(propertyValue); > } > > reportAttributeParsingError(parseError, name, value); >@@ -107,23 +91,23 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGTextContentElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ >+ if (attrName == SVGNames::startOffsetAttr) >+ updateRelativeLengthsInformation(); >+ >+ if (auto renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- InstanceInvalidationGuard guard(*this); >- > if (SVGURIReference::isKnownAttribute(attrName)) { > buildPendingResource(); > return; > } > >- if (attrName == SVGNames::startOffsetAttr) >- updateRelativeLengthsInformation(); >- >- if (auto renderer = this->renderer()) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGTextContentElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGTextPathElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGTextPathElement.h b/Source/WebCore/svg/SVGTextPathElement.h >index a35519fd9c1..3b8a565032f 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.h >+++ b/Source/WebCore/svg/SVGTextPathElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@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 >@@ -110,21 +111,27 @@ public: > > static Ref<SVGTextPathElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& startOffset() const { return m_startOffset.currentValue(); } >+ SVGTextPathMethodType method() const { return m_method.currentValue(); } >+ SVGTextPathSpacingType spacing() const { return m_spacing.currentValue(); } >+ >+ RefPtr<SVGAnimatedLength> startOffsetAnimated() { return m_startOffset.animatedProperty(); } >+ RefPtr<SVGAnimatedEnumeration> methodAnimated() { return m_method.animatedProperty(); } >+ RefPtr<SVGAnimatedEnumeration> spacingAnimated() { return m_spacing.animatedProperty(); } >+ > protected: > void didFinishInsertingNode() override; > > private: > SVGTextPathElement(const QualifiedName&, Document&); >- > virtual ~SVGTextPathElement(); > >- void clearResourceReferences(); >- >- void buildPendingResource() override; >- InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; >- void removedFromAncestor(RemovalType, ContainerNode&) override; >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -132,14 +139,17 @@ private: > bool childShouldCreateRenderer(const Node&) const override; > bool rendererIsNeeded(const RenderStyle&) override; > >+ void clearResourceReferences(); >+ void buildPendingResource() override; >+ InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; >+ void removedFromAncestor(RemovalType, ContainerNode&) override; >+ > bool selfHasRelativeLengths() const override; >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPathElement) >- DECLARE_ANIMATED_LENGTH(StartOffset, startOffset) >- DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType) >- DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- END_DECLARE_ANIMATED_PROPERTIES >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_startOffset { m_attributeOwnerProxy, LengthModeOther }; >+ SVGAnimatedEnumerationAttribute<SVGTextPathMethodType> m_method { m_attributeOwnerProxy, SVGTextPathMethodAlign }; >+ SVGAnimatedEnumerationAttribute<SVGTextPathSpacingType> m_spacing { m_attributeOwnerProxy, SVGTextPathSpacingExact }; > }; > > } // 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