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

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

Issue 2156143002: Add page coordinates to the ViewportAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + fix layout tests Created 4 years, 5 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
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 19537c930850f9368ded4c8a178258888a1bba83..ec67a2f64fca0fbd9de117abb351140248a22068 100644
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -979,41 +979,37 @@ int LocalDOMWindow::screenY() const
double LocalDOMWindow::scrollX() const
{
- if (!frame())
+ if (!frame() || !frame()->host())
return 0;
+ if (!frame()->host()->settings().inertVisualViewport())
+ return m_visualViewport->pageX();
+
FrameView* view = frame()->view();
if (!view)
return 0;
- FrameHost* host = frame()->host();
- if (!host)
- return 0;
-
frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->getScrollableArea();
- double viewportX = viewport->scrollPositionDouble().x();
+ double viewportX = view->layoutViewportScrollableArea()->scrollPositionDouble().x();
return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor());
}
double LocalDOMWindow::scrollY() const
{
- if (!frame())
+ if (!frame() || !frame()->host())
return 0;
+ if (!frame()->host()->settings().inertVisualViewport())
+ return m_visualViewport->pageY();
+
FrameView* view = frame()->view();
if (!view)
return 0;
- FrameHost* host = frame()->host();
- if (!host)
- return 0;
-
frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
- ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->layoutViewportScrollableArea() : view->getScrollableArea();
- double viewportY = viewport->scrollPositionDouble().y();
+ double viewportY = view->layoutViewportScrollableArea()->scrollPositionDouble().y();
return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor());
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp ('k') | third_party/WebKit/Source/core/frame/VisualViewport.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698