Backed out changeset ff8ff4350191 (bug 1416878) for at least static bustage at toolkit/components/browser/nsWebBrowser.h:97: bad implicit conversion constructor for 'WidgetListenerDelegate'. r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2018-01-09 11:29:17 +02:00
parent b6c9f7de65
commit 91bae803e7
4 changed files with 27 additions and 227 deletions

View File

@ -67,7 +67,6 @@ nsWebBrowser::nsWebBrowser()
, mIsActive(true)
, mParentNativeWindow(nullptr)
, mProgressListener(nullptr)
, mWidgetListenerDelegate(this)
, mBackgroundColor(0)
, mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY)
, mPersistResult(NS_OK)
@ -1201,7 +1200,7 @@ nsWebBrowser::Create()
LayoutDeviceIntRect bounds(mInitInfo->x, mInitInfo->y,
mInitInfo->cx, mInitInfo->cy);
mInternalWidget->SetWidgetListener(&mWidgetListenerDelegate);
mInternalWidget->SetWidgetListener(this);
rv = mInternalWidget->Create(nullptr, mParentNativeWindow, bounds,
&widgetInit);
NS_ENSURE_SUCCESS(rv, rv);
@ -1904,25 +1903,3 @@ nsWebBrowser::SetFocusedElement(nsIDOMElement* aFocusedElement)
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
return fm ? fm->SetFocus(aFocusedElement, 0) : NS_OK;
}
void
nsWebBrowser::WidgetListenerDelegate::WindowActivated()
{
RefPtr<nsWebBrowser> holder = mWebBrowser;
holder->WindowActivated();
}
void
nsWebBrowser::WidgetListenerDelegate::WindowDeactivated()
{
RefPtr<nsWebBrowser> holder = mWebBrowser;
holder->WindowDeactivated();
}
bool
nsWebBrowser::WidgetListenerDelegate::PaintWindow(
nsIWidget* aWidget, mozilla::LayoutDeviceIntRegion aRegion)
{
RefPtr<nsWebBrowser> holder = mWebBrowser;
return holder->PaintWindow(aWidget, aRegion);
}

View File

@ -82,31 +82,12 @@ class nsWebBrowser final : public nsIWebBrowser,
public nsIWebBrowserPersist,
public nsIWebBrowserFocus,
public nsIWebProgressListener,
public nsIWidgetListener,
public nsSupportsWeakReference
{
friend class nsDocShellTreeOwner;
public:
// The implementation of non-refcounted nsIWidgetListener, which would hold a
// strong reference on stack before calling nsWebBrowser's
// MOZ_CAN_RUN_SCRIPT methods.
class WidgetListenerDelegate : public nsIWidgetListener
{
public:
WidgetListenerDelegate(nsWebBrowser* aWebBrowser)
: mWebBrowser(aWebBrowser) {}
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void WindowActivated() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void WindowDeactivated() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual bool PaintWindow(
nsIWidget* aWidget, mozilla::LayoutDeviceIntRegion aRegion) override;
private:
// The lifetime of WidgetListenerDelegate is bound to nsWebBrowser so we
// just use raw pointer here.
nsWebBrowser* mWebBrowser;
};
nsWebBrowser();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -136,11 +117,11 @@ protected:
NS_IMETHOD UnBindListener(nsISupports* aListener, const nsIID& aIID);
NS_IMETHOD EnableGlobalHistory(bool aEnable);
// nsIWidgetListener methods for WidgetListenerDelegate.
MOZ_CAN_RUN_SCRIPT void WindowActivated();
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
MOZ_CAN_RUN_SCRIPT bool PaintWindow(
nsIWidget* aWidget, mozilla::LayoutDeviceIntRegion aRegion);
// nsIWidgetListener
virtual void WindowActivated() override;
virtual void WindowDeactivated() override;
virtual bool PaintWindow(nsIWidget* aWidget,
mozilla::LayoutDeviceIntRegion aRegion) override;
protected:
RefPtr<nsDocShellTreeOwner> mDocShellTreeOwner;
@ -165,8 +146,6 @@ protected:
nsCOMPtr<nsIPrintSettings> mPrintSettings;
WidgetListenerDelegate mWidgetListenerDelegate;
// cached background color
nscolor mBackgroundColor;

View File

@ -91,7 +91,6 @@ static NS_DEFINE_CID(kWindowCID, NS_WINDOW_CID);
nsWebShellWindow::nsWebShellWindow(uint32_t aChromeFlags)
: nsXULWindow(aChromeFlags)
, mSPTimerLock("nsWebShellWindow.mSPTimerLock")
, mWidgetListenerDelegate(this)
{
}
@ -181,7 +180,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
mParentWindow = do_GetWeakReference(aParent);
}
mWindow->SetWidgetListener(&mWidgetListenerDelegate);
mWindow->SetWidgetListener(this);
rv = mWindow->Create((nsIWidget *)parentWidget, // Parent nsIWidget
nullptr, // Native parent widget
deskRect, // Widget dimensions
@ -783,108 +782,3 @@ NS_IMETHODIMP nsWebShellWindow::Destroy()
}
return nsXULWindow::Destroy();
}
nsIXULWindow*
nsWebShellWindow::WidgetListenerDelegate::GetXULWindow()
{
return mWebShellWindow->GetXULWindow();
}
nsIPresShell*
nsWebShellWindow::WidgetListenerDelegate::GetPresShell()
{
return mWebShellWindow->GetPresShell();
}
bool
nsWebShellWindow::WidgetListenerDelegate::WindowMoved(
nsIWidget* aWidget, int32_t aX, int32_t aY)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->WindowMoved(aWidget, aX, aY);
}
bool
nsWebShellWindow::WidgetListenerDelegate::WindowResized(
nsIWidget* aWidget, int32_t aWidth, int32_t aHeight)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->WindowResized(aWidget, aWidth, aHeight);
}
bool
nsWebShellWindow::WidgetListenerDelegate::RequestWindowClose(nsIWidget* aWidget)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->RequestWindowClose(aWidget);
}
void
nsWebShellWindow::WidgetListenerDelegate::SizeModeChanged(nsSizeMode aSizeMode)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->SizeModeChanged(aSizeMode);
}
void
nsWebShellWindow::WidgetListenerDelegate::UIResolutionChanged()
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->UIResolutionChanged();
}
void
nsWebShellWindow::WidgetListenerDelegate::FullscreenWillChange(
bool aInFullscreen)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->FullscreenWillChange(aInFullscreen);
}
void
nsWebShellWindow::WidgetListenerDelegate::FullscreenChanged(bool aInFullscreen)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->FullscreenChanged(aInFullscreen);
}
void
nsWebShellWindow::WidgetListenerDelegate::OcclusionStateChanged(
bool aIsFullyOccluded)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->OcclusionStateChanged(aIsFullyOccluded);
}
void
nsWebShellWindow::WidgetListenerDelegate::OSToolbarButtonPressed()
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->OSToolbarButtonPressed();
}
bool
nsWebShellWindow::WidgetListenerDelegate::ZLevelChanged(
bool aImmediate, nsWindowZ *aPlacement, nsIWidget* aRequestBelow,
nsIWidget** aActualBelow)
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
return holder->ZLevelChanged(aImmediate,
aPlacement,
aRequestBelow,
aActualBelow);
}
void
nsWebShellWindow::WidgetListenerDelegate::WindowActivated()
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->WindowActivated();
}
void
nsWebShellWindow::WidgetListenerDelegate::WindowDeactivated()
{
RefPtr<nsWebShellWindow> holder = mWebShellWindow;
holder->WindowDeactivated();
}

View File

@ -24,57 +24,10 @@ class WebShellWindowTimerCallback;
} // namespace mozilla
class nsWebShellWindow final : public nsXULWindow,
public nsIWebProgressListener
public nsIWebProgressListener,
public nsIWidgetListener
{
public:
// The implementation of non-refcounted nsIWidgetListener, which would hold a
// strong reference on stack before calling nsWebShellWindow's
// MOZ_CAN_RUN_SCRIPT methods.
class WidgetListenerDelegate : public nsIWidgetListener
{
public:
WidgetListenerDelegate(nsWebShellWindow* aWebShellWindow)
: mWebShellWindow(aWebShellWindow) {}
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual nsIXULWindow* GetXULWindow() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual nsIPresShell* GetPresShell() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool RequestWindowClose(nsIWidget* aWidget) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void SizeModeChanged(nsSizeMode sizeMode) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void UIResolutionChanged() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void FullscreenWillChange(bool aInFullscreen) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void FullscreenChanged(bool aInFullscreen) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OcclusionStateChanged(bool aIsFullyOccluded) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void OSToolbarButtonPressed() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool ZLevelChanged(bool aImmediate,
nsWindowZ *aPlacement,
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void WindowActivated() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual void WindowDeactivated() override;
private:
// The lifetime of WidgetListenerDelegate is bound to nsWebShellWindow so
// we just use a raw pointer here.
nsWebShellWindow* mWebShellWindow;
};
explicit nsWebShellWindow(uint32_t aChromeFlags);
// nsISupports interface...
@ -97,25 +50,22 @@ public:
// nsIBaseWindow
NS_IMETHOD Destroy() override;
// nsIWidgetListener methods for WidgetListenerDelegate.
nsIXULWindow* GetXULWindow() { return this; }
nsIPresShell* GetPresShell();
MOZ_CAN_RUN_SCRIPT
bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
MOZ_CAN_RUN_SCRIPT
bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight);
MOZ_CAN_RUN_SCRIPT bool RequestWindowClose(nsIWidget* aWidget);
MOZ_CAN_RUN_SCRIPT void SizeModeChanged(nsSizeMode aSizeMode);
MOZ_CAN_RUN_SCRIPT void UIResolutionChanged();
MOZ_CAN_RUN_SCRIPT void FullscreenWillChange(bool aInFullscreen);
MOZ_CAN_RUN_SCRIPT void FullscreenChanged(bool aInFullscreen);
MOZ_CAN_RUN_SCRIPT void OcclusionStateChanged(bool aIsFullyOccluded);
MOZ_CAN_RUN_SCRIPT void OSToolbarButtonPressed();
MOZ_CAN_RUN_SCRIPT
bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,
nsIWidget* aRequestBelow, nsIWidget** aActualBelow);
MOZ_CAN_RUN_SCRIPT void WindowActivated();
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
// nsIWidgetListener
virtual nsIXULWindow* GetXULWindow() override { return this; }
virtual nsIPresShell* GetPresShell() override;
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) override;
virtual bool RequestWindowClose(nsIWidget* aWidget) override;
virtual void SizeModeChanged(nsSizeMode sizeMode) override;
virtual void UIResolutionChanged() override;
virtual void FullscreenWillChange(bool aInFullscreen) override;
virtual void FullscreenChanged(bool aInFullscreen) override;
virtual void OcclusionStateChanged(bool aIsFullyOccluded) override;
virtual void OSToolbarButtonPressed() override;
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,
nsIWidget* aRequestBelow, nsIWidget** aActualBelow) override;
virtual void WindowActivated() override;
virtual void WindowDeactivated() override;
protected:
friend class mozilla::WebShellWindowTimerCallback;
@ -127,10 +77,10 @@ protected:
nsCOMPtr<nsITimer> mSPTimer;
mozilla::Mutex mSPTimerLock;
WidgetListenerDelegate mWidgetListenerDelegate;
void SetPersistenceTimer(uint32_t aDirtyFlags);
void FirePersistenceTimer();
};
#endif /* nsWebShellWindow_h__ */