Use IntSize in RenderLayer to represent scroll offsets
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jun 2012 17:24:24 +0000 (17:24 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jun 2012 17:24:24 +0000 (17:24 +0000)
commita1b1ba464601614591e22957b59b9f213d864c45
treeb1b5e5f4ed45187826c8435b419d3a8c46845758
parentcd078f1b7f9cc55defa020845ab122d164a5081c
Use IntSize in RenderLayer to represent scroll offsets
https://bugs.webkit.org/show_bug.cgi?id=89154

Reviewed by Eric Seidel.

Source/WebCore:

Refactoring, covered by existing tests.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::scrollTo):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::forwardEvent):
* page/SpatialNavigation.cpp:
(WebCore::scrollInDirection):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::start):
Updated those call-sites to use the IntSize variant of the scrolling function.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::panScrollFromPoint):
Updated the signature to use IntPoint to avoid an extra round-trip to LayoutPoint
(furthermore touch points should be in device pixels).

(WebCore::RenderLayer::clampScrollOffset):
Added this function that clamps a scroll offset to the box's size. This enables more
code sharing between the different functions. Also removed a NULL-check that shouldn't
be needed: scrolling is a RenderBox concept so any callers should ensure that we have
a RenderBox or it makes no sense to try to scroll.

(WebCore::RenderLayer::updateLayerPosition):
(WebCore::adjustedScrollDelta):
(WebCore::RenderLayer::scrollByRecursively):
(WebCore::RenderLayer::scrollToOffset):
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::updateScrollInfoAfterLayout):
Updated to do IntSize arithmetic. Reuse clampScrollOffset when applicable.

* rendering/RenderLayer.h:
(WebCore::RenderLayer::scrollToXOffset):
(WebCore::RenderLayer::scrollToYOffset):
Updated the functions to take IntSize as much as possible.

Source/WebKit/blackberry:

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::scrollRenderer):
Updated to pass an IntSize to scrollToOffset.

Source/WebKit/win:

* WebView.cpp:
(WebView::gesture):
Updated to pass an IntSize to scrollByRecursively.

Source/WebKit2:

* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::gestureDidScroll):
Updated to pass an IntSize to scrollByRecursively.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/page/SpatialNavigation.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderMarquee.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp