Bug 1170242 - On accessibility SetSelectionRange, scroll the selection into view. r=surkov

This commit is contained in:
Samuel Thibault 2017-10-11 10:43:53 +02:00
parent db2853b001
commit 980959a1a0

View File

@ -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.