allow obscured sibling sheet show code to run when necessary. b=418699 r=bent sr=roc
authorjoshmoz@gmail.com
Thu, 21 Feb 2008 17:47:14 -0800
changeset 12066 0826452a8f8b3b48f297b995e7b79679701eeba8
parent 12065 8afadac8a346f85136164e230e1c4672f462a909
child 12067 5b544fa3c2d6e0bc4a51a90dc6fd30223f942ec3
push idunknown
push userunknown
push dateunknown
reviewersbent, roc
bugs418699
milestone1.9b4pre
allow obscured sibling sheet show code to run when necessary. b=418699 r=bent sr=roc
widget/src/cocoa/nsCocoaWindow.mm
--- a/widget/src/cocoa/nsCocoaWindow.mm
+++ b/widget/src/cocoa/nsCocoaWindow.mm
@@ -521,19 +521,17 @@ NS_IMETHODIMP nsCocoaWindow::SetModal(PR
 }
 
 
 // Hide or show this window
 NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
-  PRBool isVisible;
-  IsVisible(isVisible);
-  if (bState == isVisible)
+  if (!mSheetNeedsShow && bState == [mWindow isVisible])
     return NS_OK;
 
   nsIWidget* parentWidget = mParent;
   nsCOMPtr<nsPIWidgetCocoa> piParentWidget(do_QueryInterface(parentWidget));
   NSWindow* nativeParentWindow = (parentWidget) ?
     (NSWindow*)parentWidget->GetNativeData(NS_NATIVE_WINDOW) : nil;
 
   if (bState && !mBounds.IsEmpty()) {
@@ -557,17 +555,17 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool
       }
 
       nsCocoaWindow* sheetShown = nsnull;
       if (NS_SUCCEEDED(piParentWidget->GetChildSheet(PR_TRUE, &sheetShown)) &&
           (!sheetShown || sheetShown == this)) {
         // If this sheet is already the sheet actually being shown, don't
         // tell it to show again. Otherwise the number of calls to
         // [NSApp beginSheet...] won't match up with [NSApp endSheet...].
-        if (![mWindow isSheet]) {
+        if (![mWindow isVisible]) {
           mSheetNeedsShow = PR_FALSE;
           mSheetWindowParent = topNonSheetWindow;
           [[mSheetWindowParent delegate] sendFocusEvent:NS_LOSTFOCUS];
           [[mSheetWindowParent delegate] sendFocusEvent:NS_DEACTIVATE];
           [mWindow setAcceptsMouseMovedEvents:YES];
           [NSApp beginSheet:mWindow
              modalForWindow:mSheetWindowParent
               modalDelegate:mDelegate