Bug 1293596 (part 7) - Make nsIWidget::Destroy infallible. r=karlt.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 10 Aug 2016 10:04:11 +1000
changeset 351834 08d20351a75460e22d4c1957d2c0e076b291700c
parent 351833 a07a5bac46b40627727b4d0dd58388f9502783f9
child 351835 4ae5d84aabf94a85ee605b123040e7c2b7384a4d
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1293596
milestone51.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 1293596 (part 7) - Make nsIWidget::Destroy infallible. r=karlt.
dom/plugins/ipc/PluginWidgetParent.cpp
widget/PluginWidgetProxy.cpp
widget/PluginWidgetProxy.h
widget/PuppetWidget.cpp
widget/PuppetWidget.h
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
widget/uikit/nsWindow.h
widget/uikit/nsWindow.mm
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
--- a/dom/plugins/ipc/PluginWidgetParent.cpp
+++ b/dom/plugins/ipc/PluginWidgetParent.cpp
@@ -160,18 +160,17 @@ PluginWidgetParent::RecvCreate(nsresult*
 }
 
 void
 PluginWidgetParent::KillWidget()
 {
   PWLOG("PluginWidgetParent::KillWidget() widget=%p\n", (void*)mWidget.get());
   if (mWidget) {
     mWidget->UnregisterPluginWindowForRemoteUpdates();
-    DebugOnly<nsresult> rv = mWidget->Destroy();
-    NS_ASSERTION(NS_SUCCEEDED(rv), "widget destroy failure");
+    mWidget->Destroy();
 #if defined(MOZ_WIDGET_GTK)
     mWidget->SetNativeData(NS_NATIVE_PLUGIN_OBJECT_PTR, (uintptr_t)0);
     mWrapper = nullptr;
 #elif defined(XP_WIN)
     ::RemovePropW((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW),
                   mozilla::dom::kPluginWidgetContentParentProperty);
 #endif
     mWidget = nullptr;
--- a/widget/PluginWidgetProxy.cpp
+++ b/widget/PluginWidgetProxy.cpp
@@ -89,29 +89,29 @@ PluginWidgetProxy::SetParent(nsIWidget* 
 }
 
 nsIWidget*
 PluginWidgetProxy::GetParent(void)
 {
   return mParent.get();
 }
 
-NS_IMETHODIMP
+void
 PluginWidgetProxy::Destroy()
 {
   PWLOG("PluginWidgetProxy::Destroy()\n");
 
   if (mActor) {
     // Communicate that the layout widget has been torn down before the sub
     // protocol.
     mActor->ProxyShutdown();
     mActor = nullptr;
   }
 
-  return PuppetWidget::Destroy();
+  PuppetWidget::Destroy();
 }
 
 void
 PluginWidgetProxy::GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects)
 {
   if (mClipRects && mClipRectCount) {
     aRects->AppendElements(mClipRects.get(), mClipRectCount);
   }
--- a/widget/PluginWidgetProxy.h
+++ b/widget/PluginWidgetProxy.h
@@ -35,17 +35,17 @@ public:
 
   // nsIWidget
   using PuppetWidget::Create; // for Create signature not overridden here
   virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                        nsNativeWidget aNativeParent,
                                        const LayoutDeviceIntRect& aRect,
                                        nsWidgetInitData* aInitData = nullptr)
                                        override;
-  NS_IMETHOD Destroy() override;
+  virtual void Destroy() override;
   NS_IMETHOD SetFocus(bool aRaise = false) override;
   NS_IMETHOD SetParent(nsIWidget* aNewParent) override;
 
   virtual nsIWidget* GetParent(void) override;
   virtual void* GetNativeData(uint32_t aDataType) override;
 #if defined(XP_WIN)
   void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
 #endif
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -165,38 +165,37 @@ PuppetWidget::CreateChild(const LayoutDe
   bool isPopup = IsPopup(aInitData);
   nsCOMPtr<nsIWidget> widget = nsIWidget::CreatePuppetWidget(mTabChild);
   return ((widget &&
            NS_SUCCEEDED(widget->Create(isPopup ? nullptr: this, nullptr, aRect,
                                        aInitData))) ?
           widget.forget() : nullptr);
 }
 
-NS_IMETHODIMP
+void
 PuppetWidget::Destroy()
 {
   if (mOnDestroyCalled) {
-    return NS_OK;
+    return;
   }
   mOnDestroyCalled = true;
 
   Base::OnDestroy();
   Base::Destroy();
   mPaintTask.Revoke();
   if (mMemoryPressureObserver) {
     mMemoryPressureObserver->Remove();
   }
   mMemoryPressureObserver = nullptr;
   mChild = nullptr;
   if (mLayerManager) {
     mLayerManager->Destroy();
   }
   mLayerManager = nullptr;
   mTabChild = nullptr;
-  return NS_OK;
 }
 
 NS_IMETHODIMP
 PuppetWidget::Show(bool aState)
 {
   NS_ASSERTION(mEnabled,
                "does it make sense to Show()/Hide() a disabled widget?");
 
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -71,17 +71,17 @@ public:
 
   void InitIMEState();
 
   virtual already_AddRefed<nsIWidget>
   CreateChild(const LayoutDeviceIntRect& aRect,
               nsWidgetInitData* aInitData = nullptr,
               bool aForceUseIWidgetParent = false) override;
 
-  NS_IMETHOD Destroy() override;
+  virtual void Destroy() override;
 
   NS_IMETHOD Show(bool aState) override;
 
   virtual bool IsVisible() const override
   { return mVisible; }
 
   NS_IMETHOD ConstrainPosition(bool     /*ignored aAllowSlop*/,
                                int32_t* aX,
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1567,18 +1567,18 @@ nsWindow::Create(nsIWidget* aParent,
 
 #ifdef DEBUG_ANDROID_WIDGET
     DumpWindows();
 #endif
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::Destroy(void)
+void
+nsWindow::Destroy()
 {
     nsBaseWidget::mOnDestroyCalled = true;
 
     if (mGeckoViewSupport) {
         // Disassociate our native object with GeckoView.
         mGeckoViewSupport = nullptr;
     }
 
@@ -1598,18 +1598,16 @@ nsWindow::Destroy(void)
 
     SetParent(nullptr);
 
     nsBaseWidget::OnDestroy();
 
 #ifdef DEBUG_ANDROID_WIDGET
     DumpWindows();
 #endif
-
-    return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& config)
 {
     for (uint32_t i = 0; i < config.Length(); ++i) {
         nsWindow *childWin = (nsWindow*) config[i].mChild.get();
         childWin->Resize(config[i].mBounds.x,
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -128,17 +128,17 @@ public:
     // nsIWidget
     //
 
     using nsBaseWidget::Create; // for Create signature not overridden here
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData) override;
-    NS_IMETHOD Destroy(void) override;
+    virtual void Destroy() override;
     NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&) override;
     NS_IMETHOD SetParent(nsIWidget* aNewParent) override;
     virtual nsIWidget *GetParent(void) override;
     virtual float GetDPI() override;
     virtual double GetDefaultScaleInternal() override;
     NS_IMETHOD Show(bool aState) override;
     NS_IMETHOD SetModal(bool aModal) override;
     virtual bool IsVisible() const override;
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -298,17 +298,17 @@ public:
 
   // nsIWidget interface
   virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                        nsNativeWidget aNativeParent,
                                        const LayoutDeviceIntRect& aRect,
                                        nsWidgetInitData* aInitData = nullptr)
                                        override;
 
-  NS_IMETHOD              Destroy() override;
+  virtual void            Destroy() override;
 
   NS_IMETHOD              Show(bool aState) override;
   virtual bool            IsVisible() const override;
 
   NS_IMETHOD              SetParent(nsIWidget* aNewParent) override;
   virtual nsIWidget*      GetParent(void) override;
   virtual float           GetDPI() override;
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -552,45 +552,43 @@ nsChildView::GetXULWindowWidget()
 {
   id windowDelegate = [[mView window] delegate];
   if (windowDelegate && [windowDelegate isKindOfClass:[WindowDelegate class]]) {
     return [(WindowDelegate *)windowDelegate geckoWidget];
   }
   return nullptr;
 }
 
-NS_IMETHODIMP nsChildView::Destroy()
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+void nsChildView::Destroy()
+{
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   // Make sure that no composition is in progress while disconnecting
   // ourselves from the view.
   MutexAutoLock lock(mViewTearDownLock);
 
   if (mOnDestroyCalled)
-    return NS_OK;
+    return;
   mOnDestroyCalled = true;
 
   // Stuff below may delete the last ref to this
   nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
 
   [mView widgetDestroyed];
 
   nsBaseWidget::Destroy();
 
   NotifyWindowDestroyed();
   mParentWidget = nil;
 
   TearDownView();
 
   nsBaseWidget::OnDestroy();
 
-  return NS_OK;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 #pragma mark -
 
 #if 0
 static void PrintViewHierarchy(NSView *view)
 {
   while (view) {
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -230,17 +230,17 @@ public:
                                          override;
 
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData = nullptr)
                                          override;
 
-    NS_IMETHOD              Destroy() override;
+    virtual void            Destroy() override;
 
     NS_IMETHOD              Show(bool aState) override;
     virtual nsIWidget*      GetSheetWindowParent(void) override;
     NS_IMETHOD              Enable(bool aState) override;
     virtual bool            IsEnabled() const override;
     NS_IMETHOD              SetModal(bool aState) override;
     NS_IMETHOD              SetFakeModal(bool aState) override;
     virtual bool            IsVisible() const override;
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -521,20 +521,20 @@ nsCocoaWindow::CreatePopupContentView(co
   ChildView* newContentView = (ChildView*)mPopupContentView->GetNativeData(NS_NATIVE_WIDGET);
   [mWindow setContentView:newContentView];
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-NS_IMETHODIMP nsCocoaWindow::Destroy()
+void nsCocoaWindow::Destroy()
 {
   if (mOnDestroyCalled)
-    return NS_OK;
+    return;
   mOnDestroyCalled = true;
 
   // SetFakeModal(true) is called for non-modal window opened by modal window.
   // On Cocoa, it needs corresponding SetFakeModal(false) on destroy to restore
   // ancestor windows' state.
   if (mFakeModal) {
     SetFakeModal(false);
   }
@@ -568,18 +568,16 @@ NS_IMETHODIMP nsCocoaWindow::Destroy()
     // holding a reference to ourselves is usually waiting to be garbage-
     // collected).  See bug 757618.
     if (mInNativeFullScreenMode) {
       DestroyNativeWindow();
     } else if (mWindow) {
       nsCocoaUtils::HideOSChromeOnScreen(false);
     }
   }
-
-  return NS_OK;
 }
 
 nsIWidget* nsCocoaWindow::GetSheetWindowParent(void)
 {
   if (mWindowType != eWindowType_sheet)
     return nullptr;
   nsCocoaWindow *parent = static_cast<nsCocoaWindow*>(mParent);
   while (parent && (parent->mWindowType == eWindowType_sheet))
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -329,26 +329,25 @@ nsWindow::Create(nsIWidget* aParent,
 
     mScreen->RegisterWindow(this);
 
     Resize(0, 0, mBounds.width, mBounds.height, false);
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::Destroy(void)
+void
+nsWindow::Destroy()
 {
     mOnDestroyCalled = true;
     mScreen->UnregisterWindow(this);
     if (this == gFocusedWindow) {
         gFocusedWindow = nullptr;
     }
     nsBaseWidget::OnDestroy();
-    return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Show(bool aState)
 {
     if (mWindowType == eWindowType_invisible) {
         return NS_OK;
     }
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -47,17 +47,17 @@ public:
     static nsEventStatus DispatchKeyInput(mozilla::WidgetKeyboardEvent& aEvent);
     static void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
 
     using nsBaseWidget::Create; // for Create signature not overridden here
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          void* aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData) override;
-    NS_IMETHOD Destroy(void);
+    virtual void Destroy();
 
     NS_IMETHOD Show(bool aState);
     virtual bool IsVisible() const;
     NS_IMETHOD ConstrainPosition(bool aAllowSlop,
                                  int32_t *aX,
                                  int32_t *aY);
     NS_IMETHOD Move(double aX,
                     double aY);
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -698,21 +698,21 @@ nsWindow::DestroyChildWindows()
             gdk_window_get_user_data(child, &data);
             if (GTK_IS_WIDGET(data)) {
                 gtk_widget_destroy(static_cast<GtkWidget*>(data));
             }
         }
     }
 }
 
-NS_IMETHODIMP
-nsWindow::Destroy(void)
+void
+nsWindow::Destroy()
 {
     if (mIsDestroyed || !mCreated)
-        return NS_OK;
+        return;
 
     LOG(("nsWindow::Destroy [%p]\n", (void *)this));
     mIsDestroyed = true;
     mCreated = false;
 
     /** Need to clean our LayerManager up while still alive */
     if (mLayerManager) {
         mLayerManager->Destroy();
@@ -799,18 +799,16 @@ nsWindow::Destroy(void)
 #ifdef ACCESSIBILITY
      if (mRootAccessible) {
          mRootAccessible = nullptr;
      }
 #endif
 
     // Save until last because OnDestroy() may cause us to be deleted.
     OnDestroy();
-
-    return NS_OK;
 }
 
 nsIWidget *
 nsWindow::GetParent(void)
 {
     return mParent;
 }
 
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -92,17 +92,17 @@ public:
     bool AreBoundsSane(void);
 
     // nsIWidget
     using nsBaseWidget::Create; // for Create signature not overridden here
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData) override;
-    NS_IMETHOD         Destroy(void) override;
+    virtual void       Destroy() override;
     virtual nsIWidget *GetParent() override;
     virtual float      GetDPI() override;
     virtual double     GetDefaultScaleInternal() override;
     // Under Gtk, we manage windows using device pixels so no scaling is needed:
     mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final
     {
         return mozilla::DesktopToLayoutDeviceScale(1.0);
     }
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -507,32 +507,30 @@ void nsBaseWidget::SetAttachedWidgetList
    mAttachedWidgetListener = aListener;
  }
 
 //-------------------------------------------------------------------------
 //
 // Close this nsBaseWidget
 //
 //-------------------------------------------------------------------------
-NS_IMETHODIMP nsBaseWidget::Destroy()
+void nsBaseWidget::Destroy()
 {
   // Just in case our parent is the only ref to us
   nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
   // disconnect from the parent
   nsIWidget *parent = GetParent();
   if (parent) {
     parent->RemoveChild(this);
   }
 
 #if defined(XP_WIN)
   // Allow our scroll capture container to be cleaned up, if we have one.
   mScrollCaptureContainer = nullptr;
 #endif
-
-  return NS_OK;
 }
 
 
 //-------------------------------------------------------------------------
 //
 // Set this nsBaseWidget's parent
 //
 //-------------------------------------------------------------------------
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -138,17 +138,17 @@ public:
   nsBaseWidget();
 
   NS_DECL_ISUPPORTS
 
   // nsIWidget interface
   NS_IMETHOD              CaptureMouse(bool aCapture) override;
   virtual nsIWidgetListener*  GetWidgetListener() override;
   virtual void            SetWidgetListener(nsIWidgetListener* alistener) override;
-  NS_IMETHOD              Destroy() override;
+  virtual void            Destroy() override;
   NS_IMETHOD              SetParent(nsIWidget* aNewParent) override;
   virtual nsIWidget*      GetParent(void) override;
   virtual nsIWidget*      GetTopLevelWidget() override;
   virtual nsIWidget*      GetSheetWindowParent(void) override;
   virtual float           GetDPI() override;
   virtual void            AddChild(nsIWidget* aChild) override;
   virtual void            RemoveChild(nsIWidget* aChild) override;
 
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -502,17 +502,17 @@ class nsIWidget : public nsISupports
     virtual void SetWidgetListener(nsIWidgetListener* alistener) = 0;
     //@}
 
     /**
      * Close and destroy the internal native window.
      * This method does not delete the widget.
      */
 
-    NS_IMETHOD Destroy(void) = 0;
+    virtual void Destroy() = 0;
 
     /**
      * Destroyed() returns true if Destroy() has been called already.
      * Otherwise, false.
      */
     bool Destroyed() const { return mOnDestroyCalled; }
 
 
--- a/widget/uikit/nsWindow.h
+++ b/widget/uikit/nsWindow.h
@@ -29,17 +29,17 @@ public:
     // nsIWidget
     //
 
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData = nullptr)
                                          override;
-    NS_IMETHOD Destroy() override;
+    virtual void Destroy() override;
     NS_IMETHOD Show(bool aState) override;
     NS_IMETHOD              Enable(bool aState) override {
         return NS_OK;
     }
     virtual bool            IsEnabled() const override {
         return true;
     }
     NS_IMETHOD              SetModal(bool aState) override;
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -523,18 +523,18 @@ nsWindow::Create(nsIWidget* aParent,
     }
     else {
         [nsAppShell::gTopLevelViews addObject:mNativeView];
     }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::Destroy(void)
+void
+nsWindow::Destroy()
 {
     for (uint32_t i = 0; i < mChildren.Length(); ++i) {
         // why do we still have children?
         mChildren[i]->SetParent(nullptr);
     }
 
     if (mParent)
         mParent->mChildren.RemoveElement(this);
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -732,27 +732,27 @@ nsWindow::Create(nsIWidget* aParent,
   if (ShouldCacheTitleBarInfo(mWindowType, mBorderStyle)) {
     nsUXThemeData::UpdateTitlebarInfo(mWnd);
   }
 
   return NS_OK;
 }
 
 // Close this nsWindow
-NS_IMETHODIMP nsWindow::Destroy()
+void nsWindow::Destroy()
 {
   // WM_DESTROY has already fired, avoid calling it twice
   if (mOnDestroyCalled)
-    return NS_OK;
+    return;
 
   // Don't destroy windows that have file pickers open, we'll tear these down
   // later once the picker is closed.
   mDestroyCalled = true;
   if (mPickerDisplayCount)
-    return NS_OK;
+    return;
 
   // During the destruction of all of our children, make sure we don't get deleted.
   nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
 
   /**
    * On windows the LayerManagerOGL destructor wants the widget to be around for
    * cleanup. It also would like to have the HWND intact, so we nullptr it here.
    */
@@ -776,18 +776,16 @@ NS_IMETHODIMP nsWindow::Destroy()
   
   // Our windows can be subclassed which may prevent us receiving WM_DESTROY. If OnDestroy()
   // didn't get called, call it now.
   if (false == mOnDestroyCalled) {
     MSGResult msgResult;
     mWindowHook.Notify(mWnd, WM_DESTROY, 0, 0, msgResult);
     OnDestroy();
   }
-
-  return NS_OK;
 }
 
 /**************************************************************
  *
  * SECTION: Window class utilities
  *
  * Utilities for calculating the proper window class name for
  * Create window.
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -98,17 +98,17 @@ public:
 
   // nsIWidget interface
   using nsWindowBase::Create; // for Create signature not overridden here
   virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                        nsNativeWidget aNativeParent,
                                        const LayoutDeviceIntRect& aRect,
                                        nsWidgetInitData* aInitData = nullptr)
                                        override;
-  NS_IMETHOD              Destroy() override;
+  virtual void            Destroy() override;
   NS_IMETHOD              SetParent(nsIWidget *aNewParent) override;
   virtual nsIWidget*      GetParent(void) override;
   virtual float           GetDPI() override;
   double                  GetDefaultScaleInternal() final;
   int32_t                 LogToPhys(double aValue) final;
   mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final
   {
     if (mozilla::widget::WinUtils::IsPerMonitorDPIAware()) {