Revert of Revert of Clip incremental invalidation rects for RenderBox...

Revert of Revert of Clip incremental invalidation rects for RenderBox (patchset #4 id:160001 of https://codereview.chromium.org/899813004/)

Reason for revert:
Suspected the original CL cause of the bug, but proved not.

Original issue's description:
> Revert of Clip incremental invalidation rects for RenderBox (patchset #3 id:40001 of https://codereview.chromium.org/548523005/)
> 
> Reason for revert:
> Haven't looked into the issue deeply, but in the future we won't care about the invalidation rects, so we can just revert this kind of optimizations.
> 
> BUG=453586
> 
> Original issue's description:
> > Clip incremental invalidation rects for RenderBox
> > 
> > RenderBox::incrementallyInvalidatePaint invalidates according to
> > border-box delta, not considering the bounds. If the bounds are
> > clipped by ancestor clipping, the incrementally invalidated rect
> > may exceed the ancestor clipping.
> > 
> > Clip the incremental invalidation rects by oldBounds and newBounds
> > to avoid invalidation on unrelated areas.
> > 
> > BUG=411420
> > TEST=fast/repaint/resize-with-border-clipped.html
> > 
> > Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182081
> 
> TBR=jchaffraix@chromium.org,dsinclair@chromium.org,esprehn@chromium.org,leviw@chromium.org
> BUG=411420
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=189569

TBR=jchaffraix@chromium.org,dsinclair@chromium.org,esprehn@chromium.org,leviw@chromium.org
BUG=453586,456176

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

git-svn-id: svn://svn.chromium.org/blink/trunk@190682 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f5cfd50d
...@@ -109,6 +109,10 @@ crbug.com/66751 [ Win ] http/tests/local/link-stylesheet-load-order.html [ Failu ...@@ -109,6 +109,10 @@ crbug.com/66751 [ Win ] http/tests/local/link-stylesheet-load-order.html [ Failu
crbug.com/331566 fast/preloader/document-write-noscript.html [ Failure Pass ] crbug.com/331566 fast/preloader/document-write-noscript.html [ Failure Pass ]
crbug.com/453586 fast/repaint/line-flow-with-floats-8.html [ NeedsRebaseline ]
crbug.com/453586 fast/repaint/line-flow-with-floats-2.html [ NeedsRebaseline ]
crbug.com/453586 fast/repaint/fixed-under-composited-absolute-scrolled.html [ NeedsRebaseline ]
crbug.com/451606 virtual/slimmingpaint/svg/filters/feSpecularLight-premultiplied.svg [ ImageOnlyFailure ] crbug.com/451606 virtual/slimmingpaint/svg/filters/feSpecularLight-premultiplied.svg [ ImageOnlyFailure ]
crbug.com/451606 virtual/slimmingpaint/svg/filters/filter-clip.svg [ ImageOnlyFailure ] crbug.com/451606 virtual/slimmingpaint/svg/filters/filter-clip.svg [ ImageOnlyFailure ]
crbug.com/451606 virtual/slimmingpaint/svg/filters/feComponentTransfer-subregion.svg [ Crash ImageOnlyFailure ] crbug.com/451606 virtual/slimmingpaint/svg/filters/feComponentTransfer-subregion.svg [ Crash ImageOnlyFailure ]
......
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[220, 100, 80, 200],
[210, 100, 90, 200],
[100, 220, 200, 80],
[100, 210, 200, 90]
]
}
]
}
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
document.getElementById('target').style.width = '300px';
document.getElementById('target').style.height = '300px';
}
window.onload = runRepaintTest;
</script>
<style>
body {
margin: 0;
}
#container {
position: absolute;
top: 100px;
left: 100px;
width: 200px;
height: 200px;
overflow: hidden;
}
#target {
width: 100px;
height: 100px;
border: green 10px solid;
background-color: blue;
}
</style>
Tests invalidation when a box with border is resized within a clipping container.
Passes if the result paint rects don't exceed the container.
<div id="container">
<div id="target"></div>
</div>
...@@ -3959,7 +3959,7 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint ...@@ -3959,7 +3959,7 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()); LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size());
LayoutSize newBorderBoxSize = size(); LayoutSize newBorderBoxSize = size();
// If border box size didn't change, RenderBox's incrementallyInvalidatePaint() is good. // If border box size didn't change, RenderObject's incrementallyInvalidatePaint() is good.
if (oldBorderBoxSize == newBorderBoxSize) if (oldBorderBoxSize == newBorderBoxSize)
return; return;
...@@ -3983,7 +3983,7 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint ...@@ -3983,7 +3983,7 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
positionFromPaintInvalidationBacking.y(), positionFromPaintInvalidationBacking.y(),
deltaWidth + borderWidth, deltaWidth + borderWidth,
std::max(oldBorderBoxSize.height(), newBorderBoxSize.height())); std::max(oldBorderBoxSize.height(), newBorderBoxSize.height()));
invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRect, PaintInvalidationIncremental); invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds);
} }
// Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height. // Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height.
...@@ -3997,10 +3997,28 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint ...@@ -3997,10 +3997,28 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
positionFromPaintInvalidationBacking.y() + smallerHeight - borderHeight, positionFromPaintInvalidationBacking.y() + smallerHeight - borderHeight,
std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()),
deltaHeight + borderHeight); deltaHeight + borderHeight);
invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRect, PaintInvalidationIncremental); invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds);
} }
} }
void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutLayerModelObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& oldBounds, const LayoutRect& newBounds)
{
if (rect.isEmpty())
return;
LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds);
LayoutRect rectClippedByNewBounds = intersection(rect, newBounds);
// Invalidate only once if the clipped rects equal.
if (rectClippedByOldBounds == rectClippedByNewBounds) {
invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByOldBounds, PaintInvalidationIncremental);
return;
}
// Invalidate the bigger one if one contains another. Otherwise invalidate both.
if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByOldBounds, PaintInvalidationIncremental);
if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByNewBounds, PaintInvalidationIncremental);
}
void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScope) void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScope)
{ {
ASSERT(!needsLayout()); ASSERT(!needsLayout());
......
...@@ -697,6 +697,8 @@ protected: ...@@ -697,6 +697,8 @@ protected:
virtual bool hasNonCompositedScrollbars() const override final; virtual bool hasNonCompositedScrollbars() const override final;
private: private:
void invalidatePaintRectClippedByOldAndNewBounds(const LayoutLayerModelObject& paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, const LayoutRect& newBounds);
void updateShapeOutsideInfoAfterStyleChange(const LayoutStyle&, const LayoutStyle* oldStyle); void updateShapeOutsideInfoAfterStyleChange(const LayoutStyle&, const LayoutStyle* oldStyle);
void updateGridPositionAfterStyleChange(const LayoutStyle*); void updateGridPositionAfterStyleChange(const LayoutStyle*);
......
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