WebKit Bugzilla
Attachment 346190 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]
Add registration methods for SVGZoomAndPan
186751-11.patch (text/plain), 10.70 KB, created by
Said Abou-Hallawa
on 2018-07-31 12:34:24 PDT
(
hide
)
Description:
Add registration methods for SVGZoomAndPan
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-31 12:34:24 PDT
Size:
10.70 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 288cbbb0b4b..b9d32f09aef 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [11] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add registration methods for SVGZoomAndPan. >+ >+ 1. Add a new file for SVGZoomAndPanType. >+ 2. Define SVGZoomAndPanTypeAttribute and SVGZoomAndPanTypeAttributeAccessor >+ 3. Add template functions in SVGAttributeRegistry for registering >+ attributes of type SVGZoomAndPanTypeAttribute. >+ >+ An example of registering SVGZoomAndPanTypeAttribute: >+ registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>(); >+ >+ * svg/SVGZoomAndPan.cpp: >+ (WebCore::SVGZoomAndPan::parseAttributeValue): Deleted. >+ * svg/SVGZoomAndPan.h: >+ (WebCore::SVGZoomAndPan::parseAttribute): >+ * svg/SVGZoomAndPanType.h: Added. >+ (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::initialValue): >+ (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::toString): >+ (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::fromString): >+ * svg/properties/SVGAttributeRegistry.h: >+ (WebCore::SVGAttributeRegistry::registerAttribute): >+ > 2018-07-31 Said Abou-Hallawa <sabouhallawa@apple.com> > > [10] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index a3bf70e389e..abdd2cd6ddf 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1724,6 +1724,7 @@ > 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */; }; >+ 55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 570440591E53936200356601 /* JSAesCbcCfbParams.h */; }; > 5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; }; > 5706A6981DDE5E4600A03B14 /* JSRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */; }; >@@ -8402,6 +8403,7 @@ > 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAccessor.h; sourceTree = "<group>"; }; > 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeRegistry.h; sourceTree = "<group>"; }; > 55FA7FF9210FDB34005AEFE7 /* SVGAttributeOwnerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxy.h; sourceTree = "<group>"; }; >+ 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPanType.h; sourceTree = "<group>"; }; > 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; }; > 570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; }; > 5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; }; >@@ -23471,6 +23473,7 @@ > B222795F0D00BF210071B782 /* SVGZoomAndPan.cpp */, > B22279600D00BF210071B782 /* SVGZoomAndPan.h */, > B22279610D00BF210071B782 /* SVGZoomAndPan.idl */, >+ 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */, > B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */, > B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */, > B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */, >@@ -28880,6 +28883,7 @@ > 31078CCA1880AACE008099DC /* JSOESTextureHalfFloatLinear.h in Headers */, > 77A17AA712F28B2A004E02F6 /* JSOESVertexArrayObject.h in Headers */, > FDF6BAF9134A4C9800822920 /* JSOfflineAudioCompletionEvent.h in Headers */, >+ 55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */, > FDA9326716703BA9008982DC /* JSOfflineAudioContext.h in Headers */, > 314877E61FAAB02500C05759 /* JSOffscreenCanvas.h in Headers */, > 3140C5271FDF558200D2A873 /* JSOffscreenCanvasRenderingContext2D.h in Headers */, >diff --git a/Source/WebCore/svg/SVGZoomAndPan.cpp b/Source/WebCore/svg/SVGZoomAndPan.cpp >index f15c8370b06..1a2a6c7ace8 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.cpp >+++ b/Source/WebCore/svg/SVGZoomAndPan.cpp >@@ -40,13 +40,4 @@ bool SVGZoomAndPan::parse(const UChar*& start, const UChar* end, SVGZoomAndPanTy > return false; > } > >-SVGZoomAndPanType SVGZoomAndPan::parseAttributeValue(const AtomicString& value) >-{ >- if (value == "disable") >- return SVGZoomAndPanDisable; >- if (value == "magnify") >- return SVGZoomAndPanMagnify; >- return SVGZoomAndPanUnknown; >-} >- > } >diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h >index 2a3702b9284..03d30782e9f 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.h >+++ b/Source/WebCore/svg/SVGZoomAndPan.h >@@ -22,11 +22,10 @@ > > #include "QualifiedName.h" > #include "SVGNames.h" >+#include "SVGZoomAndPanType.h" > > namespace WebCore { > >-enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify }; >- > class SVGZoomAndPan { > public: > // Forward declare enumerations in the W3C naming scheme, for IDL generation. >@@ -42,9 +41,6 @@ public: > > static bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&); > template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value); >- >-private: >- static SVGZoomAndPanType parseAttributeValue(const AtomicString&); > }; > > inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name) >@@ -62,7 +58,7 @@ inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number) > template<class DerivedClass> void SVGZoomAndPan::parseAttribute(DerivedClass& element, const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::zoomAndPanAttr) >- element.setZoomAndPan(parseAttributeValue(value)); >+ element.setZoomAndPan(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value)); > } > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGZoomAndPanType.h b/Source/WebCore/svg/SVGZoomAndPanType.h >index 8b137891791..481e4f5d4d6 100644 >--- a/Source/WebCore/svg/SVGZoomAndPanType.h >+++ b/Source/WebCore/svg/SVGZoomAndPanType.h >@@ -1 +1,58 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ > >+#pragma once >+ >+#include "SVGAttributeAccessor.h" >+#include "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+enum SVGZoomAndPanType { >+ SVGZoomAndPanUnknown, >+ SVGZoomAndPanDisable, >+ SVGZoomAndPanMagnify >+}; >+ >+using SVGZoomAndPanTypeAttribute = SVGPropertyAttribute<SVGZoomAndPanType>; >+ >+template<typename OwnerType> >+using SVGZoomAndPanTypeAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGZoomAndPanTypeAttribute>; >+ >+template<> >+struct SVGPropertyTraits<SVGZoomAndPanType> { >+ static SVGZoomAndPanType initialValue() { return SVGZoomAndPanMagnify; } >+ static String toString(SVGZoomAndPanType) { return emptyString(); } >+ static SVGZoomAndPanType fromString(const String& value) >+ { >+ if (value == "disable") >+ return SVGZoomAndPanDisable; >+ if (value == "magnify") >+ return SVGZoomAndPanMagnify; >+ return SVGZoomAndPanUnknown; >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAttributeRegistry.h b/Source/WebCore/svg/properties/SVGAttributeRegistry.h >index 39e444214dc..f285f245d2e 100644 >--- a/Source/WebCore/svg/properties/SVGAttributeRegistry.h >+++ b/Source/WebCore/svg/properties/SVGAttributeRegistry.h >@@ -30,6 +30,9 @@ > #include "SVGAnimatedLength.h" > #include "SVGAnimatedLengthList.h" > #include "SVGAnimatedNumber.h" >+#include "SVGAnimatedProperty.h" >+#include "SVGAttributeAccessor.h" >+#include "SVGZoomAndPanType.h" > #include <wtf/HashMap.h> > > namespace WebCore { >@@ -43,6 +46,12 @@ public: > return map; > } > >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGZoomAndPanTypeAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGZoomAndPanTypeAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ > template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedBooleanAttribute OwnerType::*attribute> > void registerAttribute() > {
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