Commit 722a913a authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

[PE] Set GraphicsLayerUpdate bits on the enclosing stacking composited layer.

This ensures that we will paper over any confusions regarding non-stacking
composited layers such as as those created by backface-visibility: hidden.

Setting the bit on the enclosing stacking layer suffices because any
other composited layer must be a stacking child of it, and the
kGraphicsLayerUpdateSubtree is used.

Bug: 916077

Change-Id: I695f9b7a6700e1bed3bc55034916b200a1d7849e
Reviewed-on: https://chromium-review.googlesource.com/c/1394187Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619787}
parent cddd568a
...@@ -76,14 +76,16 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer, ...@@ -76,14 +76,16 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer,
geometry_map_.PushMappingsToAncestor(layer, layer->Parent()); geometry_map_.PushMappingsToAncestor(layer, layer->Parent());
PaintLayer* enclosing_composited_layer = info.enclosing_composited_layer; PaintLayer* enclosing_stacking_composited_layer =
info.enclosing_stacking_composited_layer;
PaintLayer* enclosing_squashing_composited_layer = PaintLayer* enclosing_squashing_composited_layer =
info.enclosing_squashing_composited_layer; info.enclosing_squashing_composited_layer;
switch (layer->GetCompositingState()) { switch (layer->GetCompositingState()) {
case kNotComposited: case kNotComposited:
break; break;
case kPaintsIntoOwnBacking: case kPaintsIntoOwnBacking:
enclosing_composited_layer = layer; if (layer->GetLayoutObject().StyleRef().IsStackingContext())
enclosing_stacking_composited_layer = layer;
break; break;
case kPaintsIntoGroupedBacking: case kPaintsIntoGroupedBacking:
enclosing_squashing_composited_layer = enclosing_squashing_composited_layer =
...@@ -92,8 +94,8 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer, ...@@ -92,8 +94,8 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer,
} }
if (layer->NeedsCompositingInputsUpdate()) { if (layer->NeedsCompositingInputsUpdate()) {
if (enclosing_composited_layer) { if (enclosing_stacking_composited_layer) {
enclosing_composited_layer->GetCompositedLayerMapping() enclosing_stacking_composited_layer->GetCompositedLayerMapping()
->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree); ->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree);
} }
if (enclosing_squashing_composited_layer) { if (enclosing_squashing_composited_layer) {
...@@ -117,7 +119,8 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer, ...@@ -117,7 +119,8 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer,
if (update_type == kForceUpdate) if (update_type == kForceUpdate)
UpdateAncestorDependentCompositingInputs(layer, info); UpdateAncestorDependentCompositingInputs(layer, info);
info.enclosing_composited_layer = enclosing_composited_layer; info.enclosing_stacking_composited_layer =
enclosing_stacking_composited_layer;
info.enclosing_squashing_composited_layer = info.enclosing_squashing_composited_layer =
enclosing_squashing_composited_layer; enclosing_squashing_composited_layer;
......
...@@ -32,7 +32,8 @@ class CompositingInputsUpdater { ...@@ -32,7 +32,8 @@ class CompositingInputsUpdater {
}; };
struct AncestorInfo { struct AncestorInfo {
PaintLayer* enclosing_composited_layer = nullptr; // The ancestor composited PaintLayer which is also a stacking context.
PaintLayer* enclosing_stacking_composited_layer = nullptr;
// A "squashing composited layer" is a PaintLayer that owns a squashing // A "squashing composited layer" is a PaintLayer that owns a squashing
// layer. This variable stores the squashing composited layer for the // layer. This variable stores the squashing composited layer for the
// nearest PaintLayer ancestor which is squashed. // nearest PaintLayer ancestor which is squashed.
......
<!doctype HTML> <!doctype HTML>
<title>CSS Test: Test for re-paint after stacking context removal due to opacity</title> <html class="reftest-wait">
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org" /> <title>CSS Test: Test for re-paint after stacking context removal due to opacity</title>
<link rel="help" href="https://www.w3.org/TR/CSS2/zindex.html"> <link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org" />
<link rel="match" href="opacity-change-parent-stacking-context-ref.html"> <link rel="help" href="https://www.w3.org/TR/CSS2/zindex.html">
<div style="width: 100px; height: 100px; background: lightblue; will-change: transform; position: absolute"> <link rel="match" href="opacity-change-parent-stacking-context-ref.html">
<div id=target style="opacity: 0; backface-visibility: hidden"> <script src="/common/reftest-wait.js"></script>
<div style="width: 50px; height: 50px; background: lightgray; top: 75px; position: relative"> <div style="width: 100px; height: 100px; background: lightblue; will-change: transform; position: absolute">
<div id=target style="opacity: 0; backface-visibility: hidden">
<div style="width: 50px; height: 50px; background: lightgray; top: 75px; position: relative">
</div>
</div> </div>
</div> <script>
onload = function() {
<script> requestAnimationFrame(() => requestAnimationFrame(() => {
onload = function() { target.style.opacity = 1;
requestAnimationFrame(() => requestAnimationFrame(() => { takeScreenshot();
target.style.opacity = 1; }));
})); }
} </script>
</script> </html
<!doctype HTML>
<title>CSS Test</title>
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org" />
Passes if it shows a green 200x200 square.
<div style="will-change: transform; width: 300px; height: 0px">
<div style="width: 1px; height: 1px; backface-visibility: hidden;">
<div id=target style="width: 200px; height: 200px; position: relative; background: green; left: 10px;"></div>
</div>
</div>
<!doctype HTML>
<html class="reftest-wait">
<title>CSS Test: Test for re-paint after resizing an element underneath a backface-visibility hidden element</title>
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#propdef-backface-visibility">
<link rel="match" href="size-change-under-backface-visibility-hidden-ref.html">
<script src="/common/reftest-wait.js"></script>
Passes if it shows a green 200x200 square.
<div style="will-change: transform; width: 300px; height: 0px">
<div style="width: 1px; height: 1px; backface-visibility: hidden;">
<div id=target style="width: 200px; height: 0px; position: relative; background: green; left: 10px;"></div>
</div>
</div>
<script>
onload = function() {
requestAnimationFrame(() => requestAnimationFrame(() => {
target.style.height = '200px';
takeScreenshot();
}));
};
</script>
</html>
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