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
Родитель 963f5a2b3a
Коммит 346d5f4895
15 изменённых файлов: 18 добавлений и 44 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -181,9 +181,6 @@ public:
NS_IMETHOD SetTitle(const nsAString& aTitle) override { return NS_OK; } NS_IMETHOD SetTitle(const nsAString& aTitle) override { return NS_OK; }
NS_IMETHOD SetIcon(const nsAString& aIconSpec) 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 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 GetAttention(int32_t aCycleCount) override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent, NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
int32_t aHorizontal, int32_t aHorizontal,

Просмотреть файл

@ -362,7 +362,6 @@ public:
NS_IMETHOD SetCursor(nsCursor aCursor) override; NS_IMETHOD SetCursor(nsCursor aCursor) override;
NS_IMETHOD SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) 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 SetTitle(const nsAString& title) override;
NS_IMETHOD GetAttention(int32_t aCycleCount) override; NS_IMETHOD GetAttention(int32_t aCycleCount) override;

Просмотреть файл

@ -1613,13 +1613,6 @@ LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset()
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0)); 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) NS_IMETHODIMP nsChildView::SetTitle(const nsAString& title)
{ {
// child views don't have titles // child views don't have titles

Просмотреть файл

@ -305,7 +305,8 @@ public:
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override; LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus) override; 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; NS_IMETHOD GetAttention(int32_t aCycleCount) override;
virtual bool HasPendingInputEvent() override; virtual bool HasPendingInputEvent() override;
virtual nsTransparencyMode GetTransparencyMode() override; virtual nsTransparencyMode GetTransparencyMode() override;

Просмотреть файл

@ -2060,9 +2060,11 @@ nsMenuBarX* nsCocoaWindow::GetMenuBar()
return mMenuBar; 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; gRollupListener = nullptr;
@ -2099,9 +2101,7 @@ NS_IMETHODIMP nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener, b
[mWindow setLevel:NSModalPanelWindowLevel]; [mWindow setLevel:NSModalPanelWindowLevel];
} }
return NS_OK; NS_OBJC_END_TRY_ABORT_BLOCK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
} }
NS_IMETHODIMP nsCocoaWindow::GetAttention(int32_t aCycleCount) NS_IMETHODIMP nsCocoaWindow::GetAttention(int32_t aCycleCount)

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1395,7 +1395,8 @@ class nsIWidget : public nsISupports
* @param aDoCapture true enables capture, false disables capture * @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 * Bring this window to the user's attention. This is intended to be a more

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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