Comment 33 for bug 602877

Revision history for this message
In , Enn (enndeakin) wrote :

(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?