From 980959a1a0a650aa797b70805eecff14a1ffab26 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 11 Oct 2017 10:43:53 +0200 Subject: [PATCH] Bug 1170242 - On accessibility SetSelectionRange, scroll the selection into view. r=surkov --- accessible/generic/HyperTextAccessible.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index 95b04a7a601c..29551353af32 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1336,6 +1336,13 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos) domSel->RemoveRange(domSel->GetRangeAt(idx)); SetSelectionBoundsAt(0, aStartPos, aEndPos); + // Make sure it is visible + domSel->ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION, + nsIPresShell::ScrollAxis(), + nsIPresShell::ScrollAxis(), + dom::Selection::SCROLL_FOR_CARET_MOVE | + dom::Selection::SCROLL_OVERFLOW_HIDDEN); + // When selection is done, move the focus to the selection if accessible is // not focusable. That happens when selection is set within hypertext // accessible.