Bug 144000 caret browsing - bad initial position

r=aaronleventhal sr=bzbarsky
This commit is contained in:
ginn.chen%sun.com 2006-02-28 10:23:38 +00:00
Родитель 6b75bfd785
Коммит 0acfa250a1
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -5104,6 +5104,18 @@ nsEventStateManager::SetContentCaretVisible(nsIPresShell* aPresShell,
// First, tell the caret which selection to use
caret->SetCaretDOMSelection(domSelection);
if (aVisible) {
// Check whether domSelection has focus node
// If not, we need move caret to the top of the document
nsCOMPtr<nsIDOMNode> focusNode;
domSelection->GetFocusNode(getter_AddRefs(focusNode));
if (!focusNode) {
nsCOMPtr<nsISelectionController> selCon(do_QueryInterface(aPresShell));
if (selCon)
selCon->CompleteMove(PR_FALSE, PR_FALSE);
}
}
// In content, we need to set the caret
// the only other case is edit fields, where they have a different frame selection from the doc's
// in that case they'll take care of making the caret visible themselves