Bug 211822 - Line wrapping is incorrect when both ("overflow-wrap: break-word"/"word-break:break-word") and ("white-space: pre") are set
Summary: Line wrapping is incorrect when both ("overflow-wrap: break-word"/"word-break...
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-12 18:19 PDT by Josh Brown
Modified: 2022-10-01 16:52 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Brown 2020-05-12 18:19:18 PDT
Line wrapping is incorrect when both ("overflow-wrap: break-word"/"word-break:break-word") and ("white-space: pre") are set.

If you set "overflow-wrap: break-word" or "word-break:break-word" and "white-space: pre", the element will wrap. This is contrary to the spec:

https://drafts.csswg.org/css-text-3/#propdef-overflow-wrap

> This property specifies whether the UA may break at otherwise disallowed points within a line to prevent overflow, when an otherwise-unbreakable string is too long to fit within the line box. **It only has an effect when white-space allows wrapping**...

See the example below: https://jsfiddle.net/nw30cvtu/


```
<style>
.wrapper {
  width: 100px;
  border: 2px solid black;
}

* {
  word-break: break-word;
}

.el {
  white-space: pre;
}
</style>
<div class="wrapper">
  <span class="el">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </span>
</div>

```


Both chrome and firefox follow the spec correctly and don't wrap.
Comment 1 Radar WebKit Bug Importer 2020-05-13 16:22:12 PDT
<rdar://problem/63205322>
Comment 2 Ahmad Saleem 2022-10-01 16:52:23 PDT
I am not able to reproduce this bug in Safari 16 and STP 154 and it matches in rendering with Chrome Canary 108 and Firefox Nightly 108 and does not wrap.

I think it is progression from IFC work done by Alan.

Marking this as "RESOLVED CONFIGURATION CHANGED". Please reopen, if it is reproducible with updated test case. Thanks!