Commit 1fc685bb authored by David Grogan's avatar David Grogan Committed by Commit Bot

[LayoutNG] Fix painting box-shadow on collapsed border table cells

NG had BoxPainterBase subtract the borders, which does so without paying
attention to collapsed borders. Legacy subtracted the (collapsed)
borders first, then passed the results to BoxPainterBase. This patch
ports that behavior to NG.

Bug: 1006241
Change-Id: I61b0f464f0e63d1dac84239e1e45a596cbad1cf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862721
Commit-Queue: David Grogan <dgrogan@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706798}
parent 0325e87c
...@@ -762,9 +762,21 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackgroundWithRect( ...@@ -762,9 +762,21 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackgroundWithRect(
} }
if (box_decoration_data.ShouldPaintShadow()) { if (box_decoration_data.ShouldPaintShadow()) {
PaintInsetBoxShadowWithBorderRect(paint_info, paint_rect, style, if (layout_box.IsTableCell()) {
border_edges.line_left, PhysicalRect inner_rect = paint_rect;
border_edges.line_right); inner_rect.Contract(layout_box.BorderBoxOutsets());
// PaintInsetBoxShadowWithInnerRect doesn't subtract borders before
// painting. We have to use it here after subtracting collapsed borders
// above. PaintInsetBoxShadowWithBorderRect below subtracts the borders
// specified on the style object, which doesn't account for border
// collapsing.
BoxPainterBase::PaintInsetBoxShadowWithInnerRect(paint_info, inner_rect,
style);
} else {
PaintInsetBoxShadowWithBorderRect(paint_info, paint_rect, style,
border_edges.line_left,
border_edges.line_right);
}
} }
// The theme will tell us whether or not we should also paint the CSS // The theme will tell us whether or not we should also paint the CSS
......
<!DOCTYPE html>
<title>Collapsed borders and box-shadow</title>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#in-collapsed-borders-mode">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#box-shadow">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<link rel="bookmark" href="https://crbug.com/1006241" />
<meta name="flags" content="" />
<meta name="assert" content="box-shadow size and location on a cell with collapsed borders are calculated correctly" />
<style>
table {
border-collapse: collapse;
}
/* Make the green box-shadow start at the inner edge of the border to cover up all the red.
Chrome's bug made the box-shadow start further toward the center. */
td {
border: 20px solid green;
box-shadow: inset 60px 0px green;
/* The properties after the blank line aren't the focus of the test. */
background: red;
line-height: 0px;
padding: 0px;
}
td > span {
display: inline-block; /* chrome only hits this bug when the td children are inline */
height: 60px;
width: 60px;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<table>
<tr>
<td><span></span></td>
</tr>
</table>
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