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>
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.
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)
(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?
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.
(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"
Created attachment 278851 [details] patch Added layout test. Thanks to Chris!
Committed r200872: <http://trac.webkit.org/changeset/200872>