Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp |
| index 7e308c2023c1fc0a1f67b776d35697e59b1d0ae9..21b74db556fa5834082cdf880610bcb04d99653f 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp |
| @@ -1688,4 +1688,51 @@ TEST_P(CompositedLayerMappingTest, StickyPositionTableCellContentOffset) { |
| IntPoint(constraint.parentRelativeStickyBoxOffset)); |
| } |
| +TEST_P(CompositedLayerMappingTest, |
| + StickyPositionIntermediateContainerContentOffset) { |
| + setBodyInnerHTML( |
| + "<style>.composited { will-change: transform; }" |
| + "#scroller { overflow: auto; height: 200px; width: 200px; }" |
| + ".container { height: 500px; }" |
| + ".innerPadding { height: 10px; }" |
| + "#sticky { position: sticky; top: 25px; height: 50px; }</style>" |
| + "<div id='scroller' class='composited'>" |
| + "<div class='composited container'>" |
| + " <div class='composited container'>" |
| + " <div class='innerPadding'></div>" |
| + " <div id='sticky' class='composited'></div>" |
| + " </div></div></div>"); |
| + |
| + CompositedLayerMapping* sticky = |
| + toLayoutBlock(getLayoutObjectByElementId("sticky")) |
| + ->layer() |
| + ->compositedLayerMapping(); |
| + ASSERT_TRUE(sticky); |
| + |
| + WebLayerStickyPositionConstraint constraint = |
| + sticky->mainGraphicsLayer() |
| + ->contentLayer() |
| + ->layer() |
| + ->stickyPositionConstraint(); |
| + EXPECT_EQ(IntPoint(0, 10), |
| + IntPoint(constraint.parentRelativeStickyBoxOffset)); |
| + |
| + // Now scroll the page - this should not affect the parent-relative offset. |
| + LayoutBoxModelObject* scroller = |
| + toLayoutBoxModelObject(getLayoutObjectByElementId("scroller")); |
| + PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea(); |
| + scrollableArea->scrollToAbsolutePosition( |
| + FloatPoint(scrollableArea->scrollPosition().x(), 100)); |
| + ASSERT_EQ(100.0, scrollableArea->scrollPosition().y()); |
| + |
| + document().view()->updateLifecycleToCompositingCleanPlusScrolling(); |
|
flackr
2017/02/22 16:14:49
Does this actually call updateStickyConstraints? W
smcgruer
2017/02/22 18:39:04
It appears to be:
[133571:133571:0222/133838.6476
|
| + |
| + constraint = sticky->mainGraphicsLayer() |
| + ->contentLayer() |
| + ->layer() |
| + ->stickyPositionConstraint(); |
| + EXPECT_EQ(IntPoint(0, 10), |
| + IntPoint(constraint.parentRelativeStickyBoxOffset)); |
| +} |
| + |
| } // namespace blink |