[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:31:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f81d90b6285d26c833e3bbbe12868632257a6b92
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 5 16:38:46 2010 +0000

    2010-11-05  Chris Marrin  <cmarrin at apple.com>
    
            Reviewed by Simon Fraser.
    
            Make suspendAnimations/resumeAnimations and setCSSAnimations traverse through subframes and remember state
            https://bugs.webkit.org/show_bug.cgi?id=46945
    
            Add new funtions to suspend and resume animations. The go through all subframes and suspend or resume them
            recursively.
    
            Test: animations/stop-animation-on-suspend.html
    
            * WebCore.exp.in:
            * page/Frame.cpp:
            (WebCore::Frame::suspendAnimations):
            (WebCore::Frame::resumeAnimations):
            * page/Frame.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71424 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4365882..3c1cc8d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-05  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Make suspendAnimations/resumeAnimations and setCSSAnimations traverse through subframes and remember state
+        https://bugs.webkit.org/show_bug.cgi?id=46945
+
+        New test which starts animations in the page an in an iframe. Makes sure both animations
+        stop when suspendAnimations is called. I also added dot notation syntax to animation-test-helpers.js
+        that can dig down into iframes to values for testing.
+
+        * animations/animation-test-helpers.js:
+        (checkExpectedValue):
+        * animations/stop-animation-on-suspend-expected.txt: Added.
+        * animations/stop-animation-on-suspend.html: Added.
+
 2010-11-05  Stephen White  <senorblanco at chromium.org>
 
         Unreviewed; test_expectations fix.
diff --git a/LayoutTests/animations/animation-test-helpers.js b/LayoutTests/animations/animation-test-helpers.js
index 2a68ef8..e15e1b0 100644
--- a/LayoutTests/animations/animation-test-helpers.js
+++ b/LayoutTests/animations/animation-test-helpers.js
@@ -23,6 +23,9 @@ Function parameters:
     [2] If a single string is passed, it is the id of the element to test. If an array with 2 elements is passed they
     are the ids of 2 elements, whose values are compared for equality. In this case the expected value is ignored
     but the tolerance is used in the comparison.
+    
+    If a string with a '.' is passed, this is an element in an iframe. The string before the dot is the iframe id
+    and the string after the dot is the element name in that iframe.
 
     [3] If the CSS property name is "webkitTransform", expected value must be an array of 1 or more numbers corresponding to the matrix elements,
     or a string which will be compared directly (useful if the expected value is "none")
@@ -65,6 +68,16 @@ function checkExpectedValue(expected, index)
         elementId = elementId[0];
         compareElements = true;
     }
+    
+    // Check for a dot separated string
+    var iframeId;
+    if (!compareElements) {
+        var array = elementId.split('.');
+        if (array.length == 2) {
+            iframeId = array[0];
+            elementId = array[1];
+        }
+    }
 
     if (animationName && hasPauseAnimationAPI && !layoutTestController.pauseAnimationAtTimeOnElementWithId(animationName, time, elementId)) {
         result += "FAIL - animation \"" + animationName + "\" is not running" + "<br>";
@@ -79,7 +92,13 @@ function checkExpectedValue(expected, index)
     var computedValue, computedValue2;
     var pass = true;
     if (!property.indexOf("webkitTransform")) {
-        computedValue = window.getComputedStyle(document.getElementById(elementId)).webkitTransform;
+        var element;
+        if (iframeId)
+            element = document.getElementById(iframeId).contentDocument.getElementById(elementId);
+        else
+            element = document.getElementById(elementId);
+            
+        computedValue = window.getComputedStyle(element).webkitTransform;
         if (compareElements) {
             computedValue2 = window.getComputedStyle(document.getElementById(elementId2)).webkitTransform;
             var m1 = matrixStringToArray(computedValue);
@@ -108,7 +127,13 @@ function checkExpectedValue(expected, index)
             }
         }
     } else if (property == "lineHeight") {
-        computedValue = parseInt(window.getComputedStyle(document.getElementById(elementId)).lineHeight);
+        var element;
+        if (iframeId)
+            element = document.getElementById(iframeId).contentDocument.getElementById(elementId);
+        else
+            element = document.getElementById(elementId);
+            
+        computedValue = parseInt(window.getComputedStyle(element).lineHeight);
         if (compareElements) {
             computedValue2 = parseInt(window.getComputedStyle(document.getElementById(elementId2)).lineHeight);
             pass = isCloseEnough(computedValue, computedValue2, tolerance);
@@ -116,7 +141,13 @@ function checkExpectedValue(expected, index)
         else
             pass = isCloseEnough(computedValue, expectedValue, tolerance);
     } else {
-        var computedStyle = window.getComputedStyle(document.getElementById(elementId)).getPropertyCSSValue(property);
+        var element;
+        if (iframeId)
+            element = document.getElementById(iframeId).contentDocument.getElementById(elementId);
+        else
+            element = document.getElementById(elementId);
+
+        var computedStyle = window.getComputedStyle(element).getPropertyCSSValue(property);
         computedValue = computedStyle.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
         if (compareElements) {
             var computedStyle2 = window.getComputedStyle(document.getElementById(elementId2)).getPropertyCSSValue(property);
@@ -129,14 +160,24 @@ function checkExpectedValue(expected, index)
 
     if (compareElements) {
         if (pass)
-            result += "PASS - \"" + property + "\" property for \"" + elementId + "\" and \"" + elementId2 + "\" elements at " + time + "s are close enough to each other" + "<br>";
+            result += "PASS - \"" + property + "\" property for \"" + elementId + "\" and \"" + elementId2 + 
+                            "\" elements at " + time + "s are close enough to each other" + "<br>";
         else
-            result += "FAIL - \"" + property + "\" property for \"" + elementId + "\" and \"" + elementId2 + "\" elements at " + time + "s saw: \"" + computedValue + "\" and \"" + computedValue2 + "\" which are not close enough to each other" + "<br>";
+            result += "FAIL - \"" + property + "\" property for \"" + elementId + "\" and \"" + elementId2 + 
+                            "\" elements at " + time + "s saw: \"" + computedValue + "\" and \"" + computedValue2 + 
+                                            "\" which are not close enough to each other" + "<br>";
     } else {
+        var elementName;
+        if (iframeId)
+            elementName = iframeId + '.' + elementId;
+        else
+            elementName = elementId;
         if (pass)
-            result += "PASS - \"" + property + "\" property for \"" + elementId + "\" element at " + time + "s saw something close to: " + expectedValue + "<br>";
+            result += "PASS - \"" + property + "\" property for \"" + elementName + "\" element at " + time + 
+                            "s saw something close to: " + expectedValue + "<br>";
         else
-            result += "FAIL - \"" + property + "\" property for \"" + elementId + "\" element at " + time + "s expected: " + expectedValue + " but saw: " + computedValue + "<br>";
+            result += "FAIL - \"" + property + "\" property for \"" + elementName + "\" element at " + time + 
+                            "s expected: " + expectedValue + " but saw: " + computedValue + "<br>";
     }
 }
 
diff --git a/LayoutTests/animations/resources/stop-animation-on-suspend-subframe.html b/LayoutTests/animations/resources/stop-animation-on-suspend-subframe.html
new file mode 100644
index 0000000..9f75dee
--- /dev/null
+++ b/LayoutTests/animations/resources/stop-animation-on-suspend-subframe.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    body { background-color:silver }
+    
+    .box {
+        height: 100px;
+        width: 100px;
+        margin: 35px;
+        background-color: blue;
+        overflow:hidden;
+        -webkit-animation: move 400ms alternate infinite linear;
+    }
+
+    @-webkit-keyframes move {
+        from { -webkit-transform: translate3d(0px, 0px, 0px); }
+        to   { -webkit-transform: translate3d(400px, 0px, 0px); }
+    }
+  </style>
+</head>
+<body>
+
+    <div id="subframe-box" class="box">
+    </div>
+    <div id="result"></div>
+
+</body>
+</html>
diff --git a/LayoutTests/animations/stop-animation-on-suspend-expected.txt b/LayoutTests/animations/stop-animation-on-suspend-expected.txt
new file mode 100644
index 0000000..7700c89
--- /dev/null
+++ b/LayoutTests/animations/stop-animation-on-suspend-expected.txt
@@ -0,0 +1,6 @@
+
+PASS - "webkitTransform" property for "box" element at 0.2s saw something close to: 1,0,0,1,100,0
+PASS - "webkitTransform" property for "iframe.subframe-box" element at 0.2s saw something close to: 1,0,0,1,100,0
+PASS - "webkitTransform" property for "box" element at 0.4s saw something close to: 1,0,0,1,200,0
+PASS - "webkitTransform" property for "iframe.subframe-box" element at 0.4s saw something close to: 1,0,0,1,200,0
+
diff --git a/LayoutTests/animations/stop-animation-on-suspend.html b/LayoutTests/animations/stop-animation-on-suspend.html
new file mode 100644
index 0000000..80c8123
--- /dev/null
+++ b/LayoutTests/animations/stop-animation-on-suspend.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <title>Test that animations stop on suspend</title>
+  <style type="text/css" media="screen">
+    iframe {
+        border: 1px solid black;
+        padding: 5px;
+        margin: 20px;
+        height: 200px;
+        width: 600px;
+    }
+    
+    .box {
+        height: 100px;
+        width: 100px;
+        margin: 35px;
+        padding: 5px;
+        background-color: green;
+        overflow:hidden;
+        -webkit-animation: move 400ms alternate infinite linear;
+    }
+
+    @-webkit-keyframes move {
+        from { -webkit-transform: translate3d(0px, 0px, 0px); }
+        to   { -webkit-transform: translate3d(400px, 0px, 0px); }
+    }
+  </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]
+      ["move", 0.2, "box", "webkitTransform", [1,0,0,1, 100, 0], 15],
+      ["move", 0.2, "iframe.subframe-box", "webkitTransform", [1,0,0,1, 100, 0], 15],
+      ["move", 0.4, "box", "webkitTransform", [1,0,0,1, 200, 0], 15],
+      ["move", 0.4, "iframe.subframe-box", "webkitTransform", [1,0,0,1, 200, 0], 15],
+    ];
+    
+    function suspend()
+    {
+        if (window.layoutTestController)
+            layoutTestController.suspendAnimations();
+    }
+    
+    function resume()
+    {
+        if (window.layoutTestController)
+            layoutTestController.resumeAnimations();
+    }
+    
+    function setTimers()
+    {
+        setTimeout(suspend, 100);
+        setTimeout(resume, 300);
+    }
+
+    runAnimationTest(expectedValues, setTimers, undefined, true);
+    
+  </script>
+</head>
+<body>
+    <div class="box" id="box"></div>
+    <!-- The parent document may into compositing mode by the iframe. -->
+    <iframe id="iframe" src="resources/stop-animation-on-suspend-subframe.html"></iframe>
+    <div id="result"></div>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 26928c2..7be64f3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-11-05  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Make suspendAnimations/resumeAnimations and setCSSAnimations traverse through subframes and remember state
+        https://bugs.webkit.org/show_bug.cgi?id=46945
+
+        Add new funtions to suspend and resume animations. The go through all subframes and suspend or resume them
+        recursively.
+
+        Test: animations/stop-animation-on-suspend.html
+
+        * WebCore.exp.in:
+        * page/Frame.cpp:
+        (WebCore::Frame::suspendAnimations):
+        (WebCore::Frame::resumeAnimations):
+        * page/Frame.h:
+
 2010-11-05  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index dc207bf..0fc9a23 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -634,8 +634,10 @@ __ZN7WebCore5Cache13getStatisticsEv
 __ZN7WebCore5Cache13setCapacitiesEjjj
 __ZN7WebCore5Frame10createViewERKNS_7IntSizeERKNS_5ColorEbS3_bNS_13ScrollbarModeEbS7_b
 __ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
+__ZN7WebCore5Frame16resumeAnimationsEv
 __ZN7WebCore5Frame17setPageZoomFactorEf
 __ZN7WebCore5Frame17setTextZoomFactorEf
+__ZN7WebCore5Frame17suspendAnimationsEv
 __ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
 __ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE
 __ZN7WebCore5Frame25setPageAndTextZoomFactorsEff
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 70499d9..dbe69a3 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -989,4 +989,22 @@ void Frame::scalePage(float scale)
     }
 }
 
+void Frame::suspendAnimations()
+{
+    animation()->suspendAnimations(document());
+    
+    // Handle subframes
+    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->suspendAnimations();
+}
+
+void Frame::resumeAnimations()
+{
+    animation()->resumeAnimations(document());
+    
+    // Handle subframes
+    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->resumeAnimations();
+}
+
 } // namespace WebCore
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index 59e1556..0bbfeb5 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -98,6 +98,9 @@ namespace WebCore {
         FrameTree* tree() const;
         AnimationController* animation() const;
         ScriptController* script();
+        
+        void suspendAnimations();
+        void resumeAnimations();
 
         RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame.
         RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 6b33108..d7ccf17 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-05  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Make suspendAnimations/resumeAnimations and setCSSAnimations traverse through subframes and remember state
+        https://bugs.webkit.org/show_bug.cgi?id=46945
+
+        * webkit/webkitwebframe.cpp:
+        (webkit_web_frame_suspend_animations):
+        (webkit_web_frame_resume_animations):
+
 2010-11-03  Daniel Bates  <dbates at rim.com>
 
         For unnamed frames, window.name returns a generated name
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index 20fde35..c60e39a 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -1059,11 +1059,7 @@ void webkit_web_frame_suspend_animations(WebKitWebFrame* frame)
     if (!coreFrame)
         return;
 
-    AnimationController* controller = coreFrame->animation();
-    if (!controller)
-        return;
-
-    controller->suspendAnimations(coreFrame->document());
+    frame->suspendAnimations();
 }
 
 void webkit_web_frame_resume_animations(WebKitWebFrame* frame)
@@ -1072,11 +1068,7 @@ void webkit_web_frame_resume_animations(WebKitWebFrame* frame)
     if (!coreFrame)
         return;
 
-    AnimationController* controller = coreFrame->animation();
-    if (!controller)
-        return;
-
-    controller->resumeAnimations(coreFrame->document());
+    frame->resumeAnimations();
 }
 
 gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame)
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 2502d41..40f6f0c 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-05  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Make suspendAnimations/resumeAnimations and setCSSAnimations traverse through subframes and remember state
+        https://bugs.webkit.org/show_bug.cgi?id=46945
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _suspendAnimations]):
+        (-[WebFrame _resumeAnimations]):
+
 2010-11-04  Jia Pu  <jpu at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 7e0bc38..78f7d6a 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -1136,12 +1136,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     Frame* frame = core(self);
     if (!frame)
         return;
-
-    AnimationController* controller = frame->animation();
-    if (!controller)
-        return;
-
-    controller->suspendAnimations(frame->document());
+        
+    frame->suspendAnimations();
 }
 
 - (void) _resumeAnimations
@@ -1150,11 +1146,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     if (!frame)
         return;
 
-    AnimationController* controller = frame->animation();
-    if (!controller)
-        return;
-
-    controller->resumeAnimations(frame->document());
+    frame->resumeAnimations();
 }
 
 - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 75966d1..40e2b01 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-05  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Make suspendAnimations/resumeAnimations and setCSSAnimations traverse through subframes and remember state
+        https://bugs.webkit.org/show_bug.cgi?id=46945
+
+        * WebFrame.cpp:
+        (WebFrame::suspendAnimations):
+        (WebFrame::resumeAnimations):
+
 2010-11-05  Patrick Gansterer  <paroga at webkit.org>
 
         Reviewed by David Kilzer.
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index f161932..eb51df1 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -1299,11 +1299,7 @@ HRESULT WebFrame::suspendAnimations()
     if (!frame)
         return E_FAIL;
 
-    AnimationController* controller = frame->animation();
-    if (!controller)
-        return E_FAIL;
-
-    controller->suspendAnimations(frame->document());
+    frame->suspendAnimations();
     return S_OK;
 }
 
@@ -1313,11 +1309,7 @@ HRESULT WebFrame::resumeAnimations()
     if (!frame)
         return E_FAIL;
 
-    AnimationController* controller = frame->animation();
-    if (!controller)
-        return E_FAIL;
-
-    controller->resumeAnimations(frame->document());
+    frame->resumeAnimations();
     return S_OK;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list