Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 423f2910dd1a255c5885c9c4d0aa09cf6addb403
      
https://github.com/WebKit/WebKit/commit/423f2910dd1a255c5885c9c4d0aa09cf6addb403
  Author: Yulun Wu <[email protected]>
  Date:   2026-01-26 (Mon, 26 Jan 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp
    M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.h

  Log Message:
  -----------
  [GFC] Fully implement flex track sizing algorithm 11.7.1.
https://bugs.webkit.org/show_bug.cgi?id=303707
<rdar://166013939>

Reviewed by Sammy Gill.

This PR fully implement fr sizing algorithm as per:

https://drafts.csswg.org/css-grid-1/#algo-find-fr-size

in `findSizeOfFr()`

Steps 1-3 are handled by `computeHypotheticalFrSize`:

1. Let leftover space be the space to fill minus the base sizes of the 
non-flexible grid tracks.
2. Let flex factor sum be the sum of the flex factors of the flexible tracks. 
If this value is less than 1, set it to 1 instead.
3. Let the hypothetical fr size be the leftover space divided by the flex 
factor sum.

Step 4 is handled by `isValidFlexFactorUnit`:
If the product of the hypothetical fr size and a flexible track’s flex factor 
is less than the track’s base size, restart this algorithm treating all such 
tracks as inflexible.

* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::InflexibleTrackState::isFlexible const):
(WebCore::Layout::InflexibleTrackState::markAsInflexible):
(WebCore::Layout::computeHypotheticalFrSize):
(WebCore::Layout::isValidFlexFactorUnit):
(WebCore::Layout::TrackSizingAlgorithm::sizeTracks):
(WebCore::Layout::TrackSizingAlgorithm::findSizeOfFr):
(WebCore::Layout::TrackSizingAlgorithm::leftoverSpace): Deleted.
* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.h:

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



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

Reply via email to