OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_impl.h" | 5 #include "cc/layers/layer_impl.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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 effect_tree_index_(EffectTree::kInvalidNodeId), | 74 effect_tree_index_(EffectTree::kInvalidNodeId), |
75 clip_tree_index_(ClipTree::kInvalidNodeId), | 75 clip_tree_index_(ClipTree::kInvalidNodeId), |
76 scroll_tree_index_(ScrollTree::kInvalidNodeId), | 76 scroll_tree_index_(ScrollTree::kInvalidNodeId), |
77 current_draw_mode_(DRAW_MODE_NONE), | 77 current_draw_mode_(DRAW_MODE_NONE), |
78 mutable_properties_(MutableProperty::kNone), | 78 mutable_properties_(MutableProperty::kNone), |
79 debug_info_(nullptr), | 79 debug_info_(nullptr), |
80 has_will_change_transform_hint_(false), | 80 has_will_change_transform_hint_(false), |
81 needs_push_properties_(false), | 81 needs_push_properties_(false), |
82 scrollbars_hidden_(false), | 82 scrollbars_hidden_(false), |
83 needs_show_scrollbars_(false), | 83 needs_show_scrollbars_(false), |
84 raster_even_if_not_in_rsll_(false) { | 84 raster_even_if_not_in_rsll_(false), |
| 85 scroll_boundary_behavior_( |
| 86 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) { |
85 DCHECK_GT(layer_id_, 0); | 87 DCHECK_GT(layer_id_, 0); |
86 | 88 |
87 DCHECK(layer_tree_impl_); | 89 DCHECK(layer_tree_impl_); |
88 layer_tree_impl_->RegisterLayer(this); | 90 layer_tree_impl_->RegisterLayer(this); |
89 layer_tree_impl_->AddToElementMap(this); | 91 layer_tree_impl_->AddToElementMap(this); |
90 | 92 |
91 SetNeedsPushProperties(); | 93 SetNeedsPushProperties(); |
92 } | 94 } |
93 | 95 |
94 LayerImpl::~LayerImpl() { | 96 LayerImpl::~LayerImpl() { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 layer->needs_show_scrollbars_ = needs_show_scrollbars_; | 348 layer->needs_show_scrollbars_ = needs_show_scrollbars_; |
347 | 349 |
348 if (layer_property_changed_) { | 350 if (layer_property_changed_) { |
349 layer->layer_tree_impl()->set_needs_update_draw_properties(); | 351 layer->layer_tree_impl()->set_needs_update_draw_properties(); |
350 layer->layer_property_changed_ = true; | 352 layer->layer_property_changed_ = true; |
351 } | 353 } |
352 | 354 |
353 layer->SetBounds(bounds_); | 355 layer->SetBounds(bounds_); |
354 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 356 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
355 layer->SetMutableProperties(mutable_properties_); | 357 layer->SetMutableProperties(mutable_properties_); |
| 358 layer->SetScrollBoundaryBehavior(scroll_boundary_behavior_); |
356 | 359 |
357 // If the main thread commits multiple times before the impl thread actually | 360 // If the main thread commits multiple times before the impl thread actually |
358 // draws, then damage tracking will become incorrect if we simply clobber the | 361 // draws, then damage tracking will become incorrect if we simply clobber the |
359 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 362 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
360 // union) any update changes that have occurred on the main thread. | 363 // union) any update changes that have occurred on the main thread. |
361 update_rect_.Union(layer->update_rect()); | 364 update_rect_.Union(layer->update_rect()); |
362 layer->SetUpdateRect(update_rect_); | 365 layer->SetUpdateRect(update_rect_); |
363 | 366 |
364 if (owned_debug_info_) | 367 if (owned_debug_info_) |
365 layer->SetDebugInfo(std::move(owned_debug_info_)); | 368 layer->SetDebugInfo(std::move(owned_debug_info_)); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 766 |
764 gfx::Vector2dF LayerImpl::ClampScrollToMaxScrollOffset() { | 767 gfx::Vector2dF LayerImpl::ClampScrollToMaxScrollOffset() { |
765 gfx::ScrollOffset old_offset = CurrentScrollOffset(); | 768 gfx::ScrollOffset old_offset = CurrentScrollOffset(); |
766 gfx::ScrollOffset clamped_offset = ClampScrollOffsetToLimits(old_offset); | 769 gfx::ScrollOffset clamped_offset = ClampScrollOffsetToLimits(old_offset); |
767 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset); | 770 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset); |
768 if (!delta.IsZero()) | 771 if (!delta.IsZero()) |
769 ScrollBy(delta); | 772 ScrollBy(delta); |
770 return delta; | 773 return delta; |
771 } | 774 } |
772 | 775 |
| 776 void LayerImpl::SetScrollBoundaryBehavior( |
| 777 const ScrollBoundaryBehavior& behavior) { |
| 778 if (scroll_boundary_behavior_ == behavior) |
| 779 return; |
| 780 scroll_boundary_behavior_ = behavior; |
| 781 layer_tree_impl()->DidUpdateScrollState(id()); |
| 782 NoteLayerPropertyChanged(); |
| 783 } |
| 784 |
773 void LayerImpl::SetNeedsPushProperties() { | 785 void LayerImpl::SetNeedsPushProperties() { |
774 if (layer_tree_impl_ && !needs_push_properties_) { | 786 if (layer_tree_impl_ && !needs_push_properties_) { |
775 needs_push_properties_ = true; | 787 needs_push_properties_ = true; |
776 layer_tree_impl()->AddLayerShouldPushProperties(this); | 788 layer_tree_impl()->AddLayerShouldPushProperties(this); |
777 } | 789 } |
778 } | 790 } |
779 | 791 |
780 void LayerImpl::GetAllPrioritizedTilesForTracing( | 792 void LayerImpl::GetAllPrioritizedTilesForTracing( |
781 std::vector<PrioritizedTile>* prioritized_tiles) const { | 793 std::vector<PrioritizedTile>* prioritized_tiles) const { |
782 } | 794 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 | 991 |
980 ScrollTree& LayerImpl::GetScrollTree() const { | 992 ScrollTree& LayerImpl::GetScrollTree() const { |
981 return GetPropertyTrees()->scroll_tree; | 993 return GetPropertyTrees()->scroll_tree; |
982 } | 994 } |
983 | 995 |
984 TransformTree& LayerImpl::GetTransformTree() const { | 996 TransformTree& LayerImpl::GetTransformTree() const { |
985 return GetPropertyTrees()->transform_tree; | 997 return GetPropertyTrees()->transform_tree; |
986 } | 998 } |
987 | 999 |
988 } // namespace cc | 1000 } // namespace cc |
OLD | NEW |