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

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

Issue 2522043002: Reland "Only promote opaque scrollers which are stacking contexts." (Closed)
Patch Set: Remove android svg-width-100p-as-background-expected.txt expectation. Created 4 years, 1 month 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/PaintLayerScrollableArea.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/PaintLayerScrollableAreaTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
index 4b393489fdef498eba1acc122bdfb02aa4ea55ed..7678aa3e6b99335d95182f37b897e04590220430 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
@@ -156,13 +156,14 @@ TEST_F(PaintLayerScrollableAreaTest,
EXPECT_FALSE(canPaintBackgroundOntoScrollingContentsLayer("scroller16"));
}
-TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromoted) {
+TEST_F(PaintLayerScrollableAreaTest, OpaqueContainedLayersPromoted) {
RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true);
setBodyInnerHTML(
"<style>"
- "#scroller { overflow: scroll; height: 200px; width: 200px; background: "
- "white local content-box; border: 10px solid rgba(0, 255, 0, 0.5); }"
+ "#scroller { overflow: scroll; height: 200px; width: 200px; "
+ "contain: paint; background: white local content-box; "
+ "border: 10px solid rgba(0, 255, 0, 0.5); }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
@@ -179,6 +180,36 @@ TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromoted) {
EXPECT_TRUE(paintLayer->graphicsLayerBackingForScrolling()->contentsOpaque());
}
+// Tests that we don't promote scrolling content which would not be contained.
+// Promoting the scroller would also require promoting the positioned div
+// which would lose subpixel anti-aliasing due to its transparent background.
+TEST_F(PaintLayerScrollableAreaTest, NonContainedLayersNotPromoted) {
+ RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true);
+
+ setBodyInnerHTML(
+ "<style>"
+ "#scroller { overflow: scroll; height: 200px; width: 200px; "
+ "background: white local content-box; "
+ "border: 10px solid rgba(0, 255, 0, 0.5); }"
+ "#scrolled { height: 300px; }"
+ "#positioned { position: relative; }"
+ "</style>"
+ "<div id=\"scroller\">"
+ " <div id=\"positioned\">Not contained by scroller.</div>"
+ " <div id=\"scrolled\"></div>"
+ "</div>");
+ document().view()->updateAllLifecyclePhases();
+
+ EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled());
+ Element* scroller = document().getElementById("scroller");
+ PaintLayer* paintLayer =
+ toLayoutBoxModelObject(scroller->layoutObject())->layer();
+ ASSERT_TRUE(paintLayer);
+ EXPECT_FALSE(paintLayer->needsCompositedScrolling());
+ EXPECT_FALSE(paintLayer->graphicsLayerBacking());
+ EXPECT_FALSE(paintLayer->graphicsLayerBackingForScrolling());
+}
+
TEST_F(PaintLayerScrollableAreaTest, TransparentLayersNotPromoted) {
RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true);
@@ -186,7 +217,7 @@ TEST_F(PaintLayerScrollableAreaTest, TransparentLayersNotPromoted) {
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
"rgba(0, 255, 0, 0.5) local content-box; border: 10px solid rgba(0, 255, "
- "0, 0.5); }"
+ "0, 0.5); contain: paint; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
@@ -208,7 +239,7 @@ TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersDepromotedOnStyleChange) {
setBodyInnerHTML(
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
- "white local content-box; }"
+ "white local content-box; contain: paint; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
@@ -239,7 +270,7 @@ TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromotedOnStyleChange) {
setBodyInnerHTML(
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
- "rgba(255,255,255,0.5) local content-box; }"
+ "rgba(255,255,255,0.5) local content-box; contain: paint; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
@@ -273,7 +304,7 @@ TEST_F(PaintLayerScrollableAreaTest, OnlyNonTransformedOpaqueLayersPromoted) {
setBodyInnerHTML(
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
- "white local content-box; }"
+ "white local content-box; contain: paint; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"parent\">"
@@ -327,7 +358,7 @@ TEST_F(PaintLayerScrollableAreaTest, OnlyOpaqueLayersPromoted) {
setBodyInnerHTML(
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
- "white local content-box; }"
+ "white local content-box; contain: paint; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"parent\">"
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698