Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 2138823002: Clamp in VisualViewport::setScrollPosition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698