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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Remove parent_relative_sticky_box_offset related logic 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index a26ee7f4559f8ea6d2c656289610dafc390d88fb..7a3192b2e892a493b2a42d988ce4de489b9e6509 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -6331,7 +6331,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionTop) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_top = true;
sticky_position.top_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(10, 20);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(10, 20, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6407,7 +6406,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionTopScrollParent) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_top = true;
sticky_position.top_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(10, 20);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(10, 20, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6480,7 +6478,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionSubpixelScroll) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_bottom = true;
sticky_position.bottom_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 200);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 200, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6526,7 +6523,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottom) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_bottom = true;
sticky_position.bottom_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 150);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 150, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6599,7 +6595,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomInnerViewportDelta) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_bottom = true;
sticky_position.bottom_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 70);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 70, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6678,7 +6673,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionBottomOuterViewportDelta) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_bottom = true;
sticky_position.bottom_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 70);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 70, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6755,7 +6749,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionLeftRight) {
sticky_position.is_anchored_right = true;
sticky_position.left_offset = 10.f;
sticky_position.right_offset = 10.f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(145, 0);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(145, 0, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6858,7 +6851,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionMainThreadUpdates) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_top = true;
sticky_position.top_offset = 10.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(10, 20);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(10, 20, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -6904,6 +6896,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionMainThreadUpdates) {
// Now the main thread commits the new position of the sticky element.
scroller->SetScrollOffset(gfx::ScrollOffset(15, 15));
sticky_pos->SetPosition(gfx::PointF(10, 25));
+ sticky_pos->SetStickyMainThreadOffset(gfx::Size(0, 5));
ExecuteCalculateDrawProperties(root.get());
host()->host_impl()->CreatePendingTree();
host()->CommitAndCreatePendingTree();
@@ -6950,10 +6943,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionCompositedContainer) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_top = true;
sticky_position.top_offset = 10.0f;
- // The sticky position layer is only offset by (0, 10) from its parent
- // layer, this position is used to determine the offset applied by the main
- // thread.
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 10);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(20, 30, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -7001,6 +6990,7 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionCompositedContainer) {
// Now the main thread commits the new position of the sticky element.
scroller->SetScrollOffset(gfx::ScrollOffset(0, 25));
sticky_pos->SetPosition(gfx::PointF(0, 15));
+ sticky_pos->SetStickyMainThreadOffset(gfx::Size(0, 5));
ExecuteCalculateDrawProperties(root.get());
host()->host_impl()->CreatePendingTree();
host()->CommitAndCreatePendingTree();
@@ -7053,7 +7043,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionScaledStickyBox) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_top = true;
sticky_position.top_offset = 0.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 20);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 20, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -7132,7 +7121,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionScaledContainer) {
sticky_position.is_sticky = true;
sticky_position.is_anchored_top = true;
sticky_position.top_offset = 0.0f;
- sticky_position.parent_relative_sticky_box_offset = gfx::Point(0, 20);
sticky_position.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 20, 10, 10);
sticky_position.scroll_container_relative_containing_block_rect =
@@ -7216,7 +7204,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionNested) {
outer_sticky_pos.is_sticky = true;
outer_sticky_pos.is_anchored_top = true;
outer_sticky_pos.top_offset = 10.0f;
- outer_sticky_pos.parent_relative_sticky_box_offset = gfx::Point(0, 50);
outer_sticky_pos.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 50, 10, 50);
outer_sticky_pos.scroll_container_relative_containing_block_rect =
@@ -7227,7 +7214,6 @@ TEST_F(LayerTreeHostCommonTest, StickyPositionNested) {
inner_sticky_pos.is_sticky = true;
inner_sticky_pos.is_anchored_top = true;
inner_sticky_pos.top_offset = 25.0f;
- inner_sticky_pos.parent_relative_sticky_box_offset = gfx::Point(0, 0);
inner_sticky_pos.scroll_container_relative_sticky_box_rect =
gfx::Rect(0, 50, 10, 10);
inner_sticky_pos.scroll_container_relative_containing_block_rect =

Powered by Google App Engine
This is Rietveld 408576698