Bug 205135 - UIWKDocumentContext returns 0 character rects when caret is at beginning or end of text
Summary: UIWKDocumentContext returns 0 character rects when caret is at beginning or e...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-12-11 14:08 PST by Daniel Bates
Modified: 2019-12-11 15:43 PST (History)
2 users (show)

See Also:


Attachments
Patch and unit tests (6.10 KB, patch)
2019-12-11 14:24 PST, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and more unit tests (8.50 KB, patch)
2019-12-11 15:35 PST, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.