RESOLVED FIXED95360
requestAnimationFrame broken with subframes (DisplayRefreshMonitorManager::registerClient fails to register client)
https://bugs.webkit.org/show_bug.cgi?id=95360
Summary requestAnimationFrame broken with subframes (DisplayRefreshMonitorManager::re...
Arvid Nilsson
Reported 2012-08-29 11:02:32 PDT
If there's already one client registered for a specific display ID, any further clients with that display ID will fail to be added, because registerClient only calls ensureMonitorForClient, which only adds the client to the monitor when creating it. If a monitor already existed, it will fail to add the new client and just return the existing monitor.
Attachments
RAF test (to be used in a subframe) (528 bytes, text/html)
2012-08-30 15:13 PDT, Simon Fraser (smfr)
no flags
Test with RAF in main document and iframe (785 bytes, text/html)
2012-08-30 15:14 PDT, Simon Fraser (smfr)
no flags
Patch (5.25 KB, patch)
2012-09-27 13:42 PDT, Andrew Lo
no flags
Patch (6.09 KB, patch)
2012-09-27 15:03 PDT, Andrew Lo
no flags
Patch (2.17 KB, patch)
2012-09-27 19:26 PDT, Andrew Lo
no flags
Simon Fraser (smfr)
Comment 1 2012-08-29 11:07:33 PDT
What are the user-visible effects of this bug?
Arvid Nilsson
Comment 2 2012-08-29 11:48:24 PDT
It looks to me like it would be a problem if you managed to get two ScriptedAnimationController instances to request animation frames. The second one would fail to register with the monitor. I'll see if I can put together something that manages to do that (it may be impossible due to more high level mechanisms, not sure). The reason I ran into this is not a specific bug, but development on a new feature for the BlackBerry port, perform accelerated compositing sync on a requestAnimationFrame instead of a 0-timeout timer. The idea is to service all the JS animations first, and then perform the AC sync last, to make sure their most recent animation changes become visible immediately.
Simon Fraser (smfr)
Comment 3 2012-08-29 11:52:56 PDT
So a page with an iframe, and both the parent and iframe doing RAF would see this?
Arvid Nilsson
Comment 4 2012-08-29 13:55:51 PDT
(In reply to comment #3) > So a page with an iframe, and both the parent and iframe doing RAF would see this? Yes, I'll try a frameset or iframe testcase as a reduction. So far, this is all in theory :)
Simon Fraser (smfr)
Comment 5 2012-08-30 15:13:17 PDT
Created attachment 161568 [details] RAF test (to be used in a subframe)
Simon Fraser (smfr)
Comment 6 2012-08-30 15:14:11 PDT
Created attachment 161569 [details] Test with RAF in main document and iframe
Simon Fraser (smfr)
Comment 7 2012-08-30 15:14:43 PDT
The attached second testcase certainly shows issues.
Simon Fraser (smfr)
Comment 8 2012-08-30 15:15:29 PDT
Safari also feels sluggish after loading these testcases.
Radar WebKit Bug Importer
Comment 9 2012-08-30 15:16:05 PDT
Andrew Lo
Comment 10 2012-09-26 14:26:20 PDT
taking
Andrew Lo
Comment 11 2012-09-27 13:42:19 PDT
Simon Fraser (smfr)
Comment 12 2012-09-27 13:58:19 PDT
Comment on attachment 166058 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166058&action=review > LayoutTests/fast/animation/request-animation-frame-iframe2.html:23 > + window.webkitRequestAnimationFrame(function() { > + mainFrameCallbackInvoked = true; > + }, e); requestAnimationFrame() does not take an element parameter. That subframe JS should be fixed too.
Andrew Lo
Comment 13 2012-09-27 15:03:24 PDT
WebKit Review Bot
Comment 14 2012-09-27 15:25:20 PDT
Comment on attachment 166069 [details] Patch Clearing flags on attachment: 166069 Committed r129808: <http://trac.webkit.org/changeset/129808>
WebKit Review Bot
Comment 15 2012-09-27 15:25:24 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 16 2012-09-27 16:43:27 PDT
Comment on attachment 166069 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166069&action=review > Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp:83 > + DisplayRefreshMonitorClientSet::iterator it = m_clients.find(client); > + if (it != m_clients.end()) > + return; > + > m_clients.add(client); This change was not needed. The HashSet::add function already is guaranteed to safely do nothing if the pointer is already in the set. Please roll this change out, since it all it does is add additional unnecessary code. > Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp:143 > + it->second.get()->addClient(client); Should not need to explicitly call get() if we are going to use -> right afterward. Pleas omit the ".get()" here.
Andrew Lo
Comment 17 2012-09-27 19:26:40 PDT
Reopening to attach new patch.
Andrew Lo
Comment 18 2012-09-27 19:26:45 PDT
WebKit Review Bot
Comment 19 2012-09-27 20:15:16 PDT
Comment on attachment 166118 [details] Patch Clearing flags on attachment: 166118 Committed r129842: <http://trac.webkit.org/changeset/129842>
WebKit Review Bot
Comment 20 2012-09-27 20:15:20 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.