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

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

Issue 1905693003: Update visual viewport API to take browser zoom into account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments % cleanup Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/VisualViewport.cpp
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
index 972c3bd1f4798080d8e9668818e0a3fc4dbaf597..5321bd6e62b7cedd556fbdd785667658cec9695d 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -211,44 +211,62 @@ void VisualViewport::setScale(float scale)
double VisualViewport::scrollLeft()
{
+ if (!mainFrame())
+ return 0;
+
updateLayoutIgnorePendingStylesheets();
- return visibleRect().x();
+ return adjustScrollForAbsoluteZoom(visibleRect().x(), mainFrame()->pageZoomFactor());
}
double VisualViewport::scrollTop()
{
+ if (!mainFrame())
+ return 0;
+
updateLayoutIgnorePendingStylesheets();
- return visibleRect().y();
+ return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomFactor());
}
void VisualViewport::setScrollLeft(double x)
{
+ if (!mainFrame())
+ return;
+
updateLayoutIgnorePendingStylesheets();
- setLocation(FloatPoint(x, visibleRect().y()));
+ setLocation(FloatPoint(x * mainFrame()->pageZoomFactor(), location().y()));
}
void VisualViewport::setScrollTop(double y)
{
+ if (!mainFrame())
+ return;
+
updateLayoutIgnorePendingStylesheets();
- setLocation(FloatPoint(visibleRect().x(), y));
+ setLocation(FloatPoint(location().x(), y * mainFrame()->pageZoomFactor()));
}
double VisualViewport::clientWidth()
{
+ if (!mainFrame())
+ return 0;
+
updateLayoutIgnorePendingStylesheets();
- return visibleRect().width();
+ return adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame()->pageZoomFactor());
}
double VisualViewport::clientHeight()
{
+ if (!mainFrame())
+ return 0;
+
updateLayoutIgnorePendingStylesheets();
- return visibleRect().height();
+ return adjustScrollForAbsoluteZoom(visibleSize().height(), mainFrame()->pageZoomFactor());
}
double VisualViewport::pageScale()
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698