| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 user_scrollable_horizontal(true), | 58 user_scrollable_horizontal(true), |
| 59 user_scrollable_vertical(true), | 59 user_scrollable_vertical(true), |
| 60 main_thread_scrolling_reasons( | 60 main_thread_scrolling_reasons( |
| 61 MainThreadScrollingReason::kNotScrollingOnMain), | 61 MainThreadScrollingReason::kNotScrollingOnMain), |
| 62 is_container_for_fixed_position_layers(false), | 62 is_container_for_fixed_position_layers(false), |
| 63 mutable_properties(MutableProperty::kNone), | 63 mutable_properties(MutableProperty::kNone), |
| 64 scroll_parent(nullptr), | 64 scroll_parent(nullptr), |
| 65 clip_parent(nullptr), | 65 clip_parent(nullptr), |
| 66 has_will_change_transform_hint(false), | 66 has_will_change_transform_hint(false), |
| 67 hide_layer_and_subtree(false), | 67 hide_layer_and_subtree(false), |
| 68 client(nullptr) {} | 68 client(nullptr), |
| 69 scroll_boundary_behavior( |
| 70 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) {} |
| 69 | 71 |
| 70 Layer::Inputs::~Inputs() {} | 72 Layer::Inputs::~Inputs() {} |
| 71 | 73 |
| 72 scoped_refptr<Layer> Layer::Create() { | 74 scoped_refptr<Layer> Layer::Create() { |
| 73 return make_scoped_refptr(new Layer()); | 75 return make_scoped_refptr(new Layer()); |
| 74 } | 76 } |
| 75 | 77 |
| 76 Layer::Layer() | 78 Layer::Layer() |
| 77 : ignore_set_needs_commit_(false), | 79 : ignore_set_needs_commit_(false), |
| 78 parent_(nullptr), | 80 parent_(nullptr), |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 auto& scroll_tree = layer_tree_host_->property_trees()->scroll_tree; | 301 auto& scroll_tree = layer_tree_host_->property_trees()->scroll_tree; |
| 300 if (auto* scroll_node = scroll_tree.Node(scroll_tree_index_)) | 302 if (auto* scroll_node = scroll_tree.Node(scroll_tree_index_)) |
| 301 scroll_node->bounds = inputs_.bounds; | 303 scroll_node->bounds = inputs_.bounds; |
| 302 else | 304 else |
| 303 SetPropertyTreesNeedRebuild(); | 305 SetPropertyTreesNeedRebuild(); |
| 304 } | 306 } |
| 305 | 307 |
| 306 SetNeedsCommit(); | 308 SetNeedsCommit(); |
| 307 } | 309 } |
| 308 | 310 |
| 311 void Layer::SetScrollBoundaryBehavior(const ScrollBoundaryBehavior& behavior) { |
| 312 DCHECK(IsPropertyChangeAllowed()); |
| 313 if (scroll_boundary_behavior() == behavior) |
| 314 return; |
| 315 inputs_.scroll_boundary_behavior = behavior; |
| 316 if (!layer_tree_host_) |
| 317 return; |
| 318 |
| 319 if (scrollable()) { |
| 320 auto& scroll_tree = layer_tree_host_->property_trees()->scroll_tree; |
| 321 if (auto* scroll_node = scroll_tree.Node(scroll_tree_index_)) |
| 322 scroll_node->scroll_boundary_behavior = behavior; |
| 323 else |
| 324 SetPropertyTreesNeedRebuild(); |
| 325 } |
| 326 |
| 327 SetNeedsCommit(); |
| 328 } |
| 329 |
| 309 Layer* Layer::RootLayer() { | 330 Layer* Layer::RootLayer() { |
| 310 Layer* layer = this; | 331 Layer* layer = this; |
| 311 while (layer->parent()) | 332 while (layer->parent()) |
| 312 layer = layer->parent(); | 333 layer = layer->parent(); |
| 313 return layer; | 334 return layer; |
| 314 } | 335 } |
| 315 | 336 |
| 316 void Layer::RemoveAllChildren() { | 337 void Layer::RemoveAllChildren() { |
| 317 DCHECK(IsPropertyChangeAllowed()); | 338 DCHECK(IsPropertyChangeAllowed()); |
| 318 while (inputs_.children.size()) { | 339 while (inputs_.children.size()) { |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 ->subtree_has_copy_request; | 1447 ->subtree_has_copy_request; |
| 1427 } | 1448 } |
| 1428 | 1449 |
| 1429 gfx::Transform Layer::ScreenSpaceTransform() const { | 1450 gfx::Transform Layer::ScreenSpaceTransform() const { |
| 1430 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1451 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
| 1431 return draw_property_utils::ScreenSpaceTransform( | 1452 return draw_property_utils::ScreenSpaceTransform( |
| 1432 this, layer_tree_host_->property_trees()->transform_tree); | 1453 this, layer_tree_host_->property_trees()->transform_tree); |
| 1433 } | 1454 } |
| 1434 | 1455 |
| 1435 } // namespace cc | 1456 } // namespace cc |
| OLD | NEW |