[GTK][WPE] Move TextureMapperAnimation to the nicosia namespace as Nicosia::Animation
authormagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Aug 2019 14:37:20 +0000 (14:37 +0000)
committermagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Aug 2019 14:37:20 +0000 (14:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200707

Reviewed by Žan Doberšek.

Move TextureMapperAnimation to Nicosia::Animation so it can be used by non TextureMapper
code paths.

* platform/TextureMapper.cmake:
* platform/graphics/nicosia/NicosiaAnimation.cpp: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp.
(Nicosia::shouldReverseAnimationValue):
(Nicosia::normalizedAnimationValue):
(Nicosia::normalizedAnimationValueForFillsForwards):
(Nicosia::timingFunctionForAnimationValue):
(Nicosia::Animation::Animation):
(Nicosia::Animation::apply):
(Nicosia::Animation::applyKeepingInternalState):
(Nicosia::Animation::pause):
(Nicosia::Animation::resume):
(Nicosia::Animation::computeTotalRunningTime):
(Nicosia::Animation::isActive const):
(Nicosia::Animation::applyInternal):
(Nicosia::Animations::add):
(Nicosia::Animations::remove):
(Nicosia::Animations::pause):
(Nicosia::Animations::suspend):
(Nicosia::Animations::resume):
(Nicosia::Animations::apply):
(Nicosia::Animations::applyKeepingInternalState):
(Nicosia::Animations::hasActiveAnimationsOfType const):
(Nicosia::Animations::hasRunningAnimations const):
(Nicosia::Animations::getActiveAnimations const):
* platform/graphics/nicosia/NicosiaAnimation.h: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h.
(Nicosia::Animation::Animation):
(Nicosia::Animation::keyframes const):
(Nicosia::Animation::timingFunction const):
(Nicosia::Animations::animations const):
(Nicosia::Animations::animations):
* platform/graphics/nicosia/NicosiaPlatformLayer.h:
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::addAnimation):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::setAnimations):
(WebCore::TextureMapperLayer::syncAnimations):
* platform/graphics/texmap/TextureMapperLayer.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::addAnimation):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/TextureMapper.cmake
Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp [moved from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp with 78% similarity]
Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h [moved from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h with 55% similarity]
Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h

index a5ea18d..a181dd5 100644 (file)
@@ -1,3 +1,55 @@
+2019-08-16  Miguel Gomez  <magomez@igalia.com>
+
+        [GTK][WPE] Move TextureMapperAnimation to the nicosia namespace as Nicosia::Animation
+        https://bugs.webkit.org/show_bug.cgi?id=200707
+
+        Reviewed by Žan Doberšek.
+
+        Move TextureMapperAnimation to Nicosia::Animation so it can be used by non TextureMapper
+        code paths.
+
+        * platform/TextureMapper.cmake:
+        * platform/graphics/nicosia/NicosiaAnimation.cpp: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp.
+        (Nicosia::shouldReverseAnimationValue):
+        (Nicosia::normalizedAnimationValue):
+        (Nicosia::normalizedAnimationValueForFillsForwards):
+        (Nicosia::timingFunctionForAnimationValue):
+        (Nicosia::Animation::Animation):
+        (Nicosia::Animation::apply):
+        (Nicosia::Animation::applyKeepingInternalState):
+        (Nicosia::Animation::pause):
+        (Nicosia::Animation::resume):
+        (Nicosia::Animation::computeTotalRunningTime):
+        (Nicosia::Animation::isActive const):
+        (Nicosia::Animation::applyInternal):
+        (Nicosia::Animations::add):
+        (Nicosia::Animations::remove):
+        (Nicosia::Animations::pause):
+        (Nicosia::Animations::suspend):
+        (Nicosia::Animations::resume):
+        (Nicosia::Animations::apply):
+        (Nicosia::Animations::applyKeepingInternalState):
+        (Nicosia::Animations::hasActiveAnimationsOfType const):
+        (Nicosia::Animations::hasRunningAnimations const):
+        (Nicosia::Animations::getActiveAnimations const):
+        * platform/graphics/nicosia/NicosiaAnimation.h: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h.
+        (Nicosia::Animation::Animation):
+        (Nicosia::Animation::keyframes const):
+        (Nicosia::Animation::timingFunction const):
+        (Nicosia::Animations::animations const):
+        (Nicosia::Animations::animations):
+        * platform/graphics/nicosia/NicosiaPlatformLayer.h:
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::addAnimation):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::setAnimations):
+        (WebCore::TextureMapperLayer::syncAnimations):
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::addAnimation):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+
 2019-08-16  Yusuke Suzuki  <ysuzuki@apple.com>
 
         Unreviewed, speculative build fix for WinCairo, part 2
index ce9ab96..4f3d6ea 100644 (file)
@@ -1,13 +1,14 @@
 list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
     "${WEBCORE_DIR}/platform/graphics/texmap"
+    "${WEBCORE_DIR}/platform/graphics/nicosia"
 )
 
 list(APPEND WebCore_SOURCES
+    platform/graphics/nicosia/NicosiaAnimation.cpp
     platform/graphics/texmap/BitmapTexture.cpp
     platform/graphics/texmap/BitmapTexturePool.cpp
     platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp
     platform/graphics/texmap/TextureMapper.cpp
-    platform/graphics/texmap/TextureMapperAnimation.cpp
     platform/graphics/texmap/TextureMapperBackingStore.cpp
     platform/graphics/texmap/TextureMapperFPSCounter.cpp
     platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp
@@ -16,11 +17,11 @@ list(APPEND WebCore_SOURCES
 )
 
 list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
+    platform/graphics/nicosia/NicosiaAnimation.h
     platform/graphics/texmap/BitmapTexture.h
     platform/graphics/texmap/ClipStack.h
     platform/graphics/texmap/GraphicsLayerTextureMapper.h
     platform/graphics/texmap/TextureMapper.h
-    platform/graphics/texmap/TextureMapperAnimation.h
     platform/graphics/texmap/TextureMapperBackingStore.h
     platform/graphics/texmap/TextureMapperContextAttributes.h
     platform/graphics/texmap/TextureMapperFPSCounter.h
@@ -70,7 +71,6 @@ if (USE_COORDINATED_GRAPHICS)
 
     # FIXME: Move this into Nicosia.cmake once the component is set for long-term use.
     list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
-        "${WEBCORE_DIR}/platform/graphics/nicosia"
         "${WEBCORE_DIR}/platform/graphics/nicosia/cairo"
         "${WEBCORE_DIR}/platform/graphics/nicosia/texmap"
     )
  */
 
 #include "config.h"
-#include "TextureMapperAnimation.h"
+#include "NicosiaAnimation.h"
 
 #include "LayoutSize.h"
 
-namespace WebCore {
+namespace Nicosia {
+
+using namespace WebCore;
 
 static RefPtr<FilterOperation> blendFunc(FilterOperation* fromOp, FilterOperation& toOp, double progress, const FloatSize&, bool blendToPassthrough = false)
 {
@@ -65,14 +67,14 @@ static FilterOperations applyFilterAnimation(const FilterOperations& from, const
     return result;
 }
 
-static bool shouldReverseAnimationValue(Animation::AnimationDirection direction, int loopCount)
+static bool shouldReverseAnimationValue(WebCore::Animation::AnimationDirection direction, int loopCount)
 {
-    return (direction == Animation::AnimationDirectionAlternate && loopCount & 1)
-        || (direction == Animation::AnimationDirectionAlternateReverse && !(loopCount & 1))
-        || direction == Animation::AnimationDirectionReverse;
+    return (direction == WebCore::Animation::AnimationDirectionAlternate && loopCount & 1)
+        || (direction == WebCore::Animation::AnimationDirectionAlternateReverse && !(loopCount & 1))
+        || direction == WebCore::Animation::AnimationDirectionReverse;
 }
 
-static double normalizedAnimationValue(double runningTime, double duration, Animation::AnimationDirection direction, double iterationCount)
+static double normalizedAnimationValue(double runningTime, double duration, WebCore::Animation::AnimationDirection direction, double iterationCount)
 {
     if (!duration)
         return 0;
@@ -86,11 +88,11 @@ static double normalizedAnimationValue(double runningTime, double duration, Anim
     return shouldReverseAnimationValue(direction, loopCount) ? 1 - normalized : normalized;
 }
 
-static double normalizedAnimationValueForFillsForwards(double iterationCount, Animation::AnimationDirection direction)
+static double normalizedAnimationValueForFillsForwards(double iterationCount, WebCore::Animation::AnimationDirection direction)
 {
-    if (direction == Animation::AnimationDirectionNormal)
+    if (direction == WebCore::Animation::AnimationDirectionNormal)
         return 1;
-    if (direction == Animation::AnimationDirectionReverse)
+    if (direction == WebCore::Animation::AnimationDirectionReverse)
         return 0;
     return shouldReverseAnimationValue(direction, iterationCount) ? 1 : 0;
 }
@@ -155,7 +157,7 @@ static TransformationMatrix applyTransformAnimation(const TransformOperations& f
     return matrix;
 }
 
-static const TimingFunction& timingFunctionForAnimationValue(const AnimationValue& animationValue, const TextureMapperAnimation& animation)
+static const TimingFunction& timingFunctionForAnimationValue(const AnimationValue& animationValue, const Animation& animation)
 {
     if (animationValue.timingFunction())
         return *animationValue.timingFunction();
@@ -164,7 +166,7 @@ static const TimingFunction& timingFunctionForAnimationValue(const AnimationValu
     return CubicBezierTimingFunction::defaultTimingFunction();
 }
 
-TextureMapperAnimation::TextureMapperAnimation(const String& name, const KeyframeValueList& keyframes, const FloatSize& boxSize, const Animation& animation, bool listsMatch, MonotonicTime startTime, Seconds pauseTime, AnimationState state)
+Animation::Animation(const String& name, const KeyframeValueList& keyframes, const FloatSize& boxSize, const WebCore::Animation& animation, bool listsMatch, MonotonicTime startTime, Seconds pauseTime, AnimationState state)
     : m_name(name.isSafeToSendToAnotherThread() ? name : name.isolatedCopy())
     , m_keyframes(keyframes)
     , m_boxSize(boxSize)
@@ -182,7 +184,7 @@ TextureMapperAnimation::TextureMapperAnimation(const String& name, const Keyfram
 {
 }
 
-TextureMapperAnimation::TextureMapperAnimation(const TextureMapperAnimation& other)
+Animation::Animation(const Animation& other)
     : m_name(other.m_name.isSafeToSendToAnotherThread() ? other.m_name : other.m_name.isolatedCopy())
     , m_keyframes(other.m_keyframes)
     , m_boxSize(other.m_boxSize)
@@ -200,7 +202,7 @@ TextureMapperAnimation::TextureMapperAnimation(const TextureMapperAnimation& oth
 {
 }
 
-void TextureMapperAnimation::apply(ApplicationResult& applicationResults, MonotonicTime time)
+void Animation::apply(ApplicationResult& applicationResults, MonotonicTime time)
 {
     if (!isActive())
         return;
@@ -208,7 +210,7 @@ void TextureMapperAnimation::apply(ApplicationResult& applicationResults, Monoto
     Seconds totalRunningTime = computeTotalRunningTime(time);
     double normalizedValue = normalizedAnimationValue(totalRunningTime.seconds(), m_duration, m_direction, m_iterationCount);
 
-    if (m_iterationCount != Animation::IterationCountInfinite && totalRunningTime.seconds() >= m_duration * m_iterationCount) {
+    if (m_iterationCount != WebCore::Animation::IterationCountInfinite && totalRunningTime.seconds() >= m_duration * m_iterationCount) {
         m_state = AnimationState::Stopped;
         m_pauseTime = 0_s;
         if (m_fillsForwards)
@@ -247,7 +249,7 @@ void TextureMapperAnimation::apply(ApplicationResult& applicationResults, Monoto
     }
 }
 
-void TextureMapperAnimation::applyKeepingInternalState(ApplicationResult& applicationResults, MonotonicTime time)
+void Animation::applyKeepingInternalState(ApplicationResult& applicationResults, MonotonicTime time)
 {
     MonotonicTime oldLastRefreshedTime = m_lastRefreshedTime;
     Seconds oldTotalRunningTime = m_totalRunningTime;
@@ -260,13 +262,13 @@ void TextureMapperAnimation::applyKeepingInternalState(ApplicationResult& applic
     m_state = oldState;
 }
 
-void TextureMapperAnimation::pause(Seconds time)
+void Animation::pause(Seconds time)
 {
     m_state = AnimationState::Paused;
     m_pauseTime = time;
 }
 
-void TextureMapperAnimation::resume()
+void Animation::resume()
 {
     m_state = AnimationState::Playing;
     // FIXME: This seems wrong. m_totalRunningTime is cleared.
@@ -276,7 +278,7 @@ void TextureMapperAnimation::resume()
     m_lastRefreshedTime = MonotonicTime::now();
 }
 
-Seconds TextureMapperAnimation::computeTotalRunningTime(MonotonicTime time)
+Seconds Animation::computeTotalRunningTime(MonotonicTime time)
 {
     if (m_state == AnimationState::Paused)
         return m_pauseTime;
@@ -287,12 +289,12 @@ Seconds TextureMapperAnimation::computeTotalRunningTime(MonotonicTime time)
     return m_totalRunningTime;
 }
 
-bool TextureMapperAnimation::isActive() const
+bool Animation::isActive() const
 {
     return m_state != AnimationState::Stopped || m_fillsForwards;
 }
 
-void TextureMapperAnimation::applyInternal(ApplicationResult& applicationResults, const AnimationValue& from, const AnimationValue& to, float progress)
+void Animation::applyInternal(ApplicationResult& applicationResults, const AnimationValue& from, const AnimationValue& to, float progress)
 {
     switch (m_keyframes.property()) {
     case AnimatedPropertyTransform:
@@ -309,7 +311,7 @@ void TextureMapperAnimation::applyInternal(ApplicationResult& applicationResults
     }
 }
 
-void TextureMapperAnimations::add(const TextureMapperAnimation& animation)
+void Animations::add(const Animation& animation)
 {
     // Remove the old state if we are resuming a paused animation.
     remove(animation.name(), animation.keyframes().property());
@@ -317,21 +319,21 @@ void TextureMapperAnimations::add(const TextureMapperAnimation& animation)
     m_animations.append(animation);
 }
 
-void TextureMapperAnimations::remove(const String& name)
+void Animations::remove(const String& name)
 {
-    m_animations.removeAllMatching([&name] (const TextureMapperAnimation& animation) {
+    m_animations.removeAllMatching([&name] (const Animation& animation) {
         return animation.name() == name;
     });
 }
 
-void TextureMapperAnimations::remove(const String& name, AnimatedPropertyID property)
+void Animations::remove(const String& name, AnimatedPropertyID property)
 {
-    m_animations.removeAllMatching([&name, property] (const TextureMapperAnimation& animation) {
+    m_animations.removeAllMatching([&name, property] (const Animation& animation) {
         return animation.name() == name && animation.keyframes().property() == property;
     });
 }
 
-void TextureMapperAnimations::pause(const String& name, Seconds offset)
+void Animations::pause(const String& name, Seconds offset)
 {
     for (auto& animation : m_animations) {
         if (animation.name() == name)
@@ -339,7 +341,7 @@ void TextureMapperAnimations::pause(const String& name, Seconds offset)
     }
 }
 
-void TextureMapperAnimations::suspend(MonotonicTime time)
+void Animations::suspend(MonotonicTime time)
 {
     // FIXME: This seems wrong. `pause` takes time offset (Seconds), not MonotonicTime.
     // https://bugs.webkit.org/show_bug.cgi?id=183112
@@ -347,39 +349,43 @@ void TextureMapperAnimations::suspend(MonotonicTime time)
         animation.pause(time.secondsSinceEpoch());
 }
 
-void TextureMapperAnimations::resume()
+void Animations::resume()
 {
     for (auto& animation : m_animations)
         animation.resume();
 }
 
-void TextureMapperAnimations::apply(TextureMapperAnimation::ApplicationResult& applicationResults, MonotonicTime time)
+void Animations::apply(Animation::ApplicationResult& applicationResults, MonotonicTime time)
 {
     for (auto& animation : m_animations)
         animation.apply(applicationResults, time);
 }
 
-void TextureMapperAnimations::applyKeepingInternalState(TextureMapperAnimation::ApplicationResult& applicationResults, MonotonicTime time)
+void Animations::applyKeepingInternalState(Animation::ApplicationResult& applicationResults, MonotonicTime time)
 {
     for (auto& animation : m_animations)
         animation.applyKeepingInternalState(applicationResults, time);
 }
 
-bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
+bool Animations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
 {
     return std::any_of(m_animations.begin(), m_animations.end(),
-        [&type](const TextureMapperAnimation& animation) { return animation.isActive() && animation.keyframes().property() == type; });
+        [&type](const Animation& animation) {
+            return animation.isActive() && animation.keyframes().property() == type;
+        });
 }
 
-bool TextureMapperAnimations::hasRunningAnimations() const
+bool Animations::hasRunningAnimations() const
 {
     return std::any_of(m_animations.begin(), m_animations.end(),
-        [](const TextureMapperAnimation& animation) { return animation.state() == TextureMapperAnimation::AnimationState::Playing; });
+        [](const Animation& animation) {
+            return animation.state() == Animation::AnimationState::Playing;
+        });
 }
 
-TextureMapperAnimations TextureMapperAnimations::getActiveAnimations() const
+Animations Animations::getActiveAnimations() const
 {
-    TextureMapperAnimations active;
+    Animations active;
     for (auto& animation : m_animations) {
         if (animation.isActive())
             active.add(animation);
@@ -387,4 +393,4 @@ TextureMapperAnimations TextureMapperAnimations::getActiveAnimations() const
     return active;
 }
 
-} // namespace WebCore
+} // namespace Nicosia
  Boston, MA 02110-1301, USA.
  */
 
-#ifndef TextureMapperAnimation_h
-#define TextureMapperAnimation_h
+#pragma once
 
 #include "GraphicsLayer.h"
 
 namespace WebCore {
-
 class TransformationMatrix;
+}
 
-class TextureMapperAnimation {
+namespace Nicosia {
+
+class Animation {
 public:
     enum class AnimationState { Playing, Paused, Stopped };
 
     struct ApplicationResult {
-        Optional<TransformationMatrix> transform;
+        Optional<WebCore::TransformationMatrix> transform;
         Optional<double> opacity;
-        Optional<FilterOperations> filters;
+        Optional<WebCore::FilterOperations> filters;
         bool hasRunningAnimations { false };
     };
 
-    TextureMapperAnimation()
-        : m_keyframes(AnimatedPropertyInvalid)
+    Animation()
+        : m_keyframes(WebCore::AnimatedPropertyInvalid)
     { }
-    TextureMapperAnimation(const String&, const KeyframeValueList&, const FloatSize&, const Animation&, bool, MonotonicTime, Seconds, AnimationState);
-    WEBCORE_EXPORT TextureMapperAnimation(const TextureMapperAnimation&);
+    Animation(const String&, const WebCore::KeyframeValueList&, const WebCore::FloatSize&, const WebCore::Animation&, bool, MonotonicTime, Seconds, AnimationState);
+    WEBCORE_EXPORT Animation(const Animation&);
 
     void apply(ApplicationResult&, MonotonicTime);
     void applyKeepingInternalState(ApplicationResult&, MonotonicTime);
@@ -50,21 +51,21 @@ public:
     bool isActive() const;
 
     const String& name() const { return m_name; }
-    const KeyframeValueList& keyframes() const { return m_keyframes; }
+    const WebCore::KeyframeValueList& keyframes() const { return m_keyframes; }
     AnimationState state() const { return m_state; }
-    TimingFunction* timingFunction() const { return m_timingFunction.get(); }
+    WebCore::TimingFunction* timingFunction() const { return m_timingFunction.get(); }
 
 private:
-    void applyInternal(ApplicationResult&, const AnimationValue& from, const AnimationValue& to, float progress);
+    void applyInternal(ApplicationResult&, const WebCore::AnimationValue& from, const WebCore::AnimationValue& to, float progress);
     Seconds computeTotalRunningTime(MonotonicTime);
 
     String m_name;
-    KeyframeValueList m_keyframes;
-    FloatSize m_boxSize;
-    RefPtr<TimingFunction> m_timingFunction;
+    WebCore::KeyframeValueList m_keyframes;
+    WebCore::FloatSize m_boxSize;
+    RefPtr<WebCore::TimingFunction> m_timingFunction;
     double m_iterationCount;
     double m_duration;
-    Animation::AnimationDirection m_direction;
+    WebCore::Animation::AnimationDirection m_direction;
     bool m_fillsForwards;
     bool m_listsMatch;
     MonotonicTime m_startTime;
@@ -74,33 +75,31 @@ private:
     AnimationState m_state;
 };
 
-class TextureMapperAnimations {
+class Animations {
 public:
-    TextureMapperAnimations() = default;
+    Animations() = default;
 
-    void add(const TextureMapperAnimation&);
+    void add(const Animation&);
     void remove(const String& name);
-    void remove(const String& name, AnimatedPropertyID);
+    void remove(const String& name, WebCore::AnimatedPropertyID);
     void pause(const String&, Seconds);
     void suspend(MonotonicTime);
     void resume();
 
-    void apply(TextureMapperAnimation::ApplicationResult&, MonotonicTime);
-    void applyKeepingInternalState(TextureMapperAnimation::ApplicationResult&, MonotonicTime);
+    void apply(Animation::ApplicationResult&, MonotonicTime);
+    void applyKeepingInternalState(Animation::ApplicationResult&, MonotonicTime);
 
     bool isEmpty() const { return m_animations.isEmpty(); }
     size_t size() const { return m_animations.size(); }
-    const Vector<TextureMapperAnimation>& animations() const { return m_animations; }
-    Vector<TextureMapperAnimation>& animations() { return m_animations; }
+    const Vector<Animation>& animations() const { return m_animations; }
+    Vector<Animation>& animations() { return m_animations; }
 
     bool hasRunningAnimations() const;
-    bool hasActiveAnimationsOfType(AnimatedPropertyID type) const;
-    TextureMapperAnimations getActiveAnimations() const;
+    bool hasActiveAnimationsOfType(WebCore::AnimatedPropertyID type) const;
+    Animations getActiveAnimations() const;
 
 private:
-    Vector<TextureMapperAnimation> m_animations;
+    Vector<Animation> m_animations;
 };
 
 }
-
-#endif // TextureMapperAnimation_h
index 11c6059..3ccfe60 100644 (file)
@@ -35,8 +35,8 @@
 #include "FloatRect.h"
 #include "FloatSize.h"
 #include "NicosiaAnimatedBackingStoreClient.h"
+#include "NicosiaAnimation.h"
 #include "NicosiaSceneIntegration.h"
-#include "TextureMapperAnimation.h"
 #include "TransformationMatrix.h"
 #include <wtf/Function.h>
 #include <wtf/Lock.h>
@@ -171,7 +171,7 @@ public:
         WebCore::FilterOperations filters;
         // FIXME: Despite the name, this implementation is not
         // TextureMapper-specific. Should be renamed when necessary.
-        WebCore::TextureMapperAnimations animations;
+        Animations animations;
 
         Vector<RefPtr<CompositionLayer>> children;
         RefPtr<CompositionLayer> replica;
index eadfba0..b7243e9 100644 (file)
@@ -23,7 +23,7 @@
 #include "GraphicsContext.h"
 #include "GraphicsLayerFactory.h"
 #include "ImageBuffer.h"
-#include "TextureMapperAnimation.h"
+#include "NicosiaAnimation.h"
 
 #if !USE(COORDINATED_GRAPHICS)
 
@@ -572,7 +572,7 @@ bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList
         listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
 
     const MonotonicTime currentTime = MonotonicTime::now();
-    m_animations.add(TextureMapperAnimation(keyframesName, valueList, boxSize, *anim, listsMatch, currentTime - Seconds(timeOffset), 0_s, TextureMapperAnimation::AnimationState::Playing));
+    m_animations.add(Nicosia::Animation(keyframesName, valueList, boxSize, *anim, listsMatch, currentTime - Seconds(timeOffset), 0_s, Nicosia::Animation::AnimationState::Playing));
     // m_animationStartTime is the time of the first real frame of animation, now or delayed by a negative offset.
     if (Seconds(timeOffset) > 0_s)
         m_animationStartTime = currentTime;
index 980041e..e6615e1 100644 (file)
@@ -162,7 +162,7 @@ private:
 
     TextureMapperPlatformLayer* m_contentsLayer;
     FloatRect m_needsDisplayRect;
-    TextureMapperAnimations m_animations;
+    Nicosia::Animations m_animations;
     MonotonicTime m_animationStartTime;
 };
 
index 3428c67..b6632c0 100644 (file)
@@ -640,7 +640,7 @@ void TextureMapperLayer::setContentsLayer(TextureMapperPlatformLayer* platformLa
     m_contentsLayer = platformLayer;
 }
 
-void TextureMapperLayer::setAnimations(const TextureMapperAnimations& animations)
+void TextureMapperLayer::setAnimations(const Nicosia::Animations& animations)
 {
     m_animations = animations;
 }
@@ -678,7 +678,7 @@ bool TextureMapperLayer::applyAnimationsRecursively(MonotonicTime time)
 
 bool TextureMapperLayer::syncAnimations(MonotonicTime time)
 {
-    TextureMapperAnimation::ApplicationResult applicationResults;
+    Nicosia::Animation::ApplicationResult applicationResults;
     m_animations.apply(applicationResults, time);
 
     m_layerTransforms.localTransform = applicationResults.transform.valueOr(m_state.transform);
@@ -687,7 +687,7 @@ bool TextureMapperLayer::syncAnimations(MonotonicTime time)
 
 #if USE(COORDINATED_GRAPHICS)
     // Calculate localTransform 50ms in the future.
-    TextureMapperAnimation::ApplicationResult futureApplicationResults;
+    Nicosia::Animation::ApplicationResult futureApplicationResults;
     m_animations.applyKeepingInternalState(futureApplicationResults, time + 50_ms);
     m_layerTransforms.futureLocalTransform = futureApplicationResults.transform.valueOr(m_layerTransforms.localTransform);
 #endif
index 50b24aa..f3c286c 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "FilterOperations.h"
 #include "FloatRect.h"
+#include "NicosiaAnimation.h"
 #include "TextureMapper.h"
-#include "TextureMapperAnimation.h"
 #include "TextureMapperBackingStore.h"
 #include <wtf/WeakPtr.h>
 
@@ -90,7 +90,7 @@ public:
     void setDebugVisuals(bool showDebugBorders, const Color& debugBorderColor, float debugBorderWidth);
     void setRepaintCounter(bool showRepaintCounter, int repaintCount);
     void setContentsLayer(TextureMapperPlatformLayer*);
-    void setAnimations(const TextureMapperAnimations&);
+    void setAnimations(const Nicosia::Animations&);
     void setBackingStore(TextureMapperBackingStore*);
 #if USE(COORDINATED_GRAPHICS)
     void setAnimatedBackingStoreClient(Nicosia::AnimatedBackingStoreClient*);
@@ -202,7 +202,7 @@ private:
 
     State m_state;
     TextureMapper* m_textureMapper { nullptr };
-    TextureMapperAnimations m_animations;
+    Nicosia::Animations m_animations;
     uint32_t m_id { 0 };
 #if USE(COORDINATED_GRAPHICS)
     RefPtr<Nicosia::AnimatedBackingStoreClient> m_animatedBackingStoreClient;
index 367d8a5..c73f01b 100644 (file)
@@ -1257,7 +1257,7 @@ bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList,
         listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0;
 
     m_lastAnimationStartTime = MonotonicTime::now() - Seconds(delayAsNegativeTimeOffset);
-    m_animations.add(TextureMapperAnimation(keyframesName, valueList, boxSize, *anim, listsMatch, m_lastAnimationStartTime, 0_s, TextureMapperAnimation::AnimationState::Playing));
+    m_animations.add(Nicosia::Animation(keyframesName, valueList, boxSize, *anim, listsMatch, m_lastAnimationStartTime, 0_s, Nicosia::Animation::AnimationState::Playing));
     m_animationStartedTimer.startOneShot(0_s);
     didChangeAnimations();
     return true;
index e6c5866..f2d7cf3 100644 (file)
 #include "Image.h"
 #include "IntSize.h"
 #include "NicosiaAnimatedBackingStoreClient.h"
+#include "NicosiaAnimation.h"
 #include "NicosiaBuffer.h"
 #include "NicosiaPlatformLayer.h"
-#include "TextureMapperAnimation.h"
 #include "TransformationMatrix.h"
 #include <wtf/RunLoop.h>
 #include <wtf/text/StringHash.h>
 
 namespace Nicosia {
+class Animations;
 class PaintingEngine;
 }
 
 namespace WebCore {
 class CoordinatedGraphicsLayer;
-class TextureMapperAnimations;
 
 class CoordinatedGraphicsLayerClient {
 public:
@@ -210,7 +210,7 @@ private:
 
     Timer m_animationStartedTimer;
     RunLoop::Timer<CoordinatedGraphicsLayer> m_requestPendingTileCreationTimer;
-    TextureMapperAnimations m_animations;
+    Nicosia::Animations m_animations;
     MonotonicTime m_lastAnimationStartTime;
 
     struct {