Index: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
index a692bc6fb48f1e260eb01111d344e7fcbd9bf004..adcf55a2208a4c0d10a7a80c421a8077d102fe52 100644 |
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
@@ -1136,10 +1136,10 @@ void LocalDOMWindow::scrollBy(double x, double y, ScrollBehavior scrollBehavior) |
x = ScrollableArea::normalizeNonFiniteScroll(x); |
y = ScrollableArea::normalizeNonFiniteScroll(y); |
- DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); |
+ ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
+ DoublePoint currentOffset = viewport->scrollPositionDouble(); |
DoubleSize scaledDelta(x * frame()->pageZoomFactor(), y * frame()->pageZoomFactor()); |
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
viewport->setScrollPosition(currentOffset + scaledDelta, ProgrammaticScroll, scrollBehavior); |
} |
@@ -1207,7 +1207,8 @@ void LocalDOMWindow::scrollTo(const ScrollToOptions& scrollToOptions) const |
double scaledX = 0.0; |
double scaledY = 0.0; |
- DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); |
+ ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
+ DoublePoint currentOffset = viewport->scrollPositionDouble(); |
scaledX = currentOffset.x(); |
scaledY = currentOffset.y(); |
@@ -1219,7 +1220,6 @@ void LocalDOMWindow::scrollTo(const ScrollToOptions& scrollToOptions) const |
ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollBehavior); |
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
viewport->setScrollPosition(DoublePoint(scaledX, scaledY), ProgrammaticScroll, scrollBehavior); |
} |