[chromium] Scroll deltas are cleared during commit to the main thread
authorhclam@chromium.org <hclam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2011 14:08:55 +0000 (14:08 +0000)
committerhclam@chromium.org <hclam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2011 14:08:55 +0000 (14:08 +0000)
commit9b4f80bba8509af7cf271d2b26e2a840c232192a
tree845fbe1e0ecce7a1c356f77c28cf31c943a72b67
parent98aabbaddb719345858e51204d262aa88c9eb4b7
[chromium] Scroll deltas are cleared during commit to the main thread
https://bugs.webkit.org/show_bug.cgi?id=71916

Reviewed by James Robinson.

Source/WebCore:

The patch keeps the scroll deltas and scroll position unchanged when
committing to the main thread. After commit has completed on the main
thread the submitted scroll deltas are then subtracted from the current
scroll deltas on the impl thread.

Doing so allow scroll deltas to be available at all time which enables
proper positioning for layers that are fixed-positioned to the
container layer.

This patch is tested by the following unit tests:
- CCLayerTreeHostImplTest.scrollDeltaRepeatedScrolls
  This test is modified to verify that scroll deltas and scroll position
  are unchanged during commit. And then after commit scroll deltas are
  subtracted correctly.

- CCLayerTreeHostTestScrollSimple.runMultiThread and
  CCLayerTreeHostTestScrollMultipleRedraw.runMultiThread
  These tests verifies that scroll deltas made on impl thread are
  committed to the main thread. The scroll deltas is eventually delegated
  to CCLayerTreeHostClient. When commit has completed the scroll deltas
  are subtracted correctly. There's no change to these two tests but they
  verify this patch maintains the overall behavior of scrolling.

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::applyScrollAndScale):
* platform/graphics/chromium/LayerChromium.h:
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::applyScrollAndScale):
* platform/graphics/chromium/cc/CCLayerImpl.h:
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::applyScrollAndScaleInternal):
(WebCore::CCLayerTreeHostCommon::applyScrollAndScale):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.h:
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::processScrollDeltas):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::beginFrameAndCommit):
(WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):
* platform/graphics/chromium/cc/CCThreadProxy.h:

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:
(WebKit::TEST_F):
CCLayerTreeHostImplTest.scrollDeltaRepeatedScrolls
This test is modified to verify that CCLayerTreeHostImpl::processScrollDeltas()
maintain the current scroll deltas and scroll positions.
It also verifies that scroll deltas are subtracted correctly by calling
CCLayerTreeHostCommon::applyScrollAndScale().
* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTest::doBeginTest):
call setLayerTreeHost() on the root layer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 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/CCLayerImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp