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

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 853103003: Fix drag-and-drop autoscrolling with --enable-pinch-virtual-viewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change only RenderBox Created 5 years, 11 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 | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index baf97ea1909c8c1bea1eabbf22fefc514121a363..4db4f6d5ceb60f8e56ac455c31a0f55907ed4797 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -526,7 +526,20 @@ void RenderBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
} else {
if (frame()->settings()->pinchVirtualViewportEnabled()) {
PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
- LayoutRect r = ScrollAlignment::getRectToExpose(LayoutRect(pinchViewport.visibleRectInDocument()), rect, alignX, alignY);
+
+ // We want to move the rect into the viewport that excludes the scrollbars so we intersect
+ // the pinch viewport with the scrollbar-excluded frameView content rect.
+ LayoutRect viewRect = intersection(
+ LayoutRect(pinchViewport.visibleRectInDocument()), frameView->visibleContentRect());
+ LayoutRect r = ScrollAlignment::getRectToExpose(viewRect, rect, alignX, alignY);
+
+ // pinchViewport.scrollIntoView will attempt to center the given rect within the viewport
+ // so to prevent it from adjusting r's coordinates the rect must match the viewport's size
+ // i.e. add the subtracted scrollbars from above back in.
+ // FIXME: This is hacky and required because getRectToExpose doesn't naturally account
+ // for the two viewports. crbug.com/449340.
+ r.setSize(LayoutSize(pinchViewport.visibleRectInDocument().size()));
+
pinchViewport.scrollIntoView(r);
} else {
LayoutRect viewRect = frameView->visibleContentRect();
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698