OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_linear_fade.h" | 5 #include "cc/input/scrollbar_animation_controller_linear_fade.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars( | 58 void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars( |
59 float opacity) { | 59 float opacity) { |
60 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { | 60 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { |
61 if (!scrollbar->is_overlay_scrollbar()) | 61 if (!scrollbar->is_overlay_scrollbar()) |
62 continue; | 62 continue; |
63 PropertyTrees* property_trees = | 63 PropertyTrees* property_trees = |
64 scrollbar->layer_tree_impl()->property_trees(); | 64 scrollbar->layer_tree_impl()->property_trees(); |
65 // If this method is called during LayerImpl::PushPropertiesTo, we may not | 65 // If this method is called during LayerImpl::PushPropertiesTo, we may not |
66 // yet have valid effect_id_to_index_map entries as property trees are | 66 // yet have valid layer_id_to_effect_node_index entries as property trees |
67 // pushed after layers during activation. We can skip updating opacity in | 67 // are pushed after layers during activation. We can skip updating opacity |
68 // that case as we are only registering a scrollbar and because opacity will | 68 // in that case as we are only registering a scrollbar and because opacity |
69 // be overwritten anyway when property trees are pushed. | 69 // will be overwritten anyway when property trees are pushed. |
70 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, | 70 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, |
71 scrollbar->id())) { | 71 scrollbar->id())) { |
72 property_trees->effect_tree.OnOpacityAnimated( | 72 property_trees->effect_tree.OnOpacityAnimated( |
73 scrollbar->CanScrollOrientation() ? opacity : 0, | 73 scrollbar->CanScrollOrientation() ? opacity : 0, |
74 property_trees->effect_id_to_index_map[scrollbar->id()], | 74 property_trees->layer_id_to_effect_node_index[scrollbar->id()], |
75 scrollbar->layer_tree_impl()); | 75 scrollbar->layer_tree_impl()); |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 } // namespace cc | 80 } // namespace cc |
OLD | NEW |