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