diff --git a/accessible/mac/HyperTextAccessibleWrap.mm b/accessible/mac/HyperTextAccessibleWrap.mm index 73ad1ef025fd..ac11c100a06f 100644 --- a/accessible/mac/HyperTextAccessibleWrap.mm +++ b/accessible/mac/HyperTextAccessibleWrap.mm @@ -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 = diff --git a/accessible/tests/browser/mac/doc_textmarker_test.html b/accessible/tests/browser/mac/doc_textmarker_test.html index c1b0e3a76262..de9d257b23ee 100644 --- a/accessible/tests/browser/mac/doc_textmarker_test.html +++ b/accessible/tests/browser/mac/doc_textmarker_test.html @@ -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.",