WebKit Bugzilla
Attachment 346529 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 SVGZoomAndPan attributes into SVGAttributeRegistry
186751-78.patch (text/plain), 5.96 KB, created by
Said Abou-Hallawa
on 2018-08-03 12:42:18 PDT
(
hide
)
Description:
Register SVGZoomAndPan attributes into SVGAttributeRegistry
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-03 12:42:18 PDT
Size:
5.96 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a9166335924..2b26bac6dc2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2018-08-02 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [78] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Register SVGZoomAndPan attributes into SVGAttributeRegistry >+ >+ * svg/SVGZoomAndPan.cpp: >+ (WebCore::SVGZoomAndPan::SVGZoomAndPan): >+ (WebCore::SVGZoomAndPan::registerAttributes): >+ (WebCore::SVGZoomAndPan::parseZoomAndPan): >+ (WebCore::SVGZoomAndPan::parseAttribute): >+ (WebCore::SVGZoomAndPan::parse): Deleted. >+ (WebCore::SVGZoomAndPan::parseAttributeValue): Deleted. >+ * svg/SVGZoomAndPan.h: >+ (WebCore::SVGZoomAndPan::zoomAndPan const): >+ (WebCore::SVGZoomAndPan::setZoomAndPan): >+ (WebCore::SVGZoomAndPan::reset): >+ (WebCore::SVGZoomAndPan::attributeRegistry): >+ (WebCore::SVGZoomAndPan::isKnownAttribute): >+ (WebCore::SVGZoomAndPan::parseFromNumber): Deleted. >+ (WebCore::SVGZoomAndPan::parseAttribute): Deleted. >+ > 2018-08-02 Said Abou-Hallawa <sabouhallawa@apple.com> > > [77] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/svg/SVGZoomAndPan.cpp b/Source/WebCore/svg/SVGZoomAndPan.cpp >index 1a2a6c7ace8..2325d48786c 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.cpp >+++ b/Source/WebCore/svg/SVGZoomAndPan.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 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,23 +22,44 @@ > #include "config.h" > #include "SVGZoomAndPan.h" > >-#include "SVGParserUtilities.h" >- > namespace WebCore { > >-bool SVGZoomAndPan::parse(const UChar*& start, const UChar* end, SVGZoomAndPanType& zoomAndPan) >+SVGZoomAndPan::SVGZoomAndPan(SVGElement& contextElement) >+ : m_attributeOwnerProxy(*this, contextElement) >+{ >+ registerAttributes(); >+} >+ >+void SVGZoomAndPan::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>(); >+} >+ >+bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end) > { > static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' }; > if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) { >- zoomAndPan = SVGZoomAndPanDisable; >+ m_zoomAndPan.setValue(SVGZoomAndPanDisable); > return true; > } >+ > static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' }; > if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) { >- zoomAndPan = SVGZoomAndPanMagnify; >+ m_zoomAndPan.setValue(SVGZoomAndPanMagnify); > return true; > } >+ > return false; > } > >+void SVGZoomAndPan::parseAttribute(const QualifiedName& attributeName, const AtomicString& value) >+{ >+ if (attributeName != SVGNames::zoomAndPanAttr) >+ return; >+ m_zoomAndPan.setValue(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value)); >+} >+ > } >diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h >index 03d30782e9f..bf81434ee8e 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.h >+++ b/Source/WebCore/svg/SVGZoomAndPan.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 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 >@@ -35,30 +36,27 @@ public: > SVG_ZOOMANDPAN_MAGNIFY = SVGZoomAndPanMagnify > }; > >- static bool isKnownAttribute(const QualifiedName&); >+ SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan.value(); } >+ void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan.setValue(zoomAndPan); } >+ ExceptionOr<void> setZoomAndPan(unsigned) { return Exception { NoModificationAllowedError }; } >+ void reset() { m_zoomAndPan.setValue(SVGZoomAndPanMagnify); } > >- static SVGZoomAndPanType parseFromNumber(unsigned short); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGZoomAndPan>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } > >- static bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&); >- template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value); >-}; >+ void parseAttribute(const QualifiedName&, const AtomicString&); >+ >+protected: >+ SVGZoomAndPan(SVGElement& contextElement); > >-inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name) >-{ >- return name == SVGNames::zoomAndPanAttr; >-} >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ bool parseZoomAndPan(const UChar*&, const UChar*); > >-inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number) >-{ >- if (number > SVGZoomAndPanMagnify) >- return SVGZoomAndPanUnknown; >- return static_cast<SVGZoomAndPanType>(number); >-} >+private: >+ static void registerAttributes(); > >-template<class DerivedClass> void SVGZoomAndPan::parseAttribute(DerivedClass& element, const QualifiedName& name, const AtomicString& value) >-{ >- if (name == SVGNames::zoomAndPanAttr) >- element.setZoomAndPan(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value)); >-} >+ AttributeOwnerProxy m_attributeOwnerProxy; >+ SVGPropertyAttribute<SVGZoomAndPanType> m_zoomAndPan { 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