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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 : needs_push_properties_(false), | 34 : needs_push_properties_(false), |
35 num_dependents_need_push_properties_(false), | 35 num_dependents_need_push_properties_(false), |
36 stacking_order_changed_(false), | 36 stacking_order_changed_(false), |
37 layer_id_(s_next_layer_id++), | 37 layer_id_(s_next_layer_id++), |
38 ignore_set_needs_commit_(false), | 38 ignore_set_needs_commit_(false), |
39 parent_(NULL), | 39 parent_(NULL), |
40 layer_tree_host_(NULL), | 40 layer_tree_host_(NULL), |
41 scrollable_(false), | 41 scrollable_(false), |
42 should_scroll_on_main_thread_(false), | 42 should_scroll_on_main_thread_(false), |
43 have_wheel_event_handlers_(false), | 43 have_wheel_event_handlers_(false), |
| 44 user_scrollable_horizontal_(true), |
| 45 user_scrollable_vertical_(true), |
44 anchor_point_(0.5f, 0.5f), | 46 anchor_point_(0.5f, 0.5f), |
45 background_color_(0), | 47 background_color_(0), |
46 compositing_reasons_(kCompositingReasonUnknown), | 48 compositing_reasons_(kCompositingReasonUnknown), |
47 opacity_(1.f), | 49 opacity_(1.f), |
48 anchor_point_z_(0.f), | 50 anchor_point_z_(0.f), |
49 is_container_for_fixed_position_layers_(false), | 51 is_container_for_fixed_position_layers_(false), |
50 is_drawable_(false), | 52 is_drawable_(false), |
51 hide_layer_and_subtree_(false), | 53 hide_layer_and_subtree_(false), |
52 masks_to_bounds_(false), | 54 masks_to_bounds_(false), |
53 contents_opaque_(false), | 55 contents_opaque_(false), |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 641 } |
640 | 642 |
641 void Layer::SetScrollable(bool scrollable) { | 643 void Layer::SetScrollable(bool scrollable) { |
642 DCHECK(IsPropertyChangeAllowed()); | 644 DCHECK(IsPropertyChangeAllowed()); |
643 if (scrollable_ == scrollable) | 645 if (scrollable_ == scrollable) |
644 return; | 646 return; |
645 scrollable_ = scrollable; | 647 scrollable_ = scrollable; |
646 SetNeedsCommit(); | 648 SetNeedsCommit(); |
647 } | 649 } |
648 | 650 |
| 651 void Layer::SetUserScrollable(bool horizontal, bool vertical) { |
| 652 DCHECK(IsPropertyChangeAllowed()); |
| 653 if (user_scrollable_horizontal_ == horizontal && |
| 654 user_scrollable_vertical_ == vertical) |
| 655 return; |
| 656 user_scrollable_horizontal_ = horizontal; |
| 657 user_scrollable_vertical_ = vertical; |
| 658 SetNeedsCommit(); |
| 659 } |
| 660 |
649 void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { | 661 void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { |
650 DCHECK(IsPropertyChangeAllowed()); | 662 DCHECK(IsPropertyChangeAllowed()); |
651 if (should_scroll_on_main_thread_ == should_scroll_on_main_thread) | 663 if (should_scroll_on_main_thread_ == should_scroll_on_main_thread) |
652 return; | 664 return; |
653 should_scroll_on_main_thread_ = should_scroll_on_main_thread; | 665 should_scroll_on_main_thread_ = should_scroll_on_main_thread; |
654 SetNeedsCommit(); | 666 SetNeedsCommit(); |
655 } | 667 } |
656 | 668 |
657 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { | 669 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { |
658 DCHECK(IsPropertyChangeAllowed()); | 670 DCHECK(IsPropertyChangeAllowed()); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 layer->SetFixedContainerSizeDelta(gfx::Vector2dF()); | 838 layer->SetFixedContainerSizeDelta(gfx::Vector2dF()); |
827 layer->SetPositionConstraint(position_constraint_); | 839 layer->SetPositionConstraint(position_constraint_); |
828 layer->SetPreserves3d(preserves_3d()); | 840 layer->SetPreserves3d(preserves_3d()); |
829 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 841 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
830 layer->SetSublayerTransform(sublayer_transform_); | 842 layer->SetSublayerTransform(sublayer_transform_); |
831 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) | 843 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) |
832 layer->SetTransform(transform_); | 844 layer->SetTransform(transform_); |
833 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 845 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
834 | 846 |
835 layer->SetScrollable(scrollable_); | 847 layer->SetScrollable(scrollable_); |
| 848 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 849 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
836 layer->SetMaxScrollOffset(max_scroll_offset_); | 850 layer->SetMaxScrollOffset(max_scroll_offset_); |
837 | 851 |
838 LayerImpl* scroll_parent = NULL; | 852 LayerImpl* scroll_parent = NULL; |
839 if (scroll_parent_) | 853 if (scroll_parent_) |
840 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 854 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
841 | 855 |
842 layer->SetScrollParent(scroll_parent); | 856 layer->SetScrollParent(scroll_parent); |
843 if (scroll_children_) { | 857 if (scroll_children_) { |
844 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | 858 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; |
845 for (std::set<Layer*>::iterator it = scroll_children_->begin(); | 859 for (std::set<Layer*>::iterator it = scroll_children_->begin(); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 clip_parent_->RemoveClipChild(this); | 1098 clip_parent_->RemoveClipChild(this); |
1085 | 1099 |
1086 clip_parent_ = NULL; | 1100 clip_parent_ = NULL; |
1087 } | 1101 } |
1088 | 1102 |
1089 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1103 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1090 benchmark->RunOnLayer(this); | 1104 benchmark->RunOnLayer(this); |
1091 } | 1105 } |
1092 | 1106 |
1093 } // namespace cc | 1107 } // namespace cc |
OLD | NEW |