зеркало из https://github.com/mozilla/gecko-dev.git
Bug 596955 - Simplify nsCocoaWindow::Resize and no longer resize our ChildView before doing the actual window resize in order to avoid painting artifacts with OpenGL. r=josh, a=final
This commit is contained in:
Родитель
393a863217
Коммит
92d57b436b
|
@ -281,11 +281,6 @@ public:
|
||||||
// be notified that a some form of drag event needs to go into Gecko
|
// be notified that a some form of drag event needs to go into Gecko
|
||||||
virtual PRBool DragEvent(unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers);
|
virtual PRBool DragEvent(unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers);
|
||||||
|
|
||||||
// Helpers to prevent recursive resizing during live-resize
|
|
||||||
PRBool IsResizing () const { return mIsResizing; }
|
|
||||||
void StartResizing () { mIsResizing = PR_TRUE; }
|
|
||||||
void StopResizing () { mIsResizing = PR_FALSE; }
|
|
||||||
|
|
||||||
PRBool HasModalDescendents() { return mNumModalDescendents > 0; }
|
PRBool HasModalDescendents() { return mNumModalDescendents > 0; }
|
||||||
NSWindow *GetCocoaWindow() { return mWindow; }
|
NSWindow *GetCocoaWindow() { return mWindow; }
|
||||||
|
|
||||||
|
@ -338,7 +333,6 @@ protected:
|
||||||
PRInt32 mShadowStyle;
|
PRInt32 mShadowStyle;
|
||||||
NSUInteger mWindowFilter;
|
NSUInteger mWindowFilter;
|
||||||
|
|
||||||
PRPackedBool mIsResizing; // we originated the resize, prevent infinite recursion
|
|
||||||
PRPackedBool mWindowMadeHere; // true if we created the window, false for embedding
|
PRPackedBool mWindowMadeHere; // true if we created the window, false for embedding
|
||||||
PRPackedBool mSheetNeedsShow; // if this is a sheet, are we waiting to be shown?
|
PRPackedBool mSheetNeedsShow; // if this is a sheet, are we waiting to be shown?
|
||||||
// this is used for sibling sheet contention only
|
// this is used for sibling sheet contention only
|
||||||
|
|
|
@ -139,7 +139,6 @@ nsCocoaWindow::nsCocoaWindow()
|
||||||
, mPopupContentView(nil)
|
, mPopupContentView(nil)
|
||||||
, mShadowStyle(NS_STYLE_WINDOW_SHADOW_DEFAULT)
|
, mShadowStyle(NS_STYLE_WINDOW_SHADOW_DEFAULT)
|
||||||
, mWindowFilter(0)
|
, mWindowFilter(0)
|
||||||
, mIsResizing(PR_FALSE)
|
|
||||||
, mWindowMadeHere(PR_FALSE)
|
, mWindowMadeHere(PR_FALSE)
|
||||||
, mSheetNeedsShow(PR_FALSE)
|
, mSheetNeedsShow(PR_FALSE)
|
||||||
, mFullScreen(PR_FALSE)
|
, mFullScreen(PR_FALSE)
|
||||||
|
@ -1134,35 +1133,16 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRIn
|
||||||
BOOL isMoving = (windowBounds.x != newBounds.x || windowBounds.y != newBounds.y);
|
BOOL isMoving = (windowBounds.x != newBounds.x || windowBounds.y != newBounds.y);
|
||||||
BOOL isResizing = (windowBounds.width != newBounds.width || windowBounds.height != newBounds.height);
|
BOOL isResizing = (windowBounds.width != newBounds.width || windowBounds.height != newBounds.height);
|
||||||
|
|
||||||
if (IsResizing() || !mWindow || (!isMoving && !isResizing))
|
if (!mWindow || (!isMoving && !isResizing))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
mBounds = newBounds;
|
mBounds = newBounds;
|
||||||
NSRect newFrame = nsCocoaUtils::GeckoRectToCocoaRect(mBounds);
|
NSRect newFrame = nsCocoaUtils::GeckoRectToCocoaRect(mBounds);
|
||||||
|
|
||||||
// We have to report the size event -first-, to make sure that content
|
|
||||||
// repositions itself. Cocoa views are anchored at the bottom left,
|
|
||||||
// so if we don't do this our child view will end up being stuck in the
|
|
||||||
// wrong place during a resize.
|
|
||||||
if (isResizing)
|
|
||||||
ReportSizeEvent(&newFrame);
|
|
||||||
|
|
||||||
StartResizing();
|
|
||||||
// We ignore aRepaint -- we have to call display:YES, otherwise the
|
// We ignore aRepaint -- we have to call display:YES, otherwise the
|
||||||
// title bar doesn't immediately get repainted and is displayed in
|
// title bar doesn't immediately get repainted and is displayed in
|
||||||
// the wrong place, leading to a visual jump.
|
// the wrong place, leading to a visual jump.
|
||||||
[mWindow setFrame:newFrame display:YES];
|
[mWindow setFrame:newFrame display:YES];
|
||||||
StopResizing();
|
|
||||||
|
|
||||||
// now, check whether we got the frame that we wanted
|
|
||||||
NSRect actualFrame = [mWindow frame];
|
|
||||||
if (newFrame.size.width != actualFrame.size.width || newFrame.size.height != actualFrame.size.height) {
|
|
||||||
// We didn't; the window must have been too big or otherwise invalid.
|
|
||||||
// Report -another- resize in this case, to make sure things are in
|
|
||||||
// the right place. This will cause some visual jitter, but
|
|
||||||
// shouldn't happen often.
|
|
||||||
ReportSizeEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
@ -1788,7 +1768,7 @@ PRBool nsCocoaWindow::ShouldFocusPlugin()
|
||||||
|
|
||||||
- (void)windowDidResize:(NSNotification *)aNotification
|
- (void)windowDidResize:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if (!mGeckoWindow || mGeckoWindow->IsResizing())
|
if (!mGeckoWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Resizing might have changed our zoom state.
|
// Resizing might have changed our zoom state.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче