Bug 157644

Summary: AX: Wrong CharacterOffset from an upstream VisiblePosition
Product: WebKit Reporter: Nan Wang <n_wang>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, cfleizach, commit-queue, dmazzoni, jcraig, jdiggs, mario, n_wang, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Initial patch
none
patch cfleizach: review+

Nan Wang
Reported 2016-05-12 15:59:28 PDT
When we are getting a text marker at the line wrap and it has an upstream VisiblePosition, we should adjust the CharacterOffset as well. <rdar://problem/25993225>
Attachments
Initial patch (3.34 KB, patch)
2016-05-12 16:15 PDT, Nan Wang
no flags
patch (6.95 KB, patch)
2016-05-13 11:02 PDT, Nan Wang
cfleizach: review+
Nan Wang
Comment 1 2016-05-12 16:15:39 PDT
Created attachment 278776 [details] Initial patch Spent quite a long time but was not able to create a layout test. 1. In Mail the end text marker of left line range has upstream affinity but I tried left/right and regular line text marker range call in layout test it gave downstream affinity all the time. 2. Although I had the fix to adjust CharacterOffset to match Range's end offset, TextIterator will always include an extra space at the line wrap. So there's no easy way to test this fix in a layout test by using lengthForTextMarkerRange of stringForTextMarkerRange, they all use TextIterator under the hood.
chris fleizach
Comment 2 2016-05-12 17:47:38 PDT
Comment on attachment 278776 [details] Initial patch When I do a grep for upstream in LayoutTests, I see platform/ios-simulator-wk1/editing/pasteboard/4242293-expected.txt:caret: position 3 of child 0 {#text} of child 1 {SPAN} of child 6 {DIV} of body (upstream affinity)
chris fleizach
Comment 3 2016-05-13 08:49:23 PDT
(In reply to comment #2) > Comment on attachment 278776 [details] > Initial patch > > When I do a grep for upstream in LayoutTests, I see > > platform/ios-simulator-wk1/editing/pasteboard/4242293-expected.txt:caret: > position 3 of child 0 {#text} of child 1 {SPAN} of child 6 {DIV} of body > (upstream affinity) Do you think that test might help you figure out how to create an upstream position?
Darin Adler
Comment 4 2016-05-13 08:53:10 PDT
Comment on attachment 278776 [details] Initial patch View in context: https://bugs.webkit.org/attachment.cgi?id=278776&action=review > Source/WebCore/ChangeLog:11 > + Not able to create an upstream VisiblePosition in a layout test. Why is that? Can we please add something to internals so we can test this? This super-subtle behavior seems critical to test; people will break it without realizing it.
Nan Wang
Comment 5 2016-05-13 10:12:24 PDT
(In reply to comment #3) > (In reply to comment #2) > > Comment on attachment 278776 [details] > > Initial patch > > > > When I do a grep for upstream in LayoutTests, I see > > > > platform/ios-simulator-wk1/editing/pasteboard/4242293-expected.txt:caret: > > position 3 of child 0 {#text} of child 1 {SPAN} of child 6 {DIV} of body > > (upstream affinity) > > Do you think that test might help you figure out how to create an upstream > position? Yes I can create an upstream position by adding contenteditable="true"
Nan Wang
Comment 6 2016-05-13 11:02:49 PDT
Created attachment 278851 [details] patch Added layout test. Thanks to Chris!
Nan Wang
Comment 7 2016-05-13 11:56:46 PDT
Note You need to log in before you can comment on or make changes to this bug.