Bug 272534 - Break-word with a float can discard text
Summary: Break-word with a float can discard text
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2024-04-11 09:20 PDT by Caleb Hearon
Modified: 2024-04-13 12:29 PDT (History)
8 users (show)

See Also:


Attachments
rendering in safari, firefox, chrome (319.58 KB, image/png)
2024-04-11 17:27 PDT, Karl Dubost
no flags Details
screen recording of the layout with/without break-word in STP 192 (1.82 MB, video/quicktime)
2024-04-11 17:33 PDT, Karl Dubost
no flags Details
[fast-cq]Patch (4.37 KB, patch)
2024-04-13 05:46 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Caleb Hearon 2024-04-11 09:20:48 PDT
I found a case where Safari doesn't render text after a float when the float is inside a word that splits across multiple lines with word-break: break-word.

Quick link: https://jsfiddle.net/317e6a9f/

With the following HTML and CSS:

<div style="word-break: break-word; width: 20px;">
  abcd<div style="float: left; width: 5px; height: 5px; background-color: red;"></div>efghijk
</div>


The letters "ef" get placed after the float successfully, but the letters "ghijk" don't show up at all, and no line boxes are allocated for them. Tested in Safari TP and Safari 17.

Chrome does this correctly. Firefox puts the float on its own line, which doesn't seem right since letters would fit after. But I don't think the specs say much specifically about when floats can be placed.
Comment 1 Karl Dubost 2024-04-11 17:27:08 PDT
Created attachment 470874 [details]
rendering in safari, firefox, chrome

Safari Technology Preview  192           19619.1.8.1
Firefox Nightly            126.0a1       12624.4.11
Google Chrome Canary       125.0.6413.0  6413.0
Comment 2 Radar WebKit Bug Importer 2024-04-11 17:28:09 PDT
<rdar://problem/126309547>
Comment 3 Karl Dubost 2024-04-11 17:33:53 PDT
Created attachment 470875 [details]
screen recording of the layout with/without break-word in STP 192

Flipping on/off the word-break: break-word shows what is happening.
Comment 4 zalan 2024-04-13 05:46:10 PDT
Created attachment 470912 [details]
[fast-cq]Patch
Comment 5 EWS 2024-04-13 12:29:42 PDT
Committed 277461@main (30130d3b5da2): <https://commits.webkit.org/277461@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 470912 [details].