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

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

Issue 1419143007: Fix bug in CSSOM window.scroll api (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inert scroll events for visual viewport Created 5 years, 1 month 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 | « no previous file | third_party/WebKit/Source/core/frame/VisualViewport.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 734b962d8ee152ed12ed4eda6a06216ee1e2b55f..65b8ef84bada10f9014fa011d3c4eb7058ec003a 100644
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -1135,10 +1135,11 @@ 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);
}
@@ -1206,7 +1207,9 @@ 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();
@@ -1218,7 +1221,7 @@ 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);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/VisualViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698