(From update of attachment 441434) >+ if (fm) { >+ nsCOMPtr<nsIPresShell> shell = GetPresShell(); >+ nsCOMPtr<nsIDocument> doc = shell->GetDocument(); >+ nsCOMPtr<nsPIDOMWindow> window = doc->GetWindow();
Do any of these need to be null-checked? If not, I would just get them in one line and not store them in comptrs.
>+ nsIDOMElement* aElement; >+ fm->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET, 0, &aElement);
This will leak aElement. You do need to use a comptr here.
The other similar places where the focus is updated to the caret position also use nsIFocusManager::FLAG_NOSCROLL. Is this an intentional difference?
(From update of attachment 441434) nsIPresShell> shell = GetPresShell(); nsIDocument> doc = shell-> GetDocument( ); nsPIDOMWindow> window = doc->GetWindow();
>+ if (fm) {
>+ nsCOMPtr<
>+ nsCOMPtr<
>+ nsCOMPtr<
Do any of these need to be null-checked? If not, I would just get them in one line and not store them in comptrs.
>+ nsIDOMElement* aElement; window, nsnull, nsIFocusManager ::MOVEFOCUS_ CARET, 0, &aElement);
>+ fm->MoveFocus(
This will leak aElement. You do need to use a comptr here.
The other similar places where the focus is updated to the caret position also use nsIFocusManager ::FLAG_ NOSCROLL. Is this an intentional difference?