Bug 276549

Summary: Aware of pre-line value of CSS white-space property when copying a selection
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: karlcow, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 289597    

Ahmad Saleem
Reported 2024-07-12 14:19:08 PDT
Hi Team, While going through Blink's commit, I came across another failing test case: Test Case: https://jasonwoof.com/downloads/pre-white.html Self-explanatory - copy paste text and you will see 'Safari' losing line-break while in case of Chrome Canary 128, it works same as above. Firefox Nightly 130 is also broken in weird way. Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/3564239b151f615afca39cfd886d225a2b4740f8 WebKit Source: https://searchfox.org/wubkat/rev/1cd233f7b4c8aea2960227249d0a2f36aa52b1de/Source/WebCore/editing/TextIterator.cpp#669 This compiles: if (isNewlineOrTab(rendererText[runStart])) { // We need to preserve new lines in case of Pre-line. if (renderer->style().whiteSpace() == WhiteSpace::PreLine) emitCharacter('\n', textNode.copyRef(), nullptr, runStart, runStart); else emitCharacter(' ', textNode.copyRef(), nullptr, runStart, runStart + 1); m_offset = runStart + 1; } else { ____ While this compiles, it does not progress one subtest from attach test case, which might be totally different test case but just wanted to raise so we can track it. Thanks!
Attachments
Ahmad Saleem
Comment 1 2024-07-12 14:25:43 PDT
In http://wpt.live/html/dom/elements/the-innertext-and-outertext-properties/getter.html: It progress these two: > \n preserved ("<div style='white-space:pre-line'>abc\ndef") > \r converted to newline ("<div style='white-space:pre-line'>abc\rdef") while fail: > \t converted to space ("<div style='white-space:pre-line'>abc\tdef") ___ Which make sense since if we look into WebKit code, we have 'isNewlineOrTab' while Blink has 'isNewline', so Blink already tackled 'tab' separately. So I think we might need to do pre-requisite as well.
Radar WebKit Bug Importer
Comment 2 2024-07-19 14:20:14 PDT
Note You need to log in before you can comment on or make changes to this bug.