nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mDocument->GetScriptGlobalObject()); nsIFocusController *focusController = nsnull; if (ourWindow) focusController = ourWindow->GetRootFocusController(); if (focusController)   focusController->SetSuppressFocus(PR_TRUE, "PresShell suppression on Web page loads");  nsCOMPtr<nsISupports> container = mPresContext->GetContainer(); if (container) { nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container)); if (cvc) { nsCOMPtr<nsIContentViewer> cv; cvc->GetContentViewer(getter_AddRefs(cv)); if (cv) { nsCOMPtr<nsIPresShell> kungFuDeathGrip(this); cv->Show();   if (mIsDestroying) { if (focusController) {   focusController->SetSuppressFocus(PR_FALSE, "PresShell suppression on Web page loads"); } return; } } }
if (!mPresContext->EnsureVisible(PR_FALSE)) {  return;
PresShell::UnsuppressAndInvalidate(){  nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mDocument->GetScriptGlobalObject());  nsIFocusController *focusController = nsnull;  if (ourWindow)    focusController = ourWindow->GetRootFocusController();  if (focusController)    // Suppress focus.  The act of tearing down the old content viewer    // causes us to blur incorrectly.    focusController->SetSuppressFocus(PR_TRUE, "PresShell suppression on Web page loads");  nsCOMPtr<nsISupports> container = mPresContext->GetContainer();  if (container) {    nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));    if (cvc) {      nsCOMPtr<nsIContentViewer> cv;      cvc->GetContentViewer(getter_AddRefs(cv));      if (cv) {        nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);        cv->Show();        // Calling |Show| may destroy us.  Not sure why yet, but it's        // a smoketest blocker.        if (mIsDestroying) {          if (focusController) {            // Unsuppress focus now that we're exiting this code,            // otherwise we're stuck in focus suppression, which hoses most of Mozilla            focusController->SetSuppressFocus(PR_FALSE, "PresShell suppression on Web page loads");          }          return;        }      }    }  }  mPaintingSuppressed = PR_FALSE;  nsIFrame* rootFrame = FrameManager()->GetRootFrame();  if (rootFrame) {    // let's assume that outline on a root frame is not supported    nsRect rect(nsPoint(0, 0), rootFrame->GetSize());    rootFrame->Invalidate(rect, PR_FALSE);  }  if (ourWindow)    CheckForFocus(ourWindow, focusController, mDocument);  if (focusController) // Unsuppress now that we've shown the new window and focused it.    focusController->SetSuppressFocus(PR_FALSE, "PresShell suppression on Web page loads");  if (mViewManager)    mViewManager->SynthesizeMouseMove(PR_FALSE);}