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: http://svn.webkit.org/repository/webkit/trunk@120832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/page/SpatialNavigation.cpp b/Source/WebCore/page/SpatialNavigation.cpp
index 6dcb814..4150b64 100644
--- a/Source/WebCore/page/SpatialNavigation.cpp
+++ b/Source/WebCore/page/SpatialNavigation.cpp
@@ -399,7 +399,7 @@
return false;
}
- container->renderBox()->enclosingLayer()->scrollByRecursively(dx, dy);
+ container->renderBox()->enclosingLayer()->scrollByRecursively(IntSize(dx, dy));
return true;
}