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

Unified Diff: third_party/WebKit/Source/core/frame/DOMVisualViewport.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/DOMVisualViewport.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp b/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp
index 2eae2a1878b4e91e7ccdab438068bb4be18efcf3..d27936f47e05d3a645794a5837094b665e36a55c 100644
--- a/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp
@@ -28,6 +28,7 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/frame/FrameHost.h"
+#include "core/frame/FrameView.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/VisualViewport.h"
@@ -85,6 +86,36 @@ double DOMVisualViewport::scrollTop()
return 0;
}
+double DOMVisualViewport::pageX()
+{
+ LocalFrame* frame = m_window->frame();
+ if (!frame)
+ return 0;
+
+ FrameView* view = frame->view();
+ if (!view)
+ return 0;
+
+ frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+ double viewportX = view->getScrollableArea()->scrollPositionDouble().x();
+ return adjustScrollForAbsoluteZoom(viewportX, frame->pageZoomFactor());
+}
+
+double DOMVisualViewport::pageY()
+{
+ LocalFrame* frame = m_window->frame();
+ if (!frame)
+ return 0;
+
+ FrameView* view = frame->view();
+ if (!view)
+ return 0;
+
+ frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+ double viewportY = view->getScrollableArea()->scrollPositionDouble().y();
+ return adjustScrollForAbsoluteZoom(viewportY, frame->pageZoomFactor());
+}
+
double DOMVisualViewport::clientWidth()
{
LocalFrame* frame = m_window->frame();
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMVisualViewport.h ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698