Commit b575ee21 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[CompositeAfterPaint] Do the same for paint property compositing reasons as pre-CAP

When we added the conditions we expected that crbug.com/900241 would
be fixed soon for CompositeAfterPaint, which hasn't happened yet.
Removing these conditions to reduce difference between CAP and pre-CAP.

Another reason of removing the conditions is to let the effect/filter
node know some of the compositing reasons of the transform/effect node,
so that when an object is forced compositing with
will-change:transform/opacity, we won't decomposite that effect to avoid
raster invalidation on change of the effect.

Bug: 765003
Change-Id: I4f2deda6b08c1efb93841a9a804c22e99dd42f2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2118390
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753401}
parent f9ae413a
......@@ -691,8 +691,7 @@ static CompositingReasons CompositingReasonsForTransformProperty() {
// will-change:opacity to avoid raster invalidation (caused by otherwise a
// created/deleted effect node) when we start/stop an opacity animation.
// https://crbug.com/942681
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
reasons |= CompositingReason::kWillChangeOpacity;
reasons |= CompositingReason::kWillChangeOpacity;
return reasons;
}
......@@ -851,8 +850,9 @@ static bool NeedsClipPathClip(const LayoutObject& object) {
return false;
}
// TODO(crbug.com/900241): Remove this function and let the caller use
// CompositingReason::kDirectReasonForEffectProperty directly.
// TODO(crbug.com/900241): When this bug is fixed, we should let NeedsEffect()
// use CompositingReason::kDirectReasonForEffectProperty directly instead of
// calling this function. We should still call this function in UpdateEffect().
static CompositingReasons CompositingReasonsForEffectProperty() {
CompositingReasons reasons =
CompositingReason::kDirectReasonsForEffectProperty;
......@@ -864,8 +864,9 @@ static CompositingReasons CompositingReasonsForEffectProperty() {
// will-change:transform to avoid raster invalidation (caused by otherwise a
// created/deleted effect node) when we start/stop a transform animation.
// https://crbug.com/942681
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
reasons |= CompositingReason::kWillChangeTransform;
// In CompositeAfterPaint, this also avoids decomposition of the effect when
// the object is forced compositing with will-change:transform.
reasons |= CompositingReason::kWillChangeTransform;
return reasons;
}
......@@ -1173,8 +1174,9 @@ static bool NeedsLinkHighlightEffect(const LayoutObject& object) {
return page->GetLinkHighlight().NeedsHighlightEffect(object);
}
// TODO(crbug.com/900241): Remove this function and let the caller use
// CompositingReason::kDirectReasonForFilterProperty directly.
// TODO(crbug.com/900241): When this bug is fixed, we should let NeedsFilter()
// use CompositingReason::kDirectReasonForFilterProperty directly instead of
// calling this function. We should still call this function in UpdateFilter().
static CompositingReasons CompositingReasonsForFilterProperty() {
CompositingReasons reasons =
CompositingReason::kDirectReasonsForFilterProperty;
......@@ -1186,10 +1188,10 @@ static CompositingReasons CompositingReasonsForFilterProperty() {
// created for will-change:transform/opacity to avoid raster invalidation
// (caused by otherwise a created/deleted filter node) when we start/stop a
// transform/opacity animation. https://crbug.com/942681
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
reasons |= CompositingReason::kWillChangeTransform |
CompositingReason::kWillChangeOpacity;
}
// In CompositeAfterPaint, this also avoids decomposition of the filter when
// the object is forced compositing with will-change:transform/opacity.
reasons |= CompositingReason::kWillChangeTransform |
CompositingReason::kWillChangeOpacity;
return reasons;
}
......
......@@ -4323,6 +4323,10 @@ TEST_P(PaintPropertyTreeBuilderTest, LayerUnderOverflowClipUnderMultiColumn) {
}
TEST_P(PaintPropertyTreeBuilderTest, CompositedUnderMultiColumn) {
// TODO(crbug.com/1064341): This test crashes in CompositeAfterPaint. Fix it.
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
SetBodyInnerHTML(R"HTML(
<style>body { margin: 0; }</style>
<div id='multicol' style='columns:3; column-fill:auto; column-gap: 0;
......@@ -4471,6 +4475,10 @@ TEST_P(PaintPropertyTreeBuilderTest, FrameUnderMulticol) {
}
TEST_P(PaintPropertyTreeBuilderTest, CompositedMulticolFrameUnderMulticol) {
// TODO(crbug.com/1064341): This test crashes in CompositeAfterPaint. Fix it.
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
SetBodyInnerHTML(R"HTML(
<style>body { margin: 0 }</style>
<div style='columns: 3; column-gap: 0; column-fill: auto;
......@@ -5371,16 +5379,8 @@ TEST_P(PaintPropertyTreeBuilderTest,
GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint(
DocumentUpdateReason::kTest);
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) {
// TODO(crbug.com/900241): Without CompositeAfterPaint, we create effect and
// filter nodes when the transform node needs compositing for
// will-change:transform, for crbug.com/942681.
EXPECT_FALSE(ToLayoutBoxModelObject(target)->Layer()->SelfNeedsRepaint());
} else {
// All paint chunks contained by the new opacity effect node need to be
// re-painted.
EXPECT_TRUE(ToLayoutBoxModelObject(target)->Layer()->SelfNeedsRepaint());
}
EXPECT_TRUE(opacity_element->GetLayoutBox()->Layer()->SelfNeedsRepaint());
EXPECT_FALSE(ToLayoutBoxModelObject(target)->Layer()->SelfNeedsRepaint());
}
TEST_P(PaintPropertyTreeBuilderTest, SVGRootWithMask) {
......@@ -5632,7 +5632,11 @@ TEST_P(PaintPropertyTreeBuilderTest, CompositedLayerSkipsFragmentClip) {
.Clip());
}
TEST_P(PaintPropertyTreeBuilderTest, CompositedLayerUnderClipUnerMulticol) {
TEST_P(PaintPropertyTreeBuilderTest, CompositedLayerUnderClipUnderMulticol) {
// TODO(crbug.com/1064341): This test crashes in CompositeAfterPaint. Fix it.
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
SetBodyInnerHTML(R"HTML(
<div id="multicol" style="columns: 2">
<div id="clip" style="height: 100px; overflow: hidden">
......@@ -6263,8 +6267,13 @@ TEST_P(PaintPropertyTreeBuilderTest, SVGRootCompositedClipPath) {
overflow_clip->UnsnappedClipRect().Rect());
EXPECT_EQ(transform, &overflow_clip->LocalTransformSpace());
// TODO(wangxianzhu): Are the following correct?
EXPECT_EQ(nullptr, properties->Effect());
const auto* effect = properties->Effect();
ASSERT_NE(nullptr, effect);
EXPECT_EQ(&EffectPaintPropertyNode::Root(), effect->Parent());
EXPECT_EQ(transform, &effect->LocalTransformSpace());
EXPECT_EQ(clip_path_clip, effect->OutputClip());
EXPECT_EQ(SkBlendMode::kSrcOver, effect->BlendMode());
EXPECT_EQ(nullptr, properties->Mask());
EXPECT_EQ(nullptr, properties->ClipPath());
} else {
......
......@@ -54,6 +54,7 @@ external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elemen
#image-rendering: pixelated doesn't work on canvas.
fast/webgl/pixelated.html [ Failure ]
compositing/masks/broken-mask.html [ Failure ]
compositing/masks/mask-with-removed-filters.html [ Failure ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to-nested.html [ Failure ]
crbug.com/667946 compositing/overflow/scrolls-with-respect-to-transform.html [ Failure ]
......@@ -91,11 +92,6 @@ paint/invalidation/compositing/should-not-repaint-move-backface-hidden.html [ Fa
paint/invalidation/position/relative-positioned-movement-repaint.html [ Failure ]
paint/invalidation/compositing/should-not-repaint-composited-descendants.html [ Failure ]
# Should not decomposite effects for composited elements.
crbug.com/765003 paint/invalidation/compositing/should-not-repaint-composited-filter.html [ Failure ]
crbug.com/765003 paint/invalidation/compositing/should-not-repaint-composited-opacity.html [ Failure ]
crbug.com/765003 compositing/contents-opaque/layer-opacity.html [ Failure ]
# Extra layers for non-fast scrolling areas.
compositing/overflow/textarea-scroll-touch.html [ Failure ]
......@@ -106,16 +102,8 @@ fullscreen/rendering/backdrop-object.html [ Failure ]
# Passes on bot, timeouts locally.
virtual/threaded/fast/events/pinch/scroll-visual-viewport-send-boundary-events.html [ Pass Timeout ]
# Outline paints incorrectly with columns
crbug.com/1047358 paint/pagination/composited-paginated-outlined-box.html [ Failure ]
paint/invalidation/media-audio-no-spurious-repaints.html [ Failure ]
# Extra raster invalidation on start/end of animation. Caused by animation
# element id namespaces
crbug.com/900241 paint/invalidation/animation/opacity-animation.html [ Failure ]
crbug.com/900241 paint/invalidation/animation/transform-animation.html [ Failure ]
crbug.com/940033 virtual/threaded-prefer-compositing/fast/scrolling/wheel-scrolling-over-custom-scrollbar.html [ Pass Failure ]
# Crash during PictureLayer::GetPicture() when DisplayItemList is finished twice.
......@@ -127,8 +115,16 @@ http/tests/devtools/layers/layer-compositing-reasons.js [ Failure ]
http/tests/devtools/layers/layer-scroll-rects-get.js [ Failure ]
# Crash on non-contiguous effect on multiple columns
fast/multicol/composited-layer-will-change.html [ Crash ]
paint/clipath/change-mask-clip-path-multicol-crash.html [ Crash ]
crbug.com/1064341 fast/multicol/composited-layer-will-change.html [ Crash ]
crbug.com/1064341 paint/clipath/change-mask-clip-path-multicol-crash.html [ Crash ]
crbug.com/1064341 fast/multicol/composited-layer-multiple-fragments-translated.html [ Crash ]
crbug.com/1064341 fast/multicol/composited-layer-multiple-fragments.html [ Crash ]
crbug.com/1064341 fast/multicol/composited-layer-nested.html [ Crash ]
# Outline paints incorrectly with columns. For now this is hidden by crbug.com/1064341.
# crbug.com/1047358 paint/pagination/composited-paginated-outlined-box.html [ Failure ]
crbug.com/1064341 paint/pagination/composited-paginated-outlined-box.html [ Crash ]
# Crash on weird clip hierarchy in multiple columns
compositing/geometry/composited-in-columns.html [ Crash ]
......
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow DIV class='box opaque-background translucent composited'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, 8, 0, 1]
]
}
]
}
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited'",
"position": [-25, -25],
"bounds": [125, 125],
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#000000",
"transform": 1
},
......
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited-parent'",
"position": [-125, -125],
"bounds": [225, 225],
"position": [-100, -100],
"bounds": [200, 200],
"backgroundColor": "#000000",
"transform": 1
},
......
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited'",
"position": [-25, -25],
"bounds": [125, 125],
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#000000",
"transform": 1
},
......
......@@ -9,8 +9,14 @@
{
"name": "LayoutNGBlockFlow DIV id='masked'",
"bounds": [400, 200],
"contentsOpaque": true,
"backgroundColor": "#000000",
"transform": 1
},
{
"name": "LayoutNGBlockFlow DIV id='masked'",
"bounds": [400, 200],
"transform": 1
}
],
"transforms": [
......
......@@ -9,6 +9,7 @@
{
"name": "LayoutNGBlockFlow DIV id='target' class='composited box opaque'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#ADD8E6",
"transform": 1
},
......
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited-layer' class='final-drop-shadow'",
"position": [-75, -75],
"bounds": [260, 260],
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
......
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited'",
"position": [-75, -75],
"bounds": [250, 250],
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
......
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow DIV id='target'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#808080",
"transform": 1
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, 8, 0, 1]
]
}
]
}
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow DIV id='target'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#808080",
"transform": 2
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, 8, 0, 1]
]
},
{
"id": 2,
"parent": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[100, 0, 0, 1]
]
}
]
}
......@@ -11,6 +11,7 @@
"bounds": [125, 125],
"backgroundColor": "#0000FF",
"invalidations": [
[0, 0, 100, 100],
[50, 50, 75, 75]
],
"transform": 1
......
......@@ -11,6 +11,7 @@
"bounds": [125, 125],
"backgroundColor": "#0000FF",
"invalidations": [
[0, 0, 100, 100],
[50, 50, 75, 75]
],
"transform": 1
......
......@@ -12,6 +12,7 @@
"contentsOpaque": true,
"backgroundColor": "#0000FF",
"invalidations": [
[0, 0, 100, 100],
[50, 50, 75, 75]
],
"transform": 1
......
......@@ -13,6 +13,7 @@ CONSOLE MESSAGE: line 30: debug
"contentsOpaque": true,
"backgroundColor": "#0000FF",
"invalidations": [
[0, 0, 100, 100],
[50, 50, 75, 75]
],
"transform": 1
......
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow DIV id='composited-box'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, 8, 0, 1]
]
}
]
}
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow DIV id='composited-box'",
"bounds": [100, 100],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[8, 8, 0, 1]
]
}
]
}
......@@ -11,11 +11,11 @@
},
{
"name": "LayoutNGBlockFlow DIV id='box' class='green box blurry'",
"position": [-30, -30],
"bounds": [260, 260],
"bounds": [200, 200],
"contentsOpaque": true,
"backgroundColor": "#008000",
"invalidations": [
[0, 0, 260, 260]
[0, 0, 200, 200]
],
"transform": 1
}
......
......@@ -14,11 +14,11 @@
},
{
"name": "LayoutNGBlockFlow DIV id='resize' class='drop-shadow accelerated'",
"position": [-14, -14],
"bounds": [160, 260],
"bounds": [100, 200],
"contentsOpaque": true,
"backgroundColor": "#008000",
"invalidations": [
[0, 0, 160, 260]
[0, 0, 100, 200]
],
"transform": 1
}
......
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited-layer' class='final-drop-shadow'",
"position": [-150, -150],
"bounds": [520, 520],
"bounds": [200, 200],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
......
......@@ -8,8 +8,8 @@
},
{
"name": "LayoutNGBlockFlow (positioned) DIV id='composited'",
"position": [-150, -150],
"bounds": [500, 500],
"bounds": [200, 200],
"contentsOpaque": true,
"backgroundColor": "#008000",
"transform": 1
}
......
......@@ -10,7 +10,6 @@
"name": "LayoutBlockFlow DIV id='composited-box'",
"bounds": [100, 100],
"contentsOpaque": true,
"backfaceVisibility": "hidden",
"backgroundColor": "#008000",
"transform": 1
}
......
......@@ -10,7 +10,6 @@
"name": "LayoutBlockFlow DIV id='composited-box'",
"bounds": [100, 100],
"contentsOpaque": true,
"backfaceVisibility": "hidden",
"backgroundColor": "#008000",
"transform": 1
}
......
......@@ -10,7 +10,6 @@
"name": "LayoutNGBlockFlow DIV id='composited-box'",
"bounds": [100, 100],
"contentsOpaque": true,
"backfaceVisibility": "hidden",
"backgroundColor": "#008000",
"transform": 1
}
......
<!DOCTYPE html>
<style>
#composited-box {
backface-visibility: hidden;
will-change: opacity;
width: 100px;
height: 100px;
background-color: green;
......
......@@ -10,7 +10,6 @@
"name": "LayoutNGBlockFlow DIV id='composited-box'",
"bounds": [100, 100],
"contentsOpaque": true,
"backfaceVisibility": "hidden",
"backgroundColor": "#008000",
"transform": 1
}
......
<!DOCTYPE html>
<style>
#composited-box {
backface-visibility: hidden;
will-change: transform;
width: 100px;
height: 100px;
background: green;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment