Title: [224957] trunk/Source/WebCore
Revision
224957
Author
[email protected]
Date
2017-11-16 19:25:07 -0800 (Thu, 16 Nov 2017)

Log Message

[Web Animations] Allow KeyframeEffect to support CSS property animation blending
https://bugs.webkit.org/show_bug.cgi?id=179810

Reviewed by Tim Horton.

We used to pass nullptr instead of a valid AnimationBase when calling CSSPropertyAnimation::blendProperties()
in KeyframeEffect::applyAtLocalTime() when blending CSS styles during a keyframe animation. Without this
AnimationBase, some blending functions would crash as certain supporting calls couldn't be made.

We now add a new CSSPropertyBlendingClient virtual interface that both KeyframeEffect and AnimationBase
implement and that CSSPropertyAnimation::blendProperties() take as a parameter in order to support
blending code.

* WebCore.xcodeproj/project.pbxproj:
* animation/CSSPropertyBlendingClient.h: Added.
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::applyAtLocalTime):
(WebCore::KeyframeEffect::renderer const):
(WebCore::KeyframeEffect::currentStyle const):
* animation/KeyframeEffect.h:
* page/animation/AnimationBase.h:
(WebCore::AnimationBase::isAccelerated const):
(WebCore::AnimationBase::transformFunctionListsMatch const):
(WebCore::AnimationBase::filterFunctionListsMatch const):
(WebCore::AnimationBase::backdropFilterFunctionListsMatch const):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::blendFilterOperations):
(WebCore::blendFilter):
(WebCore::crossfadeBlend):
(WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const):
(WebCore::PropertyWrapperShadow::blendSimpleOrMatchedShadowLists const):
(WebCore::PropertyWrapperShadow::blendMismatchedShadowLists const):
(WebCore::CSSPropertyAnimation::blendProperties):
* page/animation/CSSPropertyAnimation.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224956 => 224957)


--- trunk/Source/WebCore/ChangeLog	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/ChangeLog	2017-11-17 03:25:07 UTC (rev 224957)
@@ -1,3 +1,41 @@
+2017-11-16  Antoine Quint  <[email protected]>
+
+        [Web Animations] Allow KeyframeEffect to support CSS property animation blending
+        https://bugs.webkit.org/show_bug.cgi?id=179810
+
+        Reviewed by Tim Horton.
+
+        We used to pass nullptr instead of a valid AnimationBase when calling CSSPropertyAnimation::blendProperties()
+        in KeyframeEffect::applyAtLocalTime() when blending CSS styles during a keyframe animation. Without this
+        AnimationBase, some blending functions would crash as certain supporting calls couldn't be made.
+
+        We now add a new CSSPropertyBlendingClient virtual interface that both KeyframeEffect and AnimationBase
+        implement and that CSSPropertyAnimation::blendProperties() take as a parameter in order to support
+        blending code.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * animation/CSSPropertyBlendingClient.h: Added.
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::applyAtLocalTime):
+        (WebCore::KeyframeEffect::renderer const):
+        (WebCore::KeyframeEffect::currentStyle const):
+        * animation/KeyframeEffect.h:
+        * page/animation/AnimationBase.h:
+        (WebCore::AnimationBase::isAccelerated const):
+        (WebCore::AnimationBase::transformFunctionListsMatch const):
+        (WebCore::AnimationBase::filterFunctionListsMatch const):
+        (WebCore::AnimationBase::backdropFilterFunctionListsMatch const):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc):
+        (WebCore::blendFilterOperations):
+        (WebCore::blendFilter):
+        (WebCore::crossfadeBlend):
+        (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const):
+        (WebCore::PropertyWrapperShadow::blendSimpleOrMatchedShadowLists const):
+        (WebCore::PropertyWrapperShadow::blendMismatchedShadowLists const):
+        (WebCore::CSSPropertyAnimation::blendProperties):
+        * page/animation/CSSPropertyAnimation.h:
+
 2017-11-16  Youenn Fablet  <[email protected]>
 
         Service Worker should get the body of intercepted requests

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (224956 => 224957)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-11-17 03:25:07 UTC (rev 224957)
@@ -1855,6 +1855,7 @@
 		71025EE21F99F1EC004A250C /* JSWebAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 71025ED81F99F1A6004A250C /* JSWebAnimation.h */; };
 		7117445914BC34EC00EE5FC8 /* SVGTextMetricsBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7117445714BC34E200EE5FC8 /* SVGTextMetricsBuilder.h */; };
 		7118FED515685CC60030B79A /* JSSVGViewSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 7118FED315685CC60030B79A /* JSSVGViewSpec.h */; };
+		713171341FBE78DB00F758DE /* CSSPropertyBlendingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 713171321FBE78C500F758DE /* CSSPropertyBlendingClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7134496E146941B300720312 /* SVGLengthContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7134496C146941B300720312 /* SVGLengthContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */ = {isa = PBXBuildFile; fileRef = 715379FF146BD9D6008BD615 /* SVGPathData.h */; };
 		71556CB21F9F09BA00E78D08 /* AnimationEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CAD1F9F099D00E78D08 /* AnimationEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8571,6 +8572,7 @@
 		712157C01DCCCA0700AA7A92 /* macos-fullscreen-media-controls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "macos-fullscreen-media-controls.css"; sourceTree = "<group>"; };
 		712157C11DCCCA0700AA7A92 /* macos-fullscreen-media-controls.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "macos-fullscreen-media-controls.js"; sourceTree = "<group>"; };
 		7130141D1DC9C08600CA3A88 /* pip-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "pip-support.js"; sourceTree = "<group>"; };
+		713171321FBE78C500F758DE /* CSSPropertyBlendingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPropertyBlendingClient.h; sourceTree = "<group>"; };
 		7134496B146941B300720312 /* SVGLengthContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthContext.cpp; sourceTree = "<group>"; };
 		7134496C146941B300720312 /* SVGLengthContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthContext.h; sourceTree = "<group>"; };
 		713E70AF1733E8B300A22D00 /* plugIns.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = plugIns.js; sourceTree = "<group>"; };
@@ -15848,12 +15850,12 @@
 				A91C9FBD1B6586DE00AFFD54 /* AccessibilityTree.h */,
 				A91C9FC01B659A6700AFFD54 /* AccessibilityTreeItem.cpp */,
 				A91C9FC11B659A6700AFFD54 /* AccessibilityTreeItem.h */,
+				A941AE6B1FB62BE5000F6F71 /* AccessibleNode.cpp */,
+				A941AE6D1FB62BE7000F6F71 /* AccessibleNode.h */,
+				A941AE6E1FB62BEC000F6F71 /* AccessibleNode.idl */,
 				2981CAAF131822EC00D12F2A /* AXObjectCache.cpp */,
 				29A8121A0FBB9C1D00510293 /* AXObjectCache.h */,
 				91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */,
-				A941AE6B1FB62BE5000F6F71 /* AccessibleNode.cpp */,
-				A941AE6D1FB62BE7000F6F71 /* AccessibleNode.h */,
-				A941AE6E1FB62BEC000F6F71 /* AccessibleNode.idl */,
 			);
 			path = accessibility;
 			sourceTree = "<group>";
@@ -18642,6 +18644,7 @@
 				71025EC61F99F096004A250C /* AnimationTimeline.cpp */,
 				71025EC71F99F096004A250C /* AnimationTimeline.h */,
 				71025EC91F99F096004A250C /* AnimationTimeline.idl */,
+				713171321FBE78C500F758DE /* CSSPropertyBlendingClient.h */,
 				71025EC41F99F096004A250C /* DocumentTimeline.cpp */,
 				71025EC51F99F096004A250C /* DocumentTimeline.h */,
 				71025ECA1F99F096004A250C /* DocumentTimeline.idl */,
@@ -26468,6 +26471,7 @@
 				E1ED8AC30CC49BE000BFC557 /* CSSPrimitiveValueMappings.h in Headers */,
 				A80E6CFF0A1989CA007FB8C5 /* CSSProperty.h in Headers */,
 				78D02BC6154A18DF00B62D05 /* CSSPropertyAnimation.h in Headers */,
+				713171341FBE78DB00F758DE /* CSSPropertyBlendingClient.h in Headers */,
 				656580F409D12B20000E61D7 /* CSSPropertyNames.h in Headers */,
 				946D37461D6D01D40077084F /* CSSPropertyParser.h in Headers */,
 				949C77051D6E39EA00C0DE4F /* CSSPropertyParserHelpers.h in Headers */,

Copied: trunk/Source/WebCore/animation/CSSPropertyBlendingClient.h (from rev 224956, trunk/Source/WebCore/animation/KeyframeEffect.h) (0 => 224957)


--- trunk/Source/WebCore/animation/CSSPropertyBlendingClient.h	                        (rev 0)
+++ trunk/Source/WebCore/animation/CSSPropertyBlendingClient.h	2017-11-17 03:25:07 UTC (rev 224957)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 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
+
+namespace WebCore {
+
+class RenderElement;
+class RenderStyle;
+
+class CSSPropertyBlendingClient {
+public:
+
+    virtual RenderElement* renderer() const = 0;
+    virtual const RenderStyle& currentStyle() const = 0;
+    virtual bool isAccelerated() const = 0;
+    virtual bool filterFunctionListsMatch() const = 0;
+    virtual bool transformFunctionListsMatch() const = 0;
+#if ENABLE(FILTERS_LEVEL_2)
+    virtual bool backdropFilterFunctionListsMatch() const = 0;
+#endif
+
+    virtual ~CSSPropertyBlendingClient() = default;
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (224956 => 224957)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2017-11-17 03:25:07 UTC (rev 224957)
@@ -138,7 +138,19 @@
 
     // FIXME: This will crash if we attempt to animate properties that require an AnimationBase.
     for (auto propertyId : m_keyframes[0].properties)
-        CSSPropertyAnimation::blendProperties(nullptr, propertyId, &targetStyle, &m_keyframes[0].style, &m_keyframes[1].style, progress);
+        CSSPropertyAnimation::blendProperties(this, propertyId, &targetStyle, &m_keyframes[0].style, &m_keyframes[1].style, progress);
 }
 
+RenderElement* KeyframeEffect::renderer() const
+{
+    return m_target ? m_target->renderer() : nullptr;
+}
+
+const RenderStyle& KeyframeEffect::currentStyle() const
+{
+    if (auto* renderer = this->renderer())
+        return renderer->style();
+    return RenderStyle::defaultStyle();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (224956 => 224957)


--- trunk/Source/WebCore/animation/KeyframeEffect.h	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h	2017-11-17 03:25:07 UTC (rev 224957)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "AnimationEffect.h"
+#include "CSSPropertyBlendingClient.h"
 #include "RenderStyle.h"
 #include <wtf/Ref.h>
 
@@ -38,7 +39,8 @@
     Vector<CSSPropertyID> properties;
 };
 
-class KeyframeEffect final : public AnimationEffect {
+class KeyframeEffect final : public AnimationEffect
+    , public CSSPropertyBlendingClient {
 public:
     static ExceptionOr<Ref<KeyframeEffect>> create(JSC::ExecState&, Element*, JSC::Strong<JSC::JSObject>&&);
     ~KeyframeEffect() { }
@@ -47,6 +49,15 @@
     ExceptionOr<void> setKeyframes(JSC::ExecState&, JSC::Strong<JSC::JSObject>&&);
     void applyAtLocalTime(Seconds, RenderStyle&) override;
 
+    RenderElement* renderer() const override;
+    const RenderStyle& currentStyle() const override;
+    bool isAccelerated() const override { return false; }
+    bool filterFunctionListsMatch() const override { return false; }
+    bool transformFunctionListsMatch() const override { return false; }
+#if ENABLE(FILTERS_LEVEL_2)
+    bool backdropFilterFunctionListsMatch() const override { return false; }
+#endif
+
 private:
     KeyframeEffect(Element*);
     ExceptionOr<void> processKeyframes(JSC::ExecState&, JSC::Strong<JSC::JSObject>&&);

Modified: trunk/Source/WebCore/page/animation/AnimationBase.h (224956 => 224957)


--- trunk/Source/WebCore/page/animation/AnimationBase.h	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/page/animation/AnimationBase.h	2017-11-17 03:25:07 UTC (rev 224957)
@@ -29,6 +29,7 @@
 #pragma once
 
 #include "Animation.h"
+#include "CSSPropertyBlendingClient.h"
 #include "CSSPropertyNames.h"
 #include "RenderStyleConstants.h"
 
@@ -43,7 +44,8 @@
 class RenderStyle;
 class TimingFunction;
 
-class AnimationBase : public RefCounted<AnimationBase> {
+class AnimationBase : public RefCounted<AnimationBase>
+    , public CSSPropertyBlendingClient {
     friend class CompositeAnimation;
     friend class CSSPropertyAnimation;
     WTF_MAKE_FAST_ALLOCATED;
@@ -52,8 +54,8 @@
     virtual ~AnimationBase();
 
     Element* element() const { return m_element.get(); }
-    const RenderStyle& currentStyle() const;
-    RenderElement* renderer() const;
+    const RenderStyle& currentStyle() const override;
+    RenderElement* renderer() const override;
     RenderBoxModelObject* compositedRenderer() const;
     void clear();
 
@@ -125,7 +127,7 @@
     bool waitingForStartTime() const { return m_animationState == AnimationState::StartWaitResponse; }
     bool waitingForStyleAvailable() const { return m_animationState == AnimationState::StartWaitStyleAvailable; }
 
-    bool isAccelerated() const { return m_isAccelerated; }
+    bool isAccelerated() const override { return m_isAccelerated; }
 
     virtual std::optional<Seconds> timeToNextService();
 
@@ -179,10 +181,10 @@
         return false;
     }
 
-    bool transformFunctionListsMatch() const { return m_transformFunctionListsMatch; }
-    bool filterFunctionListsMatch() const { return m_filterFunctionListsMatch; }
+    bool transformFunctionListsMatch() const override { return m_transformFunctionListsMatch; }
+    bool filterFunctionListsMatch() const override { return m_filterFunctionListsMatch; }
 #if ENABLE(FILTERS_LEVEL_2)
-    bool backdropFilterFunctionListsMatch() const { return m_backdropFilterFunctionListsMatch; }
+    bool backdropFilterFunctionListsMatch() const override { return m_backdropFilterFunctionListsMatch; }
 #endif
 
     // Freeze the animation; used by DumpRenderTree.

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (224956 => 224957)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2017-11-17 03:25:07 UTC (rev 224957)
@@ -30,7 +30,6 @@
 #include "config.h"
 #include "CSSPropertyAnimation.h"
 
-#include "AnimationBase.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSCrossfadeValue.h"
 #include "CSSFilterImageValue.h"
@@ -37,6 +36,7 @@
 #include "CSSImageGeneratorValue.h"
 #include "CSSImageValue.h"
 #include "CSSPrimitiveValue.h"
+#include "CSSPropertyBlendingClient.h"
 #include "CSSPropertyNames.h"
 #include "CachedImage.h"
 #include "CalculationValue.h"
@@ -65,37 +65,37 @@
 
 namespace WebCore {
 
-static inline int blendFunc(const AnimationBase*, int from, int to, double progress)
+static inline int blendFunc(const CSSPropertyBlendingClient*, int from, int to, double progress)
 {
     return blend(from, to, progress);
 }
 
-static inline double blendFunc(const AnimationBase*, double from, double to, double progress)
+static inline double blendFunc(const CSSPropertyBlendingClient*, double from, double to, double progress)
 {
     return blend(from, to, progress);
 }
 
-static inline float blendFunc(const AnimationBase*, float from, float to, double progress)
+static inline float blendFunc(const CSSPropertyBlendingClient*, float from, float to, double progress)
 {
     return narrowPrecisionToFloat(from + (to - from) * progress);
 }
 
-static inline Color blendFunc(const AnimationBase*, const Color& from, const Color& to, double progress)
+static inline Color blendFunc(const CSSPropertyBlendingClient*, const Color& from, const Color& to, double progress)
 {
     return blend(from, to, progress);
 }
 
-static inline Length blendFunc(const AnimationBase*, const Length& from, const Length& to, double progress)
+static inline Length blendFunc(const CSSPropertyBlendingClient*, const Length& from, const Length& to, double progress)
 {
     return blend(from, to, progress);
 }
 
-static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
+static inline LengthSize blendFunc(const CSSPropertyBlendingClient* anim, const LengthSize& from, const LengthSize& to, double progress)
 {
     return { blendFunc(anim, from.width, to.width, progress), blendFunc(anim, from.height, to.height, progress) };
 }
 
-static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from, ShadowStyle to, double progress)
+static inline ShadowStyle blendFunc(const CSSPropertyBlendingClient* anim, ShadowStyle from, ShadowStyle to, double progress)
 {
     if (from == to)
         return to;
@@ -106,7 +106,7 @@
     return result > 0 ? Normal : Inset;
 }
 
-static inline std::unique_ptr<ShadowData> blendFunc(const AnimationBase* anim, const ShadowData* from, const ShadowData* to, double progress)
+static inline std::unique_ptr<ShadowData> blendFunc(const CSSPropertyBlendingClient* anim, const ShadowData* from, const ShadowData* to, double progress)
 {
     ASSERT(from && to);
     if (from->style() != to->style())
@@ -120,7 +120,7 @@
         blend(from->color(), to->color(), progress));
 }
 
-static inline TransformOperations blendFunc(const AnimationBase* animation, const TransformOperations& from, const TransformOperations& to, double progress)
+static inline TransformOperations blendFunc(const CSSPropertyBlendingClient* animation, const TransformOperations& from, const TransformOperations& to, double progress)
 {
     if (animation->transformFunctionListsMatch())
         return to.blendByMatchingOperations(from, progress);
@@ -127,7 +127,7 @@
     return to.blendByUsingMatrixInterpolation(from, progress, is<RenderBox>(animation->renderer()) ? downcast<RenderBox>(*animation->renderer()).borderBoxRect().size() : LayoutSize());
 }
 
-static inline RefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
+static inline RefPtr<ClipPathOperation> blendFunc(const CSSPropertyBlendingClient*, ClipPathOperation* from, ClipPathOperation* to, double progress)
 {
     if (!from || !to)
         return to;
@@ -145,7 +145,7 @@
     return ShapeClipPathOperation::create(toShape.blend(fromShape, progress));
 }
 
-static inline RefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress)
+static inline RefPtr<ShapeValue> blendFunc(const CSSPropertyBlendingClient*, ShapeValue* from, ShapeValue* to, double progress)
 {
     if (!from || !to)
         return to;
@@ -165,13 +165,13 @@
     return ShapeValue::create(toShape.blend(fromShape, progress), to->cssBox());
 }
 
-static inline RefPtr<FilterOperation> blendFunc(const AnimationBase*, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
+static inline RefPtr<FilterOperation> blendFunc(const CSSPropertyBlendingClient*, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
 {
     ASSERT(toOp);
     return toOp->blend(fromOp, progress, blendToPassthrough);
 }
 
-static inline FilterOperations blendFilterOperations(const AnimationBase* anim,  const FilterOperations& from, const FilterOperations& to, double progress)
+static inline FilterOperations blendFilterOperations(const CSSPropertyBlendingClient* anim,  const FilterOperations& from, const FilterOperations& to, double progress)
 {
     FilterOperations result;
     size_t fromSize = from.operations().size();
@@ -194,7 +194,7 @@
     return result;
 }
 
-static inline FilterOperations blendFunc(const AnimationBase* anim, const FilterOperations& from, const FilterOperations& to, double progress, bool animatingBackdropFilter = false)
+static inline FilterOperations blendFunc(const CSSPropertyBlendingClient* anim, const FilterOperations& from, const FilterOperations& to, double progress, bool animatingBackdropFilter = false)
 {
     FilterOperations result;
 
@@ -216,7 +216,7 @@
     return result;
 }
 
-static inline RefPtr<StyleImage> blendFilter(const AnimationBase* anim, CachedImage* image, const FilterOperations& from, const FilterOperations& to, double progress)
+static inline RefPtr<StyleImage> blendFilter(const CSSPropertyBlendingClient* anim, CachedImage* image, const FilterOperations& from, const FilterOperations& to, double progress)
 {
     ASSERT(image);
     FilterOperations filterResult = blendFilterOperations(anim, from, to, progress);
@@ -229,7 +229,7 @@
     return StyleGeneratedImage::create(WTFMove(result));
 }
 
-static inline EVisibility blendFunc(const AnimationBase* anim, EVisibility from, EVisibility to, double progress)
+static inline EVisibility blendFunc(const CSSPropertyBlendingClient* anim, EVisibility from, EVisibility to, double progress)
 {
     // Any non-zero result means we consider the object to be visible. Only at 0 do we consider the object to be
     // invisible. The invisible value we use (HIDDEN vs. COLLAPSE) depends on the specified from/to values.
@@ -241,7 +241,7 @@
     return result > 0. ? VISIBLE : (to != VISIBLE ? to : from);
 }
 
-static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& from, const LengthBox& to, double progress)
+static inline LengthBox blendFunc(const CSSPropertyBlendingClient* anim, const LengthBox& from, const LengthBox& to, double progress)
 {
     LengthBox result(blendFunc(anim, from.top(), to.top(), progress),
                      blendFunc(anim, from.right(), to.right(), progress),
@@ -250,12 +250,12 @@
     return result;
 }
 
-static inline SVGLengthValue blendFunc(const AnimationBase*, const SVGLengthValue& from, const SVGLengthValue& to, double progress)
+static inline SVGLengthValue blendFunc(const CSSPropertyBlendingClient*, const SVGLengthValue& from, const SVGLengthValue& to, double progress)
 {
     return to.blend(from, narrowPrecisionToFloat(progress));
 }
 
-static inline Vector<SVGLengthValue> blendFunc(const AnimationBase*, const Vector<SVGLengthValue>& from, const Vector<SVGLengthValue>& to, double progress)
+static inline Vector<SVGLengthValue> blendFunc(const CSSPropertyBlendingClient*, const Vector<SVGLengthValue>& from, const Vector<SVGLengthValue>& to, double progress)
 {
     size_t fromLength = from.size();
     size_t toLength = to.size();
@@ -276,7 +276,7 @@
     return result;
 }
 
-static inline RefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleCachedImage* fromStyleImage, StyleCachedImage* toStyleImage, double progress)
+static inline RefPtr<StyleImage> crossfadeBlend(const CSSPropertyBlendingClient*, StyleCachedImage* fromStyleImage, StyleCachedImage* toStyleImage, double progress)
 {
     // If progress is at one of the extremes, we want getComputedStyle to show the image,
     // not a completed cross-fade, so we hand back one of the existing images.
@@ -295,7 +295,7 @@
     return StyleGeneratedImage::create(WTFMove(crossfadeValue));
 }
 
-static inline RefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleImage* from, StyleImage* to, double progress)
+static inline RefPtr<StyleImage> blendFunc(const CSSPropertyBlendingClient* anim, StyleImage* from, StyleImage* to, double progress)
 {
     if (!from || !to)
         return to;
@@ -351,7 +351,7 @@
     return to;
 }
 
-static inline NinePieceImage blendFunc(const AnimationBase* anim, const NinePieceImage& from, const NinePieceImage& to, double progress)
+static inline NinePieceImage blendFunc(const CSSPropertyBlendingClient* anim, const NinePieceImage& from, const NinePieceImage& to, double progress)
 {
     if (!from.hasImage() || !to.hasImage())
         return to;
@@ -372,7 +372,7 @@
 
 #if ENABLE(VARIATION_FONTS)
 
-static inline FontVariationSettings blendFunc(const AnimationBase* anim, const FontVariationSettings& from, const FontVariationSettings& to, double progress)
+static inline FontVariationSettings blendFunc(const CSSPropertyBlendingClient* anim, const FontVariationSettings& from, const FontVariationSettings& to, double progress)
 {
     if (from.size() != to.size())
         return FontVariationSettings();
@@ -391,7 +391,7 @@
 
 #endif
 
-static inline FontSelectionValue blendFunc(const AnimationBase* anim, FontSelectionValue from, FontSelectionValue to, double progress)
+static inline FontSelectionValue blendFunc(const CSSPropertyBlendingClient* anim, FontSelectionValue from, FontSelectionValue to, double progress)
 {
     return FontSelectionValue(blendFunc(anim, static_cast<float>(from), static_cast<float>(to), progress));
 }
@@ -408,7 +408,7 @@
 
     virtual bool isShorthandWrapper() const { return false; }
     virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0;
-    virtual void blend(const AnimationBase*, RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
+    virtual void blend(const CSSPropertyBlendingClient*, RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
     
 #if !LOG_DISABLED
     virtual void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double) const = 0;
@@ -467,7 +467,7 @@
     {
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T>::m_getter)(), (b->*PropertyWrapperGetter<T>::m_getter)(), progress));
     }
@@ -486,7 +486,7 @@
     {
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T*>::m_getter)(), (b->*PropertyWrapperGetter<T*>::m_getter)(), progress));
     }
@@ -505,7 +505,7 @@
     {
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<const T&>::m_getter)(), (b->*PropertyWrapperGetter<const T&>::m_getter)(), progress));
     }
@@ -623,7 +623,7 @@
     {
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<const Color&>::m_getter)(), (b->*PropertyWrapperGetter<const Color&>::m_getter)(), progress));
     }
@@ -642,7 +642,7 @@
 
     bool animationIsAccelerated() const override { return true; }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         dst->setOpacity(blendFunc(anim, a->opacity(), b->opacity(), progress));
     }
@@ -658,7 +658,7 @@
 
     bool animationIsAccelerated() const override { return true; }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         dst->setTransform(blendFunc(anim, a->transform(), b->transform(), progress));
     }
@@ -674,7 +674,7 @@
 
     bool animationIsAccelerated() const override { return true; }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         dst->setFilter(blendFunc(anim, a->filter(), b->filter(), progress));
     }
@@ -691,7 +691,7 @@
 
     virtual bool animationIsAccelerated() const { return true; }
 
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    virtual void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
     {
         dst->setBackdropFilter(blendFunc(anim, a->backdropFilter(), b->backdropFilter(), progress, true));
     }
@@ -761,7 +761,7 @@
         return true;
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         const ShadowData* shadowA = (a->*m_getter)();
         const ShadowData* shadowB = (b->*m_getter)();
@@ -786,7 +786,7 @@
 #endif
 
 private:
-    std::unique_ptr<ShadowData> blendSimpleOrMatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
+    std::unique_ptr<ShadowData> blendSimpleOrMatchedShadowLists(const CSSPropertyBlendingClient* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
     {
         std::unique_ptr<ShadowData> newShadowData;
         ShadowData* lastShadow = 0;
@@ -812,7 +812,7 @@
         return newShadowData;
     }
 
-    std::unique_ptr<ShadowData> blendMismatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const
+    std::unique_ptr<ShadowData> blendMismatchedShadowLists(const CSSPropertyBlendingClient* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const
     {
         // The shadows in ShadowData are stored in reverse order, so when animating mismatched lists,
         // reverse them and match from the end.
@@ -882,7 +882,7 @@
         return fromColor == toColor;
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         Color fromColor = value(a);
         Color toColor = value(b);
@@ -938,7 +938,7 @@
     {
         return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
     }
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         m_wrapper->blend(anim, dst, a, b, progress);
         m_visitedWrapper->blend(anim, dst, a, b, progress);
@@ -970,7 +970,7 @@
     CSSPropertyID property() const { return m_property; }
 
     virtual bool equals(const FillLayer*, const FillLayer*) const = 0;
-    virtual void blend(const AnimationBase*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0;
+    virtual void blend(const CSSPropertyBlendingClient*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0;
 
 #if !LOG_DISABLED
     virtual void logBlend(const FillLayer* result, const FillLayer*, const FillLayer*, double) const = 0;
@@ -1025,7 +1025,7 @@
     {
     }
 
-    void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
     {
         (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<const T&>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<const T&>::m_getter)(), progress));
     }
@@ -1072,7 +1072,7 @@
         return fromLength == toLength && fromEdge == toEdge;
     }
 
-    void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
     {
         Length fromLength = (a->*FillLayerPropertyWrapperGetter<const Length&>::m_getter)();
         Length toLength = (b->*FillLayerPropertyWrapperGetter<const Length&>::m_getter)();
@@ -1117,7 +1117,7 @@
     {
     }
 
-    void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
     {
         (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), progress));
     }
@@ -1218,7 +1218,7 @@
         return true;
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         auto* aLayer = &(a->*m_layersGetter)();
         auto* bLayer = &(b->*m_layersGetter)();
@@ -1280,7 +1280,7 @@
         return true;
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         for (auto& wrapper : m_propertyWrappers)
             wrapper->blend(anim, dst, a, b, progress);
@@ -1318,7 +1318,7 @@
         return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow() && a->flexShrink() == b->flexShrink();
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         dst->setFlexBasis(blendFunc(anim, a->flexBasis(), b->flexBasis(), progress));
         dst->setFlexGrow(blendFunc(anim, a->flexGrow(), b->flexGrow(), progress));
@@ -1375,7 +1375,7 @@
         return true;
     }
 
-    void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
         if ((a->*m_paintTypeGetter)() != SVG_PAINTTYPE_RGBCOLOR
             || (b->*m_paintTypeGetter)() != SVG_PAINTTYPE_RGBCOLOR)
@@ -1701,7 +1701,7 @@
 }
 
 // Returns true if we need to start animation timers
-bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropertyID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress)
+bool CSSPropertyAnimation::blendProperties(const CSSPropertyBlendingClient* anim, CSSPropertyID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress)
 {
     ASSERT(prop != CSSPropertyInvalid);
 

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.h (224956 => 224957)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.h	2017-11-17 02:36:03 UTC (rev 224956)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.h	2017-11-17 03:25:07 UTC (rev 224957)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-class AnimationBase;
+class CSSPropertyBlendingClient;
 class RenderStyle;
 
 class CSSPropertyAnimation {
@@ -46,7 +46,7 @@
     static HashSet<CSSPropertyID> animatableShorthandsAffectingProperty(CSSPropertyID);
 
     // Return true if we need to start software animation timers
-    static bool blendProperties(const AnimationBase*, CSSPropertyID, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress);
+    static bool blendProperties(const CSSPropertyBlendingClient*, CSSPropertyID, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress);
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to