mScrollPref = aScrolling;
nsWebShell::Init(nsNativeWidget aNativeParent,                 PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,                 nsScrollPreference aScrolling,                 PRBool aAllowPlugins,                 PRBool aIsSunkenBorder){  //XXX make sure plugins have started up. this really needs to  //be associated with the nsIContentViewerContainer interfaces,  //not the nsIWebShell interfaces. this is a hack. MMP  nsRect aBounds(x,y,w,h);  nsWidgetInitData  widgetInit;  CreatePluginHost(aAllowPlugins);  mScrollPref = aScrolling;  WEB_TRACE(WEB_TRACE_CALLS,            ("nsWebShell::Init: this=%p", this));  nsresult rv = NS_OK;  // Initial error checking...  NS_PRECONDITION(nsnull != aNativeParent, "null Parent Window");  if (nsnull == aNativeParent) {    rv = NS_ERROR_NULL_POINTER;    goto done;  }  // Create a document loader...  if (nsnull != mParent) {    nsIDocumentLoader* parentLoader;    // Create a child document loader...    mParent->GetDocumentLoader(parentLoader);    if (NS_OK == rv) {      rv = parentLoader->CreateDocumentLoader(&mDocLoader);      NS_RELEASE(parentLoader);    }  } else {    rv = nsRepository::CreateInstance(kDocumentLoaderCID,                                      nsnull,                                      kIDocumentLoaderIID,                                      (void**)&mDocLoader);  }  if (NS_OK != rv) {    goto done;  }  //Register ourselves as an observer for the new doc loader  mDocLoader->AddObserver((nsIDocumentLoaderObserver*)this);  // Create device context  rv = nsRepository::CreateInstance(kDeviceContextCID, nsnull,                                    kIDeviceContextIID,                                    (void **)&mDeviceContext);  if (NS_OK != rv) {    goto done;  }  mDeviceContext->Init(aNativeParent);  float dev2twip;  mDeviceContext->GetDevUnitsToTwips(dev2twip);  mDeviceContext->SetDevUnitsToAppUnits(dev2twip);  float twip2dev;  mDeviceContext->GetTwipsToDevUnits(twip2dev);  mDeviceContext->SetAppUnitsToDevUnits(twip2dev);//  mDeviceContext->SetGamma(1.7f);  mDeviceContext->SetGamma(1.0f);  // Create a Native window for the shell container...  rv = nsRepository::CreateInstance(kChildCID, nsnull, kIWidgetIID, (void**)&mWindow);  if (NS_OK != rv) {    goto done;  }  widgetInit.clipChildren = PR_FALSE;  widgetInit.mBorderStyle = aIsSunkenBorder ? eBorderStyle_3DChildWindow : eBorderStyle_none;  mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent,                  mDeviceContext, nsnull, nsnull, &widgetInit);done:  return rv;}