Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd1628731f5e8164788c7bcbcb72a67fb10fb98e
      
https://github.com/WebKit/WebKit/commit/bd1628731f5e8164788c7bcbcb72a67fb10fb98e
  Author: Sammy Gill <[email protected]>
  Date:   2026-04-29 (Wed, 29 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/replaced-element-percentage-height-in-grid-nested-in-flex-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/replaced-element-percentage-height-in-grid-nested-in-flex-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/replaced-element-percentage-height-in-grid-nested-in-flex-002-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/replaced-element-percentage-height-in-grid-nested-in-flex-002.html
    M Source/WebCore/rendering/RenderReplaced.cpp

  Log Message:
  -----------
  `height: 100%` has wrong calculation for img as grid cell nested inside 
flexbox
rdar://169431440
https://bugs.webkit.org/show_bug.cgi?id=306258

Reviewed by Alan Baradlay.

When a replaced element is a grid item then its containing block becomes
the grid area which is computed during grid layout. The code we are
changing in this patch already has this existing logic, but we do not
currently use it to resolve the percentage because we end up checking
the containing block of the grid item (i.e. the grid) to see if has some
sort of stretched height in the formatting context it participates in.

To fix this issue we just swap the order of these checks becuase the
element being a grid item has a stronger precedence than any logic than
the formatting context the grid is in. Said another way, since grid
layout is responsible for computing and setting the containing block for
the item we should try to respect it.

Test: 
imported/w3c/web-platform-tests/css/css-grid/replaced-element-percentage-height-in-grid-nested-in-flex-001.html
      
imported/w3c/web-platform-tests/css/css-grid/replaced-element-percentage-height-in-grid-nested-in-flex-002.html

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



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

Reply via email to