Invalidate previous paint rect in RenderObject::paintInvalidationForWholeRenderer()

When an object is being removed, it calls
paintInvalidationForWholeRenderer() which previously invalidated the
current repaint rect only. However if the object has been layouted
after the last invalidation, we'll miss invalidation of the object's
previous location.

Now let the method also invalidate the previous paint rect if possible.

BUG=392794, 394004
TEST=fast/repaint/remove-block-after-layout.html
TEST=fast/repaint/remove-inline-after-layout.html
TEST=fast/repaint/remove-inline-layer-after-layout.html
R=dsinclair@chromium.org, jchaffraix@chromium.org

Review URL: https://codereview.chromium.org/395463003

git-svn-id: svn://svn.chromium.org/blink/trunk@179059 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b420c1d2
......@@ -904,6 +904,20 @@ crbug.com/361729 fast/multicol/pagination-h-horizontal-tb.html [ Pass Failure ]
crbug.com/359877 virtual/regionbasedmulticol/fast/multicol/mixed-opacity-fixed-test.html [ ImageOnlyFailure ]
crbug.com/359877 virtual/regionbasedmulticol/fast/multicol/mixed-opacity-test.html [ ImageOnlyFailure ]
crbug.com/392794 fast/repaint/change-transform.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/fixed-scale.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/remove-inline-after-layout.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/remove-inline-layer-after-layout.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/scroll-in-transformed-layer.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/table-outer-border.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/transform-absolute-child.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/transform-absolute-in-positioned-container.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/transform-relative-position.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/transform-repaint-descendants.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/transform-replaced-shadows.html [ NeedsRebaseline ]
crbug.com/392794 fast/repaint/transform-translate.html [ NeedsRebaseline ]
crbug.com/392794 svg/repaint/remove-background-property-on-root.html [ NeedsRebaseline ]
# Old multicol tests that currently have no baseline in the virtual test suite
# for the new multicol implementation.
crbug.com/386567 virtual/regionbasedmulticol/fast/multicol/border-padding-pagination.html [ Skip ]
......
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[200, 108, 100, 100],
[200, 108, 100, 100],
[8, 108, 100, 100]
]
}
]
}
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
var target = document.getElementById('target');
target.style.left = '200px';
target.offsetLeft;
target.parentNode.removeChild(target);
}
onload = runRepaintTest;
</script>
<div style="height: 100px">
Tests invalidation after layouting and then removing a div. The div should disappear without any residue.
</div>
<div id="target" style="position: absolute; width: 100px; height: 100px; background-color: red">
This div should disappear.
</div>
\ No newline at end of file
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[8, 108, 784, 105],
[8, 108, 784, 104]
]
}
]
}
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
var target = document.getElementById('target');
target.style.margin = '200px';
target.offsetLeft;
target.parentNode.removeChild(target);
}
onload = runRepaintTest;
</script>
<div style="height: 100px">
Tests invalidation after layouting and then removing a span. The span should disappear without any residue.
</div>
<div style="display: inline-block; width: 100px; height: 100px; background-color: green"></div>
<span id="target">
This span should disappear.
</span>
<div style="display: inline-block; width: 100px; height: 100px; background-color: green"></div>
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[212, 108, 171, 104],
[8, 108, 784, 104]
]
}
]
}
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
var target = document.getElementById('target');
target.style.margin = '100px';
target.parentNode.offsetHeight;
target.parentNode.removeChild(target);
}
onload = runRepaintTest;
</script>
<div style="height: 100px">
Tests invalidation after layouting and then removing a layered span. The span should disappear without any residue.
</div>
<div style="display: inline-block; width: 100px; height: 100px; background-color: green"></div>
<span id="target" style="opacity: 0.8">
This span should disappear.
</span>
<div style="display: inline-block; width: 100px; height: 100px; background-color: green"></div>
......@@ -1530,8 +1530,15 @@ void RenderObject::paintInvalidationForWholeRenderer() const
// Until those states are fully fledged, I'll just disable the ASSERTS.
DisableCompositingQueryAsserts disabler;
const RenderLayerModelObject* paintInvalidationContainer = containerForPaintInvalidation();
// FIXME: We should invalidate only previousPaintInvalidationRect, but for now we invalidate both the previous
// and current paint rects to meet the expectations of some callers in some cases (crbug.com/397555):
// - transform style change without a layout - crbug.com/394004;
// - some objects don't save previousPaintInvalidationRect - crbug.com/394133.
LayoutRect paintInvalidationRect = boundsRectForPaintInvalidation(paintInvalidationContainer);
invalidatePaintUsingContainer(paintInvalidationContainer, paintInvalidationRect, InvalidationPaint);
if (paintInvalidationRect != previousPaintInvalidationRect())
invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInvalidationRect(), InvalidationPaint);
}
LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
......
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