AX: Incorrect range from index and length in text controls when there are newlines
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2017 18:12:08 +0000 (18:12 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2017 18:12:08 +0000 (18:12 +0000)
commit9b7cf69d4132ec4c425d1040121daa0770593d27
treeb227d6468a503294ca124a9d6099431dd01ce390
parent217195c7250bed76a5c76e14a972bcf2adb91dd5
AX: Incorrect range from index and length in text controls when there are newlines
https://bugs.webkit.org/show_bug.cgi?id=167677
<rdar://problem/30300099>

Reviewed by Chris Fleizach.

Source/WebCore:

When there are newlines in text controls, the VisiblePosition that is created
from the index could be wrong. Because the index doesn't include the information
regarding a position's affinity. Fixed it by using CharacterOffset instead, since
it doesn't require that information.

Test: accessibility/mac/range-for-contenteditable-newline.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::traverseToOffsetInRange):
(WebCore::AXObjectCache::nextCharacterOffset):
(WebCore::AXObjectCache::characterOffsetForIndex):

LayoutTests:

* accessibility/mac/range-for-contenteditable-newline-expected.txt: Added.
* accessibility/mac/range-for-contenteditable-newline.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/accessibility/mac/range-for-contenteditable-newline-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/range-for-contenteditable-newline.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AXObjectCache.cpp