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

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

Issue 2614993002: Use full viewport height for layout if URL bar is locked shown or hidden. (Closed)
Patch Set: na Created 3 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 97b239bca9e784930ef1cdd502f10efc62b75382..c91b67354a38fa03a4539263b7a1791a8176566d 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -1778,6 +1778,7 @@ void WebViewImpl::performResize() {
// viewport with the browser controls shown.
IntSize ICBSize = m_size;
if (RuntimeEnabledFeatures::inertTopControlsEnabled() &&
+ browserControls().permittedState() == WebBrowserControlsBoth &&
!browserControls().shrinkViewport())
ICBSize.expand(0, -browserControls().height());
@@ -1799,8 +1800,20 @@ void WebViewImpl::performResize() {
void WebViewImpl::updateBrowserControlsState(WebBrowserControlsState constraint,
WebBrowserControlsState current,
bool animate) {
+ WebBrowserControlsState oldPermittedState =
+ browserControls().permittedState();
+
browserControls().updateConstraintsAndState(constraint, current, animate);
+ // If the controls are going from a locked to an unlocked state, or
+ // vice-versa, then we need to force a recompute of the ICB size since that
+ // depends on the permitted browser controls state.
+ if (oldPermittedState != constraint &&
+ (oldPermittedState == WebBrowserControlsBoth ||
+ constraint == WebBrowserControlsBoth)) {
+ performResize();
+ }
+
if (m_layerTreeView)
m_layerTreeView->updateBrowserControlsState(constraint, current, animate);
}
@@ -1847,8 +1860,7 @@ BrowserControls& WebViewImpl::browserControls() {
return page()->frameHost().browserControls();
}
-void WebViewImpl::resizeViewWhileAnchored(FrameView* view,
- float browserControlsHeight,
+void WebViewImpl::resizeViewWhileAnchored(float browserControlsHeight,
bool browserControlsShrinkLayout) {
DCHECK(mainFrameImpl());
@@ -1912,12 +1924,10 @@ void WebViewImpl::resizeWithBrowserControls(const WebSize& newSize,
if (isRotation) {
RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords,
pageScaleConstraintsSet());
- resizeViewWhileAnchored(view, browserControlsHeight,
- browserControlsShrinkLayout);
+ resizeViewWhileAnchored(browserControlsHeight, browserControlsShrinkLayout);
} else {
ResizeViewportAnchor::ResizeScope resizeScope(*m_resizeViewportAnchor);
- resizeViewWhileAnchored(view, browserControlsHeight,
- browserControlsShrinkLayout);
+ resizeViewWhileAnchored(browserControlsHeight, browserControlsShrinkLayout);
}
sendResizeEventAndRepaint();
}
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698