Chromium Code Reviews| Index: Source/core/frame/PinchViewport.cpp |
| diff --git a/Source/core/frame/PinchViewport.cpp b/Source/core/frame/PinchViewport.cpp |
| index ffe9f13419e98bfa2b79f3f1c4845bf13718bfce..39c250f02d7619beeab8ce7c778540acd18f3c97 100644 |
| --- a/Source/core/frame/PinchViewport.cpp |
| +++ b/Source/core/frame/PinchViewport.cpp |
| @@ -149,15 +149,18 @@ void PinchViewport::scrollIntoView(const LayoutRect& rect) |
| FrameView* view = mainFrame()->view(); |
| - // Snap the visible rect to layout units to match the input rect. |
| - FloatRect visible = LayoutRect(visibleRect()); |
| + // Snap the visible rect to layout units to match the input rect. Intersect |
| + // with the FrameView so that we exclude scrollbars from the visible area. |
| + FloatRect visible = intersection( |
| + LayoutRect(visibleRectInDocument()), |
| + LayoutRect(view->visibleContentRect())); |
| float centeringOffsetX = (visible.width() - rect.width()) / 2; |
| float centeringOffsetY = (visible.height() - rect.height()) / 2; |
| DoublePoint targetOffset( |
| - rect.x() - centeringOffsetX - visible.x(), |
| - rect.y() - centeringOffsetY - visible.y()); |
|
bokan
2015/01/15 23:53:01
visibleRect() is relative to the FrameView, since
|
| + rect.x() - centeringOffsetX, |
| + rect.y() - centeringOffsetY); |
| view->setScrollPosition(targetOffset); |