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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 use_local_transform_for_backface_visibility_(false), | 89 use_local_transform_for_backface_visibility_(false), |
90 should_check_backface_visibility_(false), | 90 should_check_backface_visibility_(false), |
91 force_render_surface_for_testing_(false), | 91 force_render_surface_for_testing_(false), |
92 subtree_property_changed_(false), | 92 subtree_property_changed_(false), |
93 may_contain_video_(false), | 93 may_contain_video_(false), |
94 is_scroll_clip_layer_(false), | 94 is_scroll_clip_layer_(false), |
| 95 needs_show_scrollbars_(false), |
95 safe_opaque_background_color_(0), | 96 safe_opaque_background_color_(0), |
96 draw_blend_mode_(SkBlendMode::kSrcOver), | 97 draw_blend_mode_(SkBlendMode::kSrcOver), |
97 num_unclipped_descendants_(0) {} | 98 num_unclipped_descendants_(0) {} |
98 | 99 |
99 Layer::~Layer() { | 100 Layer::~Layer() { |
100 // Our parent should be holding a reference to us so there should be no | 101 // Our parent should be holding a reference to us so there should be no |
101 // way for us to be destroyed while we still have a parent. | 102 // way for us to be destroyed while we still have a parent. |
102 DCHECK(!parent()); | 103 DCHECK(!parent()); |
103 // Similarly we shouldn't have a layer tree host since it also keeps a | 104 // Similarly we shouldn't have a layer tree host since it also keeps a |
104 // reference to us. | 105 // reference to us. |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1179 |
1179 // When a scroll offset animation is interrupted the new scroll position on | 1180 // When a scroll offset animation is interrupted the new scroll position on |
1180 // the pending tree will clobber any impl-side scrolling occuring on the | 1181 // the pending tree will clobber any impl-side scrolling occuring on the |
1181 // active tree. To do so, avoid scrolling the pending tree along with it | 1182 // active tree. To do so, avoid scrolling the pending tree along with it |
1182 // instead of trying to undo that scrolling later. | 1183 // instead of trying to undo that scrolling later. |
1183 if (ScrollOffsetAnimationWasInterrupted()) | 1184 if (ScrollOffsetAnimationWasInterrupted()) |
1184 layer->layer_tree_impl() | 1185 layer->layer_tree_impl() |
1185 ->property_trees() | 1186 ->property_trees() |
1186 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); | 1187 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); |
1187 | 1188 |
| 1189 if (needs_show_scrollbars_) |
| 1190 layer->set_needs_show_scrollbars(true); |
| 1191 |
1188 // If the main thread commits multiple times before the impl thread actually | 1192 // If the main thread commits multiple times before the impl thread actually |
1189 // draws, then damage tracking will become incorrect if we simply clobber the | 1193 // draws, then damage tracking will become incorrect if we simply clobber the |
1190 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 1194 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
1191 // union) any update changes that have occurred on the main thread. | 1195 // union) any update changes that have occurred on the main thread. |
1192 inputs_.update_rect.Union(layer->update_rect()); | 1196 inputs_.update_rect.Union(layer->update_rect()); |
1193 layer->SetUpdateRect(inputs_.update_rect); | 1197 layer->SetUpdateRect(inputs_.update_rect); |
1194 | 1198 |
1195 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); | 1199 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); |
1196 layer->SetNeedsPushProperties(); | 1200 layer->SetNeedsPushProperties(); |
1197 | 1201 |
1198 // Reset any state that should be cleared for the next update. | 1202 // Reset any state that should be cleared for the next update. |
| 1203 needs_show_scrollbars_ = false; |
1199 subtree_property_changed_ = false; | 1204 subtree_property_changed_ = false; |
1200 inputs_.update_rect = gfx::Rect(); | 1205 inputs_.update_rect = gfx::Rect(); |
1201 | 1206 |
1202 layer_tree_host_->RemoveLayerShouldPushProperties(this); | 1207 layer_tree_host_->RemoveLayerShouldPushProperties(this); |
1203 } | 1208 } |
1204 | 1209 |
1205 void Layer::TakeCopyRequests( | 1210 void Layer::TakeCopyRequests( |
1206 std::vector<std::unique_ptr<CopyOutputRequest>>* requests) { | 1211 std::vector<std::unique_ptr<CopyOutputRequest>>* requests) { |
1207 for (auto& it : inputs_.copy_requests) { | 1212 for (auto& it : inputs_.copy_requests) { |
1208 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = | 1213 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 ->num_copy_requests_in_subtree; | 1447 ->num_copy_requests_in_subtree; |
1443 } | 1448 } |
1444 | 1449 |
1445 gfx::Transform Layer::screen_space_transform() const { | 1450 gfx::Transform Layer::screen_space_transform() const { |
1446 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1451 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1447 return draw_property_utils::ScreenSpaceTransform( | 1452 return draw_property_utils::ScreenSpaceTransform( |
1448 this, layer_tree_host_->property_trees()->transform_tree); | 1453 this, layer_tree_host_->property_trees()->transform_tree); |
1449 } | 1454 } |
1450 | 1455 |
1451 } // namespace cc | 1456 } // namespace cc |
OLD | NEW |