Bug 869151. Implement GetParent for nsCocoaWindow so that nsBaseWidget::Destroy can find the parent and remove from the child list when destroying. r=smichaud
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 09 May 2013 18:57:20 -0500
changeset 138229 a0fb89f4a84327bffb9a847b0a40bd117b50450b
parent 138228 33746f775a64b6eb250b2de28b0c8a806bb3c424
child 138230 c3626167f6d84ba374db0ab99cabdfde1be20463
push id3752
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 17:21:10 +0000
treeherdermozilla-aurora@1580544aef0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud
bugs869151
milestone23.0a1
Bug 869151. Implement GetParent for nsCocoaWindow so that nsBaseWidget::Destroy can find the parent and remove from the child list when destroying. r=smichaud
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -211,16 +211,18 @@ public:
     NS_IMETHOD              Create(nsIWidget* aParent,
                                    nsNativeWidget aNativeParent,
                                    const nsIntRect &aRect,
                                    nsDeviceContext *aContext,
                                    nsWidgetInitData *aInitData = nullptr);
 
     NS_IMETHOD              Destroy();
 
+    virtual nsIWidget*      GetParent(void);
+
     NS_IMETHOD              Show(bool aState);
     virtual nsIWidget*      GetSheetWindowParent(void);
     NS_IMETHOD              Enable(bool aState);
     virtual bool            IsEnabled() const;
     NS_IMETHOD              SetModal(bool aState);
     virtual bool            IsVisible() const;
     NS_IMETHOD              SetFocus(bool aState=false);
     virtual nsIntPoint WidgetToScreenOffset();
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -529,16 +529,21 @@ NS_IMETHODIMP nsCocoaWindow::Destroy()
     } else if (mWindow) {
       nsCocoaUtils::HideOSChromeOnScreen(false, [mWindow screen]);
     }
   }
 
   return NS_OK;
 }
 
+nsIWidget* nsCocoaWindow::GetParent()
+{
+  return mParent;
+}
+
 nsIWidget* nsCocoaWindow::GetSheetWindowParent(void)
 {
   if (mWindowType != eWindowType_sheet)
     return nullptr;
   nsCocoaWindow *parent = static_cast<nsCocoaWindow*>(mParent);
   while (parent && (parent->mWindowType == eWindowType_sheet))
     parent = static_cast<nsCocoaWindow*>(parent->mParent);
   return parent;