winEmbed window sizing fixes on behalf of steve-w@dircon.co.uk. b=152853 r/a=adamlock@netscape.com

This commit is contained in:
locka%iol.ie 2002-07-03 20:52:05 +00:00
parent 0714c8b4f8
commit aaee4f863b
2 changed files with 17 additions and 6 deletions

View File

@ -194,12 +194,13 @@ NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow(void)
}
NS_IMETHODIMP WebBrowserChrome::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
// IN: The desired browser client area dimensions.
NS_IMETHODIMP WebBrowserChrome::SizeBrowserTo(PRInt32 aWidth, PRInt32 aHeight)
{
/* This isn't exactly correct: we're setting the whole window to
the size requested for the browser. At time of writing, though,
it's fine and useful for winEmbed's purposes. */
WebBrowserChromeUI::SizeTo(this, aCX, aCY);
WebBrowserChromeUI::SizeTo(this, aWidth, aHeight);
mSizeSet = PR_TRUE;
return NS_OK;
}

View File

@ -1302,11 +1302,21 @@ void WebBrowserChromeUI::ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow)
void WebBrowserChromeUI::SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight)
{
HWND win = GetBrowserDlgFromChrome(aChrome);
RECT winRect;
HWND hchrome = GetBrowserDlgFromChrome(aChrome);
HWND hbrowser = GetBrowserFromChrome(aChrome);
RECT chromeRect, browserRect;
::GetWindowRect(win, &winRect);
::MoveWindow(win, winRect.left, winRect.top, aWidth, aHeight, TRUE);
::GetWindowRect(hchrome, &chromeRect);
::GetWindowRect(hbrowser, &browserRect);
PRInt32 decoration_x = (browserRect.left - chromeRect.left) +
(chromeRect.right - browserRect.right);
PRInt32 decoration_y = (browserRect.top - chromeRect.top) +
(chromeRect.bottom - browserRect.bottom);
::MoveWindow(hchrome, chromeRect.left, chromeRect.top,
aWidth+decoration_x,
aHeight+decoration_y, TRUE);
}
//