WebKit Bugzilla
Attachment 346318 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]
Register SVGURIReference attributes into SVGAttributeRegistry
186751-35.patch (text/plain), 5.91 KB, created by
Said Abou-Hallawa
on 2018-08-01 17:42:19 PDT
(
hide
)
Description:
Register SVGURIReference attributes into SVGAttributeRegistry
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-01 17:42:19 PDT
Size:
5.91 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 505c7bd39f9..9c54af4f958 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [35] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Register SVGURIReference attributes into SVGAttributeRegistry >+ >+ -- Add a constructor and pass a reference to an SVGElement to it. This >+ is a reference to the owner element. We will keep a reference to this >+ SVGElement in the owner proxy. >+ -- Add registerAttributes() which registers the attributes and call it from >+ the constructor. >+ >+ * svg/SVGURIReference.cpp: >+ (WebCore::SVGURIReference::SVGURIReference): >+ (WebCore::SVGURIReference::registerAttributes): >+ (WebCore::SVGURIReference::attributeRegistry): >+ (WebCore::SVGURIReference::isKnownAttribute): >+ (WebCore::SVGURIReference::parseAttribute): >+ (WebCore::SVGURIReference::href const): >+ (WebCore::SVGURIReference::hrefAnimated): >+ (WebCore::SVGURIReference::addSupportedAttributes): Deleted. >+ * svg/SVGURIReference.h: >+ > 2018-08-01 Said Abou-Hallawa <sabouhallawa@apple.com> > > [34] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGURIReference.cpp b/Source/WebCore/svg/SVGURIReference.cpp >index 0e28196ba06..a803e0e9e3e 100644 >--- a/Source/WebCore/svg/SVGURIReference.cpp >+++ b/Source/WebCore/svg/SVGURIReference.cpp >@@ -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 >@@ -23,20 +24,51 @@ > > #include "Document.h" > #include "Element.h" >+#include "SVGAttributeOwnerProxy.h" > #include "URL.h" > #include "XLinkNames.h" > > namespace WebCore { > >+SVGURIReference::SVGURIReference(SVGElement& contextElement) >+ : m_attributeOwnerProxy(std::make_unique<AttributeOwnerProxy>(*this, contextElement)) >+ , m_href(*m_attributeOwnerProxy) >+{ >+ registerAttributes(); >+} >+ >+void SVGURIReference::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); >+} >+ >+SVGURIReference::AttributeRegistry& SVGURIReference::attributeRegistry() >+{ >+ return AttributeOwnerProxy::attributeRegistry(); >+} >+ >+bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName) >+{ >+ return AttributeOwnerProxy::isKnownAttribute(attributeName); >+} >+ > void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name.matches(XLinkNames::hrefAttr)) >- setHrefBaseValue(value); >+ m_href.setValue(value); > } > >-bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) >+const String& SVGURIReference::href() const > { >- return attrName.matches(XLinkNames::hrefAttr); >+ return m_href.currentValue(); >+} >+ >+RefPtr<SVGAnimatedString> SVGURIReference::hrefAnimated() >+{ >+ return m_href.animatedProperty(); > } > > String SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const Document& document) >@@ -98,9 +130,4 @@ Element* SVGURIReference::targetElementFromIRIString(const String& iri, const Do > return document.getElementById(id); > } > >-void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) >-{ >- supportedAttributes.add(XLinkNames::hrefAttr); >-} >- > } >diff --git a/Source/WebCore/svg/SVGURIReference.h b/Source/WebCore/svg/SVGURIReference.h >index 770f628c991..66784be62dd 100644 >--- a/Source/WebCore/svg/SVGURIReference.h >+++ b/Source/WebCore/svg/SVGURIReference.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 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 >@@ -22,16 +23,21 @@ > > #include "Document.h" > #include "QualifiedName.h" >+#include "SVGAnimatedString.h" > > namespace WebCore { > >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistry; >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeOwnerProxyImpl; >+ > class SVGURIReference { > public: > virtual ~SVGURIReference() = default; > > void parseAttribute(const QualifiedName&, const AtomicString&); >- static bool isKnownAttribute(const QualifiedName&); >- static void addSupportedAttributes(HashSet<QualifiedName>&); > > static String fragmentIdentifierFromIRIString(const String&, const Document&); > static Element* targetElementFromIRIString(const String&, const Document&, String* fragmentIdentifier = nullptr, const Document* externalDocument = nullptr); >@@ -48,9 +54,23 @@ public: > return !equalIgnoringFragmentIdentifier(url, document.url()); > } > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGURIReference>; >+ using AttributeRegistry = AttributeOwnerProxy::AttributeRegistry; >+ static AttributeRegistry& attributeRegistry(); >+ >+ const String& href() const; >+ RefPtr<SVGAnimatedString> hrefAnimated(); >+ > protected: >- virtual String& hrefBaseValue() const = 0; >- virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0; >+ SVGURIReference(SVGElement& contextElement); >+ >+ static bool isKnownAttribute(const QualifiedName& attributeName); >+ >+private: >+ static void registerAttributes(); >+ >+ std::unique_ptr<AttributeOwnerProxy> m_attributeOwnerProxy; >+ SVGAnimatedStringAttribute m_href; > }; > > } // 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