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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1612683002: Reland of Don't change layout size due to top control show/hide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 0193aed219630e0291ae57305b3d54955c9f3d01..17424826a5900d818fc4cb0ba8fa7a196d27cb93 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -1837,7 +1837,14 @@
void WebViewImpl::performResize()
{
- pageScaleConstraintsSet().didChangeViewSize(m_size);
+ // We'll keep the initial containing block size from changing when the top
+ // controls hide so that the ICB will always be the same size as the
+ // viewport with the top controls shown.
+ IntSize ICBSize = m_size;
+ if (!topControls().shrinkViewport())
+ ICBSize.expand(0, -topControls().height());
+
+ pageScaleConstraintsSet().didChangeInitialContainingBlockSize(ICBSize);
updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription());
updateMainFrameLayoutSize();
@@ -1918,7 +1925,7 @@
// so that it can be used for initalization if the main frame gets
// swapped to a LocalFrame at a later time.
m_size = newSize;
- pageScaleConstraintsSet().didChangeViewSize(m_size);
+ pageScaleConstraintsSet().didChangeInitialContainingBlockSize(m_size);
page()->frameHost().visualViewport().setSize(m_size);
return;
}
@@ -3297,7 +3304,11 @@
IntSize WebViewImpl::mainFrameSize()
{
- return pageScaleConstraintsSet().mainFrameSize();
+ // The frame size should match the viewport size at minimum scale, since the
+ // viewport must always be contained by the frame.
+ FloatSize frameSize(m_size);
+ frameSize.scale(1 / minimumPageScaleFactor());
+ return expandedIntSize(frameSize);
}
PageScaleConstraintsSet& WebViewImpl::pageScaleConstraintsSet() const
@@ -4100,7 +4111,7 @@
m_size = frameSize;
page()->frameHost().visualViewport().setSize(m_size);
- pageScaleConstraintsSet().didChangeViewSize(m_size);
+ pageScaleConstraintsSet().didChangeInitialContainingBlockSize(m_size);
m_client->didAutoResize(m_size);
sendResizeEventAndRepaint();
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | third_party/WebKit/Source/web/tests/TopControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698