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

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

Issue 2318243002: Promote opaque fixed position elements. (Closed)
Patch Set: Merge with master Created 4 years, 3 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 | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp » ('j') | 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 c11f680b01acfb761d6694d30e1f3bba896c1ea8..c0f8a6bf58e30bb56c4d99e2a6d551482c047b5b 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -620,6 +620,39 @@ TEST_F(CompositedLayerMappingTest, InterestRectOfIframeWithContentBoxOffset)
EXPECT_RECT_EQ(IntRect(0, 0, 500, 7500), recomputeInterestRect(frameDocument.view()->layoutViewItem().enclosingLayer()->graphicsLayerBacking()));
}
+TEST_F(CompositedLayerMappingTest, PromoteOpaqueFixedPosition)
+{
+ document().frame()->settings()->setPreferCompositingToLCDTextEnabled(false);
+ RuntimeEnabledFeatures::setCompositeOpaqueFixedPositionEnabled(true);
chrishtr 2016/09/29 17:25:25 Restore these flags at the end of the test. I thin
flackr 2016/09/29 18:01:28 Done. I couldn't find any helper classes or existi
+
+ setBodyInnerHTML(
+ "<div id='translucent' style='width: 20px; height: 20px; position: fixed; top: 100px; left: 100px;'></div>"
+ "<div id='opaque' style='width: 20px; height: 20px; position: fixed; top: 100px; left: 200px; background: white;'></div>"
+ "<div id='opaque-with-shadow' style='width: 20px; height: 20px; position: fixed; top: 100px; left: 300px; background: white; box-shadow: 10px 10px 5px #888888;'></div>"
+ "<div id='spacer' style='height: 2000px'></div>");
+
+ document().view()->updateAllLifecyclePhases();
+
+ // The translucent fixed box should not be promoted.
+ Element* element = document().getElementById("translucent");
+ PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ EXPECT_EQ(NotComposited, paintLayer->compositingState());
+
+ // The opaque fixed box should be promoted and be opaque so that text will be drawn
+ // with subpixel anti-aliasing.
+ element = document().getElementById("opaque");
+ paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ EXPECT_EQ(PaintsIntoOwnBacking, paintLayer->compositingState());
+ EXPECT_TRUE(paintLayer->graphicsLayerBacking()->contentsOpaque());
+
+ // The opaque fixed box with shadow should not be promoted because the layer will
+ // include the shadow which is not opaque.
+ element = document().getElementById("opaque-with-shadow");
+ paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ EXPECT_EQ(NotComposited, paintLayer->compositingState());
+}
+
+
TEST_F(CompositedLayerMappingTest, ScrollingContentsAndForegroundLayerPaintingPhase)
{
document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698