Bug 942913 - Make sheets return YES from isVisibleOrBeingShown while the sheet opening animation runs so that we don't refuse to composite them during the animation. r=smichaud, a=lsblakk
authorMarkus Stange <mstange@themasta.com>
Mon, 25 Nov 2013 19:00:55 +0100
changeset 167740 7cc3e1e4cfc1e728188c9b7e87dac5b8e5a921d9
parent 167739 5a01890560d75cb4a0527cfe5e0e04d7fb1ad46e
child 167741 1a7dbb4d887ee405093f3a44f09c4b9f978b9e87
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, lsblakk
bugs942913
milestone27.0
Bug 942913 - Make sheets return YES from isVisibleOrBeingShown while the sheet opening animation runs so that we don't refuse to composite them during the animation. r=smichaud, a=lsblakk
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -92,16 +92,17 @@ typedef struct _nsCocoaWindowList {
 - (float)getDPI;
 
 - (void)mouseEntered:(NSEvent*)aEvent;
 - (void)mouseExited:(NSEvent*)aEvent;
 - (void)mouseMoved:(NSEvent*)aEvent;
 - (void)updateTrackingArea;
 - (NSView*)trackingAreaView;
 
+- (void)setBeingShown:(BOOL)aValue;
 - (BOOL)isVisibleOrBeingShown;
 
 - (ChildView*)mainChildView;
 
 - (NSArray*)titlebarControls;
 
 @end
 
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -30,17 +30,16 @@
 #include "nsCocoaFeatures.h"
 #include "nsIScreenManager.h"
 #include "nsIWidgetListener.h"
 #include "nsIPresShell.h"
 
 #include "gfxPlatform.h"
 #include "qcms.h"
 
-#include "mozilla/AutoRestore.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/Preferences.h"
 #include <algorithm>
 
 namespace mozilla {
 namespace layers {
 class LayerManager;
 }
@@ -681,16 +680,18 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool b
   if (!mWindow)
     return NS_OK;
 
   // We need to re-execute sometimes in order to bring already-visible
   // windows forward.
   if (!mSheetNeedsShow && !bState && ![mWindow isVisible])
     return NS_OK;
 
+  [mWindow setBeingShown:bState];
+
   nsIWidget* parentWidget = mParent;
   nsCOMPtr<nsPIWidgetCocoa> piParentWidget(do_QueryInterface(parentWidget));
   NSWindow* nativeParentWindow = (parentWidget) ?
     (NSWindow*)parentWidget->GetNativeData(NS_NATIVE_WINDOW) : nil;
 
   if (bState && !mBounds.IsEmpty()) {
     if (mWindowType == eWindowType_sheet) {
       // bail if no parent window (its basically what we do in Carbon)
@@ -900,16 +901,18 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool b
                         object:@"org.mozilla.gecko.PopupWindow"];
       }
     }
   }
   
   if (mPopupContentView)
       mPopupContentView->Show(bState);
 
+  [mWindow setBeingShown:NO];
+
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 struct ShadowParams {
   float standardDeviation;
   float density;
@@ -2530,35 +2533,26 @@ GetDPI(NSWindow* aWindow)
   mDPI = GetDPI(self);
   mTrackingArea = nil;
   mBeingShown = NO;
   [self updateTrackingArea];
 
   return self;
 }
 
+- (void)setBeingShown:(BOOL)aValue
+{
+  mBeingShown = aValue;
+}
+
 - (BOOL)isVisibleOrBeingShown
 {
   return [super isVisible] || mBeingShown;
 }
 
-- (void)orderFront:(id)sender
-{
-  AutoRestore<BOOL> saveBeingShown(mBeingShown);
-  mBeingShown = YES;
-  [super orderFront:sender];
-}
-
-- (void)makeKeyAndOrderFront:(id)sender
-{
-  AutoRestore<BOOL> saveBeingShown(mBeingShown);
-  mBeingShown = YES;
-  [super makeKeyAndOrderFront:sender];
-}
-
 - (void)dealloc
 {
   [mActiveTitlebarColor release];
   [mInactiveTitlebarColor release];
   [self removeTrackingArea];
   ChildViewMouseTracker::OnDestroyWindow(self);
   [super dealloc];
 }