[chromium] Use floating point scroll deltas for layers
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2012 16:52:38 +0000 (16:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2012 16:52:38 +0000 (16:52 +0000)
commit0f75bc1448e3b1d4c472e402d10f3191d982a687
tree965c7c9db1fcea4c209aa6e81e596b7ccd6c1a39
parent37abd912ad7066b8aae3e78e2ad06f0c23778393
[chromium] Use floating point scroll deltas for layers
https://bugs.webkit.org/show_bug.cgi?id=81546

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

Source/WebCore:

Use floating point scroll deltas for layers instead of integral scroll
deltas. This is because due to page scaling it may be necessary to
scroll layers in sub-CSS-pixel steps to avoid visible jumps. When the
floating point scroll offset is committed to the main thread, it is
truncated to integer, but the fractional part is kept on the CC side to
make sure fractional scroll offsets are accumulated correctly over
multiple commits.

Test: CCLayerTreeHostTestFractionalScroll

* platform/graphics/FloatPoint.h:
(WebCore::toSize):
(WebCore):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::scrollBy):
(WebCore::CCLayerImpl::setScrollDelta):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::scrollDelta):
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::startPageScaleAnimation):
(WebCore::CCLayerTreeHostImpl::adjustScrollsForPageScaleChange):
(WebCore::CCLayerTreeHostImpl::processScrollDeltas):
(WebCore::CCLayerTreeHostImpl::animatePageScale):

Source/WebKit/chromium:

New unit test for accumulating fractional scroll deltas across multiple commits.

* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestFractionalScroll):
(WTF::CCLayerTreeHostTestFractionalScroll::CCLayerTreeHostTestFractionalScroll):
(WTF::CCLayerTreeHostTestFractionalScroll::beginTest):
(WTF::CCLayerTreeHostTestFractionalScroll::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestFractionalScroll::applyScrollAndScale):
(WTF::CCLayerTreeHostTestFractionalScroll::afterTest):
(WTF):
(WTF::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FloatSize.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp