nsCOMPtr<nsIScrollable> sc = do_QueryInterface(mContainer);  if (sc) { nsCOMPtr<nsIContent> root; mDocument->GetRootContent(getter_AddRefs(root));  nsCOMPtr<nsIDOMHTMLFrameSetElement> frameset(do_QueryInterface(root));  if (frameset) {     sc->SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, NS_STYLE_OVERFLOW_HIDDEN); sc->SetCurrentScrollbarPreferences(nsIScrollable::ScrollOrientation_X, NS_STYLE_OVERFLOW_HIDDEN); } else { sc->ResetScrollbarPreferences(); } }
DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow){  // Create the style set...  nsCOMPtr<nsIStyleSet> styleSet;  nsresult rv = CreateStyleSet(mDocument, getter_AddRefs(styleSet));  NS_ENSURE_SUCCESS(rv, rv);  // Now make the shell for the document  rv = mDocument->CreateShell(mPresContext, mViewManager, styleSet,                              getter_AddRefs(mPresShell));  NS_ENSURE_SUCCESS(rv, rv);  mPresShell->BeginObservingDocument();  // Initialize our view manager  nsRect bounds;  mWindow->GetBounds(bounds);  float p2t;  mPresContext->GetPixelsToTwips(&p2t);  nscoord width = NSIntPixelsToTwips(bounds.width, p2t);  nscoord height = NSIntPixelsToTwips(bounds.height, p2t);  mViewManager->DisableRefresh();  mViewManager->SetWindowDimensions(width, height);  // Setup default view manager background color  // This may be overridden by the docshell with the background color  // for the last document loaded into the docshell  nscolor bgcolor = NS_RGB(0, 0, 0);  mPresContext->GetDefaultBackgroundColor(&bgcolor);  mViewManager->SetDefaultBackgroundColor(bgcolor);  if (aDoInitialReflow) {    // Initial refllow    mPresShell->InitialReflow(width, height);    // Now trigger a refresh    if (mEnableRendering) {      mViewManager->EnableRefresh(NS_VMREFRESH_IMMEDIATE);    }  }  // now register ourselves as a selection listener, so that we get  // called when the selection changes in the window  nsDocViewerSelectionListener *selectionListener =    new nsDocViewerSelectionListener();  NS_ENSURE_TRUE(selectionListener, NS_ERROR_OUT_OF_MEMORY);  selectionListener->Init(this);  // mSelectionListener is a owning reference  mSelectionListener = selectionListener;  nsCOMPtr<nsISelection> selection;  rv = GetDocumentSelection(getter_AddRefs(selection));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(selection));  rv = selPrivate->AddSelectionListener(mSelectionListener);  if (NS_FAILED(rv))    return rv;  // focus listener  //  // now register ourselves as a focus listener, so that we get called  // when the focus changes in the window  nsDocViewerFocusListener *focusListener;  NS_NEWXPCOM(focusListener, nsDocViewerFocusListener);  NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);