Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 53138ef3cc2f6ac707b3c1ea9751d4587b8837aa
      
https://github.com/WebKit/WebKit/commit/53138ef3cc2f6ac707b3c1ea9751d4587b8837aa
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-10 (Mon, 10 Aug 2026)

  Changed paths:
    M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  -----------
  [remove-anon-block] A block level box on a line switches off text-wrap: 
balance for the whole container
https://bugs.webkit.org/show_bug.cgi?id=321385

Reviewed by Antti Koivisto.

cannotConstrainInlineItem rejects any item that is neither text, nor a soft 
line break, nor an inline
level box, which a block level box on a line is not. That sets 
m_cannotConstrainContent, so initialize()
returns before laying anything out, computeParagraphLevelConstraints returns 
nothing, and no available
line width override is installed: the container is not balanced at all. With 
anonymous block generation
each run of inline content is its own formatting context and balances on its 
own, so the block level box
never reaches the constrainer.

Let a block level box through, and chunk on it. The constrainer already splits 
content into chunks at
forced line breaks and constrains each separately; a line holding a block level 
box now ends the chunk
before it and forms a chunk of its own, which is left unconstrained the way any 
chunk we cannot constrain
already is. The text on either side of the box is balanced separately, matching 
what the anonymous block
wrappers used to give us.

Covered by 
imported/w3c/web-platform-tests/css/css-text/white-space/text-wrap-balance-before-after-001.html
and -002.html.

* Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp:
(WebCore::Layout::cannotConstrainInlineItem):
(WebCore::Layout::InlineContentConstrainer::initialize):
(WebCore::Layout::InlineContentConstrainer::computeParagraphLevelConstraints):
* Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h:

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



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

Reply via email to