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

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

Issue 2264663002: Paint solid color backgrounds which are equivalent to locally attached into scrolling contents layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scrollcontent-paint-bg
Patch Set: Add test and only skip local equivalence if outline enters padding-box Created 4 years, 4 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 8d80825f23199f2d5d01d3ce2e10c3a0149aeaa6..f427c51cc4ffd3532fbf0c22adb73155c6ccbeaf 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -636,7 +636,10 @@ TEST_F(CompositedLayerMappingTest, ShouldPaintBackgroundOntoScrollingContentsLay
{
document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
setBodyInnerHTML(
- "<style>.scroller { overflow: scroll; will-change: transform; width: 300px; height: 300px;} .spacer { height: 1000px; }</style>"
+ "<style>"
+ ".scroller { overflow: scroll; will-change: transform; width: 300px; height: 300px;} .spacer { height: 1000px; }"
+ "#scroller13::-webkit-scrollbar { width: 13px; height: 13px;}"
+ "</style>"
"<div id='scroller1' class='scroller' style='background: white local;'>"
" <div id='negative-composited-child' style='background-color: red; width: 1px; height: 1px; position: absolute; backface-visibility: hidden; z-index: -1'></div>"
" <div class='spacer'></div>"
@@ -647,30 +650,70 @@ TEST_F(CompositedLayerMappingTest, ShouldPaintBackgroundOntoScrollingContentsLay
"<div id='scroller5' class='scroller' style='background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUg) local, white local;'><div class='spacer'></div></div>"
"<div id='scroller6' class='scroller' style='background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUg) local, white padding-box; padding: 10px;'><div class='spacer'></div></div>"
"<div id='scroller7' class='scroller' style='background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUg) local, white content-box; padding: 10px;'><div class='spacer'></div></div>"
+ "<div id='scroller8' class='scroller' style='background: white border-box;'><div class='spacer'></div></div>"
+ "<div id='scroller9' class='scroller' style='background: white border-box; border: 10px solid black;'><div class='spacer'></div></div>"
+ "<div id='scroller10' class='scroller' style='background: white border-box; border: 10px solid rgba(0, 0, 0, 0.5);'><div class='spacer'></div></div>"
+ "<div id='scroller11' class='scroller' style='background: white content-box;'><div class='spacer'></div></div>"
+ "<div id='scroller12' class='scroller' style='background: white content-box; padding: 10px;'><div class='spacer'></div></div>"
+ "<div id='scroller13' class='scroller' style='background: white border-box;'><div class='spacer'></div></div>"
+ "<div id='scroller14' class='scroller' style='background: white; border: 1px solid black; outline: 1px solid blue; outline-offset: -1px;'><div class='spacer'></div></div>"
+ "<div id='scroller15' class='scroller' style='background: white; border: 1px solid black; outline: 1px solid blue; outline-offset: -2px;'><div class='spacer'></div></div>"
);
- // First scroller cannot paint background into scrolling contents layer because it has a negative z-index child.
+ // #scroller1 cannot paint background into scrolling contents layer because it has a negative z-index child.
EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1"));
- // Second scroller cannot paint background into scrolling contents layer because it has a content-box clip without local attachment.
+ // #scroller2 cannot paint background into scrolling contents layer because it has a content-box clip without local attachment.
EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2"));
- // Third scroller can paint background into scrolling contents layer.
+ // #scroller3 can paint background into scrolling contents layer.
EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3"));
- // Fourth scroller cannot paint background into scrolling contents layer because the background image is not locally attached.
+ // #scroller4 cannot paint background into scrolling contents layer because the background image is not locally attached.
EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller4"));
- // Fifth scroller can paint background into scrolling contents layer because both the image and color are locally attached.
+ // #scroller5 can paint background into scrolling contents layer because both the image and color are locally attached.
EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller5"));
- // Sixth scroller can paint background into scrolling contents layer because the image is locally attached and even though
+ // #scroller6 can paint background into scrolling contents layer because the image is locally attached and even though
// the color is not, it is filled to the padding box so it will be drawn the same as a locally attached background.
EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller6"));
- // Seventh scroller cannot paint background into scrolling contents layer because the color is filled to the content
+ // #scroller7 cannot paint background into scrolling contents layer because the color is filled to the content
// box and we have padding so it is not equivalent to a locally attached background.
EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller7"));
+
+ // #scroller8 can paint background into scrolling contents layer because its border-box is equivalent to its
+ // padding box since it has no border.
+ EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller8"));
+
+ // #scroller9 can paint background into scrolling contents layer because its border is opaque so it completely
+ // covers the background outside of the padding-box.
+ EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller9"));
+
+ // #scroller10 cannot paint background into scrolling contents layer because its border is partially transparent
+ // so the background must be drawn to the border-box edges.
+ EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller10"));
+
+ // #scroller11 can paint background into scrolling contents layer because its content-box is equivalent to its
+ // padding box since it has no padding.
+ EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller11"));
+
+ // #scroller12 cannot paint background into scrolling contents layer because it has padding so its content-box
+ // is not equivalent to its padding-box.
+ EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller12"));
+
+ // #scroller13 cannot paint background into scrolling contents layer because it has a custom
+ // scrollbar which the background may need to draw under.
+ EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller13"));
+
+ // #scroller14 can paint background into scrolling contents layer because the outline is drawn outside the
+ // padding box.
+ EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller14"));
+
+ // #scroller15 cannot paint background into scrolling contents layer because the outline is drawn inside
+ // the padding box.
+ EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller15"));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698