зеркало из https://github.com/mozilla/pjs.git
winEmbed window sizing fixes on behalf of steve-w@dircon.co.uk. b=152853 r/a=adamlock@netscape.com
This commit is contained in:
Родитель
ecceaf0fd2
Коммит
0136f0e511
|
@ -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
|
/* This isn't exactly correct: we're setting the whole window to
|
||||||
the size requested for the browser. At time of writing, though,
|
the size requested for the browser. At time of writing, though,
|
||||||
it's fine and useful for winEmbed's purposes. */
|
it's fine and useful for winEmbed's purposes. */
|
||||||
WebBrowserChromeUI::SizeTo(this, aCX, aCY);
|
WebBrowserChromeUI::SizeTo(this, aWidth, aHeight);
|
||||||
mSizeSet = PR_TRUE;
|
mSizeSet = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1302,11 +1302,21 @@ void WebBrowserChromeUI::ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow)
|
||||||
|
|
||||||
void WebBrowserChromeUI::SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight)
|
void WebBrowserChromeUI::SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight)
|
||||||
{
|
{
|
||||||
HWND win = GetBrowserDlgFromChrome(aChrome);
|
HWND hchrome = GetBrowserDlgFromChrome(aChrome);
|
||||||
RECT winRect;
|
HWND hbrowser = GetBrowserFromChrome(aChrome);
|
||||||
|
RECT chromeRect, browserRect;
|
||||||
|
|
||||||
::GetWindowRect(win, &winRect);
|
::GetWindowRect(hchrome, &chromeRect);
|
||||||
::MoveWindow(win, winRect.left, winRect.top, aWidth, aHeight, TRUE);
|
::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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Загрузка…
Ссылка в новой задаче