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

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

Issue 1573283002: Don't change layout size due to top control show/hide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant call to viewportSizeForViewportUnits Created 4 years, 11 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/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 5d68ff08ec5d03d29a1993c9a870a18a7d54d514..c1b784b0ff6f7f564c92fabb2520dc3925eb4ac2 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -40,7 +40,9 @@
#include "core/fetch/ResourceFetcher.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/PageScaleConstraintsSet.h"
#include "core/frame/Settings.h"
+#include "core/frame/TopControls.h"
#include "core/html/HTMLFrameElement.h"
#include "core/html/HTMLPlugInElement.h"
#include "core/html/HTMLTextFormControlElement.h"
@@ -1110,6 +1112,29 @@ IntRect FrameView::computeVisibleArea()
return us;
}
+FloatSize FrameView::viewportSizeForViewportUnits() const
+{
+ FloatSize size(layoutSize(IncludeScrollbars));
+
+ // We use the layoutSize rather than frameRect to calculate viewport units
+ // so that we get correct results on mobile where the page is laid out into
+ // a rect that may be larger than the viewport (e.g. the 980px fallback
+ // width for desktop pages). Since the layout height is statically set to
+ // be the viewport with top controls showing, we add the top controls
+ // height, compensating for page scale as well, since we want to use the
+ // viewport with top controls hidden for vh (to match Safari).
+ TopControls& topControls = m_frame->host()->topControls();
+ if (m_frame->isMainFrame() && size.width()) {
+ float pageScaleAtLayoutWidth =
+ m_frame->host()->visualViewport().size().width() / size.width();
+ size.expand(0, topControls.height() / pageScaleAtLayoutWidth);
+ }
+
+ float scale = frame().pageZoomFactor();
+ size.scale(1 / scale);
+ return size;
+}
+
DocumentLifecycle& FrameView::lifecycle() const
{
return m_frame->document()->lifecycle();
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698