WebKit Bugzilla
Attachment 356500 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]
6-SVGAnimatedProperty
6-SVGAnimatedProperty.patch (text/plain), 42.31 KB, created by
Said Abou-Hallawa
on 2018-12-04 08:59:32 PST
(
hide
)
Description:
6-SVGAnimatedProperty
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-12-04 08:59:32 PST
Size:
42.31 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 470ac168cc7..2e6fa5f2965 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,105 @@ >+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!). >+ >+ SVGAnimatedProperty will be the base class of the SVG animated properties. >+ The baseVal and animVal of SVGAnimatedProperty can be primitive type, SVG >+ type or SVGList type. If they are SVG type or SVGList, they will be RefCounted >+ since all SVG types and SVGList are all derived from SVGProperty. >+ >+ The header file SVGAnimatedPropertyImpl.h will contain the implementation >+ of all super classes of SVGAnimatedProperty. >+ >+ This patch eliminates the need for: >+ >+ 1. SVGAnimatedStaticPropertyTearOff >+ 2. SVGAnimatedEnumerationPropertyTearOff >+ 3. SVGAnimatedPropertyTearOff >+ 4. SVGAnimatedPropertyList >+ 5. SVGAnimatedPathSegListPropertyTearOff >+ 6. SVGAnimatedTransformListPropertyTearOff >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * svg/properties/SVGAnimatedDecoratedProperty.h: Added. >+ (WebCore::SVGAnimatedDecoratedProperty::create): >+ (WebCore::SVGAnimatedDecoratedProperty::SVGAnimatedDecoratedProperty): >+ (WebCore::SVGAnimatedDecoratedProperty::setBaseVal): >+ (WebCore::SVGAnimatedDecoratedProperty::setBaseValInternal): >+ (WebCore::SVGAnimatedDecoratedProperty::baseVal const): >+ (WebCore::SVGAnimatedDecoratedProperty::setAnimVal): >+ (WebCore::SVGAnimatedDecoratedProperty::animVal const): >+ (WebCore::SVGAnimatedDecoratedProperty::currentValue const): >+ * svg/properties/SVGAnimatedPrimitiveProperty.h: Added. >+ (WebCore::SVGAnimatedPrimitiveProperty::create): >+ (WebCore::SVGAnimatedPrimitiveProperty::setBaseVal): >+ (WebCore::SVGAnimatedPrimitiveProperty::setBaseValInternal): >+ (WebCore::SVGAnimatedPrimitiveProperty::baseVal const): >+ (WebCore::SVGAnimatedPrimitiveProperty::setAnimVal): >+ (WebCore::SVGAnimatedPrimitiveProperty::animVal const): >+ (WebCore::SVGAnimatedPrimitiveProperty::animVal): >+ (WebCore::SVGAnimatedPrimitiveProperty::currentValue const): >+ (WebCore::SVGAnimatedPrimitiveProperty::SVGAnimatedPrimitiveProperty): >+ * svg/properties/SVGAnimatedProperty.cpp: >+ (WebCore::SVGAnimatedProperty::owner const): >+ (WebCore::SVGAnimatedProperty::commitPropertyChange): >+ (WebCore::SVGAnimatedProperty::SVGAnimatedProperty): Deleted. >+ (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty): Deleted. >+ (WebCore::SVGAnimatedProperty::commitChange): Deleted. >+ * svg/properties/SVGAnimatedProperty.h: >+ (WebCore::SVGAnimatedProperty::isAttached const): >+ (WebCore::SVGAnimatedProperty::detach): >+ (WebCore::SVGAnimatedProperty::contextElement const): >+ (WebCore::SVGAnimatedProperty::baseValAsString const): >+ (WebCore::SVGAnimatedProperty::animValAsString const): >+ (WebCore::SVGAnimatedProperty::isDirty const): >+ (WebCore::SVGAnimatedProperty::setDirty): >+ (WebCore::SVGAnimatedProperty::synchronize): >+ (WebCore::SVGAnimatedProperty::isAnimating const): >+ (WebCore::SVGAnimatedProperty::startAnimation): >+ (WebCore::SVGAnimatedProperty::stopAnimation): >+ (WebCore::SVGAnimatedProperty::instanceStartAnimation): >+ (WebCore::SVGAnimatedProperty::instanceStopAnimation): >+ (WebCore::SVGAnimatedProperty::SVGAnimatedProperty): >+ (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const): Deleted. >+ (WebCore::SVGAnimatedProperty::attributeName const): Deleted. >+ (WebCore::SVGAnimatedProperty::animatedPropertyType const): Deleted. >+ (WebCore::SVGAnimatedProperty::isReadOnly const): Deleted. >+ (WebCore::SVGAnimatedProperty::setIsReadOnly): Deleted. >+ (WebCore::SVGAnimatedProperty::lookupOrCreateAnimatedProperty): Deleted. >+ (WebCore::SVGAnimatedProperty::lookupAnimatedProperty): Deleted. >+ (WebCore::SVGAnimatedProperty::animatedPropertyCache): Deleted. >+ * svg/properties/SVGAnimatedPropertyImpl.h: Added. >+ (WebCore::SVGAnimatedOrientType::create): >+ (WebCore::SVGAnimatedPathSegList::create): >+ (WebCore::SVGAnimatedPathSegList::currentPathByteStream): >+ (WebCore::SVGAnimatedPathSegList::currentPath): >+ (WebCore::SVGAnimatedPathSegList::approximateMemoryCost const): >+ * svg/properties/SVGAnimatedPropertyList.h: Added. >+ (WebCore::SVGAnimatedPropertyList::create): >+ (WebCore::SVGAnimatedPropertyList::~SVGAnimatedPropertyList): >+ (WebCore::SVGAnimatedPropertyList::baseVal const): >+ (WebCore::SVGAnimatedPropertyList::baseVal): >+ (WebCore::SVGAnimatedPropertyList::animVal const): >+ (WebCore::SVGAnimatedPropertyList::animVal): >+ (WebCore::SVGAnimatedPropertyList::currentValue const): >+ (WebCore::SVGAnimatedPropertyList::SVGAnimatedPropertyList): >+ (WebCore::SVGAnimatedPropertyList::ensureAnimVal): >+ * svg/properties/SVGAnimatedValueProperty.h: Added. >+ (WebCore::SVGAnimatedValueProperty::create): >+ (WebCore::SVGAnimatedValueProperty::~SVGAnimatedValueProperty): >+ (WebCore::SVGAnimatedValueProperty::setBaseValInternal): >+ (WebCore::SVGAnimatedValueProperty::baseVal const): >+ (WebCore::SVGAnimatedValueProperty::baseVal): >+ (WebCore::SVGAnimatedValueProperty::setAnimVal): >+ (WebCore::SVGAnimatedValueProperty::animVal const): >+ (WebCore::SVGAnimatedValueProperty::animVal): >+ (WebCore::SVGAnimatedValueProperty::currentValue const): >+ (WebCore::SVGAnimatedValueProperty::SVGAnimatedValueProperty): >+ (WebCore::SVGAnimatedValueProperty::ensureAnimVal): >+ > 2018-12-03 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 3e3662eb512..703fafc756f 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -9328,6 +9328,11 @@ > 72227A7521B586E7008EC3E4 /* SVGDecoratedEnumeration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDecoratedEnumeration.h; sourceTree = "<group>"; }; > 72227A7621B586E8008EC3E4 /* SVGDecoratedPrimitive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDecoratedPrimitive.h; sourceTree = "<group>"; }; > 72227A7721B586E8008EC3E4 /* SVGDecoratedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDecoratedProperty.h; sourceTree = "<group>"; }; >+ 72227A7F21B6DC6D008EC3E4 /* SVGAnimatedDecoratedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedDecoratedProperty.h; sourceTree = "<group>"; }; >+ 72227A8021B6DC6E008EC3E4 /* SVGAnimatedPropertyImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyImpl.h; sourceTree = "<group>"; }; >+ 72227A8121B6DC6E008EC3E4 /* SVGAnimatedPrimitiveProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPrimitiveProperty.h; sourceTree = "<group>"; }; >+ 72227A8221B6DC6F008EC3E4 /* SVGAnimatedPropertyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyList.h; sourceTree = "<group>"; }; >+ 72227A8321B6DC6F008EC3E4 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.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>"; }; >@@ -15756,17 +15761,22 @@ > 081CDFBD126ECFE800D215CA /* properties */ = { > isa = PBXGroup; > children = ( >+ 72227A7F21B6DC6D008EC3E4 /* SVGAnimatedDecoratedProperty.h */, > 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */, > 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */, > 55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */, > 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */, >+ 72227A8121B6DC6E008EC3E4 /* SVGAnimatedPrimitiveProperty.h */, > 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */, > 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */, >+ 72227A8021B6DC6E008EC3E4 /* SVGAnimatedPropertyImpl.h */, > 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */, >+ 72227A8221B6DC6F008EC3E4 /* SVGAnimatedPropertyList.h */, > 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */, > 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */, > 08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */, > 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */, >+ 72227A8321B6DC6F008EC3E4 /* SVGAnimatedValueProperty.h */, > 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */, > 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */, > 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */, >diff --git a/Source/WebCore/svg/properties/SVGAnimatedDecoratedProperty.h b/Source/WebCore/svg/properties/SVGAnimatedDecoratedProperty.h >index 8b137891791..803ada72bd5 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedDecoratedProperty.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedDecoratedProperty.h >@@ -1 +1,139 @@ >+/* >+ * 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 "SVGAnimatedProperty.h" >+#include "SVGDecoratedProperty.h" >+ >+namespace WebCore { >+ >+template<template <typename, typename> class DecoratedProperty, typename DecorationType> >+class SVGAnimatedDecoratedProperty : public SVGAnimatedProperty { >+public: >+ template<typename PropertyType, typename AnimatedProperty = SVGAnimatedDecoratedProperty> >+ static Ref<AnimatedProperty> create(SVGElement* contextElement) >+ { >+ return adoptRef(*new AnimatedProperty(contextElement, std::make_unique<DecoratedProperty<DecorationType, PropertyType>>())); >+ } >+ >+ template<typename PropertyType, typename AnimatedProperty = SVGAnimatedDecoratedProperty> >+ static Ref<AnimatedProperty> create(SVGElement* contextElement, const PropertyType& value) >+ { >+ return adoptRef(*new AnimatedProperty(contextElement, DecoratedProperty<DecorationType, PropertyType>::create(value))); >+ } >+ >+ SVGAnimatedDecoratedProperty(SVGElement* contextElement, std::unique_ptr<SVGDecoratedProperty<DecorationType>>&& baseVal) >+ : SVGAnimatedProperty(contextElement) >+ , m_baseVal(WTFMove(baseVal)) >+ { >+ } >+ >+ // Used by the DOM. >+ ExceptionOr<void> setBaseVal(const DecorationType& baseVal) >+ { >+ if (!m_baseVal->setValue(baseVal)) >+ return Exception { TypeError }; >+ commitPropertyChange(nullptr); >+ return { }; >+ } >+ >+ // Used by SVGElement::parseAttribute(). >+ template<typename PropertyType> >+ void setBaseValInternal(const PropertyType& baseVal) >+ { >+ m_baseVal->setValueInternal(static_cast<DecorationType>(baseVal)); >+ if (m_animVal) >+ m_animVal->setValueInternal(static_cast<DecorationType>(baseVal)); >+ } >+ >+ DecorationType baseVal() const { return m_baseVal->value(); } >+ >+ // Used by SVGAnimator::progress. >+ template<typename PropertyType> >+ void setAnimVal(const PropertyType& animVal) >+ { >+ ASSERT(isAnimating() && m_animVal); >+ m_animVal->setValueInternal(static_cast<DecorationType>(animVal)); >+ } >+ >+ template<typename PropertyType = DecorationType> >+ PropertyType animVal() const >+ { >+ ASSERT_IMPLIES(isAnimating(), m_animVal); >+ return static_cast<PropertyType>((isAnimating() ? m_animVal : m_baseVal)->value()); >+ } >+ >+ // Used when committing a change from the SVGAnimatedProperty to the attribute. >+ String baseValAsString() const override { return m_baseVal->valueAsString(); } >+ >+ // Used to apply the SVGAnimator change to the target element. >+ String animValAsString() const override >+ { >+ ASSERT(isAnimating() && !!m_animVal); >+ return m_animVal->valueAsString(); >+ } >+ >+ // Managing the relationship with the owner. >+ void setDirty() override { m_state = SVGPropertyState::Dirty; } >+ bool isDirty() const override { return m_state == SVGPropertyState::Dirty; } >+ std::optional<String> synchronize() override >+ { >+ if (m_state == SVGPropertyState::Clean) >+ return std::nullopt; >+ m_state = SVGPropertyState::Clean; >+ return baseValAsString(); >+ } >+ >+ // Used by RenderSVGElements and DumpRenderTree. >+ template<typename PropertyType> >+ PropertyType currentValue() const >+ { >+ return static_cast<PropertyType>((isAnimating() ? m_animVal : m_baseVal)->valueInternal()); >+ } >+ >+ // Controlling the animation. >+ void startAnimation() override >+ { >+ if (isAnimating()) >+ return; >+ m_animVal = m_baseVal->clone(); >+ SVGAnimatedProperty::startAnimation(); >+ } >+ void stopAnimation() override >+ { >+ if (!isAnimating()) >+ return; >+ m_animVal = nullptr; >+ SVGAnimatedProperty::stopAnimation(); >+ } >+ >+protected: >+ std::unique_ptr<SVGDecoratedProperty<DecorationType>> m_baseVal; >+ std::unique_ptr<SVGDecoratedProperty<DecorationType>> m_animVal; >+ SVGPropertyState m_state { SVGPropertyState::Clean }; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPrimitiveProperty.h b/Source/WebCore/svg/properties/SVGAnimatedPrimitiveProperty.h >index 8b137891791..7a9cc63771d 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPrimitiveProperty.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPrimitiveProperty.h >@@ -1 +1,140 @@ >+/* >+ * 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 "SVGAnimatedProperty.h" >+ >+namespace WebCore { >+ >+template<typename PropertyType> >+class SVGAnimatedPrimitiveProperty : public SVGAnimatedProperty { >+public: >+ using ValueType = PropertyType; >+ >+ static Ref<SVGAnimatedPrimitiveProperty> create(SVGElement* contextElement) >+ { >+ return adoptRef(*new SVGAnimatedPrimitiveProperty(contextElement)); >+ } >+ >+ static Ref<SVGAnimatedPrimitiveProperty> create(SVGElement* contextElement, const PropertyType& value) >+ { >+ return adoptRef(*new SVGAnimatedPrimitiveProperty(contextElement, value)); >+ } >+ >+ // Used by the DOM. >+ ExceptionOr<void> setBaseVal(const PropertyType& baseVal) >+ { >+ m_baseVal = baseVal; >+ commitPropertyChange(nullptr); >+ return { }; >+ } >+ >+ // Used by SVGElement::parseAttribute(). >+ void setBaseValInternal(const PropertyType& baseVal) { m_baseVal = baseVal; } >+ const PropertyType& baseVal() const { return m_baseVal; } >+ >+ // Used by SVGAnimator::progress. >+ void setAnimVal(const PropertyType& animVal) >+ { >+ ASSERT(isAnimating()); >+ m_animVal = animVal; >+ } >+ >+ const PropertyType& animVal() const >+ { >+ ASSERT_IMPLIES(isAnimating(), m_animVal); >+ return isAnimating() ? *m_animVal : m_baseVal; >+ } >+ >+ PropertyType& animVal() >+ { >+ ASSERT_IMPLIES(isAnimating(), m_animVal); >+ return isAnimating() ? *m_animVal : m_baseVal; >+ } >+ >+ // Used when committing a change from the SVGAnimatedProperty to the attribute. >+ String baseValAsString() const override { return SVGPropertyTraits<PropertyType>::toString(m_baseVal); } >+ >+ // Used to apply the SVGAnimator change to the target element. >+ String animValAsString() const override >+ { >+ ASSERT(isAnimating() && !!m_animVal); >+ return SVGPropertyTraits<PropertyType>::toString(*m_animVal); >+ } >+ >+ // Managing the relationship with the owner. >+ void setDirty() override { m_state = SVGPropertyState::Dirty; } >+ bool isDirty() const override { return m_state == SVGPropertyState::Dirty; } >+ std::optional<String> synchronize() override >+ { >+ if (m_state == SVGPropertyState::Clean) >+ return std::nullopt; >+ m_state = SVGPropertyState::Clean; >+ return baseValAsString(); >+ } >+ >+ // Used by RenderSVGElements and DumpRenderTree. >+ const PropertyType& currentValue() const >+ { >+ ASSERT_IMPLIES(isAnimating(), m_animVal); >+ return isAnimating() ? *m_animVal : m_baseVal; >+ } >+ >+ // Controlling the animation. >+ void startAnimation() override >+ { >+ if (isAnimating()) >+ return; >+ m_animVal = m_baseVal; >+ SVGAnimatedProperty::startAnimation(); >+ } >+ void stopAnimation() override >+ { >+ if (!isAnimating()) >+ return; >+ m_animVal = std::nullopt; >+ SVGAnimatedProperty::stopAnimation(); >+ } >+ >+protected: >+ SVGAnimatedPrimitiveProperty(SVGElement* contextElement) >+ : SVGAnimatedProperty(contextElement) >+ , m_baseVal(SVGPropertyTraits<PropertyType>::initialValue()) >+ { >+ } >+ >+ SVGAnimatedPrimitiveProperty(SVGElement* contextElement, const PropertyType& value) >+ : SVGAnimatedProperty(contextElement) >+ , m_baseVal(value) >+ { >+ } >+ >+ PropertyType m_baseVal; >+ mutable std::optional<PropertyType> m_animVal; >+ SVGPropertyState m_state { SVGPropertyState::Clean }; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp b/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >index e4eec385bfe..58d1c3bd9d8 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >+++ b/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >@@ -26,37 +26,16 @@ > > namespace WebCore { > >-SVGAnimatedProperty::SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType) >- : m_contextElement(contextElement) >- , m_attributeName(attributeName) >- , m_animatedPropertyType(animatedPropertyType) >+SVGPropertyOwner* SVGAnimatedProperty::owner() const > { >+ // Casting from SVGElement to SVGPropertyOwner requires SVGElement.h. >+ return m_contextElement; > } > >-SVGAnimatedProperty::~SVGAnimatedProperty() >+void SVGAnimatedProperty::commitPropertyChange(SVGProperty*) > { >- // Assure that animationEnded() was called, if animationStarted() was called before. >- ASSERT(!isAnimating()); >- >- // Remove wrapper from cache. >- for (auto& cache : animatedPropertyCache()) { >- if (cache.value == this) { >- animatedPropertyCache().remove(cache.key); >- return; >- } >- } >- >- RELEASE_ASSERT_NOT_REACHED(); >+ if (m_contextElement) >+ m_contextElement->commitPropertyChange(this); > } > >-void SVGAnimatedProperty::commitChange() >-{ >- ASSERT(m_contextElement); >- ASSERT(!m_contextElement->m_deletionHasBegun); >- m_contextElement->invalidateSVGAttributes(); >- m_contextElement->svgAttributeChanged(m_attributeName); >- // Needed to synchronize with CSSOM for presentation attributes with SVG DOM. >- m_contextElement->synchronizeAnimatedSVGAttribute(m_attributeName); > } >- >-} // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAnimatedProperty.h b/Source/WebCore/svg/properties/SVGAnimatedProperty.h >index 8dc52dd11ed..c00ca91ea4c 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedProperty.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedProperty.h >@@ -21,73 +21,48 @@ > > #pragma once > >-#include "QualifiedName.h" >-#include "SVGAnimatedPropertyDescription.h" >-#include "SVGAnimatedPropertyType.h" >-#include <wtf/RefCounted.h> >+#include "ExceptionOr.h" >+#include "SVGProperty.h" > > namespace WebCore { > >-class SVGElement; >-class SVGProperty; >- >-class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> { >+class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty>, public SVGPropertyOwner { > public: >- virtual ~SVGAnimatedProperty(); >- virtual bool isAnimating() const { return false; } >- virtual bool isAnimatedListTearOff() const { return false; } >+ virtual ~SVGAnimatedProperty() = default; > >- SVGElement* contextElement() const { return m_contextElement.get(); } >- const QualifiedName& attributeName() const { return m_attributeName; } >- AnimatedPropertyType animatedPropertyType() const { return m_animatedPropertyType; } >- bool isReadOnly() const { return m_isReadOnly; } >- void setIsReadOnly() { m_isReadOnly = true; } >+ // Manage the relationship with the owner. >+ bool isAttached() const { return m_contextElement; } >+ void detach() { m_contextElement = nullptr; } >+ SVGElement* contextElement() const { return m_contextElement; } > >- void commitChange(); >+ virtual String baseValAsString() const { return emptyString(); } >+ virtual String animValAsString() const { return emptyString(); } > >- template<typename TearOffType, typename PropertyType, AnimatedPropertyType animatedType> >- static RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(SVGElement& element, const QualifiedName& attributeName, const AtomicString& identifier, PropertyType& property, AnimatedPropertyState animatedState) >- { >- SVGAnimatedPropertyDescription key(&element, identifier); >+ // Control the synchronization between the attribute and its reflection in baseVal. >+ virtual bool isDirty() const { return false; } >+ virtual void setDirty() { } >+ virtual std::optional<String> synchronize() { return std::nullopt; } > >- auto result = animatedPropertyCache().add(key, nullptr); >- if (!result.isNewEntry) >- return result.iterator->value; >+ // Control the animation life cycle. >+ bool isAnimating() const { return m_isAnimating; } >+ virtual void startAnimation() { m_isAnimating = true; } >+ virtual void stopAnimation() { m_isAnimating = false; } > >- auto wrapper = TearOffType::create(&element, attributeName, animatedType, property); >- if (animatedState == PropertyIsReadOnly) >- wrapper->setIsReadOnly(); >- >- // Cache the raw pointer but return a RefPtr<>. This will break the cyclic reference >- // between SVGAnimatedProperty and SVGElement once the property pointer is not needed. >- result.iterator->value = wrapper.ptr(); >- return static_reference_cast<SVGAnimatedProperty>(wrapper); >- } >- >- static RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGElement& element, const AtomicString& identifier) >- { >- SVGAnimatedPropertyDescription key(const_cast<SVGElement*>(&element), identifier); >- return animatedPropertyCache().get(key); >- } >+ // Attach/Detach the animVal of the traget element's property by the instance element's property. >+ virtual void instanceStartAnimation(SVGAnimatedProperty&) { m_isAnimating = true; } >+ virtual void instanceStopAnimation() { m_isAnimating = false; } > > protected: >- SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType); >- >-private: >- // Caching facilities. >- using Cache = HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits>; >- static Cache& animatedPropertyCache() >+ SVGAnimatedProperty(SVGElement* contextElement) >+ : m_contextElement(contextElement) > { >- static NeverDestroyed<Cache> cache; >- return cache; > } > >- RefPtr<SVGElement> m_contextElement; >- const QualifiedName& m_attributeName; >- AnimatedPropertyType m_animatedPropertyType; >+ SVGPropertyOwner* owner() const override; >+ void commitPropertyChange(SVGProperty*) override; > >-protected: >- bool m_isReadOnly { false }; >+ SVGElement* m_contextElement { nullptr }; >+ bool m_isAnimating { false }; > }; > >-} // namespace WebCore >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h >index 8b137891791..8764475de30 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h >@@ -1 +1,101 @@ >+/* >+ * 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 "SVGAngle.h" >+#include "SVGAnimatedDecoratedProperty.h" >+#include "SVGAnimatedPrimitiveProperty.h" >+#include "SVGAnimatedPropertyList.h" >+#include "SVGAnimatedValueProperty.h" >+#include "SVGDecoratedEnumeration.h" >+#include "SVGLength.h" >+#include "SVGLengthList.h" >+#include "SVGMarkerTypes.h" >+#include "SVGNumberList.h" >+#include "SVGPathSegList.h" >+#include "SVGPointList.h" >+#include "SVGPreserveAspectRatio.h" >+#include "SVGRect.h" >+#include "SVGTransformList.h" >+ >+namespace WebCore { >+ >+using SVGAnimatedBoolean = SVGAnimatedPrimitiveProperty<bool>; >+using SVGAnimatedInteger = SVGAnimatedPrimitiveProperty<int>; >+using SVGAnimatedNumber = SVGAnimatedPrimitiveProperty<float>; >+using SVGAnimatedString = SVGAnimatedPrimitiveProperty<String>; >+ >+using SVGAnimatedEnumeration = SVGAnimatedDecoratedProperty<SVGDecoratedEnumeration, unsigned>; >+ >+using SVGAnimatedRect = SVGAnimatedValueProperty<SVGRect>; >+using SVGAnimatedAngle = SVGAnimatedValueProperty<SVGAngle>; >+using SVGAnimatedLength = SVGAnimatedValueProperty<SVGLength>; >+using SVGAnimatedPreserveAspectRatio = SVGAnimatedValueProperty<SVGPreserveAspectRatio>; >+ >+using SVGAnimatedLengthList = SVGAnimatedPropertyList<SVGLengthList>; >+using SVGAnimatedNumberList = SVGAnimatedPropertyList<SVGNumberList>; >+using SVGAnimatedPointList = SVGAnimatedPropertyList<SVGPointList>; >+using SVGAnimatedTransformList = SVGAnimatedPropertyList<SVGTransformList>; >+ >+class SVGAnimatedOrientType : public SVGAnimatedEnumeration { >+public: >+ using SVGAnimatedEnumeration::SVGAnimatedEnumeration; >+ >+ static Ref<SVGAnimatedOrientType> create(SVGElement* contextElement, SVGMarkerOrientType baseValue) >+ { >+ return SVGAnimatedEnumeration::create<SVGMarkerOrientType, SVGAnimatedOrientType>(contextElement, baseValue); >+ } >+}; >+ >+class SVGAnimatedPathSegList : public SVGAnimatedPropertyList<SVGPathSegList> { >+ using Base = SVGAnimatedPropertyList<SVGPathSegList>; >+ using Base::Base; >+ >+public: >+ static Ref<SVGAnimatedPathSegList> create(SVGElement* contextElement) >+ { >+ return adoptRef(*new SVGAnimatedPathSegList(contextElement)); >+ } >+ >+ SVGPathByteStream& currentPathByteStream() >+ { >+ return isAnimating() ? animVal()->pathByteStream() : baseVal()->pathByteStream(); >+ } >+ >+ Path currentPath() >+ { >+ return isAnimating() ? animVal()->path() : baseVal()->path(); >+ } >+ >+ size_t approximateMemoryCost() const >+ { >+ if (isAnimating()) >+ return baseVal()->approximateMemoryCost() + animVal()->approximateMemoryCost(); >+ return baseVal()->approximateMemoryCost(); >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h >index 8b137891791..a66df06bb7f 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyList.h >@@ -1 +1,137 @@ >+/* >+ * 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 "SVGAnimatedProperty.h" >+ >+namespace WebCore { >+ >+template<typename ListType> >+class SVGAnimatedPropertyList : public SVGAnimatedProperty { >+public: >+ template<typename... Arguments> >+ static Ref<SVGAnimatedPropertyList> create(SVGElement* contextElement, Arguments&&... arguments) >+ { >+ return adoptRef(*new SVGAnimatedPropertyList(contextElement, std::forward<Arguments>(arguments)...)); >+ } >+ >+ ~SVGAnimatedPropertyList() >+ { >+ m_baseVal->detach(); >+ if (m_animVal) >+ m_animVal->detach(); >+ } >+ >+ // Used by the DOM. >+ const Ref<ListType>& baseVal() const { return m_baseVal; } >+ >+ // Used by SVGElement::parseAttribute(). >+ Ref<ListType>& baseVal() { return m_baseVal; } >+ >+ // Used by the DOM. >+ const RefPtr<ListType>& animVal() const { return const_cast<SVGAnimatedPropertyList*>(this)->ensureAnimVal(); } >+ >+ // Called by SVGAnimatedPropertyAnimator to pass the animVal to the SVGAnimationFunction::progress. >+ RefPtr<ListType>& animVal() { return ensureAnimVal(); } >+ >+ // Used when committing a change from the SVGAnimatedProperty to the attribute. >+ String baseValAsString() const override { return m_baseVal->valueAsString(); } >+ >+ // Used to apply the SVGAnimator change to the target element. >+ String animValAsString() const override >+ { >+ ASSERT(isAnimating()); >+ return m_animVal->valueAsString(); >+ } >+ >+ // Managing the relationship with the owner. >+ void setDirty() override { m_baseVal->setDirty(); } >+ bool isDirty() const override { return m_baseVal->isDirty(); } >+ std::optional<String> synchronize() override { return m_baseVal->synchronize(); } >+ >+ // Used by RenderSVGElements and DumpRenderTree. >+ const ListType& currentValue() const >+ { >+ ASSERT_IMPLIES(isAnimating(), m_animVal); >+ return isAnimating() ? *m_animVal : m_baseVal.get(); >+ } >+ >+ // Controlling the animation. >+ void startAnimation() override >+ { >+ if (m_animVal) >+ *m_animVal = m_baseVal; >+ else >+ ensureAnimVal(); >+ SVGAnimatedProperty::startAnimation(); >+ } >+ void stopAnimation() override >+ { >+ if (m_animVal) >+ *m_animVal = m_baseVal; >+ SVGAnimatedProperty::stopAnimation(); >+ } >+ >+ // Controlling the instance animation. >+ void instanceStartAnimation(SVGAnimatedProperty& animated) override >+ { >+ m_animVal = static_cast<SVGAnimatedPropertyList&>(animated).animVal(); >+ SVGAnimatedProperty::instanceStartAnimation(animated); >+ } >+ void instanceStopAnimation() override >+ { >+ m_animVal = nullptr; >+ SVGAnimatedProperty::instanceStopAnimation(); >+ } >+ >+protected: >+ template<typename... Arguments> >+ SVGAnimatedPropertyList(SVGElement* contextElement, Arguments&&... arguments) >+ : SVGAnimatedProperty(contextElement) >+ , m_baseVal(ListType::create(this, SVGPropertyAccess::ReadWrite, std::forward<Arguments>(arguments)...)) >+ { >+ } >+ >+ RefPtr<ListType>& ensureAnimVal() >+ { >+ if (!m_animVal) >+ m_animVal = ListType::create(m_baseVal, SVGPropertyAccess::ReadOnly); >+ return m_animVal; >+ } >+ >+ // Called when m_baseVal changes or an item in m_baseVal changes. >+ void commitPropertyChange(SVGProperty* property) override >+ { >+ if (m_animVal) >+ *m_animVal = m_baseVal; >+ SVGAnimatedProperty::commitPropertyChange(property); >+ } >+ >+ Ref<ListType> m_baseVal; >+ mutable RefPtr<ListType> m_animVal; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h b/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h >index 8b137891791..8b78b095201 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h >@@ -1 +1,162 @@ >+/* >+ * 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 "SVGAnimatedProperty.h" >+ >+namespace WebCore { >+ >+template<typename PropertyType> >+class SVGAnimatedValueProperty : public SVGAnimatedProperty { >+public: >+ using ValueType = typename PropertyType::ValueType; >+ >+ template<typename... Arguments> >+ static Ref<SVGAnimatedValueProperty> create(SVGElement* contextElement, Arguments&&... arguments) >+ { >+ return adoptRef(*new SVGAnimatedValueProperty(contextElement, std::forward<Arguments>(arguments)...)); >+ } >+ >+ ~SVGAnimatedValueProperty() >+ { >+ m_baseVal->detach(); >+ if (m_animVal) >+ m_animVal->detach(); >+ } >+ >+ // Used by SVGElement::parseAttribute(). >+ void setBaseValInternal(const ValueType& baseVal) >+ { >+ m_baseVal->setValue(baseVal); >+ if (m_animVal) >+ m_animVal->setValue(baseVal); >+ } >+ >+ // Used by the DOM. >+ const Ref<PropertyType>& baseVal() const { return m_baseVal; } >+ >+ Ref<PropertyType>& baseVal() { return m_baseVal; } >+ >+ // Used by SVGAnimator::progress. >+ void setAnimVal(const ValueType& animVal) >+ { >+ ASSERT(isAnimating() && m_animVal); >+ m_animVal->setValue(animVal); >+ } >+ >+ // Used by the DOM. >+ const RefPtr<PropertyType>& animVal() const { return const_cast<SVGAnimatedValueProperty*>(this)->ensureAnimVal(); } >+ >+ // Called by SVGAnimatedPropertyAnimator to pass the animVal to the SVGAnimationFunction::progress. >+ RefPtr<PropertyType>& animVal() { return ensureAnimVal(); } >+ >+ // Used when committing a change from the SVGAnimatedProperty to the attribute. >+ String baseValAsString() const override { return m_baseVal->valueAsString(); } >+ >+ // Used to apply the SVGAnimator change to the target element. >+ String animValAsString() const override >+ { >+ ASSERT(isAnimating() && m_animVal); >+ return m_animVal->valueAsString(); >+ } >+ >+ // Managing the relationship with the owner. >+ void setDirty() override { m_baseVal->setDirty(); } >+ bool isDirty() const override { return m_baseVal->isDirty(); } >+ std::optional<String> synchronize() override { return m_baseVal->synchronize(); } >+ >+ // Used by RenderSVGElements and DumpRenderTree. >+ const ValueType& currentValue() const >+ { >+ ASSERT_IMPLIES(isAnimating(), m_animVal); >+ return (isAnimating() ? *m_animVal : m_baseVal.get()).value(); >+ } >+ >+ // Controlling the animation. >+ void startAnimation() override >+ { >+ if (m_animVal) >+ m_animVal->setValue(m_baseVal->value()); >+ else >+ ensureAnimVal(); >+ SVGAnimatedProperty::startAnimation(); >+ } >+ void stopAnimation() override >+ { >+ if (m_animVal) >+ m_animVal->setValue(m_baseVal->value()); >+ SVGAnimatedProperty::stopAnimation(); >+ } >+ >+ // Controlling the instance animation. >+ void instanceStartAnimation(SVGAnimatedProperty& animated) override >+ { >+ m_animVal = static_cast<SVGAnimatedValueProperty&>(animated).animVal(); >+ SVGAnimatedProperty::instanceStartAnimation(animated); >+ } >+ void instanceStopAnimation() override >+ { >+ m_animVal = nullptr; >+ SVGAnimatedProperty::instanceStopAnimation(); >+ } >+ >+protected: >+ // The packed arguments are used in PropertyType creation, for example passing >+ // SVGLengthMode to SVGLength. >+ template<typename... Arguments> >+ SVGAnimatedValueProperty(SVGElement* contextElement, Arguments&&... arguments) >+ : SVGAnimatedProperty(contextElement) >+ , m_baseVal(PropertyType::create(this, SVGPropertyAccess::ReadWrite, ValueType(std::forward<Arguments>(arguments)...))) >+ { >+ } >+ >+ template<typename... Arguments> >+ SVGAnimatedValueProperty(SVGElement* contextElement, SVGPropertyAccess access, Arguments&&... arguments) >+ : SVGAnimatedProperty(contextElement) >+ , m_baseVal(PropertyType::create(this, access, ValueType(std::forward<Arguments>(arguments)...))) >+ { >+ } >+ >+ RefPtr<PropertyType>& ensureAnimVal() >+ { >+ if (!m_animVal) >+ m_animVal = PropertyType::create(this, SVGPropertyAccess::ReadOnly, m_baseVal->value()); >+ return m_animVal; >+ } >+ >+ // Called when m_baseVal changes. >+ void commitPropertyChange(SVGProperty* property) override >+ { >+ if (m_animVal) >+ m_animVal->setValue(m_baseVal->value()); >+ SVGAnimatedProperty::commitPropertyChange(property); >+ } >+ >+ Ref<PropertyType> m_baseVal; >+ mutable RefPtr<PropertyType> m_animVal; >+}; >+ >+}
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