Commit 04469543 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Invalidate GraphicsLayerUpdate for ancestor stacking context GraphicsLayer

Previously, if |layer| was a stacking context, we would only call
SetNeedsGraphicsLayerUpdate on it, but if it loses its backing
then we should call it on the ancestor stacking context graphics
layer also.

Bug: 996931

Change-Id: I88aede8446eded11432334a58ea1a13cd5174c26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2120050Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753404}
parent 96c017ff
...@@ -227,6 +227,22 @@ void CompositingInputsUpdater::UpdateAncestorInfo(PaintLayer* const layer, ...@@ -227,6 +227,22 @@ void CompositingInputsUpdater::UpdateAncestorInfo(PaintLayer* const layer,
info.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;
if (layer->NeedsCompositingInputsUpdate()) {
if (enclosing_stacking_composited_layer) {
enclosing_stacking_composited_layer->GetCompositedLayerMapping()
->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree);
}
if (enclosing_squashing_composited_layer) {
enclosing_squashing_composited_layer->GetCompositedLayerMapping()
->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree);
}
update_type = kForceUpdate;
}
switch (layer->GetCompositingState()) { switch (layer->GetCompositingState()) {
case kNotComposited: case kNotComposited:
break; break;
...@@ -240,17 +256,19 @@ void CompositingInputsUpdater::UpdateAncestorInfo(PaintLayer* const layer, ...@@ -240,17 +256,19 @@ void CompositingInputsUpdater::UpdateAncestorInfo(PaintLayer* const layer,
break; break;
} }
// invalidate again after the switch, in case
// enclosing_stacking_composited_layer or
// enclosing_squashing_composited_layer was previously null.
if (layer->NeedsCompositingInputsUpdate()) { if (layer->NeedsCompositingInputsUpdate()) {
if (enclosing_stacking_composited_layer) { if (enclosing_stacking_composited_layer) {
enclosing_stacking_composited_layer->GetCompositedLayerMapping() enclosing_stacking_composited_layer->GetCompositedLayerMapping()
->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree); ->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree);
} }
if (enclosing_squashing_composited_layer) { if (enclosing_squashing_composited_layer) {
enclosing_squashing_composited_layer->GetCompositedLayerMapping() enclosing_squashing_composited_layer->GetCompositedLayerMapping()
->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree); ->SetNeedsGraphicsLayerUpdate(kGraphicsLayerUpdateSubtree);
} }
update_type = kForceUpdate;
} }
if (style.GetPosition() == EPosition::kAbsolute) { if (style.GetPosition() == EPosition::kAbsolute) {
......
<!doctype HTML>
<style>
#target .child::before {
content: "";
position: absolute;
height: 30px;
width: 30px;
will-change: transform;
background-color: green;
}
#target.Slider_pressed .child::before {
transform: translateZ(0);
}
</style>
<div class="ContextualPopup" style="opacity: 0.9">
<div id=target tabindex="-1" >
<div class=child></div>
</div>
<div style="position: relative; z-index: 0">
<div style=" position: absolute; z-index: -1; will-change: transform;"></div>
</div>
<div style="position: absolute; height: 30px; width: 30px; left: 100px; background-color: green;">
</div>
<!doctype HTML>
<title>Page updates correctly after click with transtion transform and complex stacking contexts.</title>
<style>
#target .child::before {
content: "";
position: absolute;
height: 30px;
width: 30px;
will-change: transform;
transition: transform ease-out 100ms;
background-color: green;
}
#target.Slider_pressed .child::before {
transform: translateZ(0);
}
</style>
<div class="ContextualPopup" style="opacity: 0.9">
<div id=target tabindex="-1" >
<div class=child></div>
</div>
<div style="position: relative; z-index: 0">
<div style=" position: absolute; z-index: -1; will-change: transform;"></div>
</div>
<div style="position: absolute; height: 30px; width: 30px; left: 100px; background-color: green;">
</div>
<script>
if (testRunner)
testRunner.waitUntilDone();
onload = () => {
target.addEventListener("mousedown", () => {
target.classList.add("Slider_pressed");
if (testRunner) {
setTimeout(() => {
testRunner.notifyDone();
}, 200);
}
});
if (eventSender) {
eventSender.mouseMoveTo(10, 10);
eventSender.mouseDown();
}
};
</script>
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