Skip to content

Commit 8f69515

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
[CSS Tables] scrollWidth incorrectly inflated by collapsed border overflow
https://bugs.webkit.org/show_bug.cgi?id=291514 rdar://149675907 Reviewed by Alan Baradlay. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Collapsed borders that extend outside a table's border box are a painting artifact and should not contribute to scrollable overflow. Previously, addOverflowFromInFlowChildren() passed the collapsed border overflow rect to both addLayoutOverflow() and addVisualOverflow(), causing the scroll container's scrollWidth/scrollHeight to include the outer half of any collapsed section/cell border. Remove the addLayoutOverflow() call so only visual overflow is recorded for collapsed border geometry. * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/collapsed-scroll-overflow-expected.txt: * Source/WebCore/rendering/RenderTable.cpp: (WebCore::RenderTable::addOverflowFromInFlowChildren): Canonical link: https://commits.webkit.org/308311@main
1 parent 09985fa commit 8f69515

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
header body body body body body body body body body body body
22

3-
FAIL collapsed-scroll-overflow assert_equals: The collapsed border does not exceed the scroll container. expected 500 but got 540
3+
PASS collapsed-scroll-overflow
44

Source/WebCore/rendering/RenderTable.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (C) 1998 Waldo Bastian ([email protected])
55
* (C) 1999 Lars Knoll ([email protected])
66
* (C) 1999 Antti Koivisto ([email protected])
7-
* Copyright (C) 2003-2025 Apple Inc. All rights reserved.
7+
* Copyright (C) 2003-2026 Apple Inc. All rights reserved.
88
* Copyright (C) 2014-2019 Google Inc. All rights reserved.
99
* Copyright (C) 2006 Alexey Proskuryakov ([email protected])
1010
*
@@ -810,7 +810,10 @@ void RenderTable::addOverflowFromInFlowChildren(OptionSet<ComputeOverflowOptions
810810
LayoutUnit topBorderOverflow = borderTop() - outerBorderTop();
811811
LayoutRect borderOverflowRect(leftBorderOverflow, topBorderOverflow, rightBorderOverflow - leftBorderOverflow, bottomBorderOverflow - topBorderOverflow);
812812
if (borderOverflowRect != borderBoxRect()) {
813-
addLayoutOverflow(borderOverflowRect);
813+
// Do NOT add layout overflow for collapsed borders — they are a
814+
// painting artifact and must not inflate the scroll container's
815+
// scrollWidth/scrollHeight.
816+
// See https://github.com/w3c/csswg-drafts/issues/6230
814817
addVisualOverflow(borderOverflowRect);
815818
}
816819
}

0 commit comments

Comments
 (0)