Bug 263306

Summary: DOMSelection toString doesn't work with flex-direction:row
Product: WebKit Reporter: Morgan Redding <morganfredding>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: megan_gardner, rniwa, sgill26, wenson_hsieh, zalan
Priority: P2    
Version: Safari 17   
Hardware: All   
OS: All   
Attachments:
Description Flags
test none

Description Morgan Redding 2023-10-17 23:48:16 PDT
When an element with "display:flex; flex-direction:row" is selected, selection.toString() inserts newlines between the child elements.

Bug is on both Desktop and iOS Safari

Safari Version: Version 17.0 (18616.1.27.111.22, 18616)

Bug is not present in Chrome

Repro steps:

```
myDiv.innerHTML = `<div style="display:flex; flex-direction:row;"><div>a</div><div>b</div></div>`;
r = document.createRange();
r.setStartBefore(myDiv);
r.setEndAfter(myDiv);
sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(r);
sel.toString()
```

Expected: "ab"

Actual: "
a
b
"
Comment 1 Ryosuke Niwa 2023-10-18 14:52:04 PDT
Created attachment 468266 [details]
test

As far as I've tested, Chrome 118.0.5993.70 as well as Firefox 118.0.2 both serializes this as "a\nb" with new line in between "a" and "b".