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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 user_scrollable_horizontal(true), | 57 user_scrollable_horizontal(true), |
58 user_scrollable_vertical(true), | 58 user_scrollable_vertical(true), |
59 main_thread_scrolling_reasons( | 59 main_thread_scrolling_reasons( |
60 MainThreadScrollingReason::kNotScrollingOnMain), | 60 MainThreadScrollingReason::kNotScrollingOnMain), |
61 is_container_for_fixed_position_layers(false), | 61 is_container_for_fixed_position_layers(false), |
62 mutable_properties(MutableProperty::kNone), | 62 mutable_properties(MutableProperty::kNone), |
63 scroll_parent(nullptr), | 63 scroll_parent(nullptr), |
64 clip_parent(nullptr), | 64 clip_parent(nullptr), |
65 has_will_change_transform_hint(false), | 65 has_will_change_transform_hint(false), |
66 hide_layer_and_subtree(false), | 66 hide_layer_and_subtree(false), |
67 client(nullptr) {} | 67 client(nullptr), |
| 68 scroll_boundary_behavior(SCROLL_BOUNDARY_BEHAVIOR_PROPAGATE) {} |
68 | 69 |
69 Layer::Inputs::~Inputs() {} | 70 Layer::Inputs::~Inputs() {} |
70 | 71 |
71 scoped_refptr<Layer> Layer::Create() { | 72 scoped_refptr<Layer> Layer::Create() { |
72 return make_scoped_refptr(new Layer()); | 73 return make_scoped_refptr(new Layer()); |
73 } | 74 } |
74 | 75 |
75 Layer::Layer() | 76 Layer::Layer() |
76 : ignore_set_needs_commit_(false), | 77 : ignore_set_needs_commit_(false), |
77 parent_(nullptr), | 78 parent_(nullptr), |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 node->bounds = inputs_.bounds; | 304 node->bounds = inputs_.bounds; |
304 } | 305 } |
305 } | 306 } |
306 | 307 |
307 if (is_scroll_clip_layer_) | 308 if (is_scroll_clip_layer_) |
308 layer_tree_host_->property_trees()->scroll_tree.set_needs_update(true); | 309 layer_tree_host_->property_trees()->scroll_tree.set_needs_update(true); |
309 | 310 |
310 SetNeedsCommit(); | 311 SetNeedsCommit(); |
311 } | 312 } |
312 | 313 |
| 314 void Layer::SetScrollBoundaryBehavior(ScrollBoundaryBehavior behavior) { |
| 315 if (scrollBoundaryBehavior() == behavior) |
| 316 return; |
| 317 inputs_.scroll_boundary_behavior = behavior; |
| 318 |
| 319 SetNeedsCommit(); |
| 320 } |
| 321 |
313 Layer* Layer::RootLayer() { | 322 Layer* Layer::RootLayer() { |
314 Layer* layer = this; | 323 Layer* layer = this; |
315 while (layer->parent()) | 324 while (layer->parent()) |
316 layer = layer->parent(); | 325 layer = layer->parent(); |
317 return layer; | 326 return layer; |
318 } | 327 } |
319 | 328 |
320 void Layer::RemoveAllChildren() { | 329 void Layer::RemoveAllChildren() { |
321 DCHECK(IsPropertyChangeAllowed()); | 330 DCHECK(IsPropertyChangeAllowed()); |
322 while (inputs_.children.size()) { | 331 while (inputs_.children.size()) { |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); | 1192 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); |
1184 | 1193 |
1185 // If the main thread commits multiple times before the impl thread actually | 1194 // If the main thread commits multiple times before the impl thread actually |
1186 // draws, then damage tracking will become incorrect if we simply clobber the | 1195 // draws, then damage tracking will become incorrect if we simply clobber the |
1187 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 1196 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
1188 // union) any update changes that have occurred on the main thread. | 1197 // union) any update changes that have occurred on the main thread. |
1189 inputs_.update_rect.Union(layer->update_rect()); | 1198 inputs_.update_rect.Union(layer->update_rect()); |
1190 layer->SetUpdateRect(inputs_.update_rect); | 1199 layer->SetUpdateRect(inputs_.update_rect); |
1191 | 1200 |
1192 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); | 1201 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); |
| 1202 layer->SetScrollBoundaryBehavior(inputs_.scroll_boundary_behavior); |
1193 layer->SetNeedsPushProperties(); | 1203 layer->SetNeedsPushProperties(); |
1194 | 1204 |
1195 // Reset any state that should be cleared for the next update. | 1205 // Reset any state that should be cleared for the next update. |
1196 subtree_property_changed_ = false; | 1206 subtree_property_changed_ = false; |
1197 inputs_.update_rect = gfx::Rect(); | 1207 inputs_.update_rect = gfx::Rect(); |
1198 | 1208 |
1199 layer_tree_host_->RemoveLayerShouldPushProperties(this); | 1209 layer_tree_host_->RemoveLayerShouldPushProperties(this); |
1200 } | 1210 } |
1201 | 1211 |
1202 void Layer::TakeCopyRequests( | 1212 void Layer::TakeCopyRequests( |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 ->num_copy_requests_in_subtree; | 1522 ->num_copy_requests_in_subtree; |
1513 } | 1523 } |
1514 | 1524 |
1515 gfx::Transform Layer::screen_space_transform() const { | 1525 gfx::Transform Layer::screen_space_transform() const { |
1516 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1526 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1517 return draw_property_utils::ScreenSpaceTransform( | 1527 return draw_property_utils::ScreenSpaceTransform( |
1518 this, layer_tree_host_->property_trees()->transform_tree); | 1528 this, layer_tree_host_->property_trees()->transform_tree); |
1519 } | 1529 } |
1520 | 1530 |
1521 } // namespace cc | 1531 } // namespace cc |
OLD | NEW |