Bug 148532

Summary: Selection has extra ClientRects at the end/beginning of some lines
Product: WebKit Reporter: Steve <steve>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, manian, rniwa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 9   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Repro none

Description Steve 2015-08-27 10:45:27 PDT
Created attachment 260069 [details]
Repro

Steps to reproduce:

1. Open this page in Safari: https://jsfiddle.net/3s6rpy8r/embedded/result/
2. Click the 'C' in the contenteditable region
3. Tap the RIGHT keyboard arrow key repeatedly to move the caret through the text
4. Notice when the caret is at the end of a line the ClientRects length is 2 (doesn't happen on the last line)
5. Notice when the caret is at the start of a line the ClientRects length is 2 (doesn't happen on the first line)
Comment 1 Radar WebKit Bug Importer 2015-09-09 15:38:25 PDT
<rdar://problem/22634654>
Comment 2 Brent Fulgham 2015-11-30 16:44:20 PST
It looks like the W3C standard for getClientRects is not yet finalized, so there is no consensus on how this should work. For now, Chrome and Safari agree on the behavior.

We should revisit this once the behavior is standardized.
Comment 3 Brent Fulgham 2015-11-30 16:45:00 PST
See <http://www.w3.org/TR/cssom-view>
Comment 4 Ahmad Saleem 2022-07-28 14:29:11 PDT
I am able to reproduce this bug in Safari 15.6 on macOS 12.5 and it shows "ClientRects.length" (2) while end and start of the line while all other browsers (Chrome Canary 106 and Firefox Nightly 105) only show '1'. Thanks!
Comment 5 Vitor Roriz 2022-08-15 09:42:53 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3312
Comment 6 EWS 2022-08-17 13:37:56 PDT
Committed 253536@main (b9508a969a49): <https://commits.webkit.org/253536@main>

Reviewed commits have been landed. Closing PR #3312 and removing active labels.