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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Layer IDs start from 1. | 79 // Layer IDs start from 1. |
80 inputs_(g_next_layer_id.GetNext() + 1), | 80 inputs_(g_next_layer_id.GetNext() + 1), |
81 num_descendants_that_draw_content_(0), | 81 num_descendants_that_draw_content_(0), |
82 transform_tree_index_(TransformTree::kInvalidNodeId), | 82 transform_tree_index_(TransformTree::kInvalidNodeId), |
83 effect_tree_index_(EffectTree::kInvalidNodeId), | 83 effect_tree_index_(EffectTree::kInvalidNodeId), |
84 clip_tree_index_(ClipTree::kInvalidNodeId), | 84 clip_tree_index_(ClipTree::kInvalidNodeId), |
85 scroll_tree_index_(ScrollTree::kInvalidNodeId), | 85 scroll_tree_index_(ScrollTree::kInvalidNodeId), |
86 property_tree_sequence_number_(-1), | 86 property_tree_sequence_number_(-1), |
87 should_flatten_transform_from_property_tree_(false), | 87 should_flatten_transform_from_property_tree_(false), |
88 draws_content_(false), | 88 draws_content_(false), |
| 89 is_hidden_(false), |
89 use_local_transform_for_backface_visibility_(false), | 90 use_local_transform_for_backface_visibility_(false), |
90 should_check_backface_visibility_(false), | 91 should_check_backface_visibility_(false), |
91 force_render_surface_for_testing_(false), | 92 force_render_surface_for_testing_(false), |
92 subtree_property_changed_(false), | 93 subtree_property_changed_(false), |
93 may_contain_video_(false), | 94 may_contain_video_(false), |
94 is_scroll_clip_layer_(false), | 95 is_scroll_clip_layer_(false), |
95 needs_show_scrollbars_(false), | 96 needs_show_scrollbars_(false), |
96 subtree_has_copy_request_(false), | 97 subtree_has_copy_request_(false), |
97 safe_opaque_background_color_(0), | 98 safe_opaque_background_color_(0), |
98 num_unclipped_descendants_(0) {} | 99 num_unclipped_descendants_(0) {} |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 std::unique_ptr<CopyOutputResult> result) { | 1121 std::unique_ptr<CopyOutputResult> result) { |
1121 main_thread_task_runner->PostTask( | 1122 main_thread_task_runner->PostTask( |
1122 FROM_HERE, base::BindOnce(&RunCopyCallbackOnMainThread, | 1123 FROM_HERE, base::BindOnce(&RunCopyCallbackOnMainThread, |
1123 base::Passed(&request), base::Passed(&result))); | 1124 base::Passed(&request), base::Passed(&result))); |
1124 } | 1125 } |
1125 | 1126 |
1126 bool Layer::IsSnapped() { | 1127 bool Layer::IsSnapped() { |
1127 return scrollable(); | 1128 return scrollable(); |
1128 } | 1129 } |
1129 | 1130 |
| 1131 bool Layer::IsSurfaceLayer() const { |
| 1132 return false; |
| 1133 } |
| 1134 |
| 1135 const SurfaceId* Layer::GetSurfaceId() const { |
| 1136 return nullptr; |
| 1137 } |
| 1138 |
1130 void Layer::PushPropertiesTo(LayerImpl* layer) { | 1139 void Layer::PushPropertiesTo(LayerImpl* layer) { |
1131 TRACE_EVENT0("cc", "Layer::PushPropertiesTo"); | 1140 TRACE_EVENT0("cc", "Layer::PushPropertiesTo"); |
1132 DCHECK(layer_tree_host_); | 1141 DCHECK(layer_tree_host_); |
1133 | 1142 |
1134 // The ElementId should be set first because other setters depend on it such | 1143 // The ElementId should be set first because other setters depend on it such |
1135 // as LayerImpl::SetScrollClipLayer. | 1144 // as LayerImpl::SetScrollClipLayer. |
1136 layer->SetElementId(inputs_.element_id); | 1145 layer->SetElementId(inputs_.element_id); |
1137 layer->SetBackgroundColor(inputs_.background_color); | 1146 layer->SetBackgroundColor(inputs_.background_color); |
1138 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); | 1147 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); |
1139 layer->SetBounds(inputs_.bounds); | 1148 layer->SetBounds(inputs_.bounds); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 return inputs_.client->TakeDebugInfo(this); | 1285 return inputs_.client->TakeDebugInfo(this); |
1277 else | 1286 else |
1278 return nullptr; | 1287 return nullptr; |
1279 } | 1288 } |
1280 | 1289 |
1281 void Layer::didUpdateMainThreadScrollingReasons() { | 1290 void Layer::didUpdateMainThreadScrollingReasons() { |
1282 if (inputs_.client) | 1291 if (inputs_.client) |
1283 inputs_.client->didUpdateMainThreadScrollingReasons(); | 1292 inputs_.client->didUpdateMainThreadScrollingReasons(); |
1284 } | 1293 } |
1285 | 1294 |
| 1295 void Layer::SetIsHidden(bool is_hidden) { |
| 1296 DCHECK(layer_tree_host_); |
| 1297 if (is_hidden == is_hidden_) |
| 1298 return; |
| 1299 is_hidden_ = is_hidden; |
| 1300 // We don't push layers that are hidden to compositor thread at commit. So, |
| 1301 // we need a full tree sync when is_hidden changes. |
| 1302 layer_tree_host_->SetNeedsFullTreeSync(); |
| 1303 SetNeedsPushProperties(); |
| 1304 } |
| 1305 |
1286 void Layer::SetSubtreePropertyChanged() { | 1306 void Layer::SetSubtreePropertyChanged() { |
1287 if (subtree_property_changed_) | 1307 if (subtree_property_changed_) |
1288 return; | 1308 return; |
1289 subtree_property_changed_ = true; | 1309 subtree_property_changed_ = true; |
1290 SetNeedsPushProperties(); | 1310 SetNeedsPushProperties(); |
1291 } | 1311 } |
1292 | 1312 |
1293 void Layer::SetMayContainVideo(bool yes) { | 1313 void Layer::SetMayContainVideo(bool yes) { |
1294 if (may_contain_video_ == yes) | 1314 if (may_contain_video_ == yes) |
1295 return; | 1315 return; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 ->subtree_has_copy_request; | 1447 ->subtree_has_copy_request; |
1428 } | 1448 } |
1429 | 1449 |
1430 gfx::Transform Layer::ScreenSpaceTransform() const { | 1450 gfx::Transform Layer::ScreenSpaceTransform() const { |
1431 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1451 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1432 return draw_property_utils::ScreenSpaceTransform( | 1452 return draw_property_utils::ScreenSpaceTransform( |
1433 this, layer_tree_host_->property_trees()->transform_tree); | 1453 this, layer_tree_host_->property_trees()->transform_tree); |
1434 } | 1454 } |
1435 | 1455 |
1436 } // namespace cc | 1456 } // namespace cc |
OLD | NEW |