Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 91844883b4cca8301c9b9a5605f8098443ef80bd
      
https://github.com/WebKit/WebKit/commit/91844883b4cca8301c9b9a5605f8098443ef80bd
  Author: Yulun Wu <[email protected]>
  Date:   2026-06-18 (Thu, 18 Jun 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-fractional-flex-factor-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-fractional-flex-factor-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-fractional-flex-factor.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-free-space-distribution-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-free-space-distribution-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-free-space-distribution.html
    M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp

  Log Message:
  -----------
  [GFC] Flex tracks are sized imprecisely
https://bugs.webkit.org/show_bug.cgi?id=317051
rdar://179531801

Reviewed by Sammy Gill.

GFC was was casting unitless flex factor into a LayoutUnit before multiplying 
it by the fr size.
LayoutUnit has 1/64px resolution causing fractional flex factors such as 1.01fr 
to be quantized to 1.0fr.

This would cause "grid-template-columns: 1.01fr 0.99fr 1fr" in a 600px grid 
produced three equal
200px columns instead of 202/198/200.

In addition, each track's size was floored to a LayoutUnit independently, 
causing 1/64px rouding errors
to accumulate and the resulting tracks would not sum to the right size.

This would cause three 1fr tracks in a 100px grid totalled 99.98px rather than 
100px.

Fix both by using floats for fr size and flex factor and carrying the fraction 
lost to
flooring form one track to the next to fix the track size sum.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-fractional-flex-factor-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-fractional-flex-factor-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-fractional-flex-factor.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-free-space-distribution-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-free-space-distribution-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-flexible-track-free-space-distribution.html:
 Added.
* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::isValidFlexFactorUnit):
(WebCore::Layout::findSizeOfFr):
(WebCore::Layout::flexFractionFromTrackBaseSize):
(WebCore::Layout::applyFlexFractionToTracks):
(WebCore::Layout::expandFlexibleTracksForMaxContent):
(WebCore::Layout::expandFlexibleTracksForDefiniteLength):

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



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

Reply via email to