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

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

Issue 2833883003: Skip paint chunks with effectively invisible opacity. (Closed)
Patch Set: Remove TODO comment. Created 3 years, 8 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/paint/PaintLayerPainterTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
index 13e261855593600ea9c9e7db09557034cb7d4550..f35c55486ec0984a1711f8f1e9e67dbcd967e1ab 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -32,29 +32,6 @@ class PaintLayerPainterTest
: ScopedRootLayerScrollingForTest(GetParam().root_layer_scrolling),
PaintControllerPaintTestBase(GetParam().slimming_paint_v2) {}
- void ExpectPaintedOutputVisibility(const char* element_name,
- bool expected_spv1) {
- ExpectPaintedOutputVisibility(element_name, expected_spv1, expected_spv1);
- }
-
- void ExpectPaintedOutputVisibility(const char* element_name,
- bool expected_spv1,
- bool expected_spv2) {
- PaintLayer* target_layer =
- ToLayoutBox(GetLayoutObjectByElementId(element_name))->Layer();
- PaintLayerPaintingInfo painting_info(nullptr, LayoutRect(),
- kGlobalPaintNormalPhase, LayoutSize());
- bool invisible =
- PaintLayerPainter(*target_layer).PaintedOutputInvisible(painting_info);
- bool expected_value = RuntimeEnabledFeatures::slimmingPaintV2Enabled()
- ? expected_spv2
- : expected_spv1;
- EXPECT_EQ(expected_value, invisible)
- << "Failed painted output visibility [spv2_enabled="
- << RuntimeEnabledFeatures::slimmingPaintV2Enabled()
- << ", expected=" << expected_value << ", actual=" << invisible << "].";
- }
-
private:
void SetUp() override {
PaintControllerPaintTestBase::SetUp();
@@ -792,141 +769,4 @@ TEST_P(PaintLayerPainterTest,
EXPECT_TRUE(layer.NeedsPaintPhaseDescendantBlockBackgrounds());
}
-TEST_P(PaintLayerPainterTest, DontPaintWithTinyOpacity) {
- SetBodyInnerHTML(
- "<div id='target' style='background: blue; opacity: 0.0001'></div>");
- ExpectPaintedOutputVisibility("target", true, false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithTinyOpacityAndWillChangeOpacity) {
- SetBodyInnerHTML(
- "<div id='target' style='background: blue; opacity: 0.0001; "
- "will-change: opacity'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithTinyOpacityAndBackdropFilter) {
- SetBodyInnerHTML(
- "<div id='target' style='background: blue; opacity: 0.0001;"
- " backdrop-filter: blur(2px);'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest,
- DoPaintWithTinyOpacityAndBackdropFilterAndWillChangeOpacity) {
- SetBodyInnerHTML(
- "<div id='target' style='background: blue; opacity: 0.0001;"
- " backdrop-filter: blur(2px); will-change: opacity'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithCompositedTinyOpacity) {
- SetBodyInnerHTML(
- "<div id='target' style='background: blue; opacity: 0.0001;"
- " will-change: transform'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithNonTinyOpacity) {
- SetBodyInnerHTML(
- "<div id='target' style='background: blue; opacity: 0.1'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithEffectAnimationZeroOpacity) {
- SetBodyInnerHTML(
- "<style> "
- "div { "
- " width: 100px; "
- " height: 100px; "
- " animation-name: example; "
- " animation-duration: 4s; "
- "} "
- "@keyframes example { "
- " from { opacity: 0.0;} "
- " to { opacity: 1.0;} "
- "} "
- "</style> "
- "<div id='target'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DontPaintWithTransformAnimationZeroOpacity) {
- SetBodyInnerHTML(
- "<style> "
- "div#target { "
- " animation-name: example; "
- " animation-duration: 4s; "
- " opacity: 0.0; "
- "} "
- "@keyframes example { "
- " from { transform: translate(0px, 0px); } "
- " to { transform: translate(3em, 0px); } "
- "} "
- "</style> "
- "<div id='target'>x</div></div>");
- ExpectPaintedOutputVisibility("target", false, true);
-}
-
-TEST_P(PaintLayerPainterTest,
- DoPaintWithTransformAnimationZeroOpacityWillChangeOpacity) {
- SetBodyInnerHTML(
- "<style> "
- "div#target { "
- " animation-name: example; "
- " animation-duration: 4s; "
- " opacity: 0.0; "
- " will-change: opacity; "
- "} "
- "@keyframes example { "
- " from { transform: translate(0px, 0px); } "
- " to { transform: translate(3em, 0px); } "
- "} "
- "</style> "
- "<div id='target'>x</div></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithWillChangeOpacity) {
- SetBodyInnerHTML(
- "<style> "
- "div { "
- " width: 100px; "
- " height: 100px; "
- " will-change: opacity;"
- "}"
- "</style> "
- "<div id='target'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest, DoPaintWithZeroOpacityAndWillChangeOpacity) {
- SetBodyInnerHTML(
- "<style> "
- "div { "
- " width: 100px; "
- " height: 100px; "
- " opacity: 0; "
- " will-change: opacity;"
- "}"
- "</style> "
- "<div id='target'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
-TEST_P(PaintLayerPainterTest,
- DoPaintWithNoContentAndZeroOpacityAndWillChangeOpacity) {
- SetBodyInnerHTML(
- "<style> "
- "div { "
- " width: 100px; "
- " height: 100px; "
- " opacity: 0; "
- " will-change: opacity;"
- "}"
- "</style> "
- "<div id='target'></div>");
- ExpectPaintedOutputVisibility("target", false);
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698