Chromium Code Reviews| 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); |