OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 clip_tree_index_(-1), | 88 clip_tree_index_(-1), |
89 scroll_tree_index_(-1), | 89 scroll_tree_index_(-1), |
90 property_tree_sequence_number_(-1), | 90 property_tree_sequence_number_(-1), |
91 should_flatten_transform_from_property_tree_(false), | 91 should_flatten_transform_from_property_tree_(false), |
92 draws_content_(false), | 92 draws_content_(false), |
93 use_local_transform_for_backface_visibility_(false), | 93 use_local_transform_for_backface_visibility_(false), |
94 should_check_backface_visibility_(false), | 94 should_check_backface_visibility_(false), |
95 force_render_surface_for_testing_(false), | 95 force_render_surface_for_testing_(false), |
96 subtree_property_changed_(false), | 96 subtree_property_changed_(false), |
97 layer_property_changed_(false), | 97 layer_property_changed_(false), |
| 98 may_contain_video_(false), |
98 safe_opaque_background_color_(0), | 99 safe_opaque_background_color_(0), |
99 draw_blend_mode_(SkXfermode::kSrcOver_Mode), | 100 draw_blend_mode_(SkXfermode::kSrcOver_Mode), |
100 num_unclipped_descendants_(0) {} | 101 num_unclipped_descendants_(0) {} |
101 | 102 |
102 Layer::~Layer() { | 103 Layer::~Layer() { |
103 // Our parent should be holding a reference to us so there should be no | 104 // Our parent should be holding a reference to us so there should be no |
104 // way for us to be destroyed while we still have a parent. | 105 // way for us to be destroyed while we still have a parent. |
105 DCHECK(!parent()); | 106 DCHECK(!parent()); |
106 // Similarly we shouldn't have a layer tree host since it also keeps a | 107 // Similarly we shouldn't have a layer tree host since it also keeps a |
107 // reference to us. | 108 // reference to us. |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 layer->SetTransformTreeIndex(transform_tree_index()); | 1138 layer->SetTransformTreeIndex(transform_tree_index()); |
1138 layer->SetEffectTreeIndex(effect_tree_index()); | 1139 layer->SetEffectTreeIndex(effect_tree_index()); |
1139 layer->SetClipTreeIndex(clip_tree_index()); | 1140 layer->SetClipTreeIndex(clip_tree_index()); |
1140 layer->SetScrollTreeIndex(scroll_tree_index()); | 1141 layer->SetScrollTreeIndex(scroll_tree_index()); |
1141 layer->set_offset_to_transform_parent(offset_to_transform_parent_); | 1142 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
1142 layer->SetDrawsContent(DrawsContent()); | 1143 layer->SetDrawsContent(DrawsContent()); |
1143 // subtree_property_changed_ is propagated to all descendants while building | 1144 // subtree_property_changed_ is propagated to all descendants while building |
1144 // property trees. So, it is enough to check it only for the current layer. | 1145 // property trees. So, it is enough to check it only for the current layer. |
1145 if (subtree_property_changed_ || layer_property_changed_) | 1146 if (subtree_property_changed_ || layer_property_changed_) |
1146 layer->NoteLayerPropertyChanged(); | 1147 layer->NoteLayerPropertyChanged(); |
| 1148 layer->set_may_contain_video(may_contain_video_); |
1147 layer->SetMasksToBounds(inputs_.masks_to_bounds); | 1149 layer->SetMasksToBounds(inputs_.masks_to_bounds); |
1148 layer->set_main_thread_scrolling_reasons( | 1150 layer->set_main_thread_scrolling_reasons( |
1149 inputs_.main_thread_scrolling_reasons); | 1151 inputs_.main_thread_scrolling_reasons); |
1150 layer->SetNonFastScrollableRegion(inputs_.non_fast_scrollable_region); | 1152 layer->SetNonFastScrollableRegion(inputs_.non_fast_scrollable_region); |
1151 layer->SetTouchEventHandlerRegion(inputs_.touch_event_handler_region); | 1153 layer->SetTouchEventHandlerRegion(inputs_.touch_event_handler_region); |
1152 layer->SetContentsOpaque(inputs_.contents_opaque); | 1154 layer->SetContentsOpaque(inputs_.contents_opaque); |
1153 layer->SetBlendMode(inputs_.blend_mode); | 1155 layer->SetBlendMode(inputs_.blend_mode); |
1154 layer->SetPosition(inputs_.position); | 1156 layer->SetPosition(inputs_.position); |
1155 layer->set_should_flatten_transform_from_property_tree( | 1157 layer->set_should_flatten_transform_from_property_tree( |
1156 should_flatten_transform_from_property_tree_); | 1158 should_flatten_transform_from_property_tree_); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 SetNeedsPushProperties(); | 1593 SetNeedsPushProperties(); |
1592 } | 1594 } |
1593 | 1595 |
1594 void Layer::SetLayerPropertyChanged() { | 1596 void Layer::SetLayerPropertyChanged() { |
1595 if (layer_property_changed_) | 1597 if (layer_property_changed_) |
1596 return; | 1598 return; |
1597 layer_property_changed_ = true; | 1599 layer_property_changed_ = true; |
1598 SetNeedsPushProperties(); | 1600 SetNeedsPushProperties(); |
1599 } | 1601 } |
1600 | 1602 |
| 1603 void Layer::SetMayContainVideo(bool yes) { |
| 1604 if (may_contain_video_ == yes) |
| 1605 return; |
| 1606 may_contain_video_ = yes; |
| 1607 SetNeedsPushProperties(); |
| 1608 } |
| 1609 |
1601 bool Layer::FilterIsAnimating() const { | 1610 bool Layer::FilterIsAnimating() const { |
1602 return GetAnimationHost()->IsAnimatingFilterProperty( | 1611 return GetAnimationHost()->IsAnimatingFilterProperty( |
1603 element_id(), GetElementTypeForAnimation()); | 1612 element_id(), GetElementTypeForAnimation()); |
1604 } | 1613 } |
1605 | 1614 |
1606 bool Layer::TransformIsAnimating() const { | 1615 bool Layer::TransformIsAnimating() const { |
1607 return GetAnimationHost()->IsAnimatingTransformProperty( | 1616 return GetAnimationHost()->IsAnimatingTransformProperty( |
1608 element_id(), GetElementTypeForAnimation()); | 1617 element_id(), GetElementTypeForAnimation()); |
1609 } | 1618 } |
1610 | 1619 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 ->num_copy_requests_in_subtree; | 1871 ->num_copy_requests_in_subtree; |
1863 } | 1872 } |
1864 | 1873 |
1865 gfx::Transform Layer::screen_space_transform() const { | 1874 gfx::Transform Layer::screen_space_transform() const { |
1866 DCHECK_NE(transform_tree_index_, -1); | 1875 DCHECK_NE(transform_tree_index_, -1); |
1867 return draw_property_utils::ScreenSpaceTransform( | 1876 return draw_property_utils::ScreenSpaceTransform( |
1868 this, layer_tree_host_->property_trees()->transform_tree); | 1877 this, layer_tree_host_->property_trees()->transform_tree); |
1869 } | 1878 } |
1870 | 1879 |
1871 } // namespace cc | 1880 } // namespace cc |
OLD | NEW |