Skip to content

Commit

Permalink
Fix wrong PaintInvalidationIncremental on empty object
Browse files Browse the repository at this point in the history
The bug was because LayoutBox::getPaintInvalidatinReason()
returned PaintInvalidationIncremental after
LayoutObject::getPaintInvalidationReason() returned
PaintInvalidationNone for an empty object. In the case we
should not do any paint invalidation but executed
incrementallyInvalidatePaint() and triggered the assertion
failure.

BUG=634807

Review-Url: https://codereview.chromium.org/2212223004
Cr-Commit-Position: refs/heads/master@{#410231}
  • Loading branch information
wangxianzhu authored and Commit bot committed Aug 6, 2016
1 parent b886659 commit b9ec37c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "Content Root Layer",
"bounds": [800, 600],
"children": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<script src="../../fast/repaint/resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
target.style.top = '200px';
target.style.left = '200px';
target.style.width = '200px';
target.style.height = '200px';
}
onload = runRepaintTest;
</script>
Tests paint invalidation of an empty object when moved and resized.
It passes if there is not any assertion failure or paint invalidation.
<div id="target" style="position: absolute; top: 100px; left: 100px; width: 100px; height: 100px"></div>
4 changes: 2 additions & 2 deletions third_party/WebKit/Source/core/layout/LayoutBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@ bool LayoutBox::paintedOutputOfObjectHasNoEffect() const
return false;

// Cannot skip paint invalidation if the box has real things to paint.
if (getSelectionState() != SelectionNone || hasBoxDecorationBackground() || styleRef().hasVisualOverflowingEffect())
if (getSelectionState() != SelectionNone || hasBoxDecorationBackground() || styleRef().hasBoxDecorations() || styleRef().hasVisualOverflowingEffect())
return false;

// If the box has clip, we need issue a paint invalidation to cover the changed part of
Expand Down Expand Up @@ -4056,7 +4056,7 @@ PaintInvalidationReason LayoutBox::getPaintInvalidationReason(const PaintInvalid
if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidateBackgroundOrBorderPaintOnHeightChange())
return PaintInvalidationBorderBoxChange;

return PaintInvalidationIncremental;
return styleRef().hasBackground() || styleRef().hasBoxDecorations() ? PaintInvalidationIncremental : invalidationReason;
}

void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const LayoutPoint& positionFromPaintInvalidationBacking)
Expand Down

0 comments on commit b9ec37c

Please sign in to comment.