Commit 045386cd authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[PE] Ensure invalidation of table section when any table col is replaced

Table section paints table col's background on its display item, so when
table col's background changes, we invalidate all table sections.
See https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/paint/table_paint_invalidator.cc?rcl=597a899086d4baebb543eb55b7bd283a3b2068a1&l=43

Now let LayoutObject::BackgroundChangedSinceLastPaintInvalidation() be
initially true, so that a new col will be treated as background changed.

Bug: 837258
Change-Id: Ic8efcbeb45ee879106f045b262fc4ee8e27cf891
Reviewed-on: https://chromium-review.googlesource.com/1043350Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556266}
parent 88eff88d
<!DOCTYPE html>
<style>td { width: 50px; height: 20px; background: green }</style>
<p style="height: 50px">
Tests repaint of table sections when a col is replaced.
Passes if there are 3 green rectangles without red.
</p>
<table>
<thead><tr><td></td></tr></thead>
<tbody><tr><td></td></tr></tbody>
<tfoot><tr><td></td></tr></tfoot>
</table>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "LayoutTableSection THEAD",
"rect": [8, 82, 56, 26],
"reason": "style change"
},
{
"object": "LayoutTableSection TFOOT",
"rect": [8, 132, 56, 24],
"reason": "style change"
},
{
"object": "LayoutTableSection TBODY",
"rect": [8, 108, 56, 24],
"reason": "style change"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutTable TABLE",
"reason": "full"
},
{
"object": "LayoutTableSection THEAD",
"reason": "style change"
},
{
"object": "LayoutTableSection TBODY",
"reason": "style change"
},
{
"object": "LayoutTableSection TFOOT",
"reason": "style change"
},
{
"object": "LayoutTableCol COL",
"reason": "appeared"
}
]
}
<!DOCTYPE html>
<style>td { width: 50px; height: 20px }</style>
<script src="../resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
col.remove();
var new_col = document.createElement('col');
new_col.style.background = 'green';
colgroup.insertBefore(new_col, colgroup.firstChild);
}
onload = runRepaintAndPixelTest;
</script>
<p style="height: 50px">
Tests repaint of table sections when a col is replaced.
Passes if there are 3 green rectangles without red.
</p>
<table>
<colgroup id="colgroup">
<col id="col" style="background: red">
</colgroup>
<thead><tr><td></td></tr></thead>
<tbody><tr><td></td></tr></tbody>
<tfoot><tr><td></td></tr></tfoot>
</table>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "LayoutTable TABLE",
"rect": [8, 82, 56, 74],
"reason": "full"
},
{
"object": "LayoutTableCol COL",
"rect": [8, 82, 56, 74],
"reason": "appeared"
},
{
"object": "LayoutTableCol COL id='col'",
"rect": [8, 82, 56, 74],
"reason": "disappeared"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutTableCol COL id='col'",
"reason": "disappeared"
},
{
"object": "LayoutTable TABLE",
"reason": "full"
},
{
"object": "LayoutTableSection THEAD",
"reason": "style change"
},
{
"object": "LayoutTableSection TBODY",
"reason": "style change"
},
{
"object": "LayoutTableSection TFOOT",
"reason": "style change"
},
{
"object": "LayoutTableCol COL",
"reason": "appeared"
}
]
}
...@@ -2328,7 +2328,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -2328,7 +2328,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
needs_paint_property_update_(true), needs_paint_property_update_(true),
subtree_needs_paint_property_update_(true), subtree_needs_paint_property_update_(true),
descendant_needs_paint_property_update_(true), descendant_needs_paint_property_update_(true),
background_changed_since_last_paint_invalidation_(false), background_changed_since_last_paint_invalidation_(true),
outline_may_be_affected_by_descendants_(false), outline_may_be_affected_by_descendants_(false),
previous_outline_may_be_affected_by_descendants_(false), previous_outline_may_be_affected_by_descendants_(false),
is_truncated_(false), is_truncated_(false),
......
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