From df268d7f09b2c44770921913fd4ed75aeb87ad84 Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Fri, 17 Dec 1999 23:43:47 +0000 Subject: [PATCH] Changed nsWebShellWindow to talk to webshell as an nsIBaseWindow where appropriate. --- xpfe/appshell/src/nsWebShellWindow.cpp | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index db5bf69d310d..a031aeafa5bd 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -92,6 +92,8 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIPresShell.h" #include "nsIPresContext.h" +#include "nsIBaseWindow.h" + // HACK for M4, should be removed by M5 #ifdef XP_MAC #include @@ -247,7 +249,8 @@ nsWebShellWindow::nsWebShellWindow() nsWebShellWindow::~nsWebShellWindow() { if (nsnull != mWebShell) { - mWebShell->Destroy(); + nsCOMPtr shellAsWin(do_QueryInterface(mWebShell)); + shellAsWin->Destroy(); NS_RELEASE(mWebShell); } @@ -431,7 +434,8 @@ nsWebShellWindow::Close() ExitModalLoop(); if (mWebShell) { - mWebShell->Destroy(); + nsCOMPtr shellAsWin(do_QueryInterface(mWebShell)); + shellAsWin->Destroy(); NS_RELEASE(mWebShell); } @@ -474,8 +478,10 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) * client area of the window... */ case NS_SIZE: { - nsSizeEvent* sizeEvent = (nsSizeEvent*)aEvent; - webShell->SetBounds(0, 0, sizeEvent->windowSize->width, sizeEvent->windowSize->height); + nsSizeEvent* sizeEvent = (nsSizeEvent*)aEvent; + nsCOMPtr shellAsWin(do_QueryInterface(webShell)); + shellAsWin->SetPositionAndSize(0, 0, sizeEvent->windowSize->width, + sizeEvent->windowSize->height, PR_FALSE); result = nsEventStatus_eConsumeNoDefault; break; } @@ -1694,7 +1700,8 @@ nsWebShellWindow::Show(PRBool aShow) if (mDebuting) return NS_OK; mDebuting = PR_TRUE; // (Show/Focus is recursive) - mWebShell->Show(); // crimminy -- it doesn't take a parameter! + nsCOMPtr shellAsWin(do_QueryInterface(mWebShell)); + shellAsWin->SetVisibility(aShow); mWindow->Show(aShow); // this may cause problems, focusing the content webshell on every show. @@ -2674,10 +2681,11 @@ NS_IMETHODIMP nsWebShellWindow::SizeContentTo(PRInt32 aWidth, PRInt32 aHeight) { nsCOMPtr content; GetContentWebShell(getter_AddRefs(content)); - if (content) { + nsCOMPtr contentAsWin(do_QueryInterface(content)); + if (contentAsWin) { PRInt32 x, y, width, height, widthDelta, heightDelta; - content->GetBounds(x,y,width,height); + contentAsWin->GetPositionAndSize(&x, & y, &width, &height); widthDelta = aWidth - width; heightDelta = aHeight - height; @@ -2695,13 +2703,14 @@ NS_IMETHODIMP nsWebShellWindow::GetContentBounds(nsRect& aResult) // Should return the size of the content webshell. nsCOMPtr contentShell; GetContentWebShell(getter_AddRefs(contentShell)); - if (!contentShell) { + nsCOMPtr contentShellAsWin(do_QueryInterface(contentShell)); + if (!contentShellAsWin) { NS_ERROR("Attempt to retrieve the content bounds for a window with no content."); return NS_ERROR_FAILURE; } PRInt32 x,y,width,height; - contentShell->GetBounds(x,y,width,height); + contentShellAsWin->GetPositionAndSize(&x, &y, &width, &height); aResult.x = x; aResult.y = y; aResult.width = width;