nsIFrame* oldFocusFrame = nsnull; presShell->GetPrimaryFrameFor(oldFocus, &oldFocusFrame); if (oldFocusFrame) {  nsRect rect; oldFocusFrame->GetRect(rect); oldFocusFrame->Invalidate(aPresContext, rect, PR_FALSE); }
nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext){  NS_ENSURE_ARG_POINTER(aPresContext);  // don't make the link grab the focus if there is no link handler  nsCOMPtr<nsILinkHandler> handler;  nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler));  if (NS_SUCCEEDED(rv) && (nsnull != handler)) {    nsCOMPtr<nsIEventStateManager> stateManager;    aPresContext->GetEventStateManager(getter_AddRefs(stateManager));    if (stateManager) {      stateManager->SetContentState(this, NS_EVENT_STATE_FOCUS);      // Make sure the presentation is up-to-date      if (mDocument) {        mDocument->FlushPendingNotifications();      }      nsCOMPtr<nsIPresShell> presShell;      aPresContext->GetShell(getter_AddRefs(presShell));      if (presShell) {        nsIFrame* frame = nsnull;        presShell->GetPrimaryFrameFor(this, &frame);        if (frame) {          presShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE,                                         NS_PRESSHELL_SCROLL_ANYWHERE);        }      }    }  }  return NS_OK;}