Backing out changeset e1983b9db75d from bug 596955 for causing bug 615858. a=backout

This commit is contained in:
Dave Townsend 2010-12-01 10:20:28 -08:00
Родитель a82dcf8509
Коммит 1f8527337b
2 изменённых файлов: 28 добавлений и 2 удалений

Просмотреть файл

@ -281,6 +281,11 @@ public:
// be notified that a some form of drag event needs to go into Gecko
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; }
NSWindow *GetCocoaWindow() { return mWindow; }
@ -333,6 +338,7 @@ protected:
PRInt32 mShadowStyle;
NSUInteger mWindowFilter;
PRPackedBool mIsResizing; // we originated the resize, prevent infinite recursion
PRPackedBool mWindowMadeHere; // true if we created the window, false for embedding
PRPackedBool mSheetNeedsShow; // if this is a sheet, are we waiting to be shown?
// this is used for sibling sheet contention only

Просмотреть файл

@ -139,6 +139,7 @@ nsCocoaWindow::nsCocoaWindow()
, mPopupContentView(nil)
, mShadowStyle(NS_STYLE_WINDOW_SHADOW_DEFAULT)
, mWindowFilter(0)
, mIsResizing(PR_FALSE)
, mWindowMadeHere(PR_FALSE)
, mSheetNeedsShow(PR_FALSE)
, mFullScreen(PR_FALSE)
@ -1133,16 +1134,35 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRIn
BOOL isMoving = (windowBounds.x != newBounds.x || windowBounds.y != newBounds.y);
BOOL isResizing = (windowBounds.width != newBounds.width || windowBounds.height != newBounds.height);
if (!mWindow || (!isMoving && !isResizing))
if (IsResizing() || !mWindow || (!isMoving && !isResizing))
return NS_OK;
mBounds = newBounds;
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
// title bar doesn't immediately get repainted and is displayed in
// the wrong place, leading to a visual jump.
[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;
@ -1768,7 +1788,7 @@ PRBool nsCocoaWindow::ShouldFocusPlugin()
- (void)windowDidResize:(NSNotification *)aNotification
{
if (!mGeckoWindow)
if (!mGeckoWindow || mGeckoWindow->IsResizing())
return;
// Resizing might have changed our zoom state.