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

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: Address reviewer comments 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 de3edbabfc1ac9d5e68978123a3a4034b433cf8f..2153a44709a1ecaa6df08e89e82e865019340f40 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -1688,4 +1688,52 @@ TEST_P(CompositedLayerMappingTest, StickyPositionTableCellContentOffset) {
IntPoint(constraint.parentRelativeStickyBoxOffset));
}
+TEST_P(CompositedLayerMappingTest, StickyPositionEnclosingLayersContentOffset) {
+ 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>");
+
+ PaintLayer* stickyLayer =
+ toLayoutBox(getLayoutObjectByElementId("sticky"))->layer();
+ CompositedLayerMapping* stickyMapping = stickyLayer->compositedLayerMapping();
+ ASSERT_TRUE(stickyMapping);
+
+ WebLayerStickyPositionConstraint constraint =
+ stickyMapping->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());
+
+ stickyLayer->setNeedsCompositingInputsUpdate();
+ EXPECT_TRUE(stickyLayer->needsCompositingInputsUpdate());
+ document().view()->updateLifecycleToCompositingCleanPlusScrolling();
+ EXPECT_FALSE(stickyLayer->needsCompositingInputsUpdate());
+
+ constraint = stickyMapping->mainGraphicsLayer()
+ ->contentLayer()
+ ->layer()
+ ->stickyPositionConstraint();
+ EXPECT_EQ(IntPoint(0, 10),
+ IntPoint(constraint.parentRelativeStickyBoxOffset));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698