mWindow->SetFocus();
DocumentViewerImpl::MakeWindow(nsNativeWidget aNativeParent,                               const nsRect& aBounds,                               nsScrollPreference aScrolling){  nsresult rv;  rv = nsComponentManager::CreateInstance(kViewManagerCID,                                           nsnull,                                           kIViewManagerIID,                                           getter_AddRefs(mViewManager));  nsCOMPtr<nsIDeviceContext> dx;  mPresContext->GetDeviceContext(getter_AddRefs(dx));  if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx))) {    return rv;  }  nsRect tbounds = aBounds;  float p2t;  mPresContext->GetPixelsToTwips(&p2t);  tbounds *= p2t;  // Create a child window of the parent that is our "root view/window"  // Create a view  rv = nsComponentManager::CreateInstance(kViewCID,                                           nsnull,                                           kIViewIID,                                           (void**)&mView);  static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);  if ((NS_OK != rv) || (NS_OK != mView->Init(mViewManager,                                              tbounds,                                             nsnull))) {    return rv;  }  rv = mView->CreateWidget(kWidgetCID, nsnull, aNativeParent);  if (rv != NS_OK)    return rv;  // Setup hierarchical relationship in view manager  mViewManager->SetRootView(mView);  mView->GetWidget(*getter_AddRefs(mWindow));  //set frame rate to 25 fps  mViewManager->SetFrameRate(25);  // This SetFocus is necessary so the Arrow Key and Page Key events  // go to the scrolled view as soon as the Window is created instead of going to  // the browser window (this enables keyboard scrolling of the document)  mWindow->SetFocus();  return rv;}