Index: third_party/WebKit/Source/core/frame/VisualViewport.cpp |
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp |
index fe5ac4494ee2ecb6dc58e36d675b0f7f4d2dad20..8e93460ea8d7003ac62732601cf4085c3b865eb3 100644 |
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp |
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp |
@@ -542,6 +542,20 @@ bool VisualViewport::shouldUseIntegerScrollOffset() const |
return ScrollableArea::shouldUseIntegerScrollOffset(); |
} |
+void VisualViewport::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scrollType, ScrollBehavior scrollBehavior) |
+{ |
+ // We clamp the position here, because the ScrollAnimator may otherwise be |
+ // set to a non-clamped position by ScrollableArea::setScrollPosition, |
+ // which may lead to incorrect scrolling behavior in RootFrameViewport down |
+ // the line. |
+ // TODO(eseckler): Solve this instead by ensuring that ScrollableArea and |
+ // ScrollAnimator are kept in sync. This requires that ScrollableArea always |
+ // stores fractional offsets and that truncation happens elsewhere, see |
+ // crbug.com/626315. |
+ DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); |
+ ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehavior); |
+} |
+ |
int VisualViewport::scrollSize(ScrollbarOrientation orientation) const |
{ |
IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition(); |