Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 #include "cc/resources/resource_pool.h" | 66 #include "cc/resources/resource_pool.h" |
| 67 #include "cc/resources/ui_resource_bitmap.h" | 67 #include "cc/resources/ui_resource_bitmap.h" |
| 68 #include "cc/scheduler/delay_based_time_source.h" | 68 #include "cc/scheduler/delay_based_time_source.h" |
| 69 #include "cc/tiles/eviction_tile_priority_queue.h" | 69 #include "cc/tiles/eviction_tile_priority_queue.h" |
| 70 #include "cc/tiles/gpu_image_decode_cache.h" | 70 #include "cc/tiles/gpu_image_decode_cache.h" |
| 71 #include "cc/tiles/picture_layer_tiling.h" | 71 #include "cc/tiles/picture_layer_tiling.h" |
| 72 #include "cc/tiles/raster_tile_priority_queue.h" | 72 #include "cc/tiles/raster_tile_priority_queue.h" |
| 73 #include "cc/tiles/software_image_decode_cache.h" | 73 #include "cc/tiles/software_image_decode_cache.h" |
| 74 #include "cc/trees/damage_tracker.h" | 74 #include "cc/trees/damage_tracker.h" |
| 75 #include "cc/trees/draw_property_utils.h" | 75 #include "cc/trees/draw_property_utils.h" |
| 76 #include "cc/trees/effect_node.h" | |
| 76 #include "cc/trees/latency_info_swap_promise_monitor.h" | 77 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 77 #include "cc/trees/layer_tree_host_common.h" | 78 #include "cc/trees/layer_tree_host_common.h" |
| 78 #include "cc/trees/layer_tree_impl.h" | 79 #include "cc/trees/layer_tree_impl.h" |
| 79 #include "cc/trees/mutator_host.h" | 80 #include "cc/trees/mutator_host.h" |
| 80 #include "cc/trees/scroll_node.h" | 81 #include "cc/trees/scroll_node.h" |
| 81 #include "cc/trees/single_thread_proxy.h" | 82 #include "cc/trees/single_thread_proxy.h" |
| 83 #include "cc/trees/transform_node.h" | |
| 82 #include "cc/trees/tree_synchronizer.h" | 84 #include "cc/trees/tree_synchronizer.h" |
| 83 #include "gpu/GLES2/gl2extchromium.h" | 85 #include "gpu/GLES2/gl2extchromium.h" |
| 84 #include "gpu/command_buffer/client/context_support.h" | 86 #include "gpu/command_buffer/client/context_support.h" |
| 85 #include "gpu/command_buffer/client/gles2_interface.h" | 87 #include "gpu/command_buffer/client/gles2_interface.h" |
| 86 #include "ui/gfx/geometry/point_conversions.h" | 88 #include "ui/gfx/geometry/point_conversions.h" |
| 87 #include "ui/gfx/geometry/rect_conversions.h" | 89 #include "ui/gfx/geometry/rect_conversions.h" |
| 88 #include "ui/gfx/geometry/scroll_offset.h" | 90 #include "ui/gfx/geometry/scroll_offset.h" |
| 89 #include "ui/gfx/geometry/size_conversions.h" | 91 #include "ui/gfx/geometry/size_conversions.h" |
| 90 #include "ui/gfx/geometry/vector2d_conversions.h" | 92 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 91 | 93 |
| (...skipping 4021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4113 | 4115 |
| 4114 void LayerTreeHostImpl::ElementIsAnimatingChanged( | 4116 void LayerTreeHostImpl::ElementIsAnimatingChanged( |
| 4115 ElementId element_id, | 4117 ElementId element_id, |
| 4116 ElementListType list_type, | 4118 ElementListType list_type, |
| 4117 const PropertyAnimationState& mask, | 4119 const PropertyAnimationState& mask, |
| 4118 const PropertyAnimationState& state) { | 4120 const PropertyAnimationState& state) { |
| 4119 LayerTreeImpl* tree = | 4121 LayerTreeImpl* tree = |
| 4120 list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); | 4122 list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); |
| 4121 if (!tree) | 4123 if (!tree) |
| 4122 return; | 4124 return; |
| 4123 LayerImpl* layer = tree->LayerByElementId(element_id); | 4125 PropertyTrees* property_trees = tree->property_trees(); |
| 4124 if (layer) | 4126 |
| 4125 layer->OnIsAnimatingChanged(mask, state); | 4127 for (int property = TargetProperty::FIRST_TARGET_PROPERTY; |
|
wkorman
2017/03/20 21:59:57
Much of this is near identical to the same in laye
weiliangc
2017/03/21 15:18:52
We could create template function in utils class t
wkorman
2017/03/21 19:44:23
Either ok IMO, could add a comment here and in oth
ajuma
2017/03/21 19:53:28
Perhaps draw_property_utils or property_tree might
| |
| 4128 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { | |
| 4129 if (!mask.currently_running[property] && | |
| 4130 !mask.potentially_animating[property]) | |
| 4131 continue; | |
| 4132 | |
| 4133 switch (property) { | |
| 4134 case TargetProperty::TRANSFORM: | |
| 4135 if (TransformNode* transform_node = | |
| 4136 property_trees->transform_tree.FindNodeFromElementId( | |
| 4137 element_id)) { | |
| 4138 if (mask.currently_running[property]) | |
| 4139 transform_node->is_currently_animating = | |
| 4140 state.currently_running[property]; | |
| 4141 if (mask.potentially_animating[property]) { | |
| 4142 transform_node->has_potential_animation = | |
| 4143 state.potentially_animating[property]; | |
| 4144 transform_node->has_only_translation_animations = | |
| 4145 mutator_host()->HasOnlyTranslationTransforms(element_id, | |
| 4146 list_type); | |
| 4147 property_trees->transform_tree.set_needs_update(true); | |
| 4148 tree->set_needs_update_draw_properties(); | |
| 4149 // TODO(crbug.com/702777): | |
| 4150 // was_ever_ready_since_last_transform_animation should not live on | |
| 4151 // layers. | |
| 4152 if (LayerImpl* layer = tree->LayerByElementId(element_id)) { | |
| 4153 layer->set_was_ever_ready_since_last_transform_animation(false); | |
| 4154 } | |
| 4155 } | |
| 4156 } | |
| 4157 break; | |
| 4158 case TargetProperty::OPACITY: | |
| 4159 if (EffectNode* effect_node = | |
| 4160 property_trees->effect_tree.FindNodeFromElementId(element_id)) { | |
| 4161 if (mask.currently_running[property]) | |
| 4162 effect_node->is_currently_animating_opacity = | |
| 4163 state.currently_running[property]; | |
| 4164 if (mask.potentially_animating[property]) { | |
| 4165 effect_node->has_potential_opacity_animation = | |
| 4166 state.potentially_animating[property]; | |
| 4167 property_trees->effect_tree.set_needs_update(true); | |
| 4168 } | |
| 4169 } | |
| 4170 break; | |
| 4171 case TargetProperty::FILTER: | |
| 4172 if (EffectNode* effect_node = | |
| 4173 property_trees->effect_tree.FindNodeFromElementId(element_id)) { | |
| 4174 if (mask.currently_running[property]) | |
| 4175 effect_node->is_currently_animating_filter = | |
| 4176 state.currently_running[property]; | |
| 4177 if (mask.potentially_animating[property]) | |
| 4178 effect_node->has_potential_filter_animation = | |
| 4179 state.potentially_animating[property]; | |
|
wkorman
2017/03/20 21:59:57
Same comment as in layer_tree_host.cc, no set_need
weiliangc
2017/03/21 15:18:52
It is because for opacity animation and transform
wkorman
2017/03/21 19:44:23
Yes, I think worth adding a comment since I wonder
| |
| 4180 } | |
| 4181 break; | |
| 4182 default: | |
| 4183 break; | |
| 4184 } | |
| 4185 } | |
| 4126 } | 4186 } |
| 4127 | 4187 |
| 4128 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { | 4188 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { |
| 4129 // TODO(majidvp): We should pass in the original starting scroll position here | 4189 // TODO(majidvp): We should pass in the original starting scroll position here |
| 4130 ScrollStateData scroll_state_data; | 4190 ScrollStateData scroll_state_data; |
| 4131 ScrollState scroll_state(scroll_state_data); | 4191 ScrollState scroll_state(scroll_state_data); |
| 4132 ScrollEnd(&scroll_state); | 4192 ScrollEnd(&scroll_state); |
| 4133 } | 4193 } |
| 4134 | 4194 |
| 4135 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( | 4195 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4182 worker_context_visibility_ = | 4242 worker_context_visibility_ = |
| 4183 worker_context->CacheController()->ClientBecameVisible(); | 4243 worker_context->CacheController()->ClientBecameVisible(); |
| 4184 } else { | 4244 } else { |
| 4185 worker_context->CacheController()->ClientBecameNotVisible( | 4245 worker_context->CacheController()->ClientBecameNotVisible( |
| 4186 std::move(worker_context_visibility_)); | 4246 std::move(worker_context_visibility_)); |
| 4187 } | 4247 } |
| 4188 } | 4248 } |
| 4189 } | 4249 } |
| 4190 | 4250 |
| 4191 } // namespace cc | 4251 } // namespace cc |
| OLD | NEW |