зеркало из https://github.com/mozilla/gecko-dev.git
Bug 538242 - Always keep mBounds up to date. r=josh
This commit is contained in:
Родитель
21d217cfc3
Коммит
15bb0ee06a
|
@ -234,6 +234,7 @@ public:
|
||||||
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
|
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
|
||||||
NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
|
NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
|
||||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
|
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
|
||||||
|
void UpdateBounds();
|
||||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||||
void ReportSizeEvent(NSRect *overrideRect = nsnull);
|
void ReportSizeEvent(NSRect *overrideRect = nsnull);
|
||||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||||
|
|
|
@ -1166,15 +1166,20 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRep
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsCocoaWindow::UpdateBounds()
|
||||||
|
{
|
||||||
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
|
mBounds = nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]);
|
||||||
|
|
||||||
|
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(nsIntRect &aRect)
|
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(nsIntRect &aRect)
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
aRect = mBounds;
|
||||||
|
|
||||||
aRect = nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]);
|
|
||||||
// printf("GetScreenBounds: output: %d,%d,%d,%d\n", aRect.x, aRect.y, aRect.width, aRect.height);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCocoaWindow::SetCursor(nsCursor aCursor)
|
NS_IMETHODIMP nsCocoaWindow::SetCursor(nsCursor aCursor)
|
||||||
|
@ -1339,27 +1344,24 @@ nsCocoaWindow::ReportSizeEvent(NSRect *r)
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
NSRect windowFrame = [mWindow frame];
|
NSRect frameRect = r ? *r : [mWindow frame];
|
||||||
if (!r)
|
NSRect contentRect = [mWindow contentRectForFrameRect:frameRect];
|
||||||
r = &windowFrame;
|
|
||||||
|
|
||||||
if ([mWindow isKindOfClass:[ToolbarWindow class]] &&
|
if ([mWindow isKindOfClass:[ToolbarWindow class]] &&
|
||||||
[(ToolbarWindow*)mWindow drawsContentsIntoWindowFrame]) {
|
[(ToolbarWindow*)mWindow drawsContentsIntoWindowFrame]) {
|
||||||
// Report the frame rect instead of the content rect. This will make our
|
// Report the frame rect instead of the content rect. This will make our
|
||||||
// root widget NSView bigger than the window's content view, and since it's
|
// root widget NSView bigger than the window's content view, and since it's
|
||||||
// anchored at the bottom, it will extend upwards into the titlebar.
|
// anchored at the bottom, it will extend upwards into the titlebar.
|
||||||
windowFrame = *r;
|
contentRect = frameRect;
|
||||||
} else {
|
|
||||||
windowFrame = [mWindow contentRectForFrameRect:(*r)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mBounds.width = nscoord(windowFrame.size.width);
|
mBounds = nsCocoaUtils::CocoaRectToGeckoRect(frameRect);
|
||||||
mBounds.height = nscoord(windowFrame.size.height);
|
nsIntRect innerBounds = nsCocoaUtils::CocoaRectToGeckoRect(contentRect);
|
||||||
|
|
||||||
nsSizeEvent sizeEvent(PR_TRUE, NS_SIZE, this);
|
nsSizeEvent sizeEvent(PR_TRUE, NS_SIZE, this);
|
||||||
sizeEvent.time = PR_IntervalNow();
|
sizeEvent.time = PR_IntervalNow();
|
||||||
|
|
||||||
sizeEvent.windowSize = &mBounds;
|
sizeEvent.windowSize = &innerBounds;
|
||||||
sizeEvent.mWinWidth = mBounds.width;
|
sizeEvent.mWinWidth = mBounds.width;
|
||||||
sizeEvent.mWinHeight = mBounds.height;
|
sizeEvent.mWinHeight = mBounds.height;
|
||||||
|
|
||||||
|
@ -1760,6 +1762,7 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut)
|
||||||
|
|
||||||
- (void)windowDidMove:(NSNotification *)aNotification
|
- (void)windowDidMove:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
|
mGeckoWindow->UpdateBounds();
|
||||||
// Dispatch the move event to Gecko
|
// Dispatch the move event to Gecko
|
||||||
nsGUIEvent guiEvent(PR_TRUE, NS_MOVE, mGeckoWindow);
|
nsGUIEvent guiEvent(PR_TRUE, NS_MOVE, mGeckoWindow);
|
||||||
nsIntRect rect;
|
nsIntRect rect;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче