WebKit Bugzilla
Attachment 356607 Details for
Bug 191237
: Remove SVG properties tear-off objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
9-SVGAccessor
9-SVGAccessor.patch (text/plain), 48.16 KB, created by
Said Abou-Hallawa
on 2018-12-05 08:28:54 PST
(
hide
)
Description:
9-SVGAccessor
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-12-05 08:28:54 PST
Size:
48.16 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3ae262bd3f7..683b3df7a19 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,61 @@ >+2018-12-04 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Remove SVG properties tear-off objects >+ https://bugs.webkit.org/show_bug.cgi?id=191237 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The SVGAccessor provides a unified way to access the SVGProperty and the >+ SVGAnimatedProperty. The owner class has to register its properties into >+ an SVGPropertyRegistry. Registering a property means associating an attribute- >+ Name with an SVGAccessor. The owner can give its SVGPropertyRegistry an >+ attributeName and asks it to create an SVGAnimator or to return the >+ baseValAsString() for this attributeName. These operations will be done >+ through virtual methods in the base SVGAccessor class. >+ >+ -- SVGAccessor is the base of: >+ >+ %% SVGAccessorPtr which gives access to the SVGAnimatedProperty or the >+ SVGProperty through a pointer member in the owner given OwnerType >+ and PropertyType. SVGAccessorPtr is the base of: >+ >+ - SVGAnimatedPropertyAccessor: it overrides virtual methods specific >+ to the SVGAnimatedProperty like isAnimatedProperty() and matches(). >+ >+ - SVGPropertyAccessor: it overrides the virtual method matches() which >+ is specific to SVGProperty >+ >+ %% SVGAnimatedPropertyPairAccessor: this accessor is created to associate >+ an attributeName with two SVGAnimatedProperties. It is implemented >+ by creating two SVGAccessors given their types and two pointer members >+ in the same owner. >+ >+ All the SVGAccessors are singleton per OwnerType. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * svg/properties/SVGAccessor.h: Added. >+ (WebCore::SVGAccessor::detach const): >+ (WebCore::SVGAccessor::isAnimatedProperty const): >+ (WebCore::SVGAccessor::isAnimatedLength const): >+ (WebCore::SVGAccessor::matches const): >+ (WebCore::SVGAccessor::synchronize const): >+ (WebCore::SVGAccessor::createAnimator const): >+ (WebCore::SVGAccessor::appendAnimatedInstance const): >+ * svg/properties/SVGAccessorPtr.h: Added. >+ (WebCore::SVGAccessorPtr::SVGAccessorPtr): >+ (WebCore::SVGAccessorPtr::property const): >+ (WebCore::SVGAccessorPtr::singleton): >+ * svg/properties/SVGAnimatedPropertyAccessor.h: Added. >+ * svg/properties/SVGAnimatedPropertyAccessorImpl.h: Added. >+ * svg/properties/SVGAnimatedPropertyPairAccessor.h: Added. >+ (WebCore::SVGAnimatedPropertyPairAccessor::SVGAnimatedPropertyPairAccessor): >+ (WebCore::SVGAnimatedPropertyPairAccessor::singleton): >+ (WebCore::SVGAnimatedPropertyPairAccessor::property1 const): >+ (WebCore::SVGAnimatedPropertyPairAccessor::property2 const): >+ * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h: Added. >+ * svg/properties/SVGPropertyAccessor.h: Added. >+ * svg/properties/SVGPropertyAccessorImpl.h: Added. >+ > 2018-12-04 Said Abou-Hallawa <sabouhallawa@apple.com> > > Remove SVG properties tear-off objects >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 011389f3e19..38643f2a181 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -9356,6 +9356,14 @@ > 72227A9821B6F5D0008EC3E4 /* SVGValuePropertyAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyAnimatorImpl.h; sourceTree = "<group>"; }; > 72227A9921B6F5D1008EC3E4 /* SVGAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimator.cpp; sourceTree = "<group>"; }; > 72227A9A21B6F5D1008EC3E4 /* SVGValuePropertyListAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyListAnimatorImpl.h; sourceTree = "<group>"; }; >+ 72227A9B21B74E51008EC3E4 /* SVGAnimatedPropertyPairAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyPairAccessor.h; sourceTree = "<group>"; }; >+ 72227A9C21B74E52008EC3E4 /* SVGAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAccessor.h; sourceTree = "<group>"; }; >+ 72227A9D21B74E52008EC3E4 /* SVGPropertyAccessorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAccessorImpl.h; sourceTree = "<group>"; }; >+ 72227A9E21B74E53008EC3E4 /* SVGPropertyAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAccessor.h; sourceTree = "<group>"; }; >+ 72227A9F21B74E53008EC3E4 /* SVGAnimatedPropertyAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyAccessor.h; sourceTree = "<group>"; }; >+ 72227AA021B74E54008EC3E4 /* SVGAnimatedPropertyAccessorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyAccessorImpl.h; sourceTree = "<group>"; }; >+ 72227AA121B74E54008EC3E4 /* SVGAnimatedPropertyPairAccessorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyPairAccessorImpl.h; sourceTree = "<group>"; }; >+ 72227AA221B74E54008EC3E4 /* SVGAccessorPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAccessorPtr.h; sourceTree = "<group>"; }; > 724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTBlendMinMax.cpp; sourceTree = "<group>"; }; > 724ED32A1A3A7E5400F5F13C /* EXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTBlendMinMax.h; sourceTree = "<group>"; }; > 724ED32B1A3A7E5400F5F13C /* EXTBlendMinMax.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTBlendMinMax.idl; sourceTree = "<group>"; }; >@@ -15784,6 +15792,8 @@ > 081CDFBD126ECFE800D215CA /* properties */ = { > isa = PBXGroup; > children = ( >+ 72227A9C21B74E52008EC3E4 /* SVGAccessor.h */, >+ 72227AA221B74E54008EC3E4 /* SVGAccessorPtr.h */, > 72227A7F21B6DC6D008EC3E4 /* SVGAnimatedDecoratedProperty.h */, > 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */, > 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */, >@@ -15792,11 +15802,15 @@ > 72227A8121B6DC6E008EC3E4 /* SVGAnimatedPrimitiveProperty.h */, > 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */, > 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */, >+ 72227A9F21B74E53008EC3E4 /* SVGAnimatedPropertyAccessor.h */, >+ 72227AA021B74E54008EC3E4 /* SVGAnimatedPropertyAccessorImpl.h */, > 72227A9221B6F5CE008EC3E4 /* SVGAnimatedPropertyAnimator.h */, > 72227A8F21B6F5CC008EC3E4 /* SVGAnimatedPropertyAnimatorImpl.h */, > 72227A8021B6DC6E008EC3E4 /* SVGAnimatedPropertyImpl.h */, > 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */, > 72227A8221B6DC6F008EC3E4 /* SVGAnimatedPropertyList.h */, >+ 72227A9B21B74E51008EC3E4 /* SVGAnimatedPropertyPairAccessor.h */, >+ 72227AA121B74E54008EC3E4 /* SVGAnimatedPropertyPairAccessorImpl.h */, > 72227A9721B6F5D0008EC3E4 /* SVGAnimatedPropertyPairAnimator.h */, > 72227A8E21B6F5CC008EC3E4 /* SVGAnimatedPropertyPairAnimatorImpl.h */, > 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */, >@@ -15831,6 +15845,8 @@ > 72227A9021B6F5CD008EC3E4 /* SVGPrimitivePropertyAnimator.h */, > 72227A9321B6F5CE008EC3E4 /* SVGPrimitivePropertyAnimatorImpl.h */, > 088A0E01126EF1DB00978F7A /* SVGProperty.h */, >+ 72227A9E21B74E53008EC3E4 /* SVGPropertyAccessor.h */, >+ 72227A9D21B74E52008EC3E4 /* SVGPropertyAccessorImpl.h */, > 72227A9421B6F5CF008EC3E4 /* SVGPropertyAnimator.h */, > 72227A9121B6F5CD008EC3E4 /* SVGPropertyAnimatorCreator.h */, > 72227A7221B50901008EC3E4 /* SVGPropertyList.h */, >diff --git a/Source/WebCore/svg/properties/SVGAccessor.h b/Source/WebCore/svg/properties/SVGAccessor.h >index 8b137891791..ccb8035df74 100644 >--- a/Source/WebCore/svg/properties/SVGAccessor.h >+++ b/Source/WebCore/svg/properties/SVGAccessor.h >@@ -1 +1,57 @@ >+/* >+ * 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 "QualifiedName.h" >+#include "SVGAnimator.h" >+ >+namespace WebCore { >+ >+class SVGAnimatedProperty; >+class SVGProperty; >+ >+template<typename OwnerType> >+class SVGAccessor { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ virtual ~SVGAccessor() = default; >+ >+ virtual void detach(const OwnerType&) const { } >+ virtual bool isAnimatedProperty() const { return false; } >+ virtual bool isAnimatedLength() const { return false; } >+ >+ virtual bool matches(const OwnerType&, const SVGProperty&) const { return false; } >+ virtual bool matches(const OwnerType&, const SVGAnimatedProperty&) const { return false; } >+ virtual std::optional<String> synchronize(const OwnerType&) const { return std::nullopt; } >+ >+ virtual RefPtr<SVGAnimator> createAnimator(OwnerType&, const QualifiedName&, AnimationMode, CalcMode, bool, bool) const { return nullptr; } >+ virtual void appendAnimatedInstance(OwnerType&, const RefPtr<SVGAnimator>&) const { } >+ >+protected: >+ SVGAccessor() = default; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAccessorPtr.h b/Source/WebCore/svg/properties/SVGAccessorPtr.h >index 8b137891791..561eeb322d1 100644 >--- a/Source/WebCore/svg/properties/SVGAccessorPtr.h >+++ b/Source/WebCore/svg/properties/SVGAccessorPtr.h >@@ -1 +1,66 @@ >+/* >+ * 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 "SVGAccessor.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType, typename PropertyType> >+class SVGAccessorPtr : public SVGAccessor<OwnerType> { >+ using Base = SVGAccessor<OwnerType>; >+ >+public: >+ SVGAccessorPtr(Ref<PropertyType> OwnerType::*property) >+ : m_property(property) >+ { >+ } >+ >+ Ref<PropertyType>& property(OwnerType& owner) const { return owner.*m_property; } >+ const Ref<PropertyType>& property(const OwnerType& owner) const { return owner.*m_property; } >+ >+ void detach(const OwnerType& owner) const override >+ { >+ property(owner)->detach(); >+ } >+ >+ std::optional<String> synchronize(const OwnerType& owner) const override >+ { >+ return property(owner)->synchronize(); >+ } >+ >+protected: >+ template<typename AccessorType, Ref<PropertyType> OwnerType::*property> >+ static const SVGAccessor<OwnerType>& singleton() >+ { >+ static NeverDestroyed<AccessorType> propertyAccessor { property }; >+ return propertyAccessor; >+ } >+ >+ Ref<PropertyType> OwnerType::*m_property; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessor.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessor.h >index 8b137891791..fc52a5e046e 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessor.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessor.h >@@ -1 +1,51 @@ >+/* >+ * 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 "SVGAccessorPtr.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType, typename AnimatedPropertyType> >+class SVGAnimatedPropertyAccessor : public SVGAccessorPtr<OwnerType, AnimatedPropertyType> { >+ using Base = SVGAccessorPtr<OwnerType, AnimatedPropertyType>; >+ >+public: >+ using Base::Base; >+ using Base::singleton; >+ using Base::property; >+ using AnimatedProperty = AnimatedPropertyType; >+ >+ bool matches(const OwnerType& owner, const SVGAnimatedProperty& animatedProperty) const override >+ { >+ return property(owner).ptr() == &animatedProperty; >+ } >+ >+private: >+ bool isAnimatedProperty() const override { return true; } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h >index 8b137891791..caa95a56601 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h >@@ -1 +1,344 @@ >+/* >+ * 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 "SVGAnimatedPropertyAccessor.h" >+#include "SVGAnimatedPropertyAnimatorImpl.h" >+#include "SVGAnimatedPropertyImpl.h" >+#include "SVGNames.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType> >+class SVGAnimatedBooleanAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedBoolean> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedBoolean>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedBoolean> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedBooleanAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedBooleanAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedBooleanAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType, typename EnumType> >+class SVGAnimatedEnumerationAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedEnumeration> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedEnumeration>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedEnumeration> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedEnumerationAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedEnumerationAnimator<EnumType>::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedEnumerationAnimator<EnumType>>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedOrientTypeAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedOrientType> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedOrientType>; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedOrientType> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() {return Base::template singleton<SVGAnimatedOrientTypeAccessor, property>(); } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedIntegerAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedInteger> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedInteger>; >+ >+public: >+ using Base::Base; >+ using Base::property; >+ template<Ref<SVGAnimatedInteger> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedIntegerAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedIntegerAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedIntegerAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedNumberAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumber> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumber>; >+ >+public: >+ using Base::Base; >+ using Base::property; >+ template<Ref<SVGAnimatedNumber> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedNumberAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedNumberAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedNumberAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedRectAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedRect> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedRect>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedRect> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedRectAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedRectAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedRectAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedStringAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedString> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedString>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedString> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedStringAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedStringAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedStringAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedAngleAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedAngle> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedAngle>; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedAngle> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedAngleAccessor, property>(); } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedLengthAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLength> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLength>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedLength> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedLengthAccessor, property>(); } >+ >+private: >+ bool isAnimatedLength() const override { return true; } >+ >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ SVGLengthMode lengthMode = property(owner)->baseVal()->value().unitMode(); >+ return SVGAnimatedLengthAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, lengthMode); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedLengthAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedPreserveAspectRatioAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPreserveAspectRatio> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPreserveAspectRatio>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedPreserveAspectRatio> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPreserveAspectRatioAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedPreserveAspectRatioAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedPreserveAspectRatioAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedLengthListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLengthList> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLengthList>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedLengthList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedLengthListAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedLengthListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, LengthModeWidth); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedLengthListAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedNumberListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumberList> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumberList>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedNumberList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedNumberListAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedNumberListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedNumberListAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedPathSegListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPathSegList> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPathSegList>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedPathSegList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPathSegListAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedPathSegListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedPathSegListAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedPointListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPointList> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedPointList>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedPointList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPointListAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedPointListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedPointListAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedTransformListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedTransformList> { >+ using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedTransformList>; >+ using Base::property; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedTransformList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedTransformListAccessor, property>(); } >+ >+private: >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedTransformListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedTransformListAnimator>(animator)->appendAnimatedInstance(property(owner)); >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h >index 8b137891791..026b085c6d4 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h >@@ -1 +1,70 @@ >+/* >+ * 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 "SVGAccessor.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType, typename AccessorType1, typename AccessorType2> >+class SVGAnimatedPropertyPairAccessor : public SVGAccessor<OwnerType> { >+ using AnimatedPropertyType1 = typename AccessorType1::AnimatedProperty; >+ using AnimatedPropertyType2 = typename AccessorType2::AnimatedProperty; >+ using Base = SVGAccessor<OwnerType>; >+ >+public: >+ SVGAnimatedPropertyPairAccessor(Ref<AnimatedPropertyType1> OwnerType::*property1, Ref<AnimatedPropertyType2> OwnerType::*property2) >+ : m_accessor1(property1) >+ , m_accessor2(property2) >+ { >+ } >+ >+protected: >+ template<typename AccessorType, Ref<AnimatedPropertyType1> OwnerType::*property1, Ref<AnimatedPropertyType2> OwnerType::*property2> >+ static SVGAccessor<OwnerType>& singleton() >+ { >+ static NeverDestroyed<AccessorType> propertyAccessor { property1, property2 }; >+ return propertyAccessor; >+ } >+ >+ bool isAnimatedProperty() const override { return true; } >+ >+ Ref<AnimatedPropertyType1>& property1(OwnerType& owner) const { return m_accessor1.property(owner); } >+ const Ref<AnimatedPropertyType1>& property1(const OwnerType& owner) const { return m_accessor1.property(owner); } >+ >+ Ref<AnimatedPropertyType2>& property2(OwnerType& owner) const { return m_accessor2.property(owner); } >+ const Ref<AnimatedPropertyType2>& property2(const OwnerType& owner) const { return m_accessor2.property(owner); } >+ >+ bool matches(const OwnerType& owner, const SVGAnimatedProperty& animatedProperty) const override >+ { >+ return m_accessor1.matches(owner, animatedProperty) || m_accessor2.matches(owner, animatedProperty); >+ } >+ >+ AccessorType1 m_accessor1; >+ AccessorType2 m_accessor2; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h >index 8b137891791..2e50e5db14d 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h >@@ -1 +1,144 @@ >+/* >+ * 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 "SVGAnimatedPropertyAccessorImpl.h" >+#include "SVGAnimatedPropertyAnimatorImpl.h" >+#include "SVGAnimatedPropertyImpl.h" >+#include "SVGAnimatedPropertyPairAccessor.h" >+#include "SVGAnimatedPropertyPairAnimatorImpl.h" >+#include "SVGNames.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType> >+class SVGAnimatedIntegerPairAccessor final : public SVGAnimatedPropertyPairAccessor<OwnerType, SVGAnimatedIntegerAccessor<OwnerType>, SVGAnimatedIntegerAccessor<OwnerType>> { >+ using Base = SVGAnimatedPropertyPairAccessor<OwnerType, SVGAnimatedIntegerAccessor<OwnerType>, SVGAnimatedIntegerAccessor<OwnerType>>; >+ using Base::property1; >+ using Base::property2; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedInteger> OwnerType::*property1, Ref<SVGAnimatedInteger> OwnerType::*property2> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedIntegerPairAccessor, property1, property2>(); } >+ >+private: >+ std::optional<String> synchronize(const OwnerType& owner) const final >+ { >+ bool dirty1 = property1(owner)->isDirty(); >+ bool dirty2 = property2(owner)->isDirty(); >+ if (!(dirty1 || dirty2)) >+ return std::nullopt; >+ >+ String string1 = dirty1 ? *property1(owner)->synchronize() : property1(owner)->baseValAsString(); >+ String string2 = dirty2 ? *property2(owner)->synchronize() : property2(owner)->baseValAsString(); >+ return string1 == string2 ? string1 : string1 + ", " + string2; >+ } >+ >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedIntegerPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedIntegerPairAnimator>(animator)->appendAnimatedInstance(property1(owner), property2(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedNumberPairAccessor final : public SVGAnimatedPropertyPairAccessor<OwnerType, SVGAnimatedNumberAccessor<OwnerType>, SVGAnimatedNumberAccessor<OwnerType>> { >+ using Base = SVGAnimatedPropertyPairAccessor<OwnerType, SVGAnimatedNumberAccessor<OwnerType>, SVGAnimatedNumberAccessor<OwnerType>>; >+ using Base::property1; >+ using Base::property2; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedNumber> OwnerType::*property1, Ref<SVGAnimatedNumber> OwnerType::*property2 > >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedNumberPairAccessor, property1, property2>(); } >+ >+private: >+ std::optional<String> synchronize(const OwnerType& owner) const final >+ { >+ bool dirty1 = property1(owner)->isDirty(); >+ bool dirty2 = property2(owner)->isDirty(); >+ if (!(dirty1 || dirty2)) >+ return std::nullopt; >+ >+ String string1 = dirty1 ? *property1(owner)->synchronize() : property1(owner)->baseValAsString(); >+ String string2 = dirty2 ? *property2(owner)->synchronize() : property2(owner)->baseValAsString(); >+ return string1 == string2 ? string1 : string1 + ", " + string2; >+ } >+ >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedNumberPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedNumberPairAnimator>(animator)->appendAnimatedInstance(property1(owner), property2(owner)); >+ } >+}; >+ >+template<typename OwnerType> >+class SVGAnimatedAngleOrientAccessor final : public SVGAnimatedPropertyPairAccessor<OwnerType, SVGAnimatedAngleAccessor<OwnerType>, SVGAnimatedOrientTypeAccessor<OwnerType>> { >+ using Base = SVGAnimatedPropertyPairAccessor<OwnerType, SVGAnimatedAngleAccessor<OwnerType>, SVGAnimatedOrientTypeAccessor<OwnerType>>; >+ using Base::property1; >+ using Base::property2; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGAnimatedAngle> OwnerType::*property1, Ref<SVGAnimatedOrientType> OwnerType::*property2> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedAngleOrientAccessor, property1, property2>(); } >+ >+private: >+ std::optional<String> synchronize(const OwnerType& owner) const final >+ { >+ bool dirty1 = property1(owner)->isDirty(); >+ bool dirty2 = property2(owner)->isDirty(); >+ if (!(dirty1 || dirty2)) >+ return std::nullopt; >+ >+ auto type = property2(owner)->baseVal(); >+ >+ String string1 = dirty1 ? *property1(owner)->synchronize() : property1(owner)->baseValAsString(); >+ String string2 = dirty2 ? *property2(owner)->synchronize() : property2(owner)->baseValAsString(); >+ return type == SVGMarkerOrientAuto || type == SVGMarkerOrientAutoStartReverse ? string2 : string1; >+ } >+ >+ RefPtr<SVGAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final >+ { >+ return SVGAnimatedAngleOrientAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive); >+ } >+ >+ void appendAnimatedInstance(OwnerType& owner, const RefPtr<SVGAnimator>& animator) const final >+ { >+ static_pointer_cast<SVGAnimatedAngleOrientAnimator>(animator)->appendAnimatedInstance(property1(owner), property2(owner)); >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGPropertyAccessor.h b/Source/WebCore/svg/properties/SVGPropertyAccessor.h >index 8b137891791..4696b1f4a3a 100644 >--- a/Source/WebCore/svg/properties/SVGPropertyAccessor.h >+++ b/Source/WebCore/svg/properties/SVGPropertyAccessor.h >@@ -1 +1,49 @@ >+/* >+ * 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 "SVGAccessorPtr.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType, typename PropertyType> >+class SVGPropertyAccessor : public SVGAccessorPtr<OwnerType, PropertyType> { >+ using Base = SVGAccessorPtr<OwnerType, PropertyType>; >+ >+public: >+ using Base::Base; >+ >+protected: >+ using Base::property; >+ using Base::singleton; >+ >+ bool matches(const OwnerType& owner, const SVGProperty& property) const override >+ { >+ return this->property(owner).ptr() == &property; >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGPropertyAccessorImpl.h b/Source/WebCore/svg/properties/SVGPropertyAccessorImpl.h >index 8b137891791..4b182ba553c 100644 >--- a/Source/WebCore/svg/properties/SVGPropertyAccessorImpl.h >+++ b/Source/WebCore/svg/properties/SVGPropertyAccessorImpl.h >@@ -1 +1,54 @@ >+/* >+ * 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 "SVGPropertyAccessor.h" >+#include "SVGStringList.h" >+#include "SVGTransformList.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType> >+class SVGStringListAccessor final : public SVGPropertyAccessor<OwnerType, SVGStringList> { >+ using Base = SVGPropertyAccessor<OwnerType, SVGStringList>; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGStringList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGStringListAccessor, property>(); } >+}; >+ >+template<typename OwnerType> >+class SVGTransformListAccessor final : public SVGPropertyAccessor<OwnerType, SVGTransformList> { >+ using Base = SVGPropertyAccessor<OwnerType, SVGTransformList>; >+ >+public: >+ using Base::Base; >+ template<Ref<SVGTransformList> OwnerType::*property> >+ constexpr static const SVGAccessor<OwnerType>& singleton() { return Base::template singleton<SVGTransformListAccessor, property>(); } >+}; >+ >+}
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 191237
:
353808
|
353812
|
353815
|
353817
|
353818
|
353820
|
353824
|
353825
|
355382
|
355386
|
355388
|
355393
|
355568
|
355574
|
355575
|
355577
|
355580
|
355582
|
355585
|
355666
|
355672
|
355693
|
355699
|
355711
|
355752
|
355777
|
355820
|
356333
|
356334
|
356338
|
356340
|
356342
|
356344
|
356346
|
356351
|
356352
|
356358
|
356360
|
356380
|
356497
|
356500
|
356507
|
356579
|
356607
|
356728
|
356729
|
356730
|
356731
|
356732
|
356733
|
356752
|
356810
|
356811
|
356879
|
356880
|
356881
|
356882
|
356883
|
356884
|
356885
|
356887
|
356888
|
356889
|
356892
|
356895
|
356896
|
359721
|
359735
|
359747
|
363581
|
363595
|
363613
|
363690
|
364172
|
364180
|
366512
|
366557
|
366636