OLD | NEW |
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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // The scroll position does not include snapping which shifts the scroll | 371 // The scroll position does not include snapping which shifts the scroll |
372 // offset to align to a pixel boundary, we need to manually include it here. | 372 // offset to align to a pixel boundary, we need to manually include it here. |
373 // In this case, snapping is caused by a scroll. | 373 // In this case, snapping is caused by a scroll. |
374 scroll_position -= transform_node->snap_amount; | 374 scroll_position -= transform_node->snap_amount; |
375 } | 375 } |
376 | 376 |
377 gfx::RectF clip( | 377 gfx::RectF clip( |
378 scroll_position, | 378 scroll_position, |
379 gfx::SizeF(property_trees.scroll_tree.scroll_clip_layer_bounds( | 379 gfx::SizeF(property_trees.scroll_tree.scroll_clip_layer_bounds( |
380 scroll_node->id))); | 380 scroll_node->id))); |
381 gfx::Vector2dF layer_offset(sticky_data->main_thread_offset); | |
382 | 381 |
383 gfx::Vector2dF ancestor_sticky_box_offset; | 382 gfx::Vector2dF ancestor_sticky_box_offset; |
384 if (sticky_data->nearest_node_shifting_sticky_box != | 383 if (sticky_data->nearest_node_shifting_sticky_box != |
385 TransformTree::kInvalidNodeId) { | 384 TransformTree::kInvalidNodeId) { |
386 ancestor_sticky_box_offset = | 385 ancestor_sticky_box_offset = |
387 tree->StickyPositionData(sticky_data->nearest_node_shifting_sticky_box) | 386 tree->StickyPositionData(sticky_data->nearest_node_shifting_sticky_box) |
388 ->total_sticky_box_sticky_offset; | 387 ->total_sticky_box_sticky_offset; |
389 } | 388 } |
390 | 389 |
391 gfx::Vector2dF ancestor_containing_block_offset; | 390 gfx::Vector2dF ancestor_containing_block_offset; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 sticky_offset.set_y(sticky_offset.y() + top_delta); | 455 sticky_offset.set_y(sticky_offset.y() + top_delta); |
457 } | 456 } |
458 | 457 |
459 sticky_data->total_sticky_box_sticky_offset = | 458 sticky_data->total_sticky_box_sticky_offset = |
460 ancestor_sticky_box_offset + sticky_offset - | 459 ancestor_sticky_box_offset + sticky_offset - |
461 sticky_box_rect.OffsetFromOrigin(); | 460 sticky_box_rect.OffsetFromOrigin(); |
462 sticky_data->total_containing_block_sticky_offset = | 461 sticky_data->total_containing_block_sticky_offset = |
463 ancestor_sticky_box_offset + ancestor_containing_block_offset + | 462 ancestor_sticky_box_offset + ancestor_containing_block_offset + |
464 sticky_offset - sticky_box_rect.OffsetFromOrigin(); | 463 sticky_offset - sticky_box_rect.OffsetFromOrigin(); |
465 | 464 |
466 return sticky_offset - layer_offset - node->source_to_parent - | 465 return sticky_offset - node->sticky_main_thread_offset - |
467 sticky_box_rect.OffsetFromOrigin(); | 466 sticky_box_rect.OffsetFromOrigin(); |
468 } | 467 } |
469 | 468 |
470 void TransformTree::UpdateLocalTransform(TransformNode* node) { | 469 void TransformTree::UpdateLocalTransform(TransformNode* node) { |
471 gfx::Transform transform = node->post_local; | 470 gfx::Transform transform = node->post_local; |
472 if (NeedsSourceToParentUpdate(node)) { | 471 if (NeedsSourceToParentUpdate(node)) { |
473 gfx::Transform to_parent; | 472 gfx::Transform to_parent; |
474 ComputeTranslation(node->source_node_id, node->parent_id, &to_parent); | 473 ComputeTranslation(node->source_node_id, node->parent_id, &to_parent); |
475 gfx::Vector2dF unsnapping; | 474 gfx::Vector2dF unsnapping; |
476 TransformNode* current; | 475 TransformNode* current; |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 const EffectNode* effect_node = effect_tree.Node(effect_id); | 2189 const EffectNode* effect_node = effect_tree.Node(effect_id); |
2191 | 2190 |
2192 if (effect_node->surface_contents_scale.x() != 0.0 && | 2191 if (effect_node->surface_contents_scale.x() != 0.0 && |
2193 effect_node->surface_contents_scale.y() != 0.0) | 2192 effect_node->surface_contents_scale.y() != 0.0) |
2194 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), | 2193 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), |
2195 1.0 / effect_node->surface_contents_scale.y()); | 2194 1.0 / effect_node->surface_contents_scale.y()); |
2196 return screen_space_transform; | 2195 return screen_space_transform; |
2197 } | 2196 } |
2198 | 2197 |
2199 } // namespace cc | 2198 } // namespace cc |
OLD | NEW |