Bug 249840

Summary: [text-wrap] Support text-wrap: balance
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: Layout and RenderingAssignee: David Choi <david_choi5>
Status: RESOLVED FIXED    
Severity: Normal CC: andrew, bfulgham, bramus, bugs.webkit.org, dev, hellodanielgamage, johannes.odland, rik, safari-dev, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 245561    

Description Tim Nguyen (:ntim) 2022-12-23 00:15:10 PST
https://drafts.csswg.org/css-text-4/#valdef-text-wrap-balance

> balance

Same as wrap for inline boxes. For block containers that establish an inline formatting context, line breaks are chosen to balance the remaining (empty) space in each line box, if better balance than wrap is possible. This must not change the number of line boxes the block would contain if text-wrap were set to wrap.
The remaining space to consider is that which remains after placing floats and inline content, but before any adjustments due to text justification. Line boxes are balanced when the standard deviation from the average inline-size of the remaining space in each line box is reduced over the block (including lines that end in a forced break).

The exact algorithm is UA-defined.

UAs may treat this value as wrap if there are more than ten lines to balance.
Comment 1 Radar WebKit Bug Importer 2022-12-23 00:16:46 PST
<rdar://problem/103663513>
Comment 2 Tim Nguyen (:ntim) 2022-12-23 01:32:47 PST
*** Bug 230473 has been marked as a duplicate of this bug. ***
Comment 3 David Choi 2023-06-27 15:44:39 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15348
Comment 4 David Choi 2023-08-07 15:39:56 PDT
Pull request: https://github.com/WebKit/WebKit/pull/16455
Comment 5 David Choi 2023-08-15 15:20:39 PDT
Pull request: https://github.com/WebKit/WebKit/pull/16723
Comment 6 EWS 2023-08-16 19:53:13 PDT
Committed 266980@main (2d299a2dd8bb): <https://commits.webkit.org/266980@main>

Reviewed commits have been landed. Closing PR #16723 and removing active labels.