OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/animation/scrollbar_animation_controller_thinning.h" | 5 #include "cc/animation/scrollbar_animation_controller_thinning.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 AnimationChange animation_change) { | 173 AnimationChange animation_change) { |
174 if (animation_change == INCREASE && current_value > new_value) | 174 if (animation_change == INCREASE && current_value > new_value) |
175 return current_value; | 175 return current_value; |
176 if (animation_change == DECREASE && current_value < new_value) | 176 if (animation_change == DECREASE && current_value < new_value) |
177 return current_value; | 177 return current_value; |
178 return new_value; | 178 return new_value; |
179 } | 179 } |
180 | 180 |
181 void ScrollbarAnimationControllerThinning::ApplyOpacityAndThumbThicknessScale( | 181 void ScrollbarAnimationControllerThinning::ApplyOpacityAndThumbThicknessScale( |
182 float opacity, float thumb_thickness_scale) { | 182 float opacity, float thumb_thickness_scale) { |
183 if (!scroll_layer_->scrollbars()) | 183 ScrollbarLayerImplBase* horizontal_scrollbar = |
184 return; | 184 scroll_layer_->horizontal_scrollbar_layer(); |
| 185 if (horizontal_scrollbar) { |
| 186 horizontal_scrollbar->SetOpacity( |
| 187 AdjustScale(opacity, horizontal_scrollbar->opacity(), opacity_change_)); |
| 188 horizontal_scrollbar->SetThumbThicknessScaleFactor( |
| 189 AdjustScale( |
| 190 thumb_thickness_scale, |
| 191 horizontal_scrollbar->thumb_thickness_scale_factor(), |
| 192 thickness_change_)); |
| 193 } |
185 | 194 |
186 LayerImpl::ScrollbarSet* scrollbars = scroll_layer_->scrollbars(); | 195 ScrollbarLayerImplBase* vertical_scrollbar = |
187 for (LayerImpl::ScrollbarSet::iterator it = scrollbars->begin(); | 196 scroll_layer_->vertical_scrollbar_layer(); |
188 it != scrollbars->end(); | 197 if (vertical_scrollbar) { |
189 ++it) { | 198 vertical_scrollbar->SetOpacity( |
190 ScrollbarLayerImplBase* scrollbar = *it; | 199 AdjustScale(opacity, vertical_scrollbar->opacity(), opacity_change_)); |
191 if (scrollbar->is_overlay_scrollbar()) { | 200 vertical_scrollbar->SetThumbThicknessScaleFactor( |
192 scrollbar->SetOpacity( | 201 AdjustScale( |
193 AdjustScale(opacity, scrollbar->opacity(), opacity_change_)); | 202 thumb_thickness_scale, |
194 scrollbar->SetThumbThicknessScaleFactor( | 203 vertical_scrollbar->thumb_thickness_scale_factor(), |
195 AdjustScale(thumb_thickness_scale, | 204 thickness_change_)); |
196 scrollbar->thumb_thickness_scale_factor(), | |
197 thickness_change_)); | |
198 } | |
199 } | 205 } |
200 } | 206 } |
201 | 207 |
202 } // namespace cc | 208 } // namespace cc |
OLD | NEW |