Bug 957332 - setting caret offset doesn't always clear visual selection, r=tbsaunde

This commit is contained in:
Alexander Surkov 2014-02-08 08:25:11 -05:00
Родитель 168d8c1c01
Коммит bdb30b262d
1 изменённых файлов: 2 добавлений и 5 удалений

Просмотреть файл

@ -1107,16 +1107,13 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos)
if (isFocusable)
TakeFocus();
// Set the selection
SetSelectionBoundsAt(0, aStartPos, aEndPos);
// If range 0 was successfully set, clear any additional selection
// ranges remaining from previous selection
Selection* domSel = DOMSelection();
NS_ENSURE_STATE(domSel);
// Set up the selection.
for (int32_t idx = domSel->GetRangeCount() - 1; idx > 0; idx--)
domSel->RemoveRange(domSel->GetRangeAt(idx));
SetSelectionBoundsAt(0, aStartPos, aEndPos);
// When selection is done, move the focus to the selection if accessible is
// not focusable. That happens when selection is set within hypertext