Chromium Code Reviews| 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) { |
|
bokan
2016/09/19 15:41:17
I don't see a need for these to be params. Just in
sahel
2016/09/19 16:07:21
The function is called for adjusting scale of both
bokan
2016/09/19 16:19:27
Ah, sorry, I missed that. In that case this is fin
|
| + 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)); |
| } |
| } |