Diff
Modified: trunk/Source/WebCore/ChangeLog (243182 => 243183)
--- trunk/Source/WebCore/ChangeLog 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/ChangeLog 2019-03-20 00:59:50 UTC (rev 243183)
@@ -1,3 +1,103 @@
+2019-03-19 Said Abou-Hallawa <sabouhall...@apple.com>
+
+ Remove the SVG property tear off objects of SVGAnimatedRect
+ https://bugs.webkit.org/show_bug.cgi?id=195949
+
+ Reviewed by Simon Fraser.
+
+ SVGRect is an SVG type, so we need to introduce two classes to represent
+ it and its animated property SVGAnimatedRect.
+
+ -- SVGValueProperty: It is derived from SVGProperty and it will be the
+ base class of all the SVG type based properties. It is basically a
+ RefCounted object with m_value member. For SVGRect, m_value will be
+ of type FloatRect.
+
+ -- SVGAnimatedValueProperty: It is derived from SVGAnimatedProperty and
+ it will be the base class of all the animated SVG type based properties.
+ It is RefCounted object with two RefCounted members: baseVal and animVal.
+ These two members are of type SVGValueProperty. For SVGAnimatedRect,
+ baseVal and animVal will be of type SVGRect.
+
+ SVGAnimatedValueProperty will be responsible for:
+
+ 1) Providing access to its baseVal and animVal. Note the same interface
+ is used internally and used by the DOM.
+
+ 2) Managing the animation of the property by starting and stopping it.
+
+ 3) Coordinating the changes in its baseVal and animVal with the owner
+ element.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * svg/SVGAnimatedRect.cpp: Removed.
+ * svg/SVGAnimatedRect.h: Removed.
+ * svg/SVGAnimatorFactory.h:
+ (WebCore::SVGAnimatorFactory::create):
+ * svg/SVGAttributeAnimationController.cpp:
+ (WebCore::SVGAttributeAnimationController::calculateAnimatedValue):
+ This is a bug from r243036. The <set> can be the tag of m_animationElement
+ not m_targetElement.
+ * svg/SVGAttributeAnimationController.h:
+ * svg/SVGAttributeAnimationControllerBase.h:
+ * svg/SVGFitToViewBox.cpp:
+ (WebCore::SVGFitToViewBox::SVGFitToViewBox):
+ (WebCore::SVGFitToViewBox::registerAttributes):
+ (WebCore::SVGFitToViewBox::setViewBox):
+ (WebCore::SVGFitToViewBox::resetViewBox):
+ * svg/SVGFitToViewBox.h:
+ (WebCore::SVGFitToViewBox::viewBox const):
+ (WebCore::SVGFitToViewBox::viewBoxAnimated):
+ (WebCore::SVGFitToViewBox::viewBoxString const):
+ * svg/SVGMarkerElement.h:
+ * svg/SVGPatternElement.h:
+ * svg/SVGRect.h:
+ (WebCore::SVGRect::create):
+ (WebCore::SVGRect::x):
+ (WebCore::SVGRect::setX):
+ (WebCore::SVGRect::y):
+ (WebCore::SVGRect::setY):
+ (WebCore::SVGRect::width):
+ (WebCore::SVGRect::setWidth):
+ (WebCore::SVGRect::height):
+ (WebCore::SVGRect::setHeight):
+ (WebCore::SVGRect::SVGRect): Deleted.
+ * svg/SVGSVGElement.cpp:
+ (WebCore::checkIntersectionWithoutUpdatingLayout):
+ (WebCore::checkEnclosureWithoutUpdatingLayout):
+ * svg/SVGSVGElement.h:
+ * svg/SVGSymbolElement.h:
+ * svg/SVGViewSpec.cpp:
+ (WebCore::SVGViewSpec::SVGViewSpec):
+ * svg/SVGViewSpec.h:
+ * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
+ * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
+ * svg/properties/SVGAnimatedPropertyImpl.h:
+ * 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):
+ * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
+ (WebCore::SVGAnimationRectFunction::progress):
+ * svg/properties/SVGAttributeRegistry.h:
+ * svg/properties/SVGPropertyOwnerRegistry.h:
+ (WebCore::SVGPropertyOwnerRegistry::registerProperty):
+ * svg/properties/SVGValueProperty.h: Added.
+ (WebCore::SVGValueProperty::create):
+ (WebCore::SVGValueProperty::value const):
+ (WebCore::SVGValueProperty::setValue):
+ (WebCore::SVGValueProperty::value):
+ (WebCore::SVGValueProperty::SVGValueProperty):
+
2019-03-19 John Wilander <wilan...@apple.com>
Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
Modified: trunk/Source/WebCore/Sources.txt (243182 => 243183)
--- trunk/Source/WebCore/Sources.txt 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/Sources.txt 2019-03-20 00:59:50 UTC (rev 243183)
@@ -2280,7 +2280,6 @@
svg/SVGAnimatedPath.cpp
svg/SVGAnimatedPointList.cpp
svg/SVGAnimatedPreserveAspectRatio.cpp
-svg/SVGAnimatedRect.cpp
svg/SVGAnimatedString.cpp
svg/SVGAnimatedTransformList.cpp
svg/SVGAnimatedTypeAnimator.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243182 => 243183)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-20 00:59:50 UTC (rev 243183)
@@ -283,7 +283,6 @@
08B35B13127B6A7C005314DD /* SVGAnimatedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */; };
08B35B17127B6A88005314DD /* SVGAnimatedNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */; };
08C7A2C710DC7462002D368B /* SVGNames.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 656581E909D1508D000E61D7 /* SVGNames.h */; };
- 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C859BF1274575300A5728D /* SVGAnimatedRect.h */; };
08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C925180FCC7C4A00480DEC /* FilterEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
08CA3D4412894A3800FFF260 /* SVGMatrixTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */; };
08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */ = {isa = PBXBuildFile; fileRef = 08D46CE2127AD5FC0089694B /* SVGAnimatedEnumeration.h */; };
@@ -5663,7 +5662,6 @@
08A484760E5272C500C3FE76 /* ScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptElement.h; sourceTree = "<group>"; };
08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedNumber.h; sourceTree = "<group>"; };
08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedNumberList.h; sourceTree = "<group>"; };
- 08C859BF1274575300A5728D /* SVGAnimatedRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedRect.h; sourceTree = "<group>"; };
08C925170FCC7C4A00480DEC /* FilterEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FilterEffect.cpp; sourceTree = "<group>"; };
08C925180FCC7C4A00480DEC /* FilterEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilterEffect.h; sourceTree = "<group>"; };
08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMatrixTearOff.h; sourceTree = "<group>"; };
@@ -7577,7 +7575,6 @@
427DA71B13735DFA007C57FB /* JSServiceWorkerInternals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerInternals.cpp; sourceTree = "<group>"; };
427DA71C13735DFA007C57FB /* JSServiceWorkerInternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSServiceWorkerInternals.h; sourceTree = "<group>"; };
43107BE118CC19DE00CC18E8 /* SelectorPseudoTypeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorPseudoTypeMap.h; sourceTree = "<group>"; };
- 43142E7913B1E97700F1C871 /* SVGAnimatedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedRect.cpp; sourceTree = "<group>"; };
431A2F9A13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedNumberOptionalNumber.h; sourceTree = "<group>"; };
431A2F9B13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberOptionalNumber.cpp; sourceTree = "<group>"; };
431A2FD613B7707A007791E4 /* SVGAnimatedLengthList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedLengthList.cpp; sourceTree = "<group>"; };
@@ -9513,6 +9510,8 @@
71EFCEDE202B39C700D7C411 /* JSAnimationEffectCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAnimationEffectCustom.cpp; sourceTree = "<group>"; };
71F936F71DD4F99B00922CC7 /* tracks-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "tracks-support.js"; sourceTree = "<group>"; };
71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedEnumerationPropertyTearOff.h; sourceTree = "<group>"; };
+ 721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.h; sourceTree = "<group>"; };
+ 721443462240CAD200F12FF7 /* SVGValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValueProperty.h; sourceTree = "<group>"; };
723F97BC2238EE08007F079C /* SVGAttributeAnimationController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAttributeAnimationController.cpp; sourceTree = "<group>"; };
723F97BD2238EE08007F079C /* SVGAttributeAnimationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAnimationController.h; sourceTree = "<group>"; };
723F97BE2239512D007F079C /* SVGLegacyAttributeAnimationController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLegacyAttributeAnimationController.cpp; sourceTree = "<group>"; };
@@ -16231,6 +16230,7 @@
55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */,
08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */,
085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */,
+ 721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */,
55BE025F223B29C50032F08A /* SVGAnimationAdditiveFunction.h */,
55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */,
55BE0259223B29C10032F08A /* SVGAnimationAdditiveValueFunctionImpl.h */,
@@ -16264,6 +16264,7 @@
088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */,
088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,
0813A4E91284132600992511 /* SVGStaticPropertyTearOff.h */,
+ 721443462240CAD200F12FF7 /* SVGValueProperty.h */,
);
path = properties;
sourceTree = "<group>";
@@ -24149,8 +24150,6 @@
431A302013B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp */,
08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */,
B22277F40D00BF1F0071B782 /* SVGAnimatedPreserveAspectRatio.idl */,
- 43142E7913B1E97700F1C871 /* SVGAnimatedRect.cpp */,
- 08C859BF1274575300A5728D /* SVGAnimatedRect.h */,
B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */,
43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */,
084DB59A128008CC002A6D64 /* SVGAnimatedString.h */,
@@ -31933,7 +31932,6 @@
088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */,
088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */,
55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */,
- 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */,
08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */,
084DB59B128008CC002A6D64 /* SVGAnimatedString.h in Headers */,
08250939128BD4D800E2ED8E /* SVGAnimatedTransformList.h in Headers */,
Deleted: trunk/Source/WebCore/svg/SVGAnimatedRect.cpp (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGAnimatedRect.cpp 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.cpp 2019-03-20 00:59:50 UTC (rev 243183)
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2011. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "SVGAnimatedRect.h"
-
-#include "SVGAnimateElementBase.h"
-#include "SVGParserUtilities.h"
-
-namespace WebCore {
-
-SVGAnimatedRectAnimator::SVGAnimatedRectAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
- : SVGAnimatedTypeAnimator(AnimatedRect, animationElement, contextElement)
-{
-}
-
-std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
-{
- return SVGAnimatedType::create(SVGPropertyTraits<FloatRect>::fromString(string));
-}
-
-std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- return constructFromBaseValue<SVGAnimatedRect>(animatedTypes);
-}
-
-void SVGAnimatedRectAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- stopAnimValAnimationForType<SVGAnimatedRect>(animatedTypes);
-}
-
-void SVGAnimatedRectAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
-{
- resetFromBaseValue<SVGAnimatedRect>(animatedTypes, type);
-}
-
-void SVGAnimatedRectAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- animValWillChangeForType<SVGAnimatedRect>(animatedTypes);
-}
-
-void SVGAnimatedRectAnimator::animValDidChange(const SVGElementAnimatedPropertyList& animatedTypes)
-{
- animValDidChangeForType<SVGAnimatedRect>(animatedTypes);
-}
-
-void SVGAnimatedRectAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
-{
- ASSERT(from->type() == AnimatedRect);
- ASSERT(from->type() == to->type());
-
- to->as<FloatRect>() += from->as<FloatRect>();
-}
-
-void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
-{
- ASSERT(m_animationElement);
- ASSERT(m_contextElement);
-
- const auto& fromRect = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<FloatRect>();
- const auto& toRect = to->as<FloatRect>();
- const auto& toAtEndOfDurationRect = toAtEndOfDuration->as<FloatRect>();
- auto& animatedRect = animated->as<FloatRect>();
-
- float animatedX = animatedRect.x();
- float animatedY = animatedRect.y();
- float animatedWidth = animatedRect.width();
- float animatedHeight = animatedRect.height();
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.x(), toRect.x(), toAtEndOfDurationRect.x(), animatedX);
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.y(), toRect.y(), toAtEndOfDurationRect.y(), animatedY);
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.width(), toRect.width(), toAtEndOfDurationRect.width(), animatedWidth);
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.height(), toRect.height(), toAtEndOfDurationRect.height(), animatedHeight);
-
- animatedRect = FloatRect(animatedX, animatedY, animatedWidth, animatedHeight);
-}
-
-float SVGAnimatedRectAnimator::calculateDistance(const String&, const String&)
-{
- // FIXME: Distance calculation is not possible for SVGRect right now. We need the distance of for every single value.
- return -1;
-}
-
-}
Deleted: trunk/Source/WebCore/svg/SVGAnimatedRect.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGAnimatedRect.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "SVGAnimatedPropertyTearOff.h"
-#include "SVGAnimatedTypeAnimator.h"
-#include "SVGAttributeAccessor.h"
-#include "SVGRect.h"
-
-namespace WebCore {
-
-class SVGAnimationElement;
-class SVGRect;
-
-using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGRect>;
-using SVGAnimatedRectAttribute = SVGAnimatedAttribute<SVGAnimatedRect>;
-
-template<typename OwnerType>
-using SVGAnimatedRectAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedRectAttribute, AnimatedRect>;
-
-class SVGAnimatedRectAnimator final : public SVGAnimatedTypeAnimator {
-public:
- SVGAnimatedRectAnimator(SVGAnimationElement*, SVGElement*);
-
- std::unique_ptr<SVGAnimatedType> constructFromString(const String&) override;
- std::unique_ptr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
- void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
- void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SVGAnimatedType&) override;
- void animValWillChange(const SVGElementAnimatedPropertyList&) override;
- void animValDidChange(const SVGElementAnimatedPropertyList&) override;
-
- void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) override;
- void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) override;
- float calculateDistance(const String& fromString, const String& toString) override;
-
- static bool parseSVGRect(const String&, FloatRect&);
-};
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGAnimatorFactory.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGAnimatorFactory.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGAnimatorFactory.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -30,7 +30,6 @@
#include "SVGAnimatedPath.h"
#include "SVGAnimatedPointList.h"
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedTransformList.h"
@@ -75,7 +74,7 @@
case AnimatedPreserveAspectRatio:
return std::make_unique<SVGAnimatedPreserveAspectRatioAnimator>(animationElement, contextElement);
case AnimatedRect:
- return std::make_unique<SVGAnimatedRectAnimator>(animationElement, contextElement);
+ return nullptr;
case AnimatedString:
return std::make_unique<SVGAnimatedStringAnimator>(animationElement, contextElement);
case AnimatedTransformList:
Modified: trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp 2019-03-20 00:59:50 UTC (rev 243183)
@@ -109,7 +109,7 @@
void SVGAttributeAnimationController::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*)
{
ASSERT(percentage >= 0 && percentage <= 1);
- if (m_targetElement.hasTagName(SVGNames::setTag))
+ if (m_animationElement.hasTagName(SVGNames::setTag))
percentage = 1;
if (m_animationElement.calcMode() == CalcMode::Discrete)
Modified: trunk/Source/WebCore/svg/SVGAttributeAnimationController.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGAttributeAnimationController.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGAttributeAnimationController.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -30,6 +30,7 @@
namespace WebCore {
class SVGAnimationElement;
+class SVGAttributeAnimator;
class SVGElement;
class SVGSMILElement;
Modified: trunk/Source/WebCore/svg/SVGAttributeAnimationControllerBase.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGAttributeAnimationControllerBase.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGAttributeAnimationControllerBase.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -25,6 +25,9 @@
#pragma once
+#include "QualifiedName.h"
+#include "SVGAnimatedPropertyType.h"
+
namespace WebCore {
class SVGAnimationElement;
Modified: trunk/Source/WebCore/svg/SVGFitToViewBox.cpp (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGFitToViewBox.cpp 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGFitToViewBox.cpp 2019-03-20 00:59:50 UTC (rev 243183)
@@ -34,10 +34,16 @@
namespace WebCore {
-SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState animatedState)
- : m_attributeOwnerProxy(*this, *contextElement, animatedState)
+SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, SVGPropertyAccess access)
+ : m_attributeOwnerProxy(*this, *contextElement, access == SVGPropertyAccess::ReadWrite ? PropertyIsReadWrite : PropertyIsReadOnly)
+ , m_viewBox(SVGAnimatedRect::create(contextElement, access))
{
registerAttributes();
+
+ static std::once_flag onceFlag;
+ std::call_once(onceFlag, [] {
+ PropertyRegistry::registerProperty<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>();
+ });
}
void SVGFitToViewBox::registerAttributes()
@@ -45,19 +51,18 @@
auto& registry = attributeRegistry();
if (!registry.isEmpty())
return;
- registry.registerAttribute<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>();
registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFitToViewBox::m_preserveAspectRatio>();
}
void SVGFitToViewBox::setViewBox(const FloatRect& viewBox)
{
- m_viewBox.setValue(viewBox);
+ m_viewBox->setBaseValInternal(viewBox);
m_isViewBoxValid = true;
}
void SVGFitToViewBox::resetViewBox()
{
- m_viewBox.resetValue();
+ m_viewBox->setBaseValInternal({ });
m_isViewBoxValid = false;
}
Modified: trunk/Source/WebCore/svg/SVGFitToViewBox.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGFitToViewBox.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGFitToViewBox.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -42,10 +42,10 @@
using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFitToViewBox>;
- const FloatRect& viewBox() const { return m_viewBox.currentValue(m_attributeOwnerProxy); }
+ const FloatRect& viewBox() const { return m_viewBox->currentValue(); }
const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(m_attributeOwnerProxy); }
- RefPtr<SVGAnimatedRect> viewBoxAnimated() { return m_viewBox.animatedProperty(m_attributeOwnerProxy); }
+ SVGAnimatedRect& viewBoxAnimated() { return m_viewBox; }
RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(m_attributeOwnerProxy); }
void setViewBox(const FloatRect&);
@@ -54,7 +54,7 @@
void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio.setValue(preserveAspectRatio); }
void resetPreserveAspectRatio() { m_preserveAspectRatio.resetValue(); }
- String viewBoxString() const { return m_viewBox.toString(); }
+ String viewBoxString() const { return SVGPropertyTraits<FloatRect>::toString(viewBox()); }
String preserveAspectRatioString() const { return m_preserveAspectRatio.toString(); }
bool hasValidViewBox() const { return m_isViewBoxValid; }
@@ -61,7 +61,7 @@
bool hasEmptyViewBox() const { return m_isViewBoxValid && viewBox().isEmpty(); }
protected:
- SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState = PropertyIsReadWrite);
+ SVGFitToViewBox(SVGElement* contextElement, SVGPropertyAccess = SVGPropertyAccess::ReadWrite);
static bool isKnownAttribute(const QualifiedName& attributeName)
{
@@ -77,7 +77,7 @@
static void registerAttributes();
AttributeOwnerProxy m_attributeOwnerProxy;
- SVGAnimatedRectAttribute m_viewBox;
+ Ref<SVGAnimatedRect> m_viewBox;
SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio;
bool m_isViewBoxValid { false };
};
Modified: trunk/Source/WebCore/svg/SVGMarkerElement.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGMarkerElement.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -25,7 +25,6 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGElement.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
Modified: trunk/Source/WebCore/svg/SVGPatternElement.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGPatternElement.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGPatternElement.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -24,7 +24,6 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGAnimatedTransformList.h"
#include "SVGElement.h"
#include "SVGExternalResourcesRequired.h"
Modified: trunk/Source/WebCore/svg/SVGRect.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGRect.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGRect.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -1,6 +1,6 @@
/*
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,34 +20,36 @@
#pragma once
-#include "SVGPropertyTearOff.h"
#include "SVGPropertyTraits.h"
+#include "SVGValueProperty.h"
namespace WebCore {
-class SVGRect : public SVGPropertyTearOff<FloatRect> {
+class SVGRect : public SVGValueProperty<FloatRect> {
+ using Base = SVGValueProperty<FloatRect>;
+ using Base::Base;
+ using Base::m_value;
+
public:
- static Ref<SVGRect> create(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatRect& value)
+ static Ref<SVGRect> create(const FloatRect& value = { })
{
- return adoptRef(*new SVGRect(animatedProperty, role, value));
+ return adoptRef(*new SVGRect(value));
}
- static Ref<SVGRect> create(const FloatRect& initialValue = { })
+ static Ref<SVGRect> create(SVGPropertyOwner* owner, SVGPropertyAccess access, const FloatRect& value = { })
{
- return adoptRef(*new SVGRect(initialValue));
+ return adoptRef(*new SVGRect(owner, access, value));
}
- template<typename T> static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& initialValue)
+ template<typename T>
+ static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& value)
{
- if (initialValue.hasException())
- return initialValue.releaseException();
- return create(initialValue.releaseReturnValue());
+ if (value.hasException())
+ return value.releaseException();
+ return adoptRef(*new SVGRect(value.releaseReturnValue()));
}
- float x()
- {
- return propertyReference().x();
- }
+ float x() { return m_value.x(); }
ExceptionOr<void> setX(float xValue)
{
@@ -54,16 +56,12 @@
if (isReadOnly())
return Exception { NoModificationAllowedError };
- propertyReference().setX(xValue);
+ m_value.setX(xValue);
commitChange();
-
return { };
}
- float y()
- {
- return propertyReference().y();
- }
+ float y() { return m_value.y(); }
ExceptionOr<void> setY(float xValue)
{
@@ -70,16 +68,12 @@
if (isReadOnly())
return Exception { NoModificationAllowedError };
- propertyReference().setY(xValue);
+ m_value.setY(xValue);
commitChange();
-
return { };
}
- float width()
- {
- return propertyReference().width();
- }
+ float width() { return m_value.width(); }
ExceptionOr<void> setWidth(float widthValue)
{
@@ -86,16 +80,12 @@
if (isReadOnly())
return Exception { NoModificationAllowedError };
- propertyReference().setWidth(widthValue);
+ m_value.setWidth(widthValue);
commitChange();
-
return { };
}
- float height()
- {
- return propertyReference().height();
- }
+ float height() { return m_value.height(); }
ExceptionOr<void> setHeight(float heightValue)
{
@@ -102,23 +92,15 @@
if (isReadOnly())
return Exception { NoModificationAllowedError };
- propertyReference().setHeight(heightValue);
+ m_value.setHeight(heightValue);
commitChange();
-
return { };
}
-
-private:
- SVGRect(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatRect& value)
- : SVGPropertyTearOff<FloatRect>(&animatedProperty, role, value)
+
+ String valueAsString() const override
{
+ return SVGPropertyTraits<FloatRect>::toString(m_value);
}
-
- explicit SVGRect(const FloatRect& initialValue)
- : SVGPropertyTearOff<FloatRect>(initialValue)
- {
- }
};
-
-} // namespace WebCore
+}
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2019-03-20 00:59:50 UTC (rev 243183)
@@ -322,12 +322,12 @@
static bool checkIntersectionWithoutUpdatingLayout(SVGElement& element, SVGRect& rect)
{
- return RenderSVGModelObject::checkIntersection(element.renderer(), rect.propertyReference());
+ return RenderSVGModelObject::checkIntersection(element.renderer(), rect.value());
}
static bool checkEnclosureWithoutUpdatingLayout(SVGElement& element, SVGRect& rect)
{
- return RenderSVGModelObject::checkEnclosure(element.renderer(), rect.propertyReference());
+ return RenderSVGModelObject::checkEnclosure(element.renderer(), rect.value());
}
Ref<NodeList> SVGSVGElement::getIntersectionList(SVGRect& rect, SVGElement* referenceElement)
Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGSVGElement.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -24,7 +24,6 @@
#include "FloatPoint.h"
#include "SVGAnimatedLength.h"
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
#include "SVGGraphicsElement.h"
Modified: trunk/Source/WebCore/svg/SVGSymbolElement.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGSymbolElement.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGSymbolElement.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -22,7 +22,6 @@
#pragma once
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGElement.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
Modified: trunk/Source/WebCore/svg/SVGViewSpec.cpp (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGViewSpec.cpp 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGViewSpec.cpp 2019-03-20 00:59:50 UTC (rev 243183)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2007, 2010 Rob Buis <b...@kde.org>
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -33,7 +33,7 @@
namespace WebCore {
SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
- : SVGFitToViewBox(&contextElement, PropertyIsReadOnly)
+ : SVGFitToViewBox(&contextElement, SVGPropertyAccess::ReadOnly)
, m_contextElement(makeWeakPtr(contextElement))
, m_attributeOwnerProxy(*this, contextElement)
{
Modified: trunk/Source/WebCore/svg/SVGViewSpec.h (243182 => 243183)
--- trunk/Source/WebCore/svg/SVGViewSpec.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/SVGViewSpec.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -21,7 +21,6 @@
#pragma once
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGFitToViewBox.h"
#include "SVGTransformListValues.h"
#include "SVGZoomAndPan.h"
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -76,4 +76,26 @@
}
};
+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 SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedRectAccessor, property>(); }
+
+private:
+ std::unique_ptr<SVGAttributeAnimator> 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, SVGAttributeAnimator& animator) const final
+ {
+ static_cast<SVGAnimatedRectAnimator&>(animator).appendAnimatedInstance(property(owner));
+ }
+};
+
}
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -36,6 +36,14 @@
public:
using AnimatorAnimatedProperty = AnimatedProperty;
+ template<typename... Arguments>
+ SVGAnimatedPropertyAnimator(const QualifiedName& attributeName, Ref<AnimatedProperty>& animated, Arguments&&... arguments)
+ : SVGAttributeAnimator(attributeName)
+ , m_animated(animated.copyRef())
+ , m_function(std::forward<Arguments>(arguments)...)
+ {
+ }
+
void appendAnimatedInstance(Ref<AnimatedProperty>& animated)
{
m_animatedInstances.append(animated.copyRef());
@@ -88,14 +96,6 @@
}
protected:
- template<typename... Arguments>
- SVGAnimatedPropertyAnimator(const QualifiedName& attributeName, Ref<AnimatedProperty>& animated, Arguments&&... arguments)
- : SVGAttributeAnimator(attributeName)
- , m_animated(animated.copyRef())
- , m_function(std::forward<Arguments>(arguments)...)
- {
- }
-
Ref<AnimatedProperty> m_animated;
Vector<Ref<AnimatedProperty>> m_animatedInstances;
AnimationFunction m_function;
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -39,12 +39,13 @@
class SVGAnimatedBooleanAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedBoolean, SVGAnimationBooleanFunction> {
using Base = SVGAnimatedPropertyAnimator<SVGAnimatedBoolean, SVGAnimationBooleanFunction>;
+
+public:
using Base::Base;
-public:
static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedBoolean>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
{
- return std::unique_ptr<SVGAnimatedBooleanAnimator>(new SVGAnimatedBooleanAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
+ return std::make_unique<SVGAnimatedBooleanAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
}
private:
@@ -59,12 +60,13 @@
friend class SVGAnimatedPropertyPairAnimator<SVGAnimatedIntegerAnimator, SVGAnimatedIntegerAnimator>;
friend class SVGAnimatedIntegerPairAnimator;
using Base = SVGAnimatedPropertyAnimator<SVGAnimatedInteger, SVGAnimationIntegerFunction>;
+
+public:
using Base::Base;
-public:
static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
{
- return std::unique_ptr<SVGAnimatedIntegerAnimator>(new SVGAnimatedIntegerAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
+ return std::make_unique<SVGAnimatedIntegerAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
}
private:
@@ -73,5 +75,23 @@
m_function.progress(targetElement, percentage, repeatCount, m_animated->animVal());
}
};
+
+class SVGAnimatedRectAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedRect, SVGAnimationRectFunction> {
+ using Base = SVGAnimatedPropertyAnimator<SVGAnimatedRect, SVGAnimationRectFunction>;
+public:
+ using Base::Base;
+
+ static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedRect>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+ {
+ return std::make_unique<SVGAnimatedRectAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+ }
+
+private:
+ void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
+ {
+ m_function.progress(targetElement, percentage, repeatCount, m_animated->animVal()->value());
+ }
+};
+
}
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -34,9 +34,10 @@
#include "SVGAnimatedPointList.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedPrimitiveProperty.h"
-#include "SVGAnimatedRect.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedTransformList.h"
+#include "SVGAnimatedValueProperty.h"
+#include "SVGRect.h"
namespace WebCore {
@@ -43,4 +44,6 @@
using SVGAnimatedBoolean = SVGAnimatedPrimitiveProperty<bool>;
using SVGAnimatedInteger = SVGAnimatedPrimitiveProperty<int>;
+using SVGAnimatedRect = SVGAnimatedValueProperty<SVGRect>;
+
}
Added: trunk/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h (0 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedValueProperty.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2018-2019 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(); }
+ 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;
+};
+
+}
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -64,5 +64,40 @@
m_to += m_from;
}
};
+
+class SVGAnimationRectFunction : public SVGAnimationAdditiveValueFunction<FloatRect> {
+public:
+ using Base = SVGAnimationAdditiveValueFunction<FloatRect>;
+ using Base::Base;
+ void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ {
+ m_from = SVGPropertyTraits<FloatRect>::fromString(from);
+ m_to = SVGPropertyTraits<FloatRect>::fromString(to);
+ }
+
+ void setToAtEndOfDurationValue(const String& toAtEndOfDuration) override
+ {
+ m_toAtEndOfDuration = SVGPropertyTraits<FloatRect>::fromString(toAtEndOfDuration);
+ }
+
+ void progress(SVGElement*, float percentage, unsigned repeatCount, FloatRect& animated)
+ {
+ FloatRect from = m_animationMode == AnimationMode::To ? animated : m_from;
+
+ float x = Base::progress(percentage, repeatCount, from.x(), m_to.x(), toAtEndOfDuration().x(), animated.x());
+ float y = Base::progress(percentage, repeatCount, from.y(), m_to.y(), toAtEndOfDuration().y(), animated.y());
+ float width = Base::progress(percentage, repeatCount, from.width(), m_to.width(), toAtEndOfDuration().width(), animated.width());
+ float height = Base::progress(percentage, repeatCount, from.height(), m_to.height(), toAtEndOfDuration().height(), animated.height());
+
+ animated = { x, y, width, height };
+ }
+
+private:
+ void addFromAndToValues(SVGElement*) override
+ {
+ m_to += m_from;
+ }
+};
+
}
Modified: trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -32,7 +32,6 @@
#include "SVGAnimatedNumberList.h"
#include "SVGAnimatedPointList.h"
#include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedRect.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedTransformList.h"
#include "SVGAttributeAccessor.h"
@@ -108,12 +107,6 @@
registerAttribute(SVGAnimatedPreserveAspectRatioAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
}
- template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedRectAttribute OwnerType::*attribute>
- void registerAttribute()
- {
- registerAttribute(SVGAnimatedRectAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
- }
-
template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedStringAttribute OwnerType::*attribute>
void registerAttribute()
{
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h (243182 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h 2019-03-20 00:28:10 UTC (rev 243182)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -55,6 +55,12 @@
registerProperty(attributeName, SVGAnimatedBooleanAccessor<OwnerType>::template singleton<property>());
}
+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedRect> OwnerType::*property>
+ static void registerProperty()
+ {
+ registerProperty(attributeName, SVGAnimatedRectAccessor<OwnerType>::template singleton<property>());
+ }
+
template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedInteger> OwnerType::*property>
static void registerProperty()
{
Added: trunk/Source/WebCore/svg/properties/SVGValueProperty.h (0 => 243183)
--- trunk/Source/WebCore/svg/properties/SVGValueProperty.h (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGValueProperty.h 2019-03-20 00:59:50 UTC (rev 243183)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2019 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 "SVGProperty.h"
+
+namespace WebCore {
+
+template<typename PropertyType>
+class SVGValueProperty : public SVGProperty {
+public:
+ using ValueType = PropertyType;
+
+ static Ref<SVGValueProperty> create()
+ {
+ return adoptRef(*new SVGValueProperty());
+ }
+
+ // Getter/Setter for the value.
+ const PropertyType& value() const { return m_value; }
+ void setValue(const PropertyType& value) { m_value = value; }
+
+ // Used by the SVGAnimatedPropertyAnimator to pass m_value to SVGAnimationFunction.
+ PropertyType& value() { return m_value; }
+
+protected:
+ // Create an initialized property, e.g creating an item to be appended in an SVGList.
+ SVGValueProperty(const PropertyType& value)
+ : m_value(value)
+ {
+ }
+
+ // Needed when value should not be copied, e.g. SVGTransfromValue.
+ SVGValueProperty(PropertyType&& value)
+ : m_value(WTFMove(value))
+ {
+ }
+
+ // Base and default constructor. Do not use "using SVGProperty::SVGProperty" because of Windows and GTK ports.
+ SVGValueProperty(SVGPropertyOwner* owner = nullptr, SVGPropertyAccess access = SVGPropertyAccess::ReadWrite)
+ : SVGProperty(owner, access)
+ {
+ }
+
+ // Create an initialized and attached property.
+ SVGValueProperty(SVGPropertyOwner* owner, SVGPropertyAccess access, const PropertyType& value)
+ : SVGProperty(owner, access)
+ , m_value(value)
+ {
+ }
+
+ PropertyType m_value;
+};
+
+}