Bug 1668958 - Don't wrap to first word when getting right word at end of input. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D92310
This commit is contained in:
Eitan Isaacson 2020-10-06 22:19:13 +00:00
Родитель 10dfa8214c
Коммит 029b948f0c
2 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -333,7 +333,7 @@ void HyperTextAccessibleWrap::RightWordAt(int32_t aOffset,
int32_t* aEndOffset) {
TextPoint here(this, aOffset);
TextPoint end = FindTextPoint(aOffset, eDirNext, eSelectWord, eEndWord);
if (!end.mContainer || end < here) {
if (!end.mContainer || end < here || here == end) {
// If we didn't find a word end, or if we wrapped around (bug 1652833),
// return with no result.
return;
@ -341,11 +341,8 @@ void HyperTextAccessibleWrap::RightWordAt(int32_t aOffset,
if ((NativeState() & states::EDITABLE) &&
!(end.mContainer->NativeState() & states::EDITABLE)) {
// The word search crossed an editable boundary. Return the last word of the
// editable root.
return EditableRoot()->LeftWordAt(
nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, aStartContainer,
aStartOffset, aEndContainer, aEndOffset);
// The word search crossed an editable boundary. Return with no result.
return;
}
TextPoint start =

Просмотреть файл

@ -1983,7 +1983,7 @@
{ style: "deceived you",
paragraph: "deceived you",
lines: ["I deceived you, mom.", "I deceived you, mom.", "I deceived you, mom."],
words: ["you", "deceived"],
words: ["you", ""],
element: ["AXTextField", "deceived you"] },
{ style: ", mom.",
paragraph: "I deceived you, mom.",