Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fa6448eb65a4ff24ace8e7b4f7b896127ffd929c
      
https://github.com/WebKit/WebKit/commit/fa6448eb65a4ff24ace8e7b4f7b896127ffd929c
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-19 (Tue, 19 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/sibling-nested-subgrids-overflow-hidden-contribution-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/sibling-nested-subgrids-overflow-hidden-contribution.html
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

  Log Message:
  -----------
  [css-grid] Nested CSS Subgrid with overflow:hidden clips content on 
subsequent items
https://bugs.webkit.org/show_bug.cgi?id=313648
rdar://175877530

Reviewed by Elika Etemad.

extraMarginFromSubgridAncestorGutters() walks an item's ancestor subgrid
chain and, at each ancestor's internal boundaries, adds half the
gutter-size difference between that ancestor and its parent to the
track.

The start-line check correctly used gridItemSpanInAncestor (ancestor-
local coords), but the end-line check compared itemSpan.endLine()
(outermost-grid coords) against the ancestor's local track count. For
any sibling subgrid after the first — whose outer-grid start line is
non-zero — the two sides live in different coordinate spaces and the
check fires spuriously, shifting the row's margin + border + padding
(MBP) floor by (subgridGap − parentGap) / 2.

Content contributions normally outrun this floor and hide the defect.
When a leaf uses overflow:hidden its automatic minimum resolves to
zero, the MBP floor becomes dominant, and the shift surfaces as
vertical clipping in every card after the first.

This patch fixes by evaluating the end-line check in ancestor-local
coords via gridItemSpanInAncestor.endLine(), matching the start-line
branch and GridLayoutFunctions::extraMarginForSubgrid.

Test: 
imported/w3c/web-platform-tests/css/css-grid/subgrid/sibling-nested-subgrids-overflow-hidden-contribution.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/sibling-nested-subgrids-overflow-hidden-contribution-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/sibling-nested-subgrids-overflow-hidden-contribution.html:
 Added.
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::extraMarginFromSubgridAncestorGutters):

Canonical link: https://commits.webkit.org/313503@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to