Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5762dcfd7a2b70730a056cae86ee934cc875a2d6
      
https://github.com/WebKit/WebKit/commit/5762dcfd7a2b70730a056cae86ee934cc875a2d6
  Author: Sammy Gill <[email protected]>
  Date:   2025-04-08 (Tue, 08 Apr 2025)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-max-content-size-with-max-content-item-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-max-content-size-with-max-content-item.html
    M Source/WebCore/rendering/RenderBlock.cpp

  Log Message:
  -----------
  wixstudio.com: Grid item with width: max-content overflows width: max-content 
grid and min-content column.
rdar://147837389
https://bugs.webkit.org/show_bug.cgi?id=289961

Reviewed by Alan Baradlay.

Consider the following piece of grid content:
<grid style="width: max-content; grid-template-columns: min-content;">
  <item style="width: max-content">foo bar</item>
</grid>

When sizing the grid to resolve its max-content size, we run the grid
track sizing algorithm, which requires the min-content contribution of
the grid item. The track sizing algorithm uses minPreferredLogicalWidth()
to compute this size, which eventually calls into 
RenderBlock::computePreferredLogicalWidths(),
and we end up setting the minimum preferred logical width to its min-content
size, completely ignoring the width: max-content on the box. This ends up
sizing the grid to the content's min-content size, but the content ends
up getting sized to its max-content size when we perform layout on it
after all of the track sizing and other grid activities.

In RenderBlock::computePreferredLogicalWidths(), we can check to see for
width: max-content and set the min preferred logical width to the
max-content size if we reach this case.

Note that RenderBlock::computeChildPreferredLogicalWidths() has some
logic to do this already, but we cannot use this in this case since the
logic doesn't work for other types of grid content (e.g. orthogonal grid
items).

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-max-content-size-with-max-content-item-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-max-content-size-with-max-content-item.html:
 Added.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computePreferredLogicalWidths):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to