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/input/scrollbar_animation_controller_thinning.h" | 5 #include "cc/input/scrollbar_animation_controller_thinning.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 #include "cc/layers/scrollbar_layer_impl_base.h" | 10 #include "cc/layers/scrollbar_layer_impl_base.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 } | 209 } |
210 | 210 |
211 void ScrollbarAnimationControllerThinning::ApplyOpacity(float opacity) { | 211 void ScrollbarAnimationControllerThinning::ApplyOpacity(float opacity) { |
212 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { | 212 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { |
213 if (!scrollbar->is_overlay_scrollbar()) | 213 if (!scrollbar->is_overlay_scrollbar()) |
214 continue; | 214 continue; |
215 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0; | 215 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0; |
216 PropertyTrees* property_trees = | 216 PropertyTrees* property_trees = |
217 scrollbar->layer_tree_impl()->property_trees(); | 217 scrollbar->layer_tree_impl()->property_trees(); |
218 // If this method is called during LayerImpl::PushPropertiesTo, we may not | 218 // If this method is called during LayerImpl::PushPropertiesTo, we may not |
219 // yet have valid effect_id_to_index_map entries as property trees are | 219 // yet have valid layer_id_to_effect_node_index entries as property trees |
220 // are | |
ajuma
2017/01/10 00:51:44
wrapping
wkorman
2017/01/10 01:13:43
Done.
| |
220 // pushed after layers during activation. We can skip updating opacity in | 221 // pushed after layers during activation. We can skip updating opacity in |
221 // that case as we are only registering a scrollbar and because opacity will | 222 // that case as we are only registering a scrollbar and because opacity will |
222 // be overwritten anyway when property trees are pushed. | 223 // be overwritten anyway when property trees are pushed. |
223 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, | 224 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, |
224 scrollbar->id())) { | 225 scrollbar->id())) { |
225 property_trees->effect_tree.OnOpacityAnimated( | 226 property_trees->effect_tree.OnOpacityAnimated( |
226 effective_opacity, | 227 effective_opacity, |
227 property_trees->effect_id_to_index_map[scrollbar->id()], | 228 property_trees->layer_id_to_effect_node_index[scrollbar->id()], |
228 scrollbar->layer_tree_impl()); | 229 scrollbar->layer_tree_impl()); |
229 } | 230 } |
230 } | 231 } |
231 | 232 |
232 bool previouslyVisible = opacity_ > 0.0f; | 233 bool previouslyVisible = opacity_ > 0.0f; |
233 bool currentlyVisible = opacity > 0.0f; | 234 bool currentlyVisible = opacity > 0.0f; |
234 | 235 |
235 opacity_ = opacity; | 236 opacity_ = opacity; |
236 | 237 |
237 if (previouslyVisible != currentlyVisible) | 238 if (previouslyVisible != currentlyVisible) |
(...skipping 17 matching lines...) Expand all Loading... | |
255 if (current_animating_property_ == property) | 256 if (current_animating_property_ == property) |
256 return; | 257 return; |
257 | 258 |
258 StopAnimation(); | 259 StopAnimation(); |
259 current_animating_property_ = property; | 260 current_animating_property_ = property; |
260 if (current_animating_property_ == THICKNESS) | 261 if (current_animating_property_ == THICKNESS) |
261 ApplyOpacity(1.f); | 262 ApplyOpacity(1.f); |
262 } | 263 } |
263 | 264 |
264 } // namespace cc | 265 } // namespace cc |
OLD | NEW |