Bug 227337 - [Legacy line layout] Incorrect wrap position at <wbr> in "white-space: pre" content.
Summary: [Legacy line layout] Incorrect wrap position at <wbr> in "white-space: pre" c...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-23 21:30 PDT by Cameron McCormack (:heycam)
Modified: 2021-06-30 21:31 PDT (History)
4 users (show)

See Also:


Attachments
test (304 bytes, text/html)
2021-06-23 21:30 PDT, Cameron McCormack (:heycam)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2021-06-23 21:30:16 PDT
Created attachment 432131 [details]
test

Noticed this looking at https://developer.apple.com/documentation/coretext/1510813-ctfontgetglyphsforcharacters?language=objc.

STR:

1. Open the attached test.
2. Click somewhere in the "Char" of "UniChar".
3. Notice that the line of text wraps (and not all of it gets repainted).

Are we incorrectly computing the intrinsic minimum width of the text by not taking into account the word wrap opportunities?

Doesn't reproduce with LFC for inline layout turned off.
Comment 1 zalan 2021-06-24 08:09:21 PDT
Yeah, it happens when legacy line layout and IFC disagrees on the layout.
According to https://www.w3.org/TR/css-text-3/#white-space-property, 
white-space: pre -> "Lines only break at forced line breaks; content that does not fit within the block container overflows it." 
While <wbr> acts as a line breaking opportunity, it is not a forced line break.
IFC layout also matches FF.
Sadly, clicking on the content forces us to fallback to legacy line layout and it makes the content wrap and we fail to make the containing block taller (as the fallback code only runs the line layout and not the block one)
We need to patch legacy line layout.
Comment 2 zalan 2021-06-24 08:16:02 PDT
>Are we incorrectly computing the intrinsic minimum width of the text by not taking into account the word wrap opportunities?
The content in inside a fixed width containing block, so we don't really compute intrinsic width here. It's simply about ignoring the soft line break opportunities (<wbr>) and letting the content overflow as specified by the spec.
Comment 3 Radar WebKit Bug Importer 2021-06-30 21:31:21 PDT
<rdar://problem/80001586>