nsIDocument* doc; nsresult rv = GetDocument(doc); if (NS_FAILED(rv)) { return rv; } if (!doc) { return NS_ERROR_NULL_POINTER; }  PRInt32 numShells = doc->GetNumberOfShells(); nsIPresShell* shell = nsnull; nsCOMPtr<nsIPresContext> context; for (PRInt32 i=0; i<numShells; i++) { shell = doc->GetShellAt(i); if (!shell) { return NS_ERROR_NULL_POINTER; }  rv = shell->GetPresContext(getter_AddRefs(context)); if (NS_FAILED(rv)) { return rv; } if (!context) { return NS_ERROR_NULL_POINTER; }  rv = SetFocus(context); if (NS_FAILED(rv)) { return rv; }  NS_RELEASE(shell); } NS_RELEASE(doc);
nsHTMLAnchorElement::Focus(){  // XXX write me  return NS_OK;}