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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 return inputs_.client->TakeDebugInfo(this); | 1299 return inputs_.client->TakeDebugInfo(this); |
1299 else | 1300 else |
1300 return nullptr; | 1301 return nullptr; |
1301 } | 1302 } |
1302 | 1303 |
1303 void Layer::didUpdateMainThreadScrollingReasons() { | 1304 void Layer::didUpdateMainThreadScrollingReasons() { |
1304 if (inputs_.client) | 1305 if (inputs_.client) |
1305 inputs_.client->didUpdateMainThreadScrollingReasons(); | 1306 inputs_.client->didUpdateMainThreadScrollingReasons(); |
1306 } | 1307 } |
1307 | 1308 |
| 1309 void Layer::SetIsHidden(bool is_hidden) { |
| 1310 DCHECK(layer_tree_host_); |
| 1311 if (is_hidden == is_hidden_) |
| 1312 return; |
| 1313 is_hidden_ = is_hidden; |
| 1314 // We don't push layers that are hidden to compositor thread at commit. So, |
| 1315 // we need a full tree sync when is_hidden changes. |
| 1316 layer_tree_host_->SetNeedsFullTreeSync(); |
| 1317 SetNeedsPushProperties(); |
| 1318 } |
| 1319 |
1308 void Layer::SetSubtreePropertyChanged() { | 1320 void Layer::SetSubtreePropertyChanged() { |
1309 if (subtree_property_changed_) | 1321 if (subtree_property_changed_) |
1310 return; | 1322 return; |
1311 subtree_property_changed_ = true; | 1323 subtree_property_changed_ = true; |
1312 SetNeedsPushProperties(); | 1324 SetNeedsPushProperties(); |
1313 } | 1325 } |
1314 | 1326 |
1315 void Layer::SetMayContainVideo(bool yes) { | 1327 void Layer::SetMayContainVideo(bool yes) { |
1316 if (may_contain_video_ == yes) | 1328 if (may_contain_video_ == yes) |
1317 return; | 1329 return; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 ->subtree_has_copy_request; | 1471 ->subtree_has_copy_request; |
1460 } | 1472 } |
1461 | 1473 |
1462 gfx::Transform Layer::ScreenSpaceTransform() const { | 1474 gfx::Transform Layer::ScreenSpaceTransform() const { |
1463 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1475 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1464 return draw_property_utils::ScreenSpaceTransform( | 1476 return draw_property_utils::ScreenSpaceTransform( |
1465 this, layer_tree_host_->property_trees()->transform_tree); | 1477 this, layer_tree_host_->property_trees()->transform_tree); |
1466 } | 1478 } |
1467 | 1479 |
1468 } // namespace cc | 1480 } // namespace cc |
OLD | NEW |