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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerTest.cpp

Issue 2776563003: Only automatically promote sticky position elements which move with scroll. (Closed)
Patch Set: Merge with master Created 3 years, 9 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/paint/PaintLayer.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/paint/PaintLayerTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
index 64129a230e24c0e9e393ad14247c7eaca9c6d359..4874d14be972f9db29646e76ea176a664ed5c6b0 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
@@ -127,14 +127,14 @@ TEST_P(PaintLayerTest, ScrollsWithViewportRelativePosition) {
setBodyInnerHTML("<div id='target' style='position: relative'></div>");
PaintLayer* layer = getPaintLayerByElementId("target");
- EXPECT_FALSE(layer->sticksToViewport());
+ EXPECT_FALSE(layer->fixedToViewport());
}
TEST_P(PaintLayerTest, ScrollsWithViewportFixedPosition) {
setBodyInnerHTML("<div id='target' style='position: fixed'></div>");
PaintLayer* layer = getPaintLayerByElementId("target");
- EXPECT_TRUE(layer->sticksToViewport());
+ EXPECT_TRUE(layer->fixedToViewport());
}
TEST_P(PaintLayerTest, ScrollsWithViewportFixedPositionInsideTransform) {
@@ -149,7 +149,7 @@ TEST_P(PaintLayerTest, ScrollsWithViewportFixedPositionInsideTransform) {
"</div>"
"<div style='width: 10px; height: 1000px'></div>");
PaintLayer* layer = getPaintLayerByElementId("target");
- EXPECT_FALSE(layer->sticksToViewport());
+ EXPECT_FALSE(layer->fixedToViewport());
}
TEST_P(PaintLayerTest,
@@ -163,41 +163,53 @@ TEST_P(PaintLayerTest,
// In SPv2 mode, we correctly determine that the frame doesn't scroll at all,
// and so return true.
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
- EXPECT_TRUE(layer->sticksToViewport());
+ EXPECT_TRUE(layer->fixedToViewport());
else
- EXPECT_FALSE(layer->sticksToViewport());
+ EXPECT_FALSE(layer->fixedToViewport());
}
-TEST_P(PaintLayerTest, ScrollsWithViewportStickyPosition) {
+TEST_P(PaintLayerTest, SticksToScrollerStickyPosition) {
setBodyInnerHTML(
"<div style='transform: translateZ(0)'>"
- " <div id='target' style='position: sticky'></div>"
+ " <div id='target' style='position: sticky; top: 0;'></div>"
"</div>"
"<div style='width: 10px; height: 1000px'></div>");
PaintLayer* layer = getPaintLayerByElementId("target");
- EXPECT_TRUE(layer->sticksToViewport());
+ EXPECT_TRUE(layer->sticksToScroller());
}
-TEST_P(PaintLayerTest, ScrollsWithViewportStickyPositionNoScroll) {
+TEST_P(PaintLayerTest, SticksToScrollerNoAnchor) {
setBodyInnerHTML(
"<div style='transform: translateZ(0)'>"
" <div id='target' style='position: sticky'></div>"
+ "</div>"
+ "<div style='width: 10px; height: 1000px'></div>");
+
+ PaintLayer* layer =
+ toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer();
+ EXPECT_FALSE(layer->sticksToScroller());
+}
+
+TEST_P(PaintLayerTest, SticksToScrollerStickyPositionNoScroll) {
+ setBodyInnerHTML(
+ "<div style='transform: translateZ(0)'>"
+ " <div id='target' style='position: sticky; top: 0;'></div>"
"</div>");
PaintLayer* layer = getPaintLayerByElementId("target");
- EXPECT_TRUE(layer->sticksToViewport());
+ EXPECT_TRUE(layer->sticksToScroller());
}
-TEST_P(PaintLayerTest, ScrollsWithViewportStickyPositionInsideScroller) {
+TEST_P(PaintLayerTest, SticksToScrollerStickyPositionInsideScroller) {
setBodyInnerHTML(
"<div style='overflow:scroll; width: 100px; height: 100px;'>"
- " <div id='target' style='position: sticky'></div>"
+ " <div id='target' style='position: sticky; top: 0;'></div>"
" <div style='width: 50px; height: 1000px;'></div>"
"</div>");
PaintLayer* layer = getPaintLayerByElementId("target");
- EXPECT_FALSE(layer->sticksToViewport());
+ EXPECT_TRUE(layer->sticksToScroller());
}
TEST_P(PaintLayerTest, CompositedScrollingNoNeedsRepaint) {
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698