Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: update the tests Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
73 clip_tree_index_(ClipTree::kInvalidNodeId), 73 clip_tree_index_(ClipTree::kInvalidNodeId),
74 scroll_tree_index_(ScrollTree::kInvalidNodeId), 74 scroll_tree_index_(ScrollTree::kInvalidNodeId),
75 current_draw_mode_(DRAW_MODE_NONE), 75 current_draw_mode_(DRAW_MODE_NONE),
76 mutable_properties_(MutableProperty::kNone), 76 mutable_properties_(MutableProperty::kNone),
77 debug_info_(nullptr), 77 debug_info_(nullptr),
78 has_will_change_transform_hint_(false), 78 has_will_change_transform_hint_(false),
79 needs_push_properties_(false), 79 needs_push_properties_(false),
80 scrollbars_hidden_(false), 80 scrollbars_hidden_(false),
81 needs_show_scrollbars_(false), 81 needs_show_scrollbars_(false),
82 raster_even_if_not_drawn_(false), 82 raster_even_if_not_drawn_(false),
83 has_transform_node_(false) { 83 has_transform_node_(false),
84 scroll_boundary_behavior_(
85 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) {
84 DCHECK_GT(layer_id_, 0); 86 DCHECK_GT(layer_id_, 0);
85 87
86 DCHECK(layer_tree_impl_); 88 DCHECK(layer_tree_impl_);
87 layer_tree_impl_->RegisterLayer(this); 89 layer_tree_impl_->RegisterLayer(this);
88 layer_tree_impl_->AddToElementMap(this); 90 layer_tree_impl_->AddToElementMap(this);
89 91
90 SetNeedsPushProperties(); 92 SetNeedsPushProperties();
91 } 93 }
92 94
93 LayerImpl::~LayerImpl() { 95 LayerImpl::~LayerImpl() {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 332
331 if (layer_property_changed_) { 333 if (layer_property_changed_) {
332 layer->layer_tree_impl()->set_needs_update_draw_properties(); 334 layer->layer_tree_impl()->set_needs_update_draw_properties();
333 layer->layer_property_changed_ = true; 335 layer->layer_property_changed_ = true;
334 } 336 }
335 337
336 layer->SetBounds(bounds_); 338 layer->SetBounds(bounds_);
337 if (scrollable_) 339 if (scrollable_)
338 layer->SetScrollable(scroll_container_bounds_); 340 layer->SetScrollable(scroll_container_bounds_);
339 layer->SetMutableProperties(mutable_properties_); 341 layer->SetMutableProperties(mutable_properties_);
342 layer->SetScrollBoundaryBehavior(scroll_boundary_behavior_);
340 343
341 // If the main thread commits multiple times before the impl thread actually 344 // If the main thread commits multiple times before the impl thread actually
342 // draws, then damage tracking will become incorrect if we simply clobber the 345 // draws, then damage tracking will become incorrect if we simply clobber the
343 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 346 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
344 // union) any update changes that have occurred on the main thread. 347 // union) any update changes that have occurred on the main thread.
345 update_rect_.Union(layer->update_rect()); 348 update_rect_.Union(layer->update_rect());
346 layer->SetUpdateRect(update_rect_); 349 layer->SetUpdateRect(update_rect_);
347 350
348 if (owned_debug_info_) 351 if (owned_debug_info_)
349 layer->SetDebugInfo(std::move(owned_debug_info_)); 352 layer->SetDebugInfo(std::move(owned_debug_info_));
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 759
757 gfx::Vector2dF LayerImpl::ClampScrollToMaxScrollOffset() { 760 gfx::Vector2dF LayerImpl::ClampScrollToMaxScrollOffset() {
758 gfx::ScrollOffset old_offset = CurrentScrollOffset(); 761 gfx::ScrollOffset old_offset = CurrentScrollOffset();
759 gfx::ScrollOffset clamped_offset = ClampScrollOffsetToLimits(old_offset); 762 gfx::ScrollOffset clamped_offset = ClampScrollOffsetToLimits(old_offset);
760 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset); 763 gfx::Vector2dF delta = clamped_offset.DeltaFrom(old_offset);
761 if (!delta.IsZero()) 764 if (!delta.IsZero())
762 ScrollBy(delta); 765 ScrollBy(delta);
763 return delta; 766 return delta;
764 } 767 }
765 768
769 void LayerImpl::SetScrollBoundaryBehavior(
770 const ScrollBoundaryBehavior& behavior) {
771 if (scroll_boundary_behavior_ == behavior)
772 return;
773 scroll_boundary_behavior_ = behavior;
774 NoteLayerPropertyChanged();
775 }
776
766 void LayerImpl::SetNeedsPushProperties() { 777 void LayerImpl::SetNeedsPushProperties() {
767 // There's no need to push layer properties on the active tree. 778 // There's no need to push layer properties on the active tree.
768 if (!needs_push_properties_ && !layer_tree_impl()->IsActiveTree()) { 779 if (!needs_push_properties_ && !layer_tree_impl()->IsActiveTree()) {
769 needs_push_properties_ = true; 780 needs_push_properties_ = true;
770 layer_tree_impl()->AddLayerShouldPushProperties(this); 781 layer_tree_impl()->AddLayerShouldPushProperties(this);
771 } 782 }
772 } 783 }
773 784
774 void LayerImpl::GetAllPrioritizedTilesForTracing( 785 void LayerImpl::GetAllPrioritizedTilesForTracing(
775 std::vector<PrioritizedTile>* prioritized_tiles) const { 786 std::vector<PrioritizedTile>* prioritized_tiles) const {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 1006
996 const bool has_valid_scroll_node = 1007 const bool has_valid_scroll_node =
997 !!GetScrollTree().Node(scroll_tree_index()); 1008 !!GetScrollTree().Node(scroll_tree_index());
998 DCHECK(has_valid_scroll_node); 1009 DCHECK(has_valid_scroll_node);
999 1010
1000 return has_valid_transform_node && has_valid_effect_node && 1011 return has_valid_transform_node && has_valid_effect_node &&
1001 has_valid_clip_node && has_valid_scroll_node; 1012 has_valid_clip_node && has_valid_scroll_node;
1002 } 1013 }
1003 1014
1004 } // namespace cc 1015 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698