WebKit Bugzilla
Attachment 346097 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]
Introduce SVGAttribute
186751-1.patch (text/plain), 10.17 KB, created by
Said Abou-Hallawa
on 2018-07-30 13:50:54 PDT
(
hide
)
Description:
Introduce SVGAttribute
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-30 13:50:54 PDT
Size:
10.17 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cfaf42b1e0b..7c341b95760 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,47 @@ >+2018-07-30 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [1] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch introduces SVGAttribute which is the base class of a set of >+ classes. These classes are meant to be the types of all the SVGElements' >+ attributes. The plan is to have SVGAttribute RefCounted after the SVG >+ attributes macros are removed. >+ >+ -- SVGPropertyAttribute represents a holder for a property whose value >+ can be synchronized with the Element. Element::getAttribute() will call >+ SVGPropertyAttribute::synchronize() which will set the call >+ Element::setAttributeInternal() with the latest modified value. >+ >+ -- SVGAnimatedAttribute represents an SVG animate-able attribute, e.g. >+ the 'x' attribute of the <rect> element. An SVGAnimatedAttribute should >+ have the ability to create a TearOff object (will be added later) which >+ will be used as the backings store of the DOM object and will be used also >+ to hold the animated value of this attribute while the animation is in >+ progress. >+ >+ -- SVGAnimatedAttributeList represents an SVG animate-able list attribute >+ e.g. the 'x' attribute of the <text> element. More list specific functions >+ will be added later. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * svg/properties/SVGAttribute.h: Added. >+ (WebCore::SVGPropertyAttribute::SVGPropertyAttribute): The template pack >+ parameter is meant for properties like SVGValueLength whose constructor >+ takes multiple parameters, e.g. (LengthModeWidth, "-10%"). >+ (WebCore::SVGPropertyAttribute::value): >+ (WebCore::SVGPropertyAttribute::value const): >+ (WebCore::SVGPropertyAttribute::setValue): >+ (WebCore::SVGPropertyAttribute::resetValue): >+ (WebCore::SVGPropertyAttribute::toString const): >+ (WebCore::SVGPropertyAttribute::setShouldSynchronize): >+ (WebCore::SVGPropertyAttribute::shouldSynchronize const): >+ (WebCore::SVGPropertyAttribute::synchronize): >+ (WebCore::SVGAnimatedAttribute::SVGAnimatedAttribute): >+ (WebCore::SVGAnimatedAttributeList::SVGAnimatedAttributeList): >+ > 2018-07-30 Rob Buis <rbuis@igalia.com> > > Merge PlatformCookieJar functions into NetworkStorageSession >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 787dcfab57d..8a5f7ac12ce 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1721,6 +1721,7 @@ > 55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55EC9599206AA7A0007DD0A9 /* PaintFrequencyTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FEF210FA386005AEFE7 /* SVGAttribute.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 */; }; >@@ -8395,6 +8396,7 @@ > 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIRegistry.h; sourceTree = "<group>"; }; > 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; }; > 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; }; >+ 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttribute.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>"; }; >@@ -15466,6 +15468,7 @@ > 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */, > 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */, > 0813A4E91284132600992511 /* SVGStaticPropertyTearOff.h */, >+ 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */, > ); > path = properties; > sourceTree = "<group>"; >@@ -30689,6 +30692,7 @@ > E4C91A0E1802343100A17F6D /* TextPaintStyle.h in Headers */, > 93F198F608245E59001E9ABC /* TextResourceDecoder.h in Headers */, > A824B4650E2EF2EA0081A7B7 /* TextRun.h in Headers */, >+ 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */, > 448B1B7A0F3A2F9B0047A9E2 /* TextSizeAdjustment.h in Headers */, > 9759E94014EF1CF80026A2DD /* TextTrack.h in Headers */, > 9759E94314EF1CF80026A2DD /* TextTrackCue.h in Headers */, >diff --git a/Source/WebCore/svg/properties/SVGAttribute.h b/Source/WebCore/svg/properties/SVGAttribute.h >index 8b137891791..8cbfc041d71 100644 >--- a/Source/WebCore/svg/properties/SVGAttribute.h >+++ b/Source/WebCore/svg/properties/SVGAttribute.h >@@ -1 +1,106 @@ >+/* >+ * 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 "Element.h" >+#include "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+struct SVGAttribute { }; >+ >+template<typename PropertyType> >+class SVGPropertyAttribute : public SVGAttribute { >+public: >+ SVGPropertyAttribute() >+ : m_property(SVGPropertyTraits<PropertyType>::initialValue()) >+ { >+ } >+ >+ template<typename... Arguments> >+ SVGPropertyAttribute(Arguments&&... arguments) >+ : m_property(std::forward<Arguments>(arguments)...) >+ { >+ } >+ >+ PropertyType& value() { return m_property; } >+ const PropertyType& value() const { return m_property; } >+ >+ void setValue(const PropertyType& property) { m_property = property; } >+ void setValue(PropertyType&& property) { m_property = WTFMove(property); } >+ void resetValue() { m_property = SVGPropertyTraits<PropertyType>::initialValue(); } >+ >+ String toString() const { return SVGPropertyTraits<PropertyType>::toString(m_property); } >+ >+ void setShouldSynchronize(bool shouldSynchronize) { m_shouldSynchronize = shouldSynchronize; } >+ bool shouldSynchronize() const { return m_shouldSynchronize; } >+ void synchronize(Element& element, const QualifiedName& attributeName) >+ { >+ if (!m_shouldSynchronize) >+ return; >+ element.setSynchronizedLazyAttribute(attributeName, toString()); >+ } >+ >+protected: >+ PropertyType m_property; >+ bool m_shouldSynchronize { false }; >+}; >+ >+template<typename TearOffType> >+class SVGAnimatedAttribute : public SVGPropertyAttribute<typename TearOffType::ContentType> { >+public: >+ using PropertyTearOffType = TearOffType; >+ using PropertyType = typename PropertyTearOffType::ContentType; >+ using Base = SVGPropertyAttribute<PropertyType>; >+ using Base::m_shouldSynchronize; >+ using Base::m_property; >+ >+ SVGAnimatedAttribute() = default; >+ >+ template<typename... Arguments> >+ SVGAnimatedAttribute(Arguments&&... arguments) >+ : Base(std::forward<Arguments>(arguments)...) >+ { >+ } >+}; >+ >+template<typename TearOffType> >+class SVGAnimatedAttributeList : public SVGAnimatedAttribute<TearOffType> { >+public: >+ using PropertyTearOffType = TearOffType; >+ using PropertyType = typename PropertyTearOffType::ContentType; >+ using Base = SVGAnimatedAttribute<PropertyTearOffType>; >+ >+ SVGAnimatedAttributeList() = default; >+ >+ template<typename... Arguments> >+ SVGAnimatedAttributeList(Arguments&&... arguments) >+ : Base(std::forward<Arguments>(arguments)...) >+ { >+ } >+}; >+ >+}
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