requestAnimationFrame broken with subframes (DisplayRefreshMonitorManager::registerCl...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 22:25:36 +0000 (22:25 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 22:25:36 +0000 (22:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95360

Patch by Andrew Lo <anlo@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.

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

LayoutTests/ChangeLog
LayoutTests/fast/animation/request-animation-frame-iframe2-expected.txt [new file with mode: 0644]
LayoutTests/fast/animation/request-animation-frame-iframe2.html [new file with mode: 0644]
LayoutTests/fast/animation/script-tests/request-animation-frame-subframe.html
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp

index 78d8672..6e1370f 100644 (file)
@@ -1,3 +1,18 @@
+2012-09-27  Andrew Lo  <anlo@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  <ojan@chromium.org>
 
         platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html is flaky on Mac debug
diff --git a/LayoutTests/fast/animation/request-animation-frame-iframe2-expected.txt b/LayoutTests/fast/animation/request-animation-frame-iframe2-expected.txt
new file mode 100644 (file)
index 0000000..5ea831a
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/fast/animation/request-animation-frame-iframe2.html b/LayoutTests/fast/animation/request-animation-frame-iframe2.html
new file mode 100644 (file)
index 0000000..4f63bd0
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+    <iframe src="script-tests/request-animation-frame-subframe.html" 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>
index 96db828..3752c80 100644 (file)
@@ -4,13 +4,10 @@
 <script src="../../js/resources/js-test-pre.js"></script>
 </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();
     
index b44b9dc..28b0a2e 100644 (file)
@@ -1,3 +1,20 @@
+2012-09-27  Andrew Lo  <anlo@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  <arv@chromium.org>
         Unreviewed Chromium debug build fix.
 
index 30d8d3d..141fb1e 100644 (file)
@@ -76,6 +76,10 @@ void DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread(void*
 
 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 @@ DisplayRefreshMonitor* DisplayRefreshMonitorManager::ensureMonitorForClient(Disp
         m_monitors.add(client->m_displayID, monitor.release());
         return result;
     }
-
+    it->second.get()->addClient(client);
     return it->second.get();
 }