зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
e6da6186fc
Коммит
ad43b2c88f
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче