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

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

Issue 2769793002: Implement CSS: scroll-boundary-behavior (Closed)
Patch Set: Update WebScrollBoundaryBehavior. Created 3 years, 7 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 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 user_scrollable_horizontal(true), 57 user_scrollable_horizontal(true),
58 user_scrollable_vertical(true), 58 user_scrollable_vertical(true),
59 main_thread_scrolling_reasons( 59 main_thread_scrolling_reasons(
60 MainThreadScrollingReason::kNotScrollingOnMain), 60 MainThreadScrollingReason::kNotScrollingOnMain),
61 is_container_for_fixed_position_layers(false), 61 is_container_for_fixed_position_layers(false),
62 mutable_properties(MutableProperty::kNone), 62 mutable_properties(MutableProperty::kNone),
63 scroll_parent(nullptr), 63 scroll_parent(nullptr),
64 clip_parent(nullptr), 64 clip_parent(nullptr),
65 has_will_change_transform_hint(false), 65 has_will_change_transform_hint(false),
66 hide_layer_and_subtree(false), 66 hide_layer_and_subtree(false),
67 client(nullptr) {} 67 client(nullptr),
68 scroll_boundary_behavior(
69 ScrollBoundaryBehavior::kScrollBoundaryBehaviorTypeAuto) {}
68 70
69 Layer::Inputs::~Inputs() {} 71 Layer::Inputs::~Inputs() {}
70 72
71 scoped_refptr<Layer> Layer::Create() { 73 scoped_refptr<Layer> Layer::Create() {
72 return make_scoped_refptr(new Layer()); 74 return make_scoped_refptr(new Layer());
73 } 75 }
74 76
75 Layer::Layer() 77 Layer::Layer()
76 : ignore_set_needs_commit_(false), 78 : ignore_set_needs_commit_(false),
77 parent_(nullptr), 79 parent_(nullptr),
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 node->bounds = inputs_.bounds; 305 node->bounds = inputs_.bounds;
304 } 306 }
305 } 307 }
306 308
307 if (is_scroll_clip_layer_) 309 if (is_scroll_clip_layer_)
308 layer_tree_host_->property_trees()->scroll_tree.set_needs_update(true); 310 layer_tree_host_->property_trees()->scroll_tree.set_needs_update(true);
309 311
310 SetNeedsCommit(); 312 SetNeedsCommit();
311 } 313 }
312 314
315 void Layer::SetScrollBoundaryBehavior(ScrollBoundaryBehavior behavior) {
316 if (scroll_boundary_behavior() == behavior)
317 return;
318 inputs_.scroll_boundary_behavior = behavior;
319
320 SetNeedsCommit();
321 }
322
313 Layer* Layer::RootLayer() { 323 Layer* Layer::RootLayer() {
314 Layer* layer = this; 324 Layer* layer = this;
315 while (layer->parent()) 325 while (layer->parent())
316 layer = layer->parent(); 326 layer = layer->parent();
317 return layer; 327 return layer;
318 } 328 }
319 329
320 void Layer::RemoveAllChildren() { 330 void Layer::RemoveAllChildren() {
321 DCHECK(IsPropertyChangeAllowed()); 331 DCHECK(IsPropertyChangeAllowed());
322 while (inputs_.children.size()) { 332 while (inputs_.children.size()) {
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 layer->set_needs_show_scrollbars(true); 1202 layer->set_needs_show_scrollbars(true);
1193 1203
1194 // If the main thread commits multiple times before the impl thread actually 1204 // If the main thread commits multiple times before the impl thread actually
1195 // draws, then damage tracking will become incorrect if we simply clobber the 1205 // draws, then damage tracking will become incorrect if we simply clobber the
1196 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 1206 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
1197 // union) any update changes that have occurred on the main thread. 1207 // union) any update changes that have occurred on the main thread.
1198 inputs_.update_rect.Union(layer->update_rect()); 1208 inputs_.update_rect.Union(layer->update_rect());
1199 layer->SetUpdateRect(inputs_.update_rect); 1209 layer->SetUpdateRect(inputs_.update_rect);
1200 1210
1201 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); 1211 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
1212 layer->SetScrollBoundaryBehavior(inputs_.scroll_boundary_behavior);
1202 layer->SetNeedsPushProperties(); 1213 layer->SetNeedsPushProperties();
1203 1214
1204 // Reset any state that should be cleared for the next update. 1215 // Reset any state that should be cleared for the next update.
1205 needs_show_scrollbars_ = false; 1216 needs_show_scrollbars_ = false;
1206 subtree_property_changed_ = false; 1217 subtree_property_changed_ = false;
1207 inputs_.update_rect = gfx::Rect(); 1218 inputs_.update_rect = gfx::Rect();
1208 1219
1209 layer_tree_host_->RemoveLayerShouldPushProperties(this); 1220 layer_tree_host_->RemoveLayerShouldPushProperties(this);
1210 } 1221 }
1211 1222
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 ->subtree_has_copy_request; 1438 ->subtree_has_copy_request;
1428 } 1439 }
1429 1440
1430 gfx::Transform Layer::ScreenSpaceTransform() const { 1441 gfx::Transform Layer::ScreenSpaceTransform() const {
1431 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); 1442 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId);
1432 return draw_property_utils::ScreenSpaceTransform( 1443 return draw_property_utils::ScreenSpaceTransform(
1433 this, layer_tree_host_->property_trees()->transform_tree); 1444 this, layer_tree_host_->property_trees()->transform_tree);
1434 } 1445 }
1435 1446
1436 } // namespace cc 1447 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698