Title: [146608] trunk/Source/WebCore
Revision
146608
Author
[email protected]
Date
2013-03-22 07:38:31 -0700 (Fri, 22 Mar 2013)

Log Message

[GTK][AC] Add removing animations procedure with clutter ac backend
https://bugs.webkit.org/show_bug.cgi?id=110607

Patch by ChangSeok Oh <[email protected]> on 2013-03-22
Reviewed by Gustavo Noronha Silva.

This changes is based on mac port implementation. The only different thing is
that updateAnimations is called explicitly in destructor of GraphicsLayerClutter
to remove uncommitted animations. Because even though we call notifyFlushRequired
to remove existing animations in removeAnimation(), removeClutterAnimationFromLayer
has been never reached since the root layer is destroyed before. It means
that we haven't lost a change to remove actual animations from clutterActor.

Covered by existing animation tests.

* platform/graphics/clutter/GraphicsLayerClutter.cpp:
(WebCore::GraphicsLayerClutter::~GraphicsLayerClutter):
(WebCore::GraphicsLayerClutter::removeAnimation):
(WebCore):
(WebCore::GraphicsLayerClutter::removeClutterAnimationFromLayer):
* platform/graphics/clutter/GraphicsLayerClutter.h:
(WebCore::GraphicsLayerClutter::animationIsRunning):
(GraphicsLayerClutter):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146607 => 146608)


--- trunk/Source/WebCore/ChangeLog	2013-03-22 14:28:56 UTC (rev 146607)
+++ trunk/Source/WebCore/ChangeLog	2013-03-22 14:38:31 UTC (rev 146608)
@@ -1,3 +1,28 @@
+2013-03-22  ChangSeok Oh  <[email protected]>
+
+        [GTK][AC] Add removing animations procedure with clutter ac backend
+        https://bugs.webkit.org/show_bug.cgi?id=110607
+
+        Reviewed by Gustavo Noronha Silva.
+
+        This changes is based on mac port implementation. The only different thing is
+        that updateAnimations is called explicitly in destructor of GraphicsLayerClutter
+        to remove uncommitted animations. Because even though we call notifyFlushRequired
+        to remove existing animations in removeAnimation(), removeClutterAnimationFromLayer
+        has been never reached since the root layer is destroyed before. It means
+        that we haven't lost a change to remove actual animations from clutterActor.
+
+        Covered by existing animation tests.
+
+        * platform/graphics/clutter/GraphicsLayerClutter.cpp:
+        (WebCore::GraphicsLayerClutter::~GraphicsLayerClutter):
+        (WebCore::GraphicsLayerClutter::removeAnimation):
+        (WebCore):
+        (WebCore::GraphicsLayerClutter::removeClutterAnimationFromLayer):
+        * platform/graphics/clutter/GraphicsLayerClutter.h:
+        (WebCore::GraphicsLayerClutter::animationIsRunning):
+        (GraphicsLayerClutter):
+
 2013-03-22  Kondapally Kalyan  <[email protected]>
 
         [EFL][WebGL] Optimize AlphaOp for HTMLVideoElement input.

Modified: trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp (146607 => 146608)


--- trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp	2013-03-22 14:28:56 UTC (rev 146607)
+++ trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp	2013-03-22 14:38:31 UTC (rev 146608)
@@ -282,6 +282,13 @@
     if (graphicsLayerActorGetLayerType(m_layer.get()) == GraphicsLayerClutter::LayerTypeRootLayer)
         return;
 
+    // Even though we call notifyFlushRequired to remove existing animations in removeAnimation(),
+    // removeClutterAnimationFromLayer has been never reached since the root layer is destroyed.
+    // It means that we haven't lost a change to remove actual animations from clutterActor. 
+    // So, we call explictly updateAnimations once here to remove uncommitted animations. 
+    if (m_uncommittedChanges & AnimationChanged)
+        updateAnimations();
+
     willBeDestroyed();
 
     // We destroy the actors on an idle so that the main loop can run enough to
@@ -992,10 +999,27 @@
     return createdAnimations;
 }
 
+void GraphicsLayerClutter::removeAnimation(const String& animationName)
+{
+    if (!animationIsRunning(animationName))
+        return;
+
+    m_animationsToProcess.add(animationName, AnimationProcessingAction(Remove));
+    noteLayerPropertyChanged(AnimationChanged);
+}
+
 bool GraphicsLayerClutter::removeClutterAnimationFromLayer(AnimatedPropertyID property, const String& animationName, int index)
 {
-    notImplemented();
-    return false;
+    GraphicsLayerActor* layer = animatedLayer(property);
+
+    String animationID = animationIdentifier(animationName, property, index);
+
+    PlatformClutterAnimation* existingAnimation = graphicsLayerActorGetAnimationForKey(layer, animationID);
+    if (!existingAnimation)
+        return false;
+
+    existingAnimation->removeAnimationForKey(layer, animationID);
+    return true;
 }
 
 void GraphicsLayerClutter::pauseClutterAnimationOnLayer(AnimatedPropertyID property, const String& animationName, int index, double timeOffset)

Modified: trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h (146607 => 146608)


--- trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h	2013-03-22 14:28:56 UTC (rev 146607)
+++ trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h	2013-03-22 14:38:31 UTC (rev 146608)
@@ -80,6 +80,7 @@
     virtual void setNeedsDisplayInRect(const FloatRect&);
 
     virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String& animationName, double timeOffset);
+    virtual void removeAnimation(const String& animationName);
 
     virtual void flushCompositingState(const FloatRect&);
     virtual void flushCompositingStateForThisLayerOnly();
@@ -88,6 +89,12 @@
 
 private:
     FloatPoint computePositionRelativeToBase(float& pageScale) const;
+
+    bool animationIsRunning(const String& animationName) const
+    {
+        return m_runningAnimations.find(animationName) != m_runningAnimations.end();
+    }
+
     void commitLayerChangesBeforeSublayers(float pageScaleFactor, const FloatPoint& positionRelativeToBase);
     void commitLayerChangesAfterSublayers();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to