Bug 1296993 (part 7) - Streamline nsIWidget::CaptureRollupEvents. r=mstange.

This patch does the following.

- Removes the return value, because none of the call sites check it.

- Puts an empty implementation into nsBaseWidget.

- Removes the empty implementations from several nsIWidget instances, because
  they can use the nsBaseWidget one.

--HG--
extra : rebase_source : 2a94a47f1e7fe986d1efc3854c72968a3e28e365
This commit is contained in:
Nicholas Nethercote 2016-08-25 13:43:27 +10:00
parent 963f5a2b3a
commit 346d5f4895
15 changed files with 18 additions and 44 deletions

View File

@ -82,7 +82,6 @@ public:
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override { return LayoutDeviceIntPoint(0, 0); }
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus) override { return NS_OK; }
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture) override { return NS_OK; }
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
const InputContextAction& aAction) override {}
NS_IMETHOD_(InputContext) GetInputContext() override { abort(); }

View File

@ -147,10 +147,6 @@ public:
const mozilla::Maybe<ZoomConstraints>& aConstraints) override;
bool AsyncPanZoomEnabled() const override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) override
{ return NS_ERROR_UNEXPECTED; }
NS_IMETHOD_(bool)
ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
const mozilla::WidgetKeyboardEvent& aEvent,

View File

@ -181,9 +181,6 @@ public:
NS_IMETHOD SetTitle(const nsAString& aTitle) override { return NS_OK; }
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override { return NS_OK; }
NS_IMETHOD CaptureMouse(bool aCapture) override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
bool aDoCapture) override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD GetAttention(int32_t aCycleCount) override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
int32_t aHorizontal,

View File

@ -362,7 +362,6 @@ public:
NS_IMETHOD SetCursor(nsCursor aCursor) override;
NS_IMETHOD SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture) override;
NS_IMETHOD SetTitle(const nsAString& title) override;
NS_IMETHOD GetAttention(int32_t aCycleCount) override;

View File

@ -1613,13 +1613,6 @@ LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset()
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
}
NS_IMETHODIMP nsChildView::CaptureRollupEvents(nsIRollupListener * aListener,
bool aDoCapture)
{
// this never gets called, only top-level windows can be rollup widgets
return NS_OK;
}
NS_IMETHODIMP nsChildView::SetTitle(const nsAString& title)
{
// child views don't have titles

View File

@ -305,7 +305,8 @@ public:
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture) override;
virtual void CaptureRollupEvents(nsIRollupListener * aListener,
bool aDoCapture) override;
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
virtual bool HasPendingInputEvent() override;
virtual nsTransparencyMode GetTransparencyMode() override;

View File

@ -2060,9 +2060,11 @@ nsMenuBarX* nsCocoaWindow::GetMenuBar()
return mMenuBar;
}
NS_IMETHODIMP nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture)
void
nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
gRollupListener = nullptr;
@ -2099,9 +2101,7 @@ NS_IMETHODIMP nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener, b
[mWindow setLevel:NSModalPanelWindowLevel];
}
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
NS_IMETHODIMP nsCocoaWindow::GetAttention(int32_t aCycleCount)

View File

@ -92,12 +92,6 @@ public:
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
bool aDoCapture)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
virtual nsresult MakeFullScreen(
bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override;

View File

@ -1890,15 +1890,15 @@ nsWindow::CaptureMouse(bool aCapture)
return NS_OK;
}
NS_IMETHODIMP
void
nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
bool aDoCapture)
{
if (!mGdkWindow)
return NS_OK;
return;
if (!mContainer)
return NS_ERROR_FAILURE;
return;
LOG(("CaptureRollupEvents %p %i\n", this, int(aDoCapture)));
@ -1921,8 +1921,6 @@ nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
gtk_grab_remove(GTK_WIDGET(mContainer));
gRollupListener = nullptr;
}
return NS_OK;
}
NS_IMETHODIMP

View File

@ -145,7 +145,7 @@ public:
virtual void SetWindowClass(const nsAString& xulWinType) override;
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
NS_IMETHOD CaptureMouse(bool aCapture) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
virtual void CaptureRollupEvents(nsIRollupListener *aListener,
bool aDoCapture) override;
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,

View File

@ -141,6 +141,8 @@ public:
// nsIWidget interface
NS_IMETHOD CaptureMouse(bool aCapture) override;
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) override {}
virtual nsIWidgetListener* GetWidgetListener() override;
virtual void SetWidgetListener(nsIWidgetListener* alistener) override;
virtual void Destroy() override;

View File

@ -1395,7 +1395,8 @@ class nsIWidget : public nsISupports
* @param aDoCapture true enables capture, false disables capture
*
*/
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture) = 0;
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) = 0;
/**
* Bring this window to the user's attention. This is intended to be a more

View File

@ -80,10 +80,6 @@ public:
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
bool aDoCapture) override {
return NS_ERROR_NOT_IMPLEMENTED;
}
void WillPaintWindow();
bool PaintWindow(LayoutDeviceIntRegion aRegion);

View File

@ -3565,8 +3565,8 @@ NS_IMETHODIMP nsWindow::CaptureMouse(bool aCapture)
*
**************************************************************/
NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener,
bool aDoCapture)
void
nsWindow::CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture)
{
if (aDoCapture) {
gRollupListener = aListener;
@ -3579,8 +3579,6 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener,
sProcessHook = false;
UnregisterSpecialDropdownHooks();
}
return NS_OK;
}
/**************************************************************

View File

@ -167,7 +167,7 @@ public:
nsEventStatus& aStatus) override;
virtual void EnableDragDrop(bool aEnable) override;
NS_IMETHOD CaptureMouse(bool aCapture) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
bool aDoCapture) override;
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
virtual bool HasPendingInputEvent() override;