Bug 869151. Implement GetParent for nsCocoaWindow so that nsBaseWidget::Destroy can find the parent and remove from the child list when destroying. r=smichaud
--- 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;