Bug 205135

Summary: UIWKDocumentContext returns 0 character rects when caret is at beginning or end of text
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebKit Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch and unit tests
none
Patch and more unit tests none

Description Daniel Bates 2019-12-11 14:08:13 PST
Load a web page with the following markup:

[[
<!DOCTYPE html>
<html>
<body>
<p id='text' contenteditable>The quick brown fox jumps over the lazy dog.</p>
<script>
getSelection().setBaseAndExtent(text.firstChild, 0, text.firstChild, 0);
</script>
</body>
</html>
]]

The request a UIWKDocumentContext for rects with word granularity. Then UIWKDocumentContext.textRects is always the empty array. But it should be non-empty.
Comment 1 Daniel Bates 2019-12-11 14:08:24 PST
<rdar://problem/56887914>
Comment 2 Daniel Bates 2019-12-11 14:24:21 PST
Created attachment 385438 [details]
Patch and unit tests
Comment 3 Daniel Bates 2019-12-11 15:35:47 PST
Created attachment 385450 [details]
Patch and more unit tests

Added tests when the caret is at the beginning or end of the text and the text has leading or trailing non-breakable space.
Comment 4 Daniel Bates 2019-12-11 15:43:54 PST
Comment on attachment 385450 [details]
Patch and more unit tests

Clearing flags on attachment: 385450

Committed r253399: <https://trac.webkit.org/changeset/253399>
Comment 5 Daniel Bates 2019-12-11 15:43:55 PST
All reviewed patches have been landed.  Closing bug.