Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e4d6f095cfbba338af740f00311e48c8e3c5dd4e
      
https://github.com/WebKit/WebKit/commit/e4d6f095cfbba338af740f00311e48c8e3c5dd4e
  Author: Alan Baradlay <[email protected]>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/balance-line-break-overflowing-item-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/balance-line-break-overflowing-item-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/balance-line-break-overflowing-item.html
    M Source/WebCore/layout/formattingContexts/flex/FlexLineBreaker.cpp

  Log Message:
  -----------
  [Flex] flex-wrap: balance puts every item after an overflowing item on its 
own line
https://bugs.webkit.org/show_bug.cgi?id=324007
<rdar://problem/187242330>

Reviewed by Antti Koivisto.

    <div style="display: flex; flex-wrap: balance; width: 100px; column-gap: 
10px">
      <div style="width: 50px"></div>
      <div style="width: 300px"></div>
      <div style="width: 20px"></div>
      <div style="width: 20px"></div>
    </div>

The last two items should share the third line. Instead each got a line of its 
own.

Before balancing,
1, the line breaker walks the items once to record how many of them fit on a 
line starting at each index
2, the walk keeps a single end index across iterations so it never re-measures

but end only moves forward when something fits, so an item wider than the line 
leaves it behind start.

The next iteration then asks for the length of an empty range producing a 
length larger than any line,
so the walk stops at once and records that only one item fits.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/balance-line-break-overflowing-item-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/balance-line-break-overflowing-item-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/balance/balance-line-break-overflowing-item.html:
 Added.
* Source/WebCore/layout/formattingContexts/flex/FlexLineBreaker.cpp:
(WebCore::balancedLineBreaks):

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



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

Reply via email to