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

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

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format Created 3 years, 6 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
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 node->bounds = inputs_.bounds; 303 node->bounds = inputs_.bounds;
304 } 304 }
305 } 305 }
306 306
307 if (is_scroll_clip_layer_) 307 if (is_scroll_clip_layer_)
308 layer_tree_host_->property_trees()->scroll_tree.set_needs_update(true); 308 layer_tree_host_->property_trees()->scroll_tree.set_needs_update(true);
309 309
310 SetNeedsCommit(); 310 SetNeedsCommit();
311 } 311 }
312 312
313 void Layer::SetScrollSnapOffsets(const SnapPointList& offsets) {
314 DCHECK(IsPropertyChangeAllowed());
315 if (inputs_.snap_offsets == offsets)
316 return;
317 inputs_.snap_offsets = offsets;
318 SetPropertyTreesNeedRebuild();
319 SetNeedsCommit();
320 }
321
313 Layer* Layer::RootLayer() { 322 Layer* Layer::RootLayer() {
314 Layer* layer = this; 323 Layer* layer = this;
315 while (layer->parent()) 324 while (layer->parent())
316 layer = layer->parent(); 325 layer = layer->parent();
317 return layer; 326 return layer;
318 } 327 }
319 328
320 void Layer::RemoveAllChildren() { 329 void Layer::RemoveAllChildren() {
321 DCHECK(IsPropertyChangeAllowed()); 330 DCHECK(IsPropertyChangeAllowed());
322 while (inputs_.children.size()) { 331 while (inputs_.children.size()) {
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 layer->set_needs_show_scrollbars(true); 1199 layer->set_needs_show_scrollbars(true);
1191 1200
1192 // If the main thread commits multiple times before the impl thread actually 1201 // If the main thread commits multiple times before the impl thread actually
1193 // draws, then damage tracking will become incorrect if we simply clobber the 1202 // draws, then damage tracking will become incorrect if we simply clobber the
1194 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 1203 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
1195 // union) any update changes that have occurred on the main thread. 1204 // union) any update changes that have occurred on the main thread.
1196 inputs_.update_rect.Union(layer->update_rect()); 1205 inputs_.update_rect.Union(layer->update_rect());
1197 layer->SetUpdateRect(inputs_.update_rect); 1206 layer->SetUpdateRect(inputs_.update_rect);
1198 1207
1199 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); 1208 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
1209 layer->SetScrollSnapOffsets(inputs_.snap_offsets);
1210 /*for (SnapPoint point : inputs_.snap_offsets.horizontal) {
1211 LOG(ERROR) << point.offset << " " << point.must_snap << " "
1212 << point.is_start << " " << point.is_end;
1213 }*/
1200 layer->SetNeedsPushProperties(); 1214 layer->SetNeedsPushProperties();
1201 1215
1202 // Reset any state that should be cleared for the next update. 1216 // Reset any state that should be cleared for the next update.
1203 needs_show_scrollbars_ = false; 1217 needs_show_scrollbars_ = false;
1204 subtree_property_changed_ = false; 1218 subtree_property_changed_ = false;
1205 inputs_.update_rect = gfx::Rect(); 1219 inputs_.update_rect = gfx::Rect();
1206 1220
1207 layer_tree_host_->RemoveLayerShouldPushProperties(this); 1221 layer_tree_host_->RemoveLayerShouldPushProperties(this);
1208 } 1222 }
1209 1223
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 ->subtree_has_copy_request; 1439 ->subtree_has_copy_request;
1426 } 1440 }
1427 1441
1428 gfx::Transform Layer::ScreenSpaceTransform() const { 1442 gfx::Transform Layer::ScreenSpaceTransform() const {
1429 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); 1443 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId);
1430 return draw_property_utils::ScreenSpaceTransform( 1444 return draw_property_utils::ScreenSpaceTransform(
1431 this, layer_tree_host_->property_trees()->transform_tree); 1445 this, layer_tree_host_->property_trees()->transform_tree);
1432 } 1446 }
1433 1447
1434 } // namespace cc 1448 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698