GetBounds(oldX, oldY, oldWidth, oldHeight);
GetPositionAndSize(&oldX, &oldY, &oldWidth, &oldHeight);
nsWebShell::SizeToContent(){  nsresult rv;  // get the presentation shell  nsCOMPtr<nsIContentViewer> cv;  GetContentViewer(getter_AddRefs(cv));  if (cv) {    nsCOMPtr<nsIDocumentViewer> dv = do_QueryInterface(cv);    if (dv) {      nsCOMPtr<nsIPresContext> pcx;      dv->GetPresContext(*getter_AddRefs(pcx));      if (pcx) {        nsCOMPtr<nsIPresShell> pshell;        pcx->GetShell(getter_AddRefs(pshell));        // whew! so resize the presentation shell        if (pshell) {          nsRect  shellArea;          PRInt32 width, height;          float   pixelScale;          rv = pshell->ResizeReflow(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);          // so how big is it?          pcx->GetVisibleArea(shellArea);          pcx->GetTwipsToPixels(&pixelScale);          width = PRInt32((float)shellArea.width*pixelScale);          height = PRInt32((float)shellArea.height*pixelScale);          // if we're the outermost webshell for this window, size the window          if (mContainer) {            nsCOMPtr<nsIBrowserWindow> browser = do_QueryInterface(mContainer);            if (browser) {              nsCOMPtr<nsIWebShell> browserWebShell;              PRInt32 oldX, oldY, oldWidth, oldHeight,                      widthDelta, heightDelta;              nsRect  windowBounds;              GetBounds(oldX, oldY, oldWidth, oldHeight);              widthDelta = width - oldWidth;              heightDelta = height - oldHeight;              browser->GetWindowBounds(windowBounds);              browser->SizeWindowTo(windowBounds.width + widthDelta,                                    windowBounds.height + heightDelta);            }          }        }      }    }  }  return rv;}