WebKit Bugzilla
Attachment 346212 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 SVGLangSpace attributes into SVGAttributeRegistry
186751-24.patch (text/plain), 7.03 KB, created by
Said Abou-Hallawa
on 2018-07-31 15:57:33 PDT
(
hide
)
Description:
Register SVGLangSpace attributes into SVGAttributeRegistry
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-31 15:57:33 PDT
Size:
7.03 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e90e0e8b241..fdda4738ab2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [24] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Allow attributes of SVGLangSpace to be accessible through SVG attribute >+ accessors. >+ >+ -- Change the type of m_lang and m_space to be SVGStringAttribute. >+ -- Add attributeRegistry() which can be called by SVGAttributeRegistry >+ to have access to the attributes of SVGLangSpace from its one of its >+ super classes. >+ -- registerAttributes() and call it from the constructor. >+ -- Add svgAttributeChanged() which will be called from the super class >+ if an attribute changes. >+ >+ * svg/SVGLangSpace.cpp: >+ (WebCore::SVGLangSpace::SVGLangSpace): >+ (WebCore::SVGLangSpace::registerAttributes): >+ (WebCore::SVGLangSpace::xmlspace const): >+ (WebCore::SVGLangSpace::svgAttributeChanged): >+ (WebCore::SVGLangSpace::setXmllang): Deleted. >+ (WebCore::SVGLangSpace::setXmlspace): Deleted. >+ (WebCore::SVGLangSpace::isKnownAttribute): Deleted. >+ (WebCore::addWithAndWithoutXMLPrefix): Deleted. >+ (WebCore::SVGLangSpace::addSupportedAttributes): Deleted. >+ * svg/SVGLangSpace.h: >+ > 2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> > > [23] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGLangSpace.cpp b/Source/WebCore/svg/SVGLangSpace.cpp >index 1f4ce6b0e84..f0975afadb5 100644 >--- a/Source/WebCore/svg/SVGLangSpace.cpp >+++ b/Source/WebCore/svg/SVGLangSpace.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 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 >@@ -21,29 +22,37 @@ > #include "config.h" > #include "SVGLangSpace.h" > >+#include "SVGElement.h" >+#include "RenderSVGShape.h" >+#include "RenderSVGResource.h" > #include "XMLNames.h" > #include <wtf/NeverDestroyed.h> > > namespace WebCore { > >-void SVGLangSpace::setXmllang(const AtomicString& xmlLang) >+SVGLangSpace::SVGLangSpace(SVGElement* contextElement) >+ : m_contextElement(*contextElement) >+ , m_attributeOwnerProxy(*this, *contextElement) > { >- m_lang = xmlLang; >+ registerAttributes(); > } > >-const AtomicString& SVGLangSpace::xmlspace() const >+void SVGLangSpace::registerAttributes() > { >- if (!m_space) { >- static NeverDestroyed<const AtomicString> defaultString("default", AtomicString::ConstructFromLiteral); >- return defaultString; >- } >- >- return m_space; >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::langAttr, &SVGLangSpace::m_lang>()); >+ registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::spaceAttr, &SVGLangSpace::m_space>()); > } > >-void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace) >+const String& SVGLangSpace::xmlspace() const > { >- m_space = xmlSpace; >+ if (!m_space.value()) { >+ static NeverDestroyed<String> defaultString("default"); >+ return defaultString; >+ } >+ return m_space.value(); > } > > void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -54,22 +63,15 @@ void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& > setXmlspace(value); > } > >-bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName) >+void SVGLangSpace::svgAttributeChanged(const QualifiedName& attrName) > { >- return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr); >-} >+ if (!isKnownAttribute(attrName)) >+ return; > >-static void addWithAndWithoutXMLPrefix(HashSet<QualifiedName>& set, const QualifiedName& attributeName) >-{ >- ASSERT(attributeName.prefix().isNull()); >- set.add(attributeName); >- set.add({ xmlAtom(), attributeName.localName(), attributeName.namespaceURI() }); >-} >- >-void SVGLangSpace::addSupportedAttributes(HashSet<QualifiedName>& set) >-{ >- addWithAndWithoutXMLPrefix(set, XMLNames::langAttr); >- addWithAndWithoutXMLPrefix(set, XMLNames::spaceAttr); >+ if (auto* renderer = downcast<RenderSVGShape>(m_contextElement.renderer())) { >+ SVGElement::InstanceInvalidationGuard guard(m_contextElement); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > } > > } >diff --git a/Source/WebCore/svg/SVGLangSpace.h b/Source/WebCore/svg/SVGLangSpace.h >index 22c4118a80c..0d253ec4603 100644 >--- a/Source/WebCore/svg/SVGLangSpace.h >+++ b/Source/WebCore/svg/SVGLangSpace.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 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 >@@ -21,26 +22,43 @@ > #pragma once > > #include "QualifiedName.h" >+#include "SVGAttributeOwnerProxy.h" > #include <wtf/HashSet.h> > > namespace WebCore { > >+class SVGElement; >+ > class SVGLangSpace { > public: >- const AtomicString& xmllang() const { return m_lang; } >- void setXmllang(const AtomicString& xmlLang); >+ const String& xmllang() const { return m_lang.value(); } >+ void setXmllang(const AtomicString& xmlLang) { m_lang.setValue(xmlLang); } > >- const AtomicString& xmlspace() const; >- void setXmlspace(const AtomicString& xmlSpace); >+ const String& xmlspace() const; >+ void setXmlspace(const AtomicString& xmlSpace) { m_space.setValue(xmlSpace); } > > void parseAttribute(const QualifiedName&, const AtomicString&); > >- static bool isKnownAttribute(const QualifiedName&); >- static void addSupportedAttributes(HashSet<QualifiedName>&); >+ void svgAttributeChanged(const QualifiedName&); >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLangSpace>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return attributeRegistry().isKnownAttribute(attributeName); } >+ >+protected: >+ SVGLangSpace(SVGElement* contextElement); > > private: >- AtomicString m_lang; >- AtomicString m_space; >+ using SVGStringAttribute = SVGPropertyAttribute<String>; >+ using SVGStringAttributeAccessor = SVGPropertyAttributeAccessor<SVGLangSpace, SVGStringAttribute>; >+ >+ static void registerAttributes(); >+ >+ SVGElement& m_contextElement; >+ >+ AttributeOwnerProxy m_attributeOwnerProxy; >+ SVGStringAttribute m_lang { m_attributeOwnerProxy }; >+ SVGStringAttribute m_space { 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