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

Side by Side Diff: cc/trees/property_tree.cc

Issue 2874793004: Remove one use of ScrollNode's owning_layer_id for StickyPositionOffset (Closed)
Patch Set: DCHECK that the scroll offset values are unchanged 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 bool all_are_invertible = dest_to_source.GetInverse(&source_to_dest); 345 bool all_are_invertible = dest_to_source.GetInverse(&source_to_dest);
346 transform->PreconcatTransform(source_to_dest); 346 transform->PreconcatTransform(source_to_dest);
347 return all_are_invertible; 347 return all_are_invertible;
348 } 348 }
349 349
350 gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) { 350 gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) {
351 if (node->sticky_position_constraint_id == -1) 351 if (node->sticky_position_constraint_id == -1)
352 return gfx::Vector2dF(); 352 return gfx::Vector2dF();
353 StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id); 353 StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id);
354 const LayerStickyPositionConstraint& constraint = sticky_data->constraints; 354 const LayerStickyPositionConstraint& constraint = sticky_data->constraints;
355 auto& property_trees = *tree->property_trees();
355 ScrollNode* scroll_node = 356 ScrollNode* scroll_node =
356 tree->property_trees()->scroll_tree.Node(sticky_data->scroll_ancestor); 357 property_trees.scroll_tree.Node(sticky_data->scroll_ancestor);
357 gfx::ScrollOffset scroll_offset = 358 TransformNode* transform_node =
358 tree->property_trees()->scroll_tree.current_scroll_offset( 359 property_trees.transform_tree.Node(scroll_node->transform_id);
359 scroll_node->owning_layer_id); 360 const auto& scroll_offset = transform_node->scroll_offset;
361 DCHECK(property_trees.scroll_tree.current_scroll_offset(
chrishtr 2017/05/12 22:11:20 Add a note that this can be removed later, and is
enne (OOO) 2017/05/12 22:15:28 Can you DCHECK_EQ this?
362 scroll_node->owning_layer_id) == scroll_offset);
360 gfx::PointF scroll_position(scroll_offset.x(), scroll_offset.y()); 363 gfx::PointF scroll_position(scroll_offset.x(), scroll_offset.y());
361 TransformNode* scroll_ancestor_transform_node = 364 if (transform_node->scrolls) {
362 tree->Node(scroll_node->transform_id);
363 if (scroll_ancestor_transform_node->scrolls) {
364 // The scroll position does not include snapping which shifts the scroll 365 // The scroll position does not include snapping which shifts the scroll
365 // offset to align to a pixel boundary, we need to manually include it here. 366 // offset to align to a pixel boundary, we need to manually include it here.
366 // In this case, snapping is caused by a scroll. 367 // In this case, snapping is caused by a scroll.
367 scroll_position -= scroll_ancestor_transform_node->snap_amount; 368 scroll_position -= transform_node->snap_amount;
368 } 369 }
369 370
370 gfx::RectF clip( 371 gfx::RectF clip(
371 scroll_position, 372 scroll_position,
372 gfx::SizeF(tree->property_trees()->scroll_tree.scroll_clip_layer_bounds( 373 gfx::SizeF(property_trees.scroll_tree.scroll_clip_layer_bounds(
373 scroll_node->id))); 374 scroll_node->id)));
374 gfx::Vector2dF layer_offset(sticky_data->main_thread_offset); 375 gfx::Vector2dF layer_offset(sticky_data->main_thread_offset);
375 376
376 gfx::Vector2dF ancestor_sticky_box_offset; 377 gfx::Vector2dF ancestor_sticky_box_offset;
377 if (sticky_data->nearest_node_shifting_sticky_box != 378 if (sticky_data->nearest_node_shifting_sticky_box !=
378 TransformTree::kInvalidNodeId) { 379 TransformTree::kInvalidNodeId) {
379 ancestor_sticky_box_offset = 380 ancestor_sticky_box_offset =
380 tree->StickyPositionData(sticky_data->nearest_node_shifting_sticky_box) 381 tree->StickyPositionData(sticky_data->nearest_node_shifting_sticky_box)
381 ->total_sticky_box_sticky_offset; 382 ->total_sticky_box_sticky_offset;
382 } 383 }
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 const EffectNode* effect_node = effect_tree.Node(effect_id); 2121 const EffectNode* effect_node = effect_tree.Node(effect_id);
2121 2122
2122 if (effect_node->surface_contents_scale.x() != 0.0 && 2123 if (effect_node->surface_contents_scale.x() != 0.0 &&
2123 effect_node->surface_contents_scale.y() != 0.0) 2124 effect_node->surface_contents_scale.y() != 0.0)
2124 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), 2125 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(),
2125 1.0 / effect_node->surface_contents_scale.y()); 2126 1.0 / effect_node->surface_contents_scale.y());
2126 return screen_space_transform; 2127 return screen_space_transform;
2127 } 2128 }
2128 2129
2129 } // namespace cc 2130 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698