Chromium Code Reviews| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 draw_blend_mode_(SkBlendMode::kSrcOver), | 73 draw_blend_mode_(SkBlendMode::kSrcOver), |
| 74 transform_tree_index_(TransformTree::kInvalidNodeId), | 74 transform_tree_index_(TransformTree::kInvalidNodeId), |
| 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 scroll_boundary_behavior_(SCROLL_BOUNDARY_BEHAVIOR_PROPAGATE) { | |
|
bokan
2017/03/23 13:18:26
How does a LayerImpl get scroll_boundary_behavior_
sunyunjia
2017/03/23 20:16:54
Yeah, that's added.
bokan
2017/03/23 21:52:19
Sorry, actually, now that you're storing the bit i
| |
| 84 DCHECK_GT(layer_id_, 0); | 85 DCHECK_GT(layer_id_, 0); |
| 85 | 86 |
| 86 DCHECK(layer_tree_impl_); | 87 DCHECK(layer_tree_impl_); |
| 87 layer_tree_impl_->RegisterLayer(this); | 88 layer_tree_impl_->RegisterLayer(this); |
| 88 layer_tree_impl_->AddToElementMap(this); | 89 layer_tree_impl_->AddToElementMap(this); |
| 89 | 90 |
| 90 SetNeedsPushProperties(); | 91 SetNeedsPushProperties(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 LayerImpl::~LayerImpl() { | 94 LayerImpl::~LayerImpl() { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 | 342 |
| 342 if (layer_property_changed_) { | 343 if (layer_property_changed_) { |
| 343 layer->layer_tree_impl()->set_needs_update_draw_properties(); | 344 layer->layer_tree_impl()->set_needs_update_draw_properties(); |
| 344 layer->layer_property_changed_ = true; | 345 layer->layer_property_changed_ = true; |
| 345 } | 346 } |
| 346 | 347 |
| 347 layer->SetBounds(bounds_); | 348 layer->SetBounds(bounds_); |
| 348 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 349 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 349 layer->SetElementId(element_id_); | 350 layer->SetElementId(element_id_); |
| 350 layer->SetMutableProperties(mutable_properties_); | 351 layer->SetMutableProperties(mutable_properties_); |
| 352 layer->SetScrollBoundaryBehavior(scroll_boundary_behavior_); | |
| 351 | 353 |
| 352 // If the main thread commits multiple times before the impl thread actually | 354 // If the main thread commits multiple times before the impl thread actually |
| 353 // draws, then damage tracking will become incorrect if we simply clobber the | 355 // draws, then damage tracking will become incorrect if we simply clobber the |
| 354 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 356 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
| 355 // union) any update changes that have occurred on the main thread. | 357 // union) any update changes that have occurred on the main thread. |
| 356 update_rect_.Union(layer->update_rect()); | 358 update_rect_.Union(layer->update_rect()); |
| 357 layer->SetUpdateRect(update_rect_); | 359 layer->SetUpdateRect(update_rect_); |
| 358 | 360 |
| 359 if (owned_debug_info_) | 361 if (owned_debug_info_) |
| 360 layer->SetDebugInfo(std::move(owned_debug_info_)); | 362 layer->SetDebugInfo(std::move(owned_debug_info_)); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 | 829 |
| 828 gfx::Vector2dF LayerImpl::ClampScrollToMaxScrollOffset() { | 830 gfx::Vector2dF LayerImpl::ClampScrollToMaxScrollOffset() { |
| 829 gfx::ScrollOffset old_offset = CurrentScrollOffset(); | 831 gfx::ScrollOffset old_offset = CurrentScrollOffset(); |
| 830 gfx::ScrollOffset clamped_offset = ClampScrollOffsetToLimits(old_offset); | 832 gfx::ScrollOffset clamped_offset = ClampScrollOffsetToLimits(old_offset); |
| 831 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset); | 833 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset); |
| 832 if (!delta.IsZero()) | 834 if (!delta.IsZero()) |
| 833 ScrollBy(delta); | 835 ScrollBy(delta); |
| 834 return delta; | 836 return delta; |
| 835 } | 837 } |
| 836 | 838 |
| 839 void LayerImpl::SetScrollBoundaryBehavior(ScrollBoundaryBehavior behavior) { | |
| 840 if (scroll_boundary_behavior_ == behavior) | |
| 841 return; | |
| 842 scroll_boundary_behavior_ = behavior; | |
| 843 layer_tree_impl()->DidUpdateScrollState(id()); | |
| 844 NoteLayerPropertyChanged(); | |
| 845 } | |
| 846 | |
| 837 void LayerImpl::SetNeedsPushProperties() { | 847 void LayerImpl::SetNeedsPushProperties() { |
| 838 if (layer_tree_impl_ && !needs_push_properties_) { | 848 if (layer_tree_impl_ && !needs_push_properties_) { |
| 839 needs_push_properties_ = true; | 849 needs_push_properties_ = true; |
| 840 layer_tree_impl()->AddLayerShouldPushProperties(this); | 850 layer_tree_impl()->AddLayerShouldPushProperties(this); |
| 841 } | 851 } |
| 842 } | 852 } |
| 843 | 853 |
| 844 void LayerImpl::GetAllPrioritizedTilesForTracing( | 854 void LayerImpl::GetAllPrioritizedTilesForTracing( |
| 845 std::vector<PrioritizedTile>* prioritized_tiles) const { | 855 std::vector<PrioritizedTile>* prioritized_tiles) const { |
| 846 } | 856 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1050 | 1060 |
| 1051 ScrollTree& LayerImpl::GetScrollTree() const { | 1061 ScrollTree& LayerImpl::GetScrollTree() const { |
| 1052 return GetPropertyTrees()->scroll_tree; | 1062 return GetPropertyTrees()->scroll_tree; |
| 1053 } | 1063 } |
| 1054 | 1064 |
| 1055 TransformTree& LayerImpl::GetTransformTree() const { | 1065 TransformTree& LayerImpl::GetTransformTree() const { |
| 1056 return GetPropertyTrees()->transform_tree; | 1066 return GetPropertyTrees()->transform_tree; |
| 1057 } | 1067 } |
| 1058 | 1068 |
| 1059 } // namespace cc | 1069 } // namespace cc |
| OLD | NEW |