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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp

Issue 2698843004: Correct for enclosing layers scroll position in sticky_data->main_thread_offset (Closed)
Patch Set: Move offset correction to blink side Created 3 years, 10 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: 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..79496d33ed1efec53521600e7328026dc4aae326 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -1688,4 +1688,49 @@ 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='innerPadding'></div>"
+ " <div id='sticky' class='composited'></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();
+
+ constraint = sticky->mainGraphicsLayer()
+ ->contentLayer()
+ ->layer()
+ ->stickyPositionConstraint();
+ EXPECT_EQ(IntPoint(0, 10),
+ IntPoint(constraint.parentRelativeStickyBoxOffset));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698