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

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

Issue 2105523002: Don't set shownRatio in main thread top controls on animated state change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improved test a bit Created 4 years, 6 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/Source/core/frame/TopControls.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/TopControls.cpp
diff --git a/third_party/WebKit/Source/core/frame/TopControls.cpp b/third_party/WebKit/Source/core/frame/TopControls.cpp
index d7d3ad90dfcf318d91f96c0cc1e2f5b159f83821..c44217dde01f4ec2f0d0a9f846d2ffb958934a07 100644
--- a/third_party/WebKit/Source/core/frame/TopControls.cpp
+++ b/third_party/WebKit/Source/core/frame/TopControls.cpp
@@ -95,14 +95,29 @@ void TopControls::setShownRatio(float shownRatio)
m_frameHost->chromeClient().didUpdateTopControls();
}
-void TopControls::updateConstraints(WebTopControlsState constraints)
+void TopControls::updateConstraintsAndState(
+ WebTopControlsState constraints,
+ WebTopControlsState current,
+ bool animate)
{
m_permittedState = constraints;
- if (m_permittedState == WebTopControlsShown)
- setShownRatio(1.f);
- else if (m_permittedState == WebTopControlsHidden)
+ DCHECK(!(constraints == WebTopControlsShown && current == WebTopControlsHidden));
+ DCHECK(!(constraints == WebTopControlsHidden && current == WebTopControlsShown));
+
+ // If the change should be animated, let the impl thread drive the change.
+ // Otherwise, immediately set the shown ratio so we don't have to wait for
+ // a commit from the impl thread.
+ if (animate)
+ return;
+
+ if (constraints == WebTopControlsBoth && current == WebTopControlsBoth)
+ return;
+
+ if (constraints == WebTopControlsHidden || current == WebTopControlsHidden)
setShownRatio(0.f);
+ else
+ setShownRatio(1.f);
}
void TopControls::setHeight(float height, bool shrinkViewport)
« no previous file with comments | « third_party/WebKit/Source/core/frame/TopControls.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698