| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // from the destination to the source, with flattening, and then invert the | 346 // from the destination to the source, with flattening, and then invert the |
| 347 // result. | 347 // result. |
| 348 gfx::Transform dest_to_source; | 348 gfx::Transform dest_to_source; |
| 349 CombineTransformsBetween(dest_id, source_id, &dest_to_source); | 349 CombineTransformsBetween(dest_id, source_id, &dest_to_source); |
| 350 gfx::Transform source_to_dest; | 350 gfx::Transform source_to_dest; |
| 351 bool all_are_invertible = dest_to_source.GetInverse(&source_to_dest); | 351 bool all_are_invertible = dest_to_source.GetInverse(&source_to_dest); |
| 352 transform->PreconcatTransform(source_to_dest); | 352 transform->PreconcatTransform(source_to_dest); |
| 353 return all_are_invertible; | 353 return all_are_invertible; |
| 354 } | 354 } |
| 355 | 355 |
| 356 // This function should match the offset we set for sticky position layer in |
| 357 // CompositedLayerMapping::UpdateMainGraphicsLayerGeometry. |
| 356 gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) { | 358 gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) { |
| 357 if (node->sticky_position_constraint_id == -1) | 359 if (node->sticky_position_constraint_id == -1) |
| 358 return gfx::Vector2dF(); | 360 return gfx::Vector2dF(); |
| 359 StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id); | 361 StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id); |
| 360 const LayerStickyPositionConstraint& constraint = sticky_data->constraints; | 362 const LayerStickyPositionConstraint& constraint = sticky_data->constraints; |
| 361 auto& property_trees = *tree->property_trees(); | 363 auto& property_trees = *tree->property_trees(); |
| 362 ScrollNode* scroll_node = | 364 ScrollNode* scroll_node = |
| 363 property_trees.scroll_tree.Node(sticky_data->scroll_ancestor); | 365 property_trees.scroll_tree.Node(sticky_data->scroll_ancestor); |
| 364 TransformNode* transform_node = | 366 TransformNode* transform_node = |
| 365 property_trees.transform_tree.Node(scroll_node->transform_id); | 367 property_trees.transform_tree.Node(scroll_node->transform_id); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 top_delta = available_space; | 456 top_delta = available_space; |
| 455 sticky_offset.set_y(sticky_offset.y() + top_delta); | 457 sticky_offset.set_y(sticky_offset.y() + top_delta); |
| 456 } | 458 } |
| 457 | 459 |
| 458 sticky_data->total_sticky_box_sticky_offset = | 460 sticky_data->total_sticky_box_sticky_offset = |
| 459 ancestor_sticky_box_offset + sticky_offset; | 461 ancestor_sticky_box_offset + sticky_offset; |
| 460 sticky_data->total_containing_block_sticky_offset = | 462 sticky_data->total_containing_block_sticky_offset = |
| 461 ancestor_sticky_box_offset + ancestor_containing_block_offset + | 463 ancestor_sticky_box_offset + ancestor_containing_block_offset + |
| 462 sticky_offset; | 464 sticky_offset; |
| 463 | 465 |
| 464 return sticky_offset - node->offset_for_sticky_position_from_main_thread; | 466 return sticky_offset; |
| 465 } | 467 } |
| 466 | 468 |
| 467 void TransformTree::UpdateLocalTransform(TransformNode* node) { | 469 void TransformTree::UpdateLocalTransform(TransformNode* node) { |
| 468 gfx::Transform transform = node->post_local; | 470 gfx::Transform transform = node->post_local; |
| 469 if (NeedsSourceToParentUpdate(node)) { | 471 if (NeedsSourceToParentUpdate(node)) { |
| 470 gfx::Transform to_parent; | 472 gfx::Transform to_parent; |
| 471 ComputeTranslation(node->source_node_id, node->parent_id, &to_parent); | 473 ComputeTranslation(node->source_node_id, node->parent_id, &to_parent); |
| 472 gfx::Vector2dF unsnapping; | 474 gfx::Vector2dF unsnapping; |
| 473 TransformNode* current; | 475 TransformNode* current; |
| 474 TransformNode* parent_node; | 476 TransformNode* parent_node; |
| (...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2183 const EffectNode* effect_node = effect_tree.Node(effect_id); | 2185 const EffectNode* effect_node = effect_tree.Node(effect_id); |
| 2184 | 2186 |
| 2185 if (effect_node->surface_contents_scale.x() != 0.0 && | 2187 if (effect_node->surface_contents_scale.x() != 0.0 && |
| 2186 effect_node->surface_contents_scale.y() != 0.0) | 2188 effect_node->surface_contents_scale.y() != 0.0) |
| 2187 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), | 2189 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), |
| 2188 1.0 / effect_node->surface_contents_scale.y()); | 2190 1.0 / effect_node->surface_contents_scale.y()); |
| 2189 return screen_space_transform; | 2191 return screen_space_transform; |
| 2190 } | 2192 } |
| 2191 | 2193 |
| 2192 } // namespace cc | 2194 } // namespace cc |
| OLD | NEW |