WebKit Bugzilla
Attachment 346129 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 SVGAttributeOwnerProxy
186751-4.patch (text/plain), 10.98 KB, created by
Said Abou-Hallawa
on 2018-07-30 17:26:58 PDT
(
hide
)
Description:
Introduce SVGAttributeOwnerProxy
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-30 17:26:58 PDT
Size:
10.98 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 34ba09add61..f46ea85367a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2018-07-30 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [4] Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch introduces the SVGAttributeOwnerProxy which represents the >+ pair: (owner, SVGElement) for the SVG attributes. To access the attribute >+ value the owner of this attribute has to be known. To synchronize the >+ value with the DOM or to create the TearOff object, the SVGElement has >+ to be provided. >+ >+ SVGAttributeOwnerProxy is a base class which does not include the owner >+ but has all its methods virtual. SVGAttributeOwnerProxyImpl is a template >+ class which owns the owner and uses it its override-able methods. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * svg/properties/SVGAttribute.h: Added. >+ (WebCore::SVGPropertyAttribute::SVGPropertyAttribute): >+ (WebCore::SVGAnimatedAttribute::SVGAnimatedAttribute): >+ (WebCore::SVGAnimatedAttributeList::SVGAnimatedAttributeList): >+ Connect the SVG attributes with their owner proxies. The owner proxy will >+ be used to create the TearOff objects. >+ >+ * svg/properties/SVGAttributeOwnerProxy.h: Added. >+ (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy): >+ (WebCore::SVGAttributeOwnerProxyImpl::SVGAttributeOwnerProxyImpl): >+ (WebCore::SVGAttributeOwnerProxyImpl::attributeRegistry): >+ (WebCore::SVGAttributeOwnerProxyImpl::isKnownAttribute): >+ > 2018-07-30 Said Abou-Hallawa <sabouhallawa@apple.com> > > [3] Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index ea6a3c11ab6..a3bf70e389e 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -8401,6 +8401,7 @@ > 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttribute.h; sourceTree = "<group>"; }; > 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>"; }; > 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>"; }; >@@ -15462,6 +15463,7 @@ > 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */, > 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */, > 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */, >+ 55FA7FF9210FDB34005AEFE7 /* SVGAttributeOwnerProxy.h */, > 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */, > 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */, > 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */, >diff --git a/Source/WebCore/svg/properties/SVGAttribute.h b/Source/WebCore/svg/properties/SVGAttribute.h >index 8cbfc041d71..31ca1972a09 100644 >--- a/Source/WebCore/svg/properties/SVGAttribute.h >+++ b/Source/WebCore/svg/properties/SVGAttribute.h >@@ -30,19 +30,23 @@ > > namespace WebCore { > >+class SVGAttributeOwnerProxy; >+ > struct SVGAttribute { }; > > template<typename PropertyType> > class SVGPropertyAttribute : public SVGAttribute { > public: >- SVGPropertyAttribute() >+ SVGPropertyAttribute(const SVGAttributeOwnerProxy& attributeOwnerProxy) > : m_property(SVGPropertyTraits<PropertyType>::initialValue()) >+ , m_attributeOwnerProxy(attributeOwnerProxy) > { > } > > template<typename... Arguments> > SVGPropertyAttribute(Arguments&&... arguments) > : m_property(std::forward<Arguments>(arguments)...) >+ , m_attributeOwnerProxy(attributeOwnerProxy) > { > } > >@@ -67,6 +71,7 @@ public: > protected: > PropertyType m_property; > bool m_shouldSynchronize { false }; >+ const SVGAttributeOwnerProxy& m_attributeOwnerProxy; > }; > > template<typename TearOffType> >@@ -78,11 +83,14 @@ public: > using Base::m_shouldSynchronize; > using Base::m_property; > >- SVGAnimatedAttribute() = default; >+ SVGAnimatedAttribute(const SVGAttributeOwnerProxy& attributeOwnerProxy) >+ : Base(attributeOwnerProxy) >+ { >+ } > > template<typename... Arguments> >- SVGAnimatedAttribute(Arguments&&... arguments) >- : Base(std::forward<Arguments>(arguments)...) >+ SVGAnimatedAttribute(const SVGAttributeOwnerProxy& attributeOwnerProxy, Arguments&&... arguments) >+ : Base(attributeOwnerProxy, std::forward<Arguments>(arguments)...) > { > } > }; >@@ -94,11 +102,14 @@ public: > using PropertyType = typename PropertyTearOffType::ContentType; > using Base = SVGAnimatedAttribute<PropertyTearOffType>; > >- SVGAnimatedAttributeList() = default; >+ SVGAnimatedAttributeList(const SVGAttributeOwnerProxy& attributeOwnerProxy) >+ : Base(attributeOwnerProxy) >+ { >+ } > > template<typename... Arguments> >- SVGAnimatedAttributeList(Arguments&&... arguments) >- : Base(std::forward<Arguments>(arguments)...) >+ SVGAnimatedAttributeList(const SVGAttributeOwnerProxy& attributeOwnerProxy, Arguments&&... arguments) >+ : Base(attributeOwnerProxy, std::forward<Arguments>(arguments)...) > { > } > }; >diff --git a/Source/WebCore/svg/properties/SVGAttributeAccessor.h b/Source/WebCore/svg/properties/SVGAttributeAccessor.h >index 0e482e4f717..aa3795a7b29 100644 >--- a/Source/WebCore/svg/properties/SVGAttributeAccessor.h >+++ b/Source/WebCore/svg/properties/SVGAttributeAccessor.h >@@ -47,10 +47,10 @@ public: > : m_attributeName(attributeName) > { > } >+ virtual ~SVGAttributeAccessor() = default; > > const QualifiedName& attributeName() const { return m_attributeName; } > >- virtual ~SVGAttributeAccessor() = default; > virtual bool isMatched(const OwnerType&, const SVGAttribute&) const = 0; > virtual void synchronizeProperty(OwnerType&, Element&) const = 0; > >@@ -58,7 +58,7 @@ public: > virtual Vector<AnimatedPropertyType> animatedTypes() const { return { animatedType() }; } > > protected: >- const QualifiedName& m_attributeName; >+ const QualifiedName m_attributeName; > }; > > template<typename OwnerType, typename AttributeType> >diff --git a/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h b/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h >index 8b137891791..727b8e82614 100644 >--- a/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h >+++ b/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h >@@ -1 +1,100 @@ >+/* >+ * 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 "SVGAttributeRegistry.h" >+ >+namespace WebCore { >+ >+class SVGAttributeOwnerProxy { >+public: >+ SVGAttributeOwnerProxy(SVGElement& element) >+ : m_element(element) >+ { >+ } >+ >+ virtual ~SVGAttributeOwnerProxy() = default; >+ >+ virtual void synchronizeAttributes() const = 0; >+ virtual void synchronizeAttribute(const QualifiedName&) const = 0; >+ >+ virtual Vector<AnimatedPropertyType> animatedTypes(const QualifiedName&) const = 0; >+ >+protected: >+ SVGElement& m_element; >+}; >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeOwnerProxyImpl : public SVGAttributeOwnerProxy { >+public: >+ using AttributeRegistry = SVGAttributeRegistry<OwnerType, BaseTypes...>; >+ >+ SVGAttributeOwnerProxyImpl(OwnerType& owner, SVGElement& element, AnimatedPropertyState animatedState = PropertyIsReadWrite) >+ : SVGAttributeOwnerProxy(element) >+ , m_owner(owner) >+ , m_animatedState(animatedState) >+ { >+ // This is the OwnerProxy constructor for the non SVGElement based owners, e.g. SVGTests. >+ } >+ >+ SVGAttributeOwnerProxyImpl(OwnerType& owner) >+ : SVGAttributeOwnerProxy(owner) >+ , m_owner(owner) >+ { >+ static_assert(std::is_base_of<SVGElement, OwnerType>::value, "The owner of SVGAttributeOwnerProxy should be derived from SVGElement."); >+ } >+ >+ static AttributeRegistry& attributeRegistry() >+ { >+ return AttributeRegistry::singleton(); >+ } >+ >+ static bool isKnownAttribute(const QualifiedName& attributeName) >+ { >+ return attributeRegistry().isKnownAttribute(attributeName); >+ } >+ >+private: >+ void synchronizeAttributes() const override >+ { >+ attributeRegistry().synchronizeAttributes(m_owner, m_element); >+ } >+ >+ void synchronizeAttribute(const QualifiedName& attributeName) const override >+ { >+ attributeRegistry().synchronizeAttribute(m_owner, m_element, attributeName); >+ } >+ >+ Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const override >+ { >+ return attributeRegistry().animatedTypes(attributeName); >+ } >+ >+ OwnerType& m_owner; >+ AnimatedPropertyState m_animatedState { PropertyIsReadWrite }; >+}; >+ >+}
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