if (IsInDoc()) { GetOwnerDoc()->FlushPendingNotifications(Flush_Layout);
nsIDocument* doc = GetCurrentDoc(); if (doc) { doc->FlushPendingNotifications(Flush_Layout);
nsHTMLAnchorElement::SetFocus(nsPresContext* aPresContext){  if (!aPresContext) {    return;  }  // don't make the link grab the focus if there is no link handler  nsILinkHandler *handler = aPresContext->GetLinkHandler();  if (handler) {    aPresContext->EventStateManager()->SetContentState(this,                                                       NS_EVENT_STATE_FOCUS);    // Make sure the presentation is up-to-date    if (IsInDoc()) {      GetOwnerDoc()->FlushPendingNotifications(Flush_Layout);    }    nsIPresShell *presShell = aPresContext->GetPresShell();    if (presShell) {      nsIFrame* frame = nsnull;      presShell->GetPrimaryFrameFor(this, &frame);      if (frame) {        presShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE,                                       NS_PRESSHELL_SCROLL_ANYWHERE);      }    }  }}