Skip to content
  • noam.rosenthal@nokia.com's avatar
    Coordinated Graphics: Animation jerkiness when rAF is enabled · 085d3fc3
    noam.rosenthal@nokia.com authored
    https://bugs.webkit.org/show_bug.cgi?id=100536
    
    Reviewed by Kenneth Rohde Christiansen.
    
    Source/WebKit2:
    
    The jerkiness comes from the fact that we schedule animations excessively; That's because
    the previous patch broke requestAnimationFrame behavior during CSS animations, since the
    frame returns right away instead of waiting till the previous frame is actually rendered.
    
    This patch makes sure that when animations are scheduled, they're only serviced after the
    UI process has actually painted the previous frame. We do so by sending a
    RequestAnimationFrame message to the UI process, which responds with AnimationFrameReady
    after the UI process paints.
    
    New test: fast/animations/request-animation-frame-too-rapid.html
    Tests that we don't receive an unreasonably high number of callbacks from
    requestAnimationFrame (> 1000FPS).
    
    * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
    (WebKit):
    (WebKit::LayerTreeCoordinatorProxy::requestAnimationFrame):
    (WebKit::LayerTreeCoordinatorProxy::animationFrameReady):
    * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
    (LayerTreeCoordinatorProxy):
    * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
    * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
    (WebKit::LayerTreeRenderer::LayerTreeRenderer):
    (WebKit::LayerTreeRenderer::paintToCurrentGLContext):
    (WebKit):
    (WebKit::LayerTreeRenderer::animationFrameReady):
    (WebKit::LayerTreeRenderer::requestAnimationFrame):
    * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
    (LayerTreeRenderer):
    * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
    (WebKit):
    (WebKit::LayerTreeCoordinator::scheduleAnimation):
    (WebKit::LayerTreeCoordinator::animationFrameReady):
    * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
    (LayerTreeCoordinator):
    * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.messages.in:
    
    LayoutTests:
    
    Added a test to make sure we don't respond too eagerly to requestAnimationFrame.
    
    * fast/animation/request-animation-frame-too-rapid-expected.txt: Added.
    * fast/animation/request-animation-frame-too-rapid.html: Added.
    * fast/animation/script-tests/request-animation-frame-too-rapid.js: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    085d3fc3