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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 return inputs_.client->TakeDebugInfo(this); | 1277 return inputs_.client->TakeDebugInfo(this); |
1277 else | 1278 else |
1278 return nullptr; | 1279 return nullptr; |
1279 } | 1280 } |
1280 | 1281 |
1281 void Layer::didUpdateMainThreadScrollingReasons() { | 1282 void Layer::didUpdateMainThreadScrollingReasons() { |
1282 if (inputs_.client) | 1283 if (inputs_.client) |
1283 inputs_.client->didUpdateMainThreadScrollingReasons(); | 1284 inputs_.client->didUpdateMainThreadScrollingReasons(); |
1284 } | 1285 } |
1285 | 1286 |
| 1287 void Layer::SetIsHidden(bool is_hidden) { |
| 1288 DCHECK(layer_tree_host_); |
| 1289 if (is_hidden == is_hidden_) |
| 1290 return; |
| 1291 is_hidden_ = is_hidden; |
| 1292 // We don't push layers that are hidden to compositor thread at commit. So, |
| 1293 // we need a full tree sync when is_hidden changes. |
| 1294 layer_tree_host_->SetNeedsFullTreeSync(); |
| 1295 } |
| 1296 |
1286 void Layer::SetSubtreePropertyChanged() { | 1297 void Layer::SetSubtreePropertyChanged() { |
1287 if (subtree_property_changed_) | 1298 if (subtree_property_changed_) |
1288 return; | 1299 return; |
1289 subtree_property_changed_ = true; | 1300 subtree_property_changed_ = true; |
1290 SetNeedsPushProperties(); | 1301 SetNeedsPushProperties(); |
1291 } | 1302 } |
1292 | 1303 |
1293 void Layer::SetMayContainVideo(bool yes) { | 1304 void Layer::SetMayContainVideo(bool yes) { |
1294 if (may_contain_video_ == yes) | 1305 if (may_contain_video_ == yes) |
1295 return; | 1306 return; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 ->subtree_has_copy_request; | 1438 ->subtree_has_copy_request; |
1428 } | 1439 } |
1429 | 1440 |
1430 gfx::Transform Layer::ScreenSpaceTransform() const { | 1441 gfx::Transform Layer::ScreenSpaceTransform() const { |
1431 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1442 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1432 return draw_property_utils::ScreenSpaceTransform( | 1443 return draw_property_utils::ScreenSpaceTransform( |
1433 this, layer_tree_host_->property_trees()->transform_tree); | 1444 this, layer_tree_host_->property_trees()->transform_tree); |
1434 } | 1445 } |
1435 | 1446 |
1436 } // namespace cc | 1447 } // namespace cc |
OLD | NEW |