From e68d2c191f88f742fd0186928f26b7b7fcfabe43 Mon Sep 17 00:00:00 2001 From: James Teh Date: Sun, 30 Jun 2024 18:06:02 +0000 Subject: [PATCH] Bug 1905065: When a caret is at the end of a line, have TextLeafPoint::FindBoundary return no character for BOUNDARY_CLUSTER. a=RyanVM We already did this for BOUNDARY_CHAR, but i neglected to update this for cluster in bug 855184. Without this, FindBoundary with BOUNDARY_CLUSTER on a caret TextLeafPoint when the caret is at the end of a line would return the last cluster instead of no character. Differential Revision: https://phabricator.services.mozilla.com/D215178 --- accessible/base/TextLeafRange.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accessible/base/TextLeafRange.cpp b/accessible/base/TextLeafRange.cpp index a1cbbd763995..b790af364c78 100644 --- a/accessible/base/TextLeafRange.cpp +++ b/accessible/base/TextLeafRange.cpp @@ -1049,7 +1049,8 @@ TextLeafPoint TextLeafPoint::FindBoundary(AccessibleTextBoundary aBoundaryType, nsDirection aDirection, BoundaryFlags aFlags) const { if (IsCaret()) { - if (aBoundaryType == nsIAccessibleText::BOUNDARY_CHAR) { + if (aBoundaryType == nsIAccessibleText::BOUNDARY_CHAR || + aBoundaryType == nsIAccessibleText::BOUNDARY_CLUSTER) { if (IsCaretAtEndOfLine()) { // The caret is at the end of the line. Return no character. return ActualizeCaret(/* aAdjustAtEndOfLine */ false);