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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2090223002: Clamp compositor's top controls shown ratio on commit from main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clamp from helper method 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 | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 56d9c6c4f2862ce984e704328694916d57bc4e1f..de16100cd5a727db95c3820b25a4770691bc377b 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -722,12 +722,19 @@ void LayerTreeImpl::set_top_controls_height(float top_controls_height) {
layer_tree_host_impl_->UpdateViewportContainerSizes();
}
-bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) {
+bool LayerTreeImpl::ClampTopControlsShownRatio() {
+ float ratio = top_controls_shown_ratio_->Current(true);
ratio = std::max(ratio, 0.f);
ratio = std::min(ratio, 1.f);
return top_controls_shown_ratio_->SetCurrent(ratio);
}
+bool LayerTreeImpl::SetCurrentTopControlsShownRatio(float ratio) {
+ bool changed = top_controls_shown_ratio_->SetCurrent(ratio);
+ changed |= ClampTopControlsShownRatio();
+ return changed;
+}
+
void LayerTreeImpl::PushTopControlsFromMainThread(
float top_controls_shown_ratio) {
PushTopControls(&top_controls_shown_ratio);
@@ -741,7 +748,9 @@ void LayerTreeImpl::PushTopControls(const float* top_controls_shown_ratio) {
top_controls_shown_ratio_->PushFromMainThread(*top_controls_shown_ratio);
}
if (IsActiveTree()) {
- if (top_controls_shown_ratio_->PushPendingToActive())
+ bool changed_active = top_controls_shown_ratio_->PushPendingToActive();
+ changed_active |= ClampTopControlsShownRatio();
+ if (changed_active)
layer_tree_host_impl_->DidChangeTopControlsPosition();
}
}
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698