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 ScrollbarLayerImplBase* horizontal_scrollbar = | 183 if (!scroll_layer_->scrollbars()) |
184 scroll_layer_->horizontal_scrollbar_layer(); | 184 return; |
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 } | |
194 | 185 |
195 ScrollbarLayerImplBase* vertical_scrollbar = | 186 LayerImpl::ScrollbarSet* scrollbars = scroll_layer_->scrollbars(); |
196 scroll_layer_->vertical_scrollbar_layer(); | 187 for (LayerImpl::ScrollbarSet::iterator it = scrollbars->begin(); |
197 if (vertical_scrollbar) { | 188 it != scrollbars->end(); |
198 vertical_scrollbar->SetOpacity( | 189 ++it) { |
199 AdjustScale(opacity, vertical_scrollbar->opacity(), opacity_change_)); | 190 ScrollbarLayerImplBase* scrollbar = *it; |
200 vertical_scrollbar->SetThumbThicknessScaleFactor( | 191 if (scrollbar->is_overlay_scrollbar()) { |
201 AdjustScale( | 192 scrollbar->SetOpacity( |
202 thumb_thickness_scale, | 193 AdjustScale(opacity, scrollbar->opacity(), opacity_change_)); |
203 vertical_scrollbar->thumb_thickness_scale_factor(), | 194 scrollbar->SetThumbThicknessScaleFactor( |
204 thickness_change_)); | 195 AdjustScale(thumb_thickness_scale, |
| 196 scrollbar->thumb_thickness_scale_factor(), |
| 197 thickness_change_)); |
| 198 } |
205 } | 199 } |
206 } | 200 } |
207 | 201 |
208 } // namespace cc | 202 } // namespace cc |
OLD | NEW |