Bug 1372602 Make child widgets not visible if the window around it isn't visible on OS X. r=mstange
authorMason Chang <mchang@mozilla.com>
Thu, 10 Aug 2017 21:43:26 -0700
changeset 374240 8fa9361b19689f6107b028317c14bacd1a72c11f
parent 374239 0059106aaa203a57da28bfd063d3a4b0427c2d20
child 374241 b7d1a669a548f64e152e0a1bd53efda9d852ea40
push id32318
push userkwierso@gmail.com
push dateFri, 11 Aug 2017 20:16:01 +0000
treeherdermozilla-central@80ff3f300e05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1372602
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1372602 Make child widgets not visible if the window around it isn't visible on OS X. r=mstange
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -479,17 +479,17 @@ public:
   void              ResetParent();
 
   static bool DoHasPendingInputEvent();
   static uint32_t GetCurrentInputEventCount();
   static void UpdateCurrentInputEventCount();
 
   NSView<mozView>* GetEditorView();
 
-  nsCocoaWindow*    GetXULWindowWidget();
+  nsCocoaWindow*    GetXULWindowWidget() const;
 
   virtual void      ReparentNativeWidget(nsIWidget* aNewParent) override;
 
   mozilla::widget::TextInputHandler* GetTextInputHandler()
   {
     return mTextInputHandler;
   }
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -557,17 +557,17 @@ void nsChildView::TearDownView()
     [mView performSelectorOnMainThread:@selector(delayedTearDown) withObject:nil waitUntilDone:false];
   }
   mView = nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 nsCocoaWindow*
-nsChildView::GetXULWindowWidget()
+nsChildView::GetXULWindowWidget() const
 {
   id windowDelegate = [[mView window] delegate];
   if (windowDelegate && [windowDelegate isKindOfClass:[WindowDelegate class]]) {
     return [(WindowDelegate *)windowDelegate geckoWidget];
   }
   return nullptr;
 }
 
@@ -693,16 +693,20 @@ void nsChildView::SetTransparencyMode(ns
 bool nsChildView::IsVisible() const
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   if (!mVisible) {
     return mVisible;
   }
 
+  if (!GetXULWindowWidget()->IsVisible()) {
+    return false;
+  }
+
   // mVisible does not accurately reflect the state of a hidden tabbed view
   // so verify that the view has a window as well
   // then check native widget hierarchy visibility
   return ([mView window] != nil) && !NSIsEmptyRect([mView visibleRect]);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
 }