| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 6322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6333 root->AddChild(container); | 6333 root->AddChild(container); |
| 6334 container->AddChild(scroller); | 6334 container->AddChild(scroller); |
| 6335 scroller->AddChild(sticky_pos); | 6335 scroller->AddChild(sticky_pos); |
| 6336 host()->SetRootLayer(root); | 6336 host()->SetRootLayer(root); |
| 6337 scroller->SetScrollClipLayerId(container->id()); | 6337 scroller->SetScrollClipLayerId(container->id()); |
| 6338 | 6338 |
| 6339 LayerStickyPositionConstraint sticky_position; | 6339 LayerStickyPositionConstraint sticky_position; |
| 6340 sticky_position.is_sticky = true; | 6340 sticky_position.is_sticky = true; |
| 6341 sticky_position.is_anchored_top = true; | 6341 sticky_position.is_anchored_top = true; |
| 6342 sticky_position.top_offset = 10.0f; | 6342 sticky_position.top_offset = 10.0f; |
| 6343 sticky_position.parent_relative_sticky_box_offset = gfx::Point(10, 20); | |
| 6344 sticky_position.scroll_container_relative_sticky_box_rect = | 6343 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6345 gfx::Rect(10, 20, 10, 10); | 6344 gfx::Rect(10, 20, 10, 10); |
| 6346 sticky_position.scroll_container_relative_containing_block_rect = | 6345 sticky_position.scroll_container_relative_containing_block_rect = |
| 6347 gfx::Rect(0, 0, 50, 50); | 6346 gfx::Rect(0, 0, 50, 50); |
| 6348 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6347 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6349 | 6348 |
| 6350 root->SetBounds(gfx::Size(100, 100)); | 6349 root->SetBounds(gfx::Size(100, 100)); |
| 6351 container->SetBounds(gfx::Size(100, 100)); | 6350 container->SetBounds(gfx::Size(100, 100)); |
| 6352 scroller->SetBounds(gfx::Size(1000, 1000)); | 6351 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 6353 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6352 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6409 host()->SetRootLayer(root); | 6408 host()->SetRootLayer(root); |
| 6410 scroller->SetScrollClipLayerId(container->id()); | 6409 scroller->SetScrollClipLayerId(container->id()); |
| 6411 | 6410 |
| 6412 // The sticky layer has already been scrolled on the main thread side, and has | 6411 // The sticky layer has already been scrolled on the main thread side, and has |
| 6413 // stuck. This test then checks that further changes from cc-only scrolling | 6412 // stuck. This test then checks that further changes from cc-only scrolling |
| 6414 // are handled correctly. | 6413 // are handled correctly. |
| 6415 LayerStickyPositionConstraint sticky_position; | 6414 LayerStickyPositionConstraint sticky_position; |
| 6416 sticky_position.is_sticky = true; | 6415 sticky_position.is_sticky = true; |
| 6417 sticky_position.is_anchored_top = true; | 6416 sticky_position.is_anchored_top = true; |
| 6418 sticky_position.top_offset = 10.0f; | 6417 sticky_position.top_offset = 10.0f; |
| 6419 sticky_position.parent_relative_sticky_box_offset = gfx::Point(10, 20); | |
| 6420 sticky_position.scroll_container_relative_sticky_box_rect = | 6418 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6421 gfx::Rect(10, 20, 10, 10); | 6419 gfx::Rect(10, 20, 10, 10); |
| 6422 sticky_position.scroll_container_relative_containing_block_rect = | 6420 sticky_position.scroll_container_relative_containing_block_rect = |
| 6423 gfx::Rect(0, 0, 50, 50); | 6421 gfx::Rect(0, 0, 50, 50); |
| 6424 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6422 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6425 | 6423 |
| 6426 root->SetBounds(gfx::Size(200, 200)); | 6424 root->SetBounds(gfx::Size(200, 200)); |
| 6427 container->SetBounds(gfx::Size(100, 100)); | 6425 container->SetBounds(gfx::Size(100, 100)); |
| 6428 container->SetPosition(gfx::PointF(50, 50)); | 6426 container->SetPosition(gfx::PointF(50, 50)); |
| 6429 scroller->SetBounds(gfx::Size(1000, 1000)); | 6427 scroller->SetBounds(gfx::Size(1000, 1000)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6482 root->AddChild(container); | 6480 root->AddChild(container); |
| 6483 container->AddChild(scroller); | 6481 container->AddChild(scroller); |
| 6484 scroller->AddChild(sticky_pos); | 6482 scroller->AddChild(sticky_pos); |
| 6485 host()->SetRootLayer(root); | 6483 host()->SetRootLayer(root); |
| 6486 scroller->SetScrollClipLayerId(container->id()); | 6484 scroller->SetScrollClipLayerId(container->id()); |
| 6487 | 6485 |
| 6488 LayerStickyPositionConstraint sticky_position; | 6486 LayerStickyPositionConstraint sticky_position; |
| 6489 sticky_position.is_sticky = true; | 6487 sticky_position.is_sticky = true; |
| 6490 sticky_position.is_anchored_bottom = true; | 6488 sticky_position.is_anchored_bottom = true; |
| 6491 sticky_position.bottom_offset = 10.0f; | 6489 sticky_position.bottom_offset = 10.0f; |
| 6492 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 200); | |
| 6493 sticky_position.scroll_container_relative_sticky_box_rect = | 6490 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6494 gfx::Rect(0, 200, 10, 10); | 6491 gfx::Rect(0, 200, 10, 10); |
| 6495 sticky_position.scroll_container_relative_containing_block_rect = | 6492 sticky_position.scroll_container_relative_containing_block_rect = |
| 6496 gfx::Rect(0, 0, 100, 500); | 6493 gfx::Rect(0, 0, 100, 500); |
| 6497 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6494 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6498 | 6495 |
| 6499 root->SetBounds(gfx::Size(100, 100)); | 6496 root->SetBounds(gfx::Size(100, 100)); |
| 6500 container->SetBounds(gfx::Size(100, 100)); | 6497 container->SetBounds(gfx::Size(100, 100)); |
| 6501 scroller->SetBounds(gfx::Size(100, 1000)); | 6498 scroller->SetBounds(gfx::Size(100, 1000)); |
| 6502 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6499 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 6528 root->AddChild(container); | 6525 root->AddChild(container); |
| 6529 container->AddChild(scroller); | 6526 container->AddChild(scroller); |
| 6530 scroller->AddChild(sticky_pos); | 6527 scroller->AddChild(sticky_pos); |
| 6531 host()->SetRootLayer(root); | 6528 host()->SetRootLayer(root); |
| 6532 scroller->SetScrollClipLayerId(container->id()); | 6529 scroller->SetScrollClipLayerId(container->id()); |
| 6533 | 6530 |
| 6534 LayerStickyPositionConstraint sticky_position; | 6531 LayerStickyPositionConstraint sticky_position; |
| 6535 sticky_position.is_sticky = true; | 6532 sticky_position.is_sticky = true; |
| 6536 sticky_position.is_anchored_bottom = true; | 6533 sticky_position.is_anchored_bottom = true; |
| 6537 sticky_position.bottom_offset = 10.0f; | 6534 sticky_position.bottom_offset = 10.0f; |
| 6538 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 150); | |
| 6539 sticky_position.scroll_container_relative_sticky_box_rect = | 6535 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6540 gfx::Rect(0, 150, 10, 10); | 6536 gfx::Rect(0, 150, 10, 10); |
| 6541 sticky_position.scroll_container_relative_containing_block_rect = | 6537 sticky_position.scroll_container_relative_containing_block_rect = |
| 6542 gfx::Rect(0, 100, 50, 50); | 6538 gfx::Rect(0, 100, 50, 50); |
| 6543 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6539 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6544 | 6540 |
| 6545 root->SetBounds(gfx::Size(100, 100)); | 6541 root->SetBounds(gfx::Size(100, 100)); |
| 6546 container->SetBounds(gfx::Size(100, 100)); | 6542 container->SetBounds(gfx::Size(100, 100)); |
| 6547 scroller->SetBounds(gfx::Size(1000, 1000)); | 6543 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 6548 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6544 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6601 LayerTreeHost::ViewportLayers viewport_layers; | 6597 LayerTreeHost::ViewportLayers viewport_layers; |
| 6602 viewport_layers.page_scale = root; | 6598 viewport_layers.page_scale = root; |
| 6603 viewport_layers.inner_viewport_container = root; | 6599 viewport_layers.inner_viewport_container = root; |
| 6604 viewport_layers.inner_viewport_scroll = scroller; | 6600 viewport_layers.inner_viewport_scroll = scroller; |
| 6605 host()->RegisterViewportLayers(viewport_layers); | 6601 host()->RegisterViewportLayers(viewport_layers); |
| 6606 | 6602 |
| 6607 LayerStickyPositionConstraint sticky_position; | 6603 LayerStickyPositionConstraint sticky_position; |
| 6608 sticky_position.is_sticky = true; | 6604 sticky_position.is_sticky = true; |
| 6609 sticky_position.is_anchored_bottom = true; | 6605 sticky_position.is_anchored_bottom = true; |
| 6610 sticky_position.bottom_offset = 10.0f; | 6606 sticky_position.bottom_offset = 10.0f; |
| 6611 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 70); | |
| 6612 sticky_position.scroll_container_relative_sticky_box_rect = | 6607 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6613 gfx::Rect(0, 70, 10, 10); | 6608 gfx::Rect(0, 70, 10, 10); |
| 6614 sticky_position.scroll_container_relative_containing_block_rect = | 6609 sticky_position.scroll_container_relative_containing_block_rect = |
| 6615 gfx::Rect(0, 60, 100, 100); | 6610 gfx::Rect(0, 60, 100, 100); |
| 6616 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6611 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6617 | 6612 |
| 6618 root->SetBounds(gfx::Size(100, 100)); | 6613 root->SetBounds(gfx::Size(100, 100)); |
| 6619 scroller->SetBounds(gfx::Size(100, 1000)); | 6614 scroller->SetBounds(gfx::Size(100, 1000)); |
| 6620 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6615 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| 6621 sticky_pos->SetPosition(gfx::PointF(0, 70)); | 6616 sticky_pos->SetPosition(gfx::PointF(0, 70)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6680 viewport_layers.inner_viewport_container = root; | 6675 viewport_layers.inner_viewport_container = root; |
| 6681 viewport_layers.outer_viewport_container = outer_clip; | 6676 viewport_layers.outer_viewport_container = outer_clip; |
| 6682 viewport_layers.inner_viewport_scroll = scroller; | 6677 viewport_layers.inner_viewport_scroll = scroller; |
| 6683 viewport_layers.outer_viewport_scroll = outer_viewport; | 6678 viewport_layers.outer_viewport_scroll = outer_viewport; |
| 6684 host()->RegisterViewportLayers(viewport_layers); | 6679 host()->RegisterViewportLayers(viewport_layers); |
| 6685 | 6680 |
| 6686 LayerStickyPositionConstraint sticky_position; | 6681 LayerStickyPositionConstraint sticky_position; |
| 6687 sticky_position.is_sticky = true; | 6682 sticky_position.is_sticky = true; |
| 6688 sticky_position.is_anchored_bottom = true; | 6683 sticky_position.is_anchored_bottom = true; |
| 6689 sticky_position.bottom_offset = 10.0f; | 6684 sticky_position.bottom_offset = 10.0f; |
| 6690 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 70); | |
| 6691 sticky_position.scroll_container_relative_sticky_box_rect = | 6685 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6692 gfx::Rect(0, 70, 10, 10); | 6686 gfx::Rect(0, 70, 10, 10); |
| 6693 sticky_position.scroll_container_relative_containing_block_rect = | 6687 sticky_position.scroll_container_relative_containing_block_rect = |
| 6694 gfx::Rect(0, 60, 100, 100); | 6688 gfx::Rect(0, 60, 100, 100); |
| 6695 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6689 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6696 | 6690 |
| 6697 root->SetBounds(gfx::Size(100, 100)); | 6691 root->SetBounds(gfx::Size(100, 100)); |
| 6698 scroller->SetBounds(gfx::Size(100, 1000)); | 6692 scroller->SetBounds(gfx::Size(100, 1000)); |
| 6699 outer_clip->SetBounds(gfx::Size(100, 100)); | 6693 outer_clip->SetBounds(gfx::Size(100, 100)); |
| 6700 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6694 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6757 scroller->AddChild(sticky_pos); | 6751 scroller->AddChild(sticky_pos); |
| 6758 host()->SetRootLayer(root); | 6752 host()->SetRootLayer(root); |
| 6759 scroller->SetScrollClipLayerId(container->id()); | 6753 scroller->SetScrollClipLayerId(container->id()); |
| 6760 | 6754 |
| 6761 LayerStickyPositionConstraint sticky_position; | 6755 LayerStickyPositionConstraint sticky_position; |
| 6762 sticky_position.is_sticky = true; | 6756 sticky_position.is_sticky = true; |
| 6763 sticky_position.is_anchored_left = true; | 6757 sticky_position.is_anchored_left = true; |
| 6764 sticky_position.is_anchored_right = true; | 6758 sticky_position.is_anchored_right = true; |
| 6765 sticky_position.left_offset = 10.f; | 6759 sticky_position.left_offset = 10.f; |
| 6766 sticky_position.right_offset = 10.f; | 6760 sticky_position.right_offset = 10.f; |
| 6767 sticky_position.parent_relative_sticky_box_offset = gfx::Point(145, 0); | |
| 6768 sticky_position.scroll_container_relative_sticky_box_rect = | 6761 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6769 gfx::Rect(145, 0, 10, 10); | 6762 gfx::Rect(145, 0, 10, 10); |
| 6770 sticky_position.scroll_container_relative_containing_block_rect = | 6763 sticky_position.scroll_container_relative_containing_block_rect = |
| 6771 gfx::Rect(100, 0, 100, 100); | 6764 gfx::Rect(100, 0, 100, 100); |
| 6772 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6765 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6773 | 6766 |
| 6774 root->SetBounds(gfx::Size(100, 100)); | 6767 root->SetBounds(gfx::Size(100, 100)); |
| 6775 container->SetBounds(gfx::Size(100, 100)); | 6768 container->SetBounds(gfx::Size(100, 100)); |
| 6776 scroller->SetBounds(gfx::Size(1000, 1000)); | 6769 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 6777 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6770 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6860 root->AddChild(container); | 6853 root->AddChild(container); |
| 6861 container->AddChild(scroller); | 6854 container->AddChild(scroller); |
| 6862 scroller->AddChild(sticky_pos); | 6855 scroller->AddChild(sticky_pos); |
| 6863 host()->SetRootLayer(root); | 6856 host()->SetRootLayer(root); |
| 6864 scroller->SetScrollClipLayerId(container->id()); | 6857 scroller->SetScrollClipLayerId(container->id()); |
| 6865 | 6858 |
| 6866 LayerStickyPositionConstraint sticky_position; | 6859 LayerStickyPositionConstraint sticky_position; |
| 6867 sticky_position.is_sticky = true; | 6860 sticky_position.is_sticky = true; |
| 6868 sticky_position.is_anchored_top = true; | 6861 sticky_position.is_anchored_top = true; |
| 6869 sticky_position.top_offset = 10.0f; | 6862 sticky_position.top_offset = 10.0f; |
| 6870 sticky_position.parent_relative_sticky_box_offset = gfx::Point(10, 20); | |
| 6871 sticky_position.scroll_container_relative_sticky_box_rect = | 6863 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6872 gfx::Rect(10, 20, 10, 10); | 6864 gfx::Rect(10, 20, 10, 10); |
| 6873 sticky_position.scroll_container_relative_containing_block_rect = | 6865 sticky_position.scroll_container_relative_containing_block_rect = |
| 6874 gfx::Rect(0, 0, 50, 50); | 6866 gfx::Rect(0, 0, 50, 50); |
| 6875 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6867 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6876 | 6868 |
| 6877 root->SetBounds(gfx::Size(100, 100)); | 6869 root->SetBounds(gfx::Size(100, 100)); |
| 6878 container->SetBounds(gfx::Size(100, 100)); | 6870 container->SetBounds(gfx::Size(100, 100)); |
| 6879 scroller->SetBounds(gfx::Size(1000, 1000)); | 6871 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 6880 sticky_pos->SetBounds(gfx::Size(10, 10)); | 6872 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 6906 // Scroll past the sticking point, the Y coordinate should now be clamped. | 6898 // Scroll past the sticking point, the Y coordinate should now be clamped. |
| 6907 SetScrollOffsetDelta(scroller_impl, gfx::Vector2dF(15.f, 15.f)); | 6899 SetScrollOffsetDelta(scroller_impl, gfx::Vector2dF(15.f, 15.f)); |
| 6908 ExecuteCalculateDrawProperties(root_impl); | 6900 ExecuteCalculateDrawProperties(root_impl); |
| 6909 EXPECT_VECTOR2DF_EQ( | 6901 EXPECT_VECTOR2DF_EQ( |
| 6910 gfx::Vector2dF(-5.f, 10.f), | 6902 gfx::Vector2dF(-5.f, 10.f), |
| 6911 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); | 6903 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); |
| 6912 | 6904 |
| 6913 // Now the main thread commits the new position of the sticky element. | 6905 // Now the main thread commits the new position of the sticky element. |
| 6914 scroller->SetScrollOffset(gfx::ScrollOffset(15, 15)); | 6906 scroller->SetScrollOffset(gfx::ScrollOffset(15, 15)); |
| 6915 sticky_pos->SetPosition(gfx::PointF(10, 25)); | 6907 sticky_pos->SetPosition(gfx::PointF(10, 25)); |
| 6908 sticky_pos->SetStickyMainThreadOffset(gfx::Size(0, 5)); |
| 6916 ExecuteCalculateDrawProperties(root.get()); | 6909 ExecuteCalculateDrawProperties(root.get()); |
| 6917 host()->host_impl()->CreatePendingTree(); | 6910 host()->host_impl()->CreatePendingTree(); |
| 6918 host()->CommitAndCreatePendingTree(); | 6911 host()->CommitAndCreatePendingTree(); |
| 6919 host()->host_impl()->ActivateSyncTree(); | 6912 host()->host_impl()->ActivateSyncTree(); |
| 6920 layer_tree_impl = host()->host_impl()->active_tree(); | 6913 layer_tree_impl = host()->host_impl()->active_tree(); |
| 6921 root_impl = layer_tree_impl->LayerById(root->id()); | 6914 root_impl = layer_tree_impl->LayerById(root->id()); |
| 6922 scroller_impl = layer_tree_impl->LayerById(scroller->id()); | 6915 scroller_impl = layer_tree_impl->LayerById(scroller->id()); |
| 6923 sticky_pos_impl = layer_tree_impl->LayerById(sticky_pos->id()); | 6916 sticky_pos_impl = layer_tree_impl->LayerById(sticky_pos->id()); |
| 6924 | 6917 |
| 6925 // The element should still be where it was before. We reset the delta to | 6918 // The element should still be where it was before. We reset the delta to |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6952 container->AddChild(scroller); | 6945 container->AddChild(scroller); |
| 6953 scroller->AddChild(sticky_container); | 6946 scroller->AddChild(sticky_container); |
| 6954 sticky_container->AddChild(sticky_pos); | 6947 sticky_container->AddChild(sticky_pos); |
| 6955 host()->SetRootLayer(root); | 6948 host()->SetRootLayer(root); |
| 6956 scroller->SetScrollClipLayerId(container->id()); | 6949 scroller->SetScrollClipLayerId(container->id()); |
| 6957 | 6950 |
| 6958 LayerStickyPositionConstraint sticky_position; | 6951 LayerStickyPositionConstraint sticky_position; |
| 6959 sticky_position.is_sticky = true; | 6952 sticky_position.is_sticky = true; |
| 6960 sticky_position.is_anchored_top = true; | 6953 sticky_position.is_anchored_top = true; |
| 6961 sticky_position.top_offset = 10.0f; | 6954 sticky_position.top_offset = 10.0f; |
| 6962 // The sticky position layer is only offset by (0, 10) from its parent | |
| 6963 // layer, this position is used to determine the offset applied by the main | |
| 6964 // thread. | |
| 6965 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 10); | |
| 6966 sticky_position.scroll_container_relative_sticky_box_rect = | 6955 sticky_position.scroll_container_relative_sticky_box_rect = |
| 6967 gfx::Rect(20, 30, 10, 10); | 6956 gfx::Rect(20, 30, 10, 10); |
| 6968 sticky_position.scroll_container_relative_containing_block_rect = | 6957 sticky_position.scroll_container_relative_containing_block_rect = |
| 6969 gfx::Rect(20, 20, 30, 30); | 6958 gfx::Rect(20, 20, 30, 30); |
| 6970 sticky_pos->SetStickyPositionConstraint(sticky_position); | 6959 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 6971 | 6960 |
| 6972 root->SetBounds(gfx::Size(100, 100)); | 6961 root->SetBounds(gfx::Size(100, 100)); |
| 6973 container->SetBounds(gfx::Size(100, 100)); | 6962 container->SetBounds(gfx::Size(100, 100)); |
| 6974 scroller->SetBounds(gfx::Size(1000, 1000)); | 6963 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 6975 sticky_container->SetPosition(gfx::PointF(20, 20)); | 6964 sticky_container->SetPosition(gfx::PointF(20, 20)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7003 // Scroll past the sticking point, the Y coordinate should now be clamped. | 6992 // Scroll past the sticking point, the Y coordinate should now be clamped. |
| 7004 SetScrollOffsetDelta(scroller_impl, gfx::Vector2dF(0.f, 25.f)); | 6993 SetScrollOffsetDelta(scroller_impl, gfx::Vector2dF(0.f, 25.f)); |
| 7005 ExecuteCalculateDrawProperties(root_impl); | 6994 ExecuteCalculateDrawProperties(root_impl); |
| 7006 EXPECT_VECTOR2DF_EQ( | 6995 EXPECT_VECTOR2DF_EQ( |
| 7007 gfx::Vector2dF(20.f, 10.f), | 6996 gfx::Vector2dF(20.f, 10.f), |
| 7008 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); | 6997 sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); |
| 7009 | 6998 |
| 7010 // Now the main thread commits the new position of the sticky element. | 6999 // Now the main thread commits the new position of the sticky element. |
| 7011 scroller->SetScrollOffset(gfx::ScrollOffset(0, 25)); | 7000 scroller->SetScrollOffset(gfx::ScrollOffset(0, 25)); |
| 7012 sticky_pos->SetPosition(gfx::PointF(0, 15)); | 7001 sticky_pos->SetPosition(gfx::PointF(0, 15)); |
| 7002 sticky_pos->SetStickyMainThreadOffset(gfx::Size(0, 5)); |
| 7013 ExecuteCalculateDrawProperties(root.get()); | 7003 ExecuteCalculateDrawProperties(root.get()); |
| 7014 host()->host_impl()->CreatePendingTree(); | 7004 host()->host_impl()->CreatePendingTree(); |
| 7015 host()->CommitAndCreatePendingTree(); | 7005 host()->CommitAndCreatePendingTree(); |
| 7016 host()->host_impl()->ActivateSyncTree(); | 7006 host()->host_impl()->ActivateSyncTree(); |
| 7017 layer_tree_impl = host()->host_impl()->active_tree(); | 7007 layer_tree_impl = host()->host_impl()->active_tree(); |
| 7018 root_impl = layer_tree_impl->LayerById(root->id()); | 7008 root_impl = layer_tree_impl->LayerById(root->id()); |
| 7019 scroller_impl = layer_tree_impl->LayerById(scroller->id()); | 7009 scroller_impl = layer_tree_impl->LayerById(scroller->id()); |
| 7020 sticky_pos_impl = layer_tree_impl->LayerById(sticky_pos->id()); | 7010 sticky_pos_impl = layer_tree_impl->LayerById(sticky_pos->id()); |
| 7021 | 7011 |
| 7022 // The element should still be where it was before. We reset the delta to | 7012 // The element should still be where it was before. We reset the delta to |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7055 host()->SetRootLayer(root); | 7045 host()->SetRootLayer(root); |
| 7056 scroller->SetScrollClipLayerId(container->id()); | 7046 scroller->SetScrollClipLayerId(container->id()); |
| 7057 gfx::Transform t; | 7047 gfx::Transform t; |
| 7058 t.Scale(2, 2); | 7048 t.Scale(2, 2); |
| 7059 sticky_pos->SetTransform(t); | 7049 sticky_pos->SetTransform(t); |
| 7060 | 7050 |
| 7061 LayerStickyPositionConstraint sticky_position; | 7051 LayerStickyPositionConstraint sticky_position; |
| 7062 sticky_position.is_sticky = true; | 7052 sticky_position.is_sticky = true; |
| 7063 sticky_position.is_anchored_top = true; | 7053 sticky_position.is_anchored_top = true; |
| 7064 sticky_position.top_offset = 0.0f; | 7054 sticky_position.top_offset = 0.0f; |
| 7065 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 20); | |
| 7066 sticky_position.scroll_container_relative_sticky_box_rect = | 7055 sticky_position.scroll_container_relative_sticky_box_rect = |
| 7067 gfx::Rect(0, 20, 10, 10); | 7056 gfx::Rect(0, 20, 10, 10); |
| 7068 sticky_position.scroll_container_relative_containing_block_rect = | 7057 sticky_position.scroll_container_relative_containing_block_rect = |
| 7069 gfx::Rect(0, 0, 50, 50); | 7058 gfx::Rect(0, 0, 50, 50); |
| 7070 sticky_pos->SetStickyPositionConstraint(sticky_position); | 7059 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 7071 | 7060 |
| 7072 root->SetBounds(gfx::Size(100, 100)); | 7061 root->SetBounds(gfx::Size(100, 100)); |
| 7073 container->SetBounds(gfx::Size(100, 100)); | 7062 container->SetBounds(gfx::Size(100, 100)); |
| 7074 scroller->SetBounds(gfx::Size(1000, 1000)); | 7063 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 7075 sticky_pos->SetBounds(gfx::Size(10, 10)); | 7064 sticky_pos->SetBounds(gfx::Size(10, 10)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7134 host()->SetRootLayer(root); | 7123 host()->SetRootLayer(root); |
| 7135 scroller->SetScrollClipLayerId(container->id()); | 7124 scroller->SetScrollClipLayerId(container->id()); |
| 7136 gfx::Transform t; | 7125 gfx::Transform t; |
| 7137 t.Scale(2, 2); | 7126 t.Scale(2, 2); |
| 7138 sticky_container->SetTransform(t); | 7127 sticky_container->SetTransform(t); |
| 7139 | 7128 |
| 7140 LayerStickyPositionConstraint sticky_position; | 7129 LayerStickyPositionConstraint sticky_position; |
| 7141 sticky_position.is_sticky = true; | 7130 sticky_position.is_sticky = true; |
| 7142 sticky_position.is_anchored_top = true; | 7131 sticky_position.is_anchored_top = true; |
| 7143 sticky_position.top_offset = 0.0f; | 7132 sticky_position.top_offset = 0.0f; |
| 7144 sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 20); | |
| 7145 sticky_position.scroll_container_relative_sticky_box_rect = | 7133 sticky_position.scroll_container_relative_sticky_box_rect = |
| 7146 gfx::Rect(0, 20, 10, 10); | 7134 gfx::Rect(0, 20, 10, 10); |
| 7147 sticky_position.scroll_container_relative_containing_block_rect = | 7135 sticky_position.scroll_container_relative_containing_block_rect = |
| 7148 gfx::Rect(0, 0, 50, 50); | 7136 gfx::Rect(0, 0, 50, 50); |
| 7149 sticky_pos->SetStickyPositionConstraint(sticky_position); | 7137 sticky_pos->SetStickyPositionConstraint(sticky_position); |
| 7150 | 7138 |
| 7151 root->SetBounds(gfx::Size(100, 100)); | 7139 root->SetBounds(gfx::Size(100, 100)); |
| 7152 container->SetBounds(gfx::Size(100, 100)); | 7140 container->SetBounds(gfx::Size(100, 100)); |
| 7153 scroller->SetBounds(gfx::Size(1000, 1000)); | 7141 scroller->SetBounds(gfx::Size(1000, 1000)); |
| 7154 sticky_container->SetBounds(gfx::Size(50, 50)); | 7142 sticky_container->SetBounds(gfx::Size(50, 50)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7218 scroller->SetBounds(gfx::Size(100, 1000)); | 7206 scroller->SetBounds(gfx::Size(100, 1000)); |
| 7219 outer_sticky->SetBounds(gfx::Size(10, 50)); | 7207 outer_sticky->SetBounds(gfx::Size(10, 50)); |
| 7220 outer_sticky->SetPosition(gfx::PointF(0, 50)); | 7208 outer_sticky->SetPosition(gfx::PointF(0, 50)); |
| 7221 inner_sticky->SetBounds(gfx::Size(10, 10)); | 7209 inner_sticky->SetBounds(gfx::Size(10, 10)); |
| 7222 inner_sticky->SetPosition(gfx::PointF(0, 0)); | 7210 inner_sticky->SetPosition(gfx::PointF(0, 0)); |
| 7223 | 7211 |
| 7224 LayerStickyPositionConstraint outer_sticky_pos; | 7212 LayerStickyPositionConstraint outer_sticky_pos; |
| 7225 outer_sticky_pos.is_sticky = true; | 7213 outer_sticky_pos.is_sticky = true; |
| 7226 outer_sticky_pos.is_anchored_top = true; | 7214 outer_sticky_pos.is_anchored_top = true; |
| 7227 outer_sticky_pos.top_offset = 10.0f; | 7215 outer_sticky_pos.top_offset = 10.0f; |
| 7228 outer_sticky_pos.parent_relative_sticky_box_offset = gfx::Point(0, 50); | |
| 7229 outer_sticky_pos.scroll_container_relative_sticky_box_rect = | 7216 outer_sticky_pos.scroll_container_relative_sticky_box_rect = |
| 7230 gfx::Rect(0, 50, 10, 50); | 7217 gfx::Rect(0, 50, 10, 50); |
| 7231 outer_sticky_pos.scroll_container_relative_containing_block_rect = | 7218 outer_sticky_pos.scroll_container_relative_containing_block_rect = |
| 7232 gfx::Rect(0, 0, 50, 400); | 7219 gfx::Rect(0, 0, 50, 400); |
| 7233 outer_sticky->SetStickyPositionConstraint(outer_sticky_pos); | 7220 outer_sticky->SetStickyPositionConstraint(outer_sticky_pos); |
| 7234 | 7221 |
| 7235 LayerStickyPositionConstraint inner_sticky_pos; | 7222 LayerStickyPositionConstraint inner_sticky_pos; |
| 7236 inner_sticky_pos.is_sticky = true; | 7223 inner_sticky_pos.is_sticky = true; |
| 7237 inner_sticky_pos.is_anchored_top = true; | 7224 inner_sticky_pos.is_anchored_top = true; |
| 7238 inner_sticky_pos.top_offset = 25.0f; | 7225 inner_sticky_pos.top_offset = 25.0f; |
| 7239 inner_sticky_pos.parent_relative_sticky_box_offset = gfx::Point(0, 0); | |
| 7240 inner_sticky_pos.scroll_container_relative_sticky_box_rect = | 7226 inner_sticky_pos.scroll_container_relative_sticky_box_rect = |
| 7241 gfx::Rect(0, 50, 10, 10); | 7227 gfx::Rect(0, 50, 10, 10); |
| 7242 inner_sticky_pos.scroll_container_relative_containing_block_rect = | 7228 inner_sticky_pos.scroll_container_relative_containing_block_rect = |
| 7243 gfx::Rect(0, 50, 10, 50); | 7229 gfx::Rect(0, 50, 10, 50); |
| 7244 inner_sticky_pos.nearest_layer_shifting_containing_block = outer_sticky->id(); | 7230 inner_sticky_pos.nearest_layer_shifting_containing_block = outer_sticky->id(); |
| 7245 inner_sticky->SetStickyPositionConstraint(inner_sticky_pos); | 7231 inner_sticky->SetStickyPositionConstraint(inner_sticky_pos); |
| 7246 | 7232 |
| 7247 ExecuteCalculateDrawProperties(root.get()); | 7233 ExecuteCalculateDrawProperties(root.get()); |
| 7248 host()->host_impl()->CreatePendingTree(); | 7234 host()->host_impl()->CreatePendingTree(); |
| 7249 host()->CommitAndCreatePendingTree(); | 7235 host()->CommitAndCreatePendingTree(); |
| (...skipping 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10218 | 10204 |
| 10219 // Check child layer draw properties. | 10205 // Check child layer draw properties. |
| 10220 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 10206 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
| 10221 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); | 10207 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); |
| 10222 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); | 10208 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); |
| 10223 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); | 10209 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); |
| 10224 } | 10210 } |
| 10225 | 10211 |
| 10226 } // namespace | 10212 } // namespace |
| 10227 } // namespace cc | 10213 } // namespace cc |
| OLD | NEW |