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

Unified Diff: cc/input/scrollbar_animation_controller_thinning.cc

Issue 2345823003: Overlay scrollbars are painted onload. (Closed)
Patch Set: nit fixed. Created 4 years, 3 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: cc/input/scrollbar_animation_controller_thinning.cc
diff --git a/cc/input/scrollbar_animation_controller_thinning.cc b/cc/input/scrollbar_animation_controller_thinning.cc
index af02ad3cddb6d2ebf5b31d877bcecdba8abd8ac1..afc10f8ae25453048e517d47d4100eb94c13f5b0 100644
--- a/cc/input/scrollbar_animation_controller_thinning.cc
+++ b/cc/input/scrollbar_animation_controller_thinning.cc
@@ -124,12 +124,21 @@ float ScrollbarAnimationControllerThinning::
float ScrollbarAnimationControllerThinning::AdjustScale(
float new_value,
float current_value,
- AnimationChange animation_change) {
+ AnimationChange animation_change,
+ float min_value,
+ float max_value) {
+ float result;
if (animation_change == INCREASE && current_value > new_value)
- return current_value;
- if (animation_change == DECREASE && current_value < new_value)
- return current_value;
- return new_value;
+ result = current_value;
+ else if (animation_change == DECREASE && current_value < new_value)
+ result = current_value;
+ else
+ result = new_value;
+ if (result > max_value)
+ return max_value;
+ if (result < min_value)
+ return min_value;
+ return result;
}
void ScrollbarAnimationControllerThinning::ApplyOpacityAndThumbThicknessScale(
@@ -140,9 +149,9 @@ void ScrollbarAnimationControllerThinning::ApplyOpacityAndThumbThicknessScale(
continue;
float effective_opacity =
scrollbar->CanScrollOrientation()
- ? AdjustScale(opacity, scrollbar->Opacity(), opacity_change_)
+ ? AdjustScale(opacity, scrollbar->Opacity(), opacity_change_,
+ kIdleOpacity, 1)
: 0;
-
PropertyTrees* property_trees =
scrollbar->layer_tree_impl()->property_trees();
// If this method is called during LayerImpl::PushPropertiesTo, we may not
@@ -159,7 +168,7 @@ void ScrollbarAnimationControllerThinning::ApplyOpacityAndThumbThicknessScale(
}
scrollbar->SetThumbThicknessScaleFactor(AdjustScale(
thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(),
- thickness_change_));
+ thickness_change_, kIdleThicknessScale, 1));
}
}
« no previous file with comments | « cc/input/scrollbar_animation_controller_thinning.h ('k') | cc/input/scrollbar_animation_controller_thinning_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698