[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

cmarrin at apple.com cmarrin at apple.com
Wed Dec 22 15:24:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8df562c9b4a2d5cfcff9b48f0609ddc96d9abbd5
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 2 20:47:18 2010 +0000

    2010-11-02  Chris Marrin  <cmarrin at apple.com>
    
            Reviewed by Simon Fraser.
    
            When animations are paused, play-state can cause them to be unpaused.
            https://bugs.webkit.org/show_bug.cgi?id=46525
    
            I Changed updatePlayState() to only unpause when both play-state is
            "running" and not suspended. Likewise I pause animation when either
            play-state is "paused" or suspended.
    
            Test: animations/play-state-suspend.html
    
            * page/animation/AnimationBase.cpp:
            (WebCore::AnimationBase::updatePlayState):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71161 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 65a7c1b..6bfe1b5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-02  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        When animations are paused, play-state can cause them to be unpaused.
+        https://bugs.webkit.org/show_bug.cgi?id=46525
+
+        Tests that animation stays paused when setting play-state to "running"
+        but animations are suspended.
+
+        * animations/play-state-suspend-expected.txt: Added.
+        * animations/play-state-suspend.html: Added.
+
 2010-11-02  Dmitry Titov  <dimich at chromium.org>
 
         [Chromium] Unreviewed update of test expectations.
diff --git a/LayoutTests/animations/play-state-suspend-expected.txt b/LayoutTests/animations/play-state-suspend-expected.txt
new file mode 100644
index 0000000..6b8f2b8
--- /dev/null
+++ b/LayoutTests/animations/play-state-suspend-expected.txt
@@ -0,0 +1,11 @@
+This test makes sure a play-state change in an animation during suspend does not resume the animation.
+
+PASS - "webkitTransform" property for "box1" element at 0.55s saw something close to: 1,0,0,1,100,0
+PASS - "left" property for "box2" element at 0.55s saw something close to: 100
+PASS - "webkitTransform" property for "box1" element at 0.65s saw something close to: 1,0,0,1,100,0
+PASS - "left" property for "box2" element at 0.65s saw something close to: 100
+PASS - "webkitTransform" property for "box1" element at 0.75s saw something close to: 1,0,0,1,100,0
+PASS - "left" property for "box2" element at 0.75s saw something close to: 100
+PASS - "webkitTransform" property for "box1" element at 1s saw something close to: 1,0,0,1,140,0
+PASS - "left" property for "box2" element at 1s saw something close to: 140
+
diff --git a/LayoutTests/animations/play-state-suspend.html b/LayoutTests/animations/play-state-suspend.html
new file mode 100644
index 0000000..9a5ef2e
--- /dev/null
+++ b/LayoutTests/animations/play-state-suspend.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Test of -webkit-animation-play-state interacting with suspendAnimation</title>
+  <style type="text/css" media="screen">
+    #box1 {
+      height: 100px;
+      width: 100px;
+      background-color: blue;
+      margin: 0;
+      -webkit-animation-duration: 2s;
+      -webkit-animation-timing-function: linear;
+      -webkit-animation-name: "move1";
+      -webkit-animation-play-state: running;
+    }
+    @-webkit-keyframes "move1" {
+        from { -webkit-transform: translateX(0); }
+        to   { -webkit-transform: translateX(400px); }
+    }
+    #box2 {
+      position:absolute;
+      top: 260px;
+      height: 100px;
+      width: 100px;
+      background-color: red;
+      -webkit-animation-duration: 2s;
+      -webkit-animation-timing-function: linear;
+      -webkit-animation-name: "move2";
+    }
+    @-webkit-keyframes "move2" {
+        from { left: 0; }
+        to   { left: 400px; }
+    }
+  </style>
+  <script src="animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
+  <script type="text/javascript" charset="utf-8">
+    
+    const expectedValues = [
+      // [animation-name, time, element-id, property, expected-value, tolerance]
+      ["move1", 0.55, "box1", "webkitTransform", [1,0,0,1,100,0], 20],
+      ["move1", 0.65, "box1", "webkitTransform", [1,0,0,1,100,0], 20],
+      ["move1", 0.75, "box1", "webkitTransform", [1,0,0,1,100,0], 20],
+      ["move1", 1,    "box1", "webkitTransform", [1,0,0,1,140,0], 20],
+      ["move2", 0.55, "box2", "left", 100, 20],
+      ["move2", 0.65, "box2", "left", 100, 20],
+      ["move2", 0.75, "box2", "left", 100, 20],
+      ["move2", 1,    "box2", "left", 140, 20],
+    ];
+    
+    function pause()
+    {
+        document.getElementById("box1").style.webkitAnimationPlayState = "paused";
+        document.getElementById("box2").style.webkitAnimationPlayState = "paused";
+    }
+
+    function suspend()
+    {
+        if (window.layoutTestController)
+            layoutTestController.suspendAnimations();
+    }
+
+    function unpause()
+    {
+        document.getElementById("box1").style.webkitAnimationPlayState = "running";
+        document.getElementById("box2").style.webkitAnimationPlayState = "running";
+    }
+
+    function resume()
+    {
+        if (window.layoutTestController)
+            layoutTestController.resumeAnimations();
+    }
+
+    function setTimers()
+    {
+        setTimeout(pause, 500);
+        setTimeout(suspend, 600);
+        setTimeout(unpause, 700);
+        setTimeout(resume, 800);
+    }
+    
+    runAnimationTest(expectedValues, setTimers, null /* event */, true /* disablePauseAnimationAPI */);
+    
+  </script>
+</head>
+<body>
+<p>
+This test makes sure a play-state change in an animation during suspend does not resume the animation.
+<div id="box1">
+</div>
+<div id="box2">
+</div>
+<div id="result">
+</div>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d90a68d..9865419 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -266,6 +266,22 @@
 
 2010-11-02  Chris Marrin  <cmarrin at apple.com>
 
+        Reviewed by Simon Fraser.
+
+        When animations are paused, play-state can cause them to be unpaused.
+        https://bugs.webkit.org/show_bug.cgi?id=46525
+
+        I Changed updatePlayState() to only unpause when both play-state is 
+        "running" and not suspended. Likewise I pause animation when either
+        play-state is "paused" or suspended.
+
+        Test: animations/play-state-suspend.html
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::updatePlayState):
+
+2010-11-02  Chris Marrin  <cmarrin at apple.com>
+
         Reviewed by Adam Roben.
 
         Make RenderStyle::playState() return typed value and cleanup naming in Animation code
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index bab396f..ad5257e 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -1208,9 +1208,15 @@ void AnimationBase::fireAnimationEventsIfNeeded()
 
 void AnimationBase::updatePlayState(EAnimPlayState playState)
 {
-    bool run = playState == AnimPlayStatePlaying;
-    if (paused() == run || isNew())
-        updateStateMachine(run ? AnimationStateInputPlayStateRunning : AnimationStateInputPlayStatePaused, -1);
+    // When we get here, we can have one of 4 desired states: running, paused, suspended, paused & suspended.
+    // The state machine can be in one of two states: running, paused.
+    // Set the state machine to the desired state.
+    bool pause = playState == AnimPlayStatePaused || m_compAnim->suspended();
+    
+    if (pause == paused() && !isNew())
+        return;
+    
+    updateStateMachine(pause ?  AnimationStateInputPlayStatePaused : AnimationStateInputPlayStateRunning, -1);
 }
 
 double AnimationBase::timeToNextService()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list