diff --git a/accessible/base/TextLeafRange.cpp b/accessible/base/TextLeafRange.cpp index 365e9109d2d8..bb1790246db7 100644 --- a/accessible/base/TextLeafRange.cpp +++ b/accessible/base/TextLeafRange.cpp @@ -523,7 +523,8 @@ TextLeafPoint TextLeafPoint::FindLineStartSameRemoteAcc( } } MOZ_ASSERT(index <= lines->Length()); - if ((aDirection == eDirNext && index == lines->Length()) || index == 0) { + if ((aDirection == eDirNext && index == lines->Length()) || + (aDirection == eDirPrevious && index == 0)) { return TextLeafPoint(); } // index points at the line start after mOffset. diff --git a/accessible/tests/browser/e10s/browser_caching_text.js b/accessible/tests/browser/e10s/browser_caching_text.js index 53de492c2228..7f846ecce97c 100644 --- a/accessible/tests/browser/e10s/browser_caching_text.js +++ b/accessible/tests/browser/e10s/browser_caching_text.js @@ -26,6 +26,7 @@ ef gh

abc

ab
c
d

a
b

+

abc

`, async function(browser, docAcc) { for (const id of ["br", "pre"]) { @@ -157,6 +158,11 @@ ef gh [1, 2, "b", 1, 2], ]); testTextAtOffset(p, BOUNDARY_PARAGRAPH, [[0, 2, "ab", 0, 2]]); + const leafThenWrap = findAccessibleChildByID(docAcc, "leafThenWrap"); + testTextAtOffset(leafThenWrap, BOUNDARY_LINE_START, [ + [0, 1, "ab", 0, 2], + [2, 3, "c", 2, 3], + ]); }, { chrome: true, topLevel: true, iframe: true, remoteIframe: true } );