Bug 363200 Calling setCaretOffset should scroll the text into view if it is off screen

patch by Nian.Liu at sun.com r=aaronleventhal
This commit is contained in:
ginn.chen%sun.com 2007-01-05 06:20:10 +00:00
Родитель e6da6186fc
Коммит ad43b2c88f
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -1305,7 +1305,8 @@ nsresult nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEn
// If range 0 was successfully set, clear any additional selection
// ranges remaining from previous selection
nsCOMPtr<nsISelection> domSel;
GetSelections(nsnull, getter_AddRefs(domSel));
nsCOMPtr<nsISelectionController> selCon;
GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel));
if (domSel) {
PRInt32 numRanges;
domSel->GetRangeCount(&numRanges);
@ -1316,6 +1317,11 @@ nsresult nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEn
domSel->RemoveRange(range);
}
}
if (selCon) {
selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
}
return NS_OK;
}