Title: [129808] trunk
Revision
129808
Author
commit-qu...@webkit.org
Date
2012-09-27 15:25:36 -0700 (Thu, 27 Sep 2012)

Log Message

requestAnimationFrame broken with subframes (DisplayRefreshMonitorManager::registerClient fails to register client)
https://bugs.webkit.org/show_bug.cgi?id=95360

Patch by Andrew Lo <a...@rim.com> on 2012-09-27
Reviewed by Simon Fraser.

Source/WebCore:

DisplayRefreshMonitorManager::ensureMonitorForClient currently only adds the DisplayRefreshMonitorClient
to the appropriate DisplayRefreshMonitor when a new monitor is created.
It should also do so when it finds an existing monitor.

Test: fast/animation/request-animation-frame-iframe2.html

* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::addClient):
(WebCore::DisplayRefreshMonitorManager::ensureMonitorForClient):

LayoutTests:

Add a new test which does requestAnimationFrame in both a sub-frame and
main-frame, and checks that both were executed.

* fast/animation/request-animation-frame-iframe2-expected.txt: Added.
* fast/animation/request-animation-frame-iframe2.html: Added.
* fast/animation/script-tests/request-animation-frame-subframe.html:
    Remove element parameter from window.webkitRequestAnimationFrame.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129807 => 129808)


--- trunk/LayoutTests/ChangeLog	2012-09-27 22:15:24 UTC (rev 129807)
+++ trunk/LayoutTests/ChangeLog	2012-09-27 22:25:36 UTC (rev 129808)
@@ -1,3 +1,18 @@
+2012-09-27  Andrew Lo  <a...@rim.com>
+
+        requestAnimationFrame broken with subframes (DisplayRefreshMonitorManager::registerClient fails to register client)
+        https://bugs.webkit.org/show_bug.cgi?id=95360
+
+        Reviewed by Simon Fraser.
+
+        Add a new test which does requestAnimationFrame in both a sub-frame and
+        main-frame, and checks that both were executed.
+
+        * fast/animation/request-animation-frame-iframe2-expected.txt: Added.
+        * fast/animation/request-animation-frame-iframe2.html: Added.
+        * fast/animation/script-tests/request-animation-frame-subframe.html:
+            Remove element parameter from window.webkitRequestAnimationFrame.
+
 2012-09-27  Ojan Vafai  <o...@chromium.org>
 
         platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html is flaky on Mac debug

Added: trunk/LayoutTests/fast/animation/request-animation-frame-iframe2-expected.txt (0 => 129808)


--- trunk/LayoutTests/fast/animation/request-animation-frame-iframe2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-iframe2-expected.txt	2012-09-27 22:25:36 UTC (rev 129808)
@@ -0,0 +1,11 @@
+Tests requestAnimationFrame in both an iframe and main frame
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS callbackInvoked is true
+PASS mainFrameCallbackInvoked is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/animation/request-animation-frame-iframe2.html (0 => 129808)


--- trunk/LayoutTests/fast/animation/request-animation-frame-iframe2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-iframe2.html	2012-09-27 22:25:36 UTC (rev 129808)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+    <iframe src="" width="700" height="500"></iframe>
+    <script type="text/_javascript_" charset="utf-8">
+        description("Tests requestAnimationFrame in both an iframe and main frame");
+
+        var callbackInvoked = false;
+        var mainFrameCallbackInvoked = false;
+
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        window.webkitRequestAnimationFrame(function() {
+            mainFrameCallbackInvoked = true;
+        });
+
+        // Called from subframe.
+        function doDisplay()
+        {
+            if (window.testRunner)
+                testRunner.display();
+        }
+
+        function doCheckResult()
+        {
+            shouldBeTrue("callbackInvoked");
+            shouldBeTrue("mainFrameCallbackInvoked");
+        }
+
+        function doTestDone()
+        {
+            isSuccessfullyParsed();
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+    </script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-subframe.html (129807 => 129808)


--- trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-subframe.html	2012-09-27 22:15:24 UTC (rev 129807)
+++ trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-subframe.html	2012-09-27 22:25:36 UTC (rev 129808)
@@ -4,13 +4,10 @@
 <script src=""
 </head>
 <body>
-<span id="e"></span>
-<span id="f"></span>
 <script>
-    var e = document.getElementById("e");
     window.webkitRequestAnimationFrame(function() {
         parent.callbackInvoked = true;
-    }, e);
+    });
 
     parent.doDisplay();
     

Modified: trunk/Source/WebCore/ChangeLog (129807 => 129808)


--- trunk/Source/WebCore/ChangeLog	2012-09-27 22:15:24 UTC (rev 129807)
+++ trunk/Source/WebCore/ChangeLog	2012-09-27 22:25:36 UTC (rev 129808)
@@ -1,3 +1,20 @@
+2012-09-27  Andrew Lo  <a...@rim.com>
+
+        requestAnimationFrame broken with subframes (DisplayRefreshMonitorManager::registerClient fails to register client)
+        https://bugs.webkit.org/show_bug.cgi?id=95360
+
+        Reviewed by Simon Fraser.
+
+        DisplayRefreshMonitorManager::ensureMonitorForClient currently only adds the DisplayRefreshMonitorClient
+        to the appropriate DisplayRefreshMonitor when a new monitor is created.
+        It should also do so when it finds an existing monitor.
+
+        Test: fast/animation/request-animation-frame-iframe2.html
+
+        * platform/graphics/DisplayRefreshMonitor.cpp:
+        (WebCore::DisplayRefreshMonitor::addClient):
+        (WebCore::DisplayRefreshMonitorManager::ensureMonitorForClient):
+
 2012-09-27  Erik Arvidsson  <a...@chromium.org>
         Unreviewed Chromium debug build fix.
 

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (129807 => 129808)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2012-09-27 22:15:24 UTC (rev 129807)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2012-09-27 22:25:36 UTC (rev 129808)
@@ -76,6 +76,10 @@
 
 void DisplayRefreshMonitor::addClient(DisplayRefreshMonitorClient* client)
 {
+    DisplayRefreshMonitorClientSet::iterator it = m_clients.find(client);
+    if (it != m_clients.end())
+        return;
+
     m_clients.add(client);
 }
 
@@ -136,7 +140,7 @@
         m_monitors.add(client->m_displayID, monitor.release());
         return result;
     }
-
+    it->second.get()->addClient(client);
     return it->second.get();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to