[chromium] Allow scrolling non-root layers in the compositor thread
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jun 2012 12:45:58 +0000 (12:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jun 2012 12:45:58 +0000 (12:45 +0000)
commitda508ee734146a784f000e4455f95996d79fed41
treec6b20165cfe8c7e7bf813e25b12a04e3526d962f
parent2aa1a450d2be0eabfe608034e29a065747d69448
[chromium] Allow scrolling non-root layers in the compositor thread
https://bugs.webkit.org/show_bug.cgi?id=73350

Patch by Sami Kyostila <skyostil@chromium.org> on 2012-06-15
Reviewed by James Robinson.

Source/WebCore:

This patch enables scrolling child layers in the compositor thread.
Scroll deltas are accumulated for each scrolled CCLayerImpl and
synchronized to the main thread.

If a layer has no room to scroll in a given direction, one of its
ancestor layers is scrolled instead if possible.

Layer hit testing code by Shawn Singh.

Added new unit tests to verify layer scrolling behavior:

    CCLayerTreeHostCommonTest.verifySubtreeSearch
    CCLayerTreeHostImplTest.clearRootRenderSurfaceAndScroll
    CCLayerTreeHostImplTest.inhibitScrollAndPageScaleUpdatesWhileAnimatingPageScale
    CCLayerTreeHostImplTest.inhibitScrollAndPageScaleUpdatesWhilePinchZooming
    CCLayerTreeHostImplTest.replaceTreeWhileScrolling
    CCLayerTreeHostImplTest.scrollBeforeRedraw
    CCLayerTreeHostImplTest.scrollBlockedByContentLayer
    CCLayerTreeHostImplTest.scrollChildAndChangePageScaleOnMainThread
    CCLayerTreeHostImplTest.scrollChildBeyondLimit
    CCLayerTreeHostImplTest.scrollChildCallsCommitAndRedraw
    CCLayerTreeHostImplTest.scrollEventBubbling
    CCLayerTreeHostImplTest.scrollMissesBackfacingChild
    CCLayerTreeHostImplTest.scrollMissesChild
    CCLayerTreeHostImplTest.scrollNonCompositedRoot
    CCLayerTreeHostImplTest.scrollRootAndChangePageScaleOnImplThread
    CCLayerTreeHostImplTest.scrollRootAndChangePageScaleOnMainThread
    CCLayerTreeHostImplTest.scrollRootIgnored
    CCLayerTreeHostImplTest.scrollWithoutRootLayer
    CCLayerTreeHostTestScrollChildLayer
    WebCompositorInputHandlerImplTest.gestureScrollOnMainThread

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::setMaxScrollPosition):
(WebCore):
(WebCore::LayerChromium::scrollBy):
(WebCore::LayerChromium::pushPropertiesTo):
* platform/graphics/chromium/LayerChromium.h:
(WebCore):
(LayerChromiumScrollDelegate):
(WebCore::LayerChromiumScrollDelegate::~LayerChromiumScrollDelegate):
(LayerChromium):
(WebCore::LayerChromium::maxScrollPosition):
(WebCore::LayerChromium::scrollable):
(WebCore::LayerChromium::setLayerScrollDelegate):
* platform/graphics/chromium/cc/CCInputHandler.h:
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::tryScroll):
(WebCore):
(WebCore::sortLayers):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::finishCommitOnImplThread):
(WebCore::findFirstScrollableLayer):
(WebCore):
(WebCore::CCLayerTreeHost::applyScrollAndScale):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.h:
(CCLayerTreeHostCommon):
(WebCore):
(WebCore::CCLayerTreeHostCommon::findLayerInSubtree):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::~CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::startPageScaleAnimation):
(WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList):
(WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
(WebCore::CCLayerTreeHostImpl::contentSize):
(WebCore::CCLayerTreeHostImpl::prepareToDraw):
(WebCore::CCLayerTreeHostImpl::drawLayers):
(WebCore::findRootScrollLayer):
(WebCore):
(WebCore::findScrollLayerForContentLayer):
(WebCore::CCLayerTreeHostImpl::setRootLayer):
(WebCore::CCLayerTreeHostImpl::detachLayerTree):
(WebCore::adjustScrollsForPageScaleChange):
(WebCore::applyPageScaleDeltaToScrollLayers):
(WebCore::CCLayerTreeHostImpl::setPageScaleFactorAndLimits):
(WebCore::CCLayerTreeHostImpl::setPageScaleDelta):
(WebCore::CCLayerTreeHostImpl::updateMaxScrollPosition):
(WebCore::CCLayerTreeHostImpl::ensureRenderSurfaceLayerList):
(WebCore::CCLayerTreeHostImpl::clearCurrentlyScrollingLayer):
(WebCore::CCLayerTreeHostImpl::scrollBegin):
(WebCore::CCLayerTreeHostImpl::scrollBy):
(WebCore::CCLayerTreeHostImpl::scrollEnd):
(WebCore::CCLayerTreeHostImpl::pinchGestureUpdate):
(WebCore::CCLayerTreeHostImpl::computePinchZoomDeltas):
(WebCore::CCLayerTreeHostImpl::makeScrollAndScaleSet):
(WebCore::collectScrollDeltas):
(WebCore::CCLayerTreeHostImpl::processScrollDeltas):
(WebCore::CCLayerTreeHostImpl::animatePageScale):
(WebCore::CCLayerTreeHostImpl::animateLayers):
(WebCore::CCLayerTreeHostImpl::clearRenderSurfaces):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(FrameData):
(CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::rootScrollLayer):

Source/WebKit/chromium:

New unit tests to verify layer scrolling behavior and the associated
utility functions.

* src/WebCompositorInputHandlerImpl.cpp:
(WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
(WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
* tests/CCLayerTreeHostCommonTest.cpp:
* tests/CCLayerTreeHostImplTest.cpp:
* tests/CCLayerTreeHostTest.cpp:
(WTF::MockContentLayerDelegate::paintContents):
(CCLayerTreeHostTestScrollChildLayer):
(WTF::CCLayerTreeHostTestScrollChildLayer::CCLayerTreeHostTestScrollChildLayer):
(WTF::CCLayerTreeHostTestScrollChildLayer::beginTest):
(WTF::CCLayerTreeHostTestScrollChildLayer::applyScrollAndScale):
(WTF::CCLayerTreeHostTestScrollChildLayer::beginCommitOnCCThread):
(WTF::CCLayerTreeHostTestScrollChildLayer::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestScrollChildLayer::afterTest):
(WTF):
(WTF::TEST_F):
* tests/WebCompositorInputHandlerImplTest.cpp:
(WebKit::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp