Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3d436acad33f6ebc79a75acf0aed418a489c37f9
      
https://github.com/WebKit/WebKit/commit/3d436acad33f6ebc79a75acf0aed418a489c37f9
  Author: Sammy Gill <[email protected]>
  Date:   2026-06-29 (Mon, 29 Jun 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-block-axis-alignment-auto-margins-explicit-row-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-block-axis-alignment-auto-margins-explicit-row.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-calc-margins-explicit-row-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-calc-margins-explicit-row.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/reference/grid-block-axis-alignment-auto-margins-explicit-row-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/reference/grid-calc-margins-explicit-row-ref.html
    M Source/WebCore/layout/integration/grid/LayoutIntegrationGridCoverage.cpp

  Log Message:
  -----------
  [GFC] Items with auto or calc margins are not supported
https://bugs.webkit.org/show_bug.cgi?id=317983
rdar://problem/180765717

Reviewed by Alan Baradlay.

The grid coverage check uses MarginEdge::isPossiblyZero() to decide whether a
grid item has margins that force the legacy path. However, isPossiblyZero()
returns true for both the `auto` keyword and calc() values (keywords and calc()
are always treated as possibly-zero), so a grid item with an `auto` margin or a
calc() margin was not detected as having a margin and was allowed onto the
modern GFC path.

The modern path does not support these margins:
- auto margins were treated as zero, so the item was start-aligned within its
  grid area instead of having the auto margin absorb the free space (e.g. a
  `margin: auto 0` item was not centered in its row).
- a calc() margin containing a percentage was treated as a zero offset, so the
  item was placed at the start of its grid area (e.g. `margin-left: calc(10px +
  30%)` produced a 0px offset instead of 70px against a 200px grid area).

Detect both cases explicitly via MarginEdge::isAuto() and
MarginEdge::isCalculated() so these items fall back to the legacy grid layout
path, which resolves the margins correctly. Non-zero fixed and percentage
margins were already routed to legacy by the existing isPossiblyZero() check.

Add two reftests (reduced from grid-block-axis-alignment-auto-margins-008.html)
that use explicit row placement so the items stay on the modern path,
exercising the auto-margin and calc()-margin cases directly.

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



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

Reply via email to