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 4a03c8426bee330e75e2a336d81195589f3a09cf..5e0f2603deb6e8a75ca5f51d206a0cf2416d031f 100644 |
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
@@ -934,9 +934,7 @@ static FloatSize getViewportSize(LocalFrame* frame) |
toLocalFrame(parent)->document()->updateLayoutIgnorePendingStylesheets(); |
} |
- return frame->isMainFrame() && !host->settings().inertVisualViewport() |
- ? host->visualViewport().visibleRect().size() |
- : view->visibleContentRect(IncludeScrollbars).size(); |
+ return view->visibleContentRect(IncludeScrollbars).size(); |
} |
int LocalDOMWindow::innerHeight() const |
@@ -1000,8 +998,7 @@ double LocalDOMWindow::scrollX() const |
frame()->document()->updateLayoutIgnorePendingStylesheets(); |
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
- double viewportX = viewport->scrollPositionDouble().x(); |
+ double viewportX = view->layoutViewportScrollableArea()->scrollPositionDouble().x(); |
return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor()); |
} |
@@ -1020,8 +1017,7 @@ double LocalDOMWindow::scrollY() const |
frame()->document()->updateLayoutIgnorePendingStylesheets(); |
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
- double viewportY = viewport->scrollPositionDouble().y(); |
+ double viewportY = view->layoutViewportScrollableArea()->scrollPositionDouble().y(); |
return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); |
} |
@@ -1129,18 +1125,14 @@ void LocalDOMWindow::scrollBy(double x, double y, ScrollBehavior scrollBehavior) |
if (!view) |
return; |
- FrameHost* host = frame()->host(); |
- if (!host) |
- return; |
- |
x = ScrollableArea::normalizeNonFiniteScroll(x); |
y = ScrollableArea::normalizeNonFiniteScroll(y); |
- DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); |
+ DoublePoint currentOffset = view->layoutViewportScrollableArea()->scrollPositionDouble(); |
DoubleSize scaledDelta(x * frame()->pageZoomFactor(), y * frame()->pageZoomFactor()); |
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
- viewport->setScrollPosition(currentOffset + scaledDelta, ProgrammaticScroll, scrollBehavior); |
+ view->layoutViewportScrollableArea()->setScrollPosition( |
+ currentOffset + scaledDelta, ProgrammaticScroll, scrollBehavior); |
} |
void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const |
@@ -1165,10 +1157,6 @@ void LocalDOMWindow::scrollTo(double x, double y) const |
if (!view) |
return; |
- FrameHost* host = frame()->host(); |
- if (!host) |
- return; |
- |
x = ScrollableArea::normalizeNonFiniteScroll(x); |
y = ScrollableArea::normalizeNonFiniteScroll(y); |
@@ -1178,8 +1166,8 @@ void LocalDOMWindow::scrollTo(double x, double y) const |
document()->updateLayoutIgnorePendingStylesheets(); |
DoublePoint layoutPos(x * frame()->pageZoomFactor(), y * frame()->pageZoomFactor()); |
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->scrollableArea(); |
- viewport->setScrollPosition(layoutPos, ProgrammaticScroll, ScrollBehaviorAuto); |
+ view->layoutViewportScrollableArea()->setScrollPosition( |
+ layoutPos, ProgrammaticScroll, ScrollBehaviorAuto); |
} |
void LocalDOMWindow::scrollTo(const ScrollToOptions& scrollToOptions) const |
@@ -1191,10 +1179,6 @@ void LocalDOMWindow::scrollTo(const ScrollToOptions& scrollToOptions) const |
if (!view) |
return; |
- FrameHost* host = frame()->host(); |
- if (!host) |
- return; |
- |
// It is only necessary to have an up-to-date layout if the position may be clamped, |
// which is never the case for (0, 0). |
if (!scrollToOptions.hasLeft() |
@@ -1207,7 +1191,7 @@ void LocalDOMWindow::scrollTo(const ScrollToOptions& scrollToOptions) const |
double scaledX = 0.0; |
double scaledY = 0.0; |
- DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); |
+ DoublePoint currentOffset = view->layoutViewportScrollableArea()->scrollPositionDouble(); |
scaledX = currentOffset.x(); |
scaledY = currentOffset.y(); |
@@ -1219,8 +1203,9 @@ 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); |
+ |
+ view->layoutViewportScrollableArea()->setScrollPosition( |
+ DoublePoint(scaledX, scaledY), ProgrammaticScroll, scrollBehavior); |
} |
void LocalDOMWindow::moveBy(int x, int y) const |