Skip to content

Commit aade634

Browse files
Ahmad-S792darinadler
authored andcommitted
Inset box-shadow incorrectly positioned on table cells with collapsed borders
https://bugs.webkit.org/show_bug.cgi?id=306607 rdar://169254286 Reviewed by Darin Adler. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. When painting inset box-shadows on table cells with collapsed borders, we were positioning the shadow too far inward, exposing the background color. This occurred because collapsed borders report half-widths through borderTop()/borderLeft() etc., but BackgroundPainter expects the border box to be at the outer edge when calculating inset shadow bounds. The fix expands the paint rect by the half-widths before passing it to BackgroundPainter for inset shadows. BackgroundPainter then subtracts these half-widths to compute the inner edge, correctly positioning the inset shadow at the true inner edge of the collapsed border. * Source/WebCore/rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::paintBoxDecorations): * LayoutTests/TestExpectations: Progression Canonical link: https://commits.webkit.org/307661@main
1 parent 2b6b310 commit aade634

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

LayoutTests/TestExpectations

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6857,7 +6857,6 @@ imported/w3c/web-platform-tests/css/css-tables/absolute-tables-007.html [ ImageO
68576857
imported/w3c/web-platform-tests/css/css-tables/absolute-tables-011.tentative.html [ ImageOnlyFailure ]
68586858
imported/w3c/web-platform-tests/css/css-tables/absolute-tables-015.html [ ImageOnlyFailure ]
68596859
imported/w3c/web-platform-tests/css/css-tables/anonymous-table-ws-001.html [ ImageOnlyFailure ]
6860-
imported/w3c/web-platform-tests/css/css-tables/box-shadow-001.html [ ImageOnlyFailure ]
68616860
imported/w3c/web-platform-tests/css/css-tables/col-definite-min-size-001.html [ ImageOnlyFailure ]
68626861
imported/w3c/web-platform-tests/css/css-tables/fixup-dynamic-anonymous-inline-table-001.html [ ImageOnlyFailure ]
68636862
imported/w3c/web-platform-tests/css/css-tables/fixup-dynamic-anonymous-inline-table-002.html [ ImageOnlyFailure ]

Source/WebCore/rendering/RenderTableCell.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,12 @@ void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoin
16431643
// Paint our cell background.
16441644
paintBackgroundsBehindCell(paintInfo, paintOffset, this, paintOffset);
16451645

1646-
backgroundPainter.paintBoxShadow(paintRect, style(), Style::ShadowStyle::Inset);
1646+
// For collapsed borders, we expand from inner edge to outer edge for inset shadow painting.
1647+
LayoutRect insetShadowRect = paintRect;
1648+
if (table->collapseBorders())
1649+
insetShadowRect.expand(RectEdges<LayoutUnit> { borderTop(), borderRight(), borderBottom(), borderLeft() });
1650+
1651+
backgroundPainter.paintBoxShadow(insetShadowRect, style(), Style::ShadowStyle::Inset);
16471652

16481653
if (!style().border().hasBorder() || table->collapseBorders())
16491654
return;

0 commit comments

Comments
 (0)