зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1299335 (part 1) - Change some nsIWidget function return values from |NS_IMETHOD| to |virtual MOZ_MUST_USE nsresult|. r=jimm.
Specifically: OnDefaultButtonLoaded, AttachNativeKeyEvent, BeginMoveDrag, BeginResizeDrag, GetAttention. These are all fallible functions whose result is always checked. The patch also moves some trivial function definitions from nsBaseWidget.cpp to nsBaseWidget.h, and removes the android BeginResizeDrag() because it can use the nsBaseWidget one. --HG-- extra : rebase_source : ef32a41b547bcbc21f7df0043f683307470b136e
This commit is contained in:
Родитель
b892b168cf
Коммит
3970265787
|
@ -204,13 +204,7 @@ public:
|
|||
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle) override { return NS_OK; }
|
||||
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override { return NS_OK; }
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical) override
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
||||
const InputContextAction& aAction) override;
|
||||
|
|
|
@ -365,7 +365,8 @@ public:
|
|||
|
||||
NS_IMETHOD SetTitle(const nsAString& title) override;
|
||||
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
GetAttention(int32_t aCycleCount) override;
|
||||
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
|
||||
|
@ -378,7 +379,7 @@ public:
|
|||
NS_IMETHOD_(InputContext) GetInputContext() override;
|
||||
NS_IMETHOD_(TextEventDispatcherListener*)
|
||||
GetNativeTextEventDispatcherListener() override;
|
||||
NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override;
|
||||
virtual MOZ_MUST_USE nsresult AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override;
|
||||
NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
|
||||
NativeKeyBindingsType aType,
|
||||
const mozilla::WidgetKeyboardEvent& aEvent,
|
||||
|
|
|
@ -1619,7 +1619,8 @@ NS_IMETHODIMP nsChildView::SetTitle(const nsAString& title)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::GetAttention(int32_t aCycleCount)
|
||||
nsresult
|
||||
nsChildView::GetAttention(int32_t aCycleCount)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
|
@ -1788,7 +1789,7 @@ nsChildView::GetNativeTextEventDispatcherListener()
|
|||
return mTextInputHandler;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsChildView::AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
|
||||
|
|
|
@ -308,7 +308,7 @@ public:
|
|||
nsEventStatus& aStatus) override;
|
||||
virtual void CaptureRollupEvents(nsIRollupListener * aListener,
|
||||
bool aDoCapture) override;
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
virtual nsTransparencyMode GetTransparencyMode() override;
|
||||
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
||||
|
|
|
@ -2111,7 +2111,8 @@ nsCocoaWindow::CaptureRollupEvents(nsIRollupListener* aListener,
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::GetAttention(int32_t aCycleCount)
|
||||
nsresult
|
||||
nsCocoaWindow::GetAttention(int32_t aCycleCount)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
|
|
|
@ -1937,7 +1937,7 @@ nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsWindow::GetAttention(int32_t aCycleCount)
|
||||
{
|
||||
LOG(("nsWindow::GetAttention [%p]\n", (void *)this));
|
||||
|
@ -6627,7 +6627,7 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent,
|
|||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsWindow::BeginMoveDrag(WidgetMouseEvent* aEvent)
|
||||
{
|
||||
MOZ_ASSERT(aEvent, "must have event");
|
||||
|
@ -6649,7 +6649,7 @@ nsWindow::BeginMoveDrag(WidgetMouseEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical)
|
||||
|
|
|
@ -148,7 +148,7 @@ public:
|
|||
virtual void CaptureMouse(bool aCapture) override;
|
||||
virtual void CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
bool aDoCapture) override;
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting) override;
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
|
@ -258,10 +258,12 @@ public:
|
|||
|
||||
static guint32 sLastButtonPressTime;
|
||||
|
||||
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical) override;
|
||||
NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override;
|
||||
|
||||
MozContainer* GetMozContainer() { return mContainer; }
|
||||
// GetMozContainerWidget returns the MozContainer even for undestroyed
|
||||
|
|
|
@ -1604,11 +1604,6 @@ uint32_t nsBaseWidget::GetMaxTouchPoints() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseWidget::GetAttention(int32_t aCycleCount) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsBaseWidget::HasPendingInputEvent()
|
||||
{
|
||||
|
@ -1694,20 +1689,6 @@ nsBaseWidget::ResolveIconName(const nsAString &aIconName,
|
|||
NS_ADDREF(*aResult = file);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseWidget::BeginResizeDrag(WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseWidget::BeginMoveDrag(WidgetMouseEvent* aEvent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void nsBaseWidget::SetSizeConstraints(const SizeConstraints& aConstraints)
|
||||
{
|
||||
mSizeConstraints = aConstraints;
|
||||
|
|
|
@ -243,7 +243,9 @@ public:
|
|||
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
virtual void EnableDragDrop(bool aEnable) override {};
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
GetAttention(int32_t aCycleCount) override
|
||||
{ return NS_OK; }
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
NS_IMETHOD SetIcon(const nsAString &anIconSpec) override;
|
||||
virtual void SetWindowTitlebarColor(nscolor aColor, bool aActive)
|
||||
|
@ -251,10 +253,14 @@ public:
|
|||
virtual void SetDrawsInTitlebar(bool aState) override {}
|
||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
||||
virtual void FreeNativeData(void * data, uint32_t aDataType) override {}
|
||||
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical) override;
|
||||
NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override;
|
||||
int32_t aVertical) override
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override
|
||||
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) override final;
|
||||
|
@ -270,7 +276,7 @@ public:
|
|||
virtual void DefaultProcOfPluginEvent(
|
||||
const mozilla::WidgetPluginEvent& aEvent) override
|
||||
{ }
|
||||
NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual MOZ_MUST_USE nsresult AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
|
||||
NativeKeyBindingsType aType,
|
||||
const mozilla::WidgetKeyboardEvent& aEvent,
|
||||
|
@ -279,7 +285,7 @@ public:
|
|||
bool ComputeShouldAccelerate();
|
||||
virtual bool WidgetTypeSupportsAcceleration() { return true; }
|
||||
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override { return nsIMEUpdatePreference(); }
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual MOZ_MUST_USE nsresult OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual already_AddRefed<nsIWidget>
|
||||
CreateChild(const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr,
|
||||
|
|
|
@ -1417,7 +1417,7 @@ class nsIWidget : public nsISupports
|
|||
* conventions. If set to -1, cycles indefinitely until
|
||||
* window is brought into the foreground.
|
||||
*/
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) = 0;
|
||||
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) = 0;
|
||||
|
||||
/**
|
||||
* Ask whether there user input events pending. All input events are
|
||||
|
@ -1475,14 +1475,16 @@ class nsIWidget : public nsISupports
|
|||
/**
|
||||
* Begin a window resizing drag, based on the event passed in.
|
||||
*/
|
||||
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical) = 0;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical) = 0;
|
||||
|
||||
/**
|
||||
* Begin a window moving drag, based on the event passed in.
|
||||
*/
|
||||
NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) = 0;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) = 0;
|
||||
|
||||
enum Modifiers {
|
||||
CAPS_LOCK = 0x01, // when CapsLock is active
|
||||
|
@ -1811,7 +1813,8 @@ public:
|
|||
* keystrokes that trigger native key bindings (which require a native
|
||||
* event).
|
||||
*/
|
||||
NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) = 0;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) = 0;
|
||||
|
||||
/*
|
||||
* Execute native key bindings for aType.
|
||||
|
@ -1838,7 +1841,8 @@ public:
|
|||
* Call this method when a dialog is opened which has a default button.
|
||||
* The button's rectangle should be supplied in aButtonRect.
|
||||
*/
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) = 0;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) = 0;
|
||||
|
||||
/**
|
||||
* Return true if this process shouldn't use platform widgets, and
|
||||
|
|
|
@ -1483,7 +1483,7 @@ NS_IMETHODIMP nsWindow::Show(bool bState)
|
|||
::ShowWindow(mWnd, SW_SHOWNORMAL);
|
||||
} else {
|
||||
::ShowWindow(mWnd, SW_SHOWNOACTIVATE);
|
||||
GetAttention(2);
|
||||
Unused << GetAttention(2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1866,7 +1866,7 @@ NS_IMETHODIMP nsWindow::Resize(double aX, double aY, double aWidth,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical)
|
||||
|
@ -3720,7 +3720,7 @@ nsWindow::CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture)
|
|||
**************************************************************/
|
||||
|
||||
// Draw user's attention to this window until it comes to foreground.
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsWindow::GetAttention(int32_t aCycleCount)
|
||||
{
|
||||
// Got window?
|
||||
|
@ -3838,8 +3838,8 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
|||
* Called after the dialog is loaded and it has a default button.
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
nsresult
|
||||
nsWindow::OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect)
|
||||
{
|
||||
if (aButtonRect.IsEmpty())
|
||||
|
|
|
@ -126,7 +126,8 @@ public:
|
|||
NS_IMETHOD Move(double aX, double aY) override;
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
int32_t aVertical) override;
|
||||
virtual void PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate) override;
|
||||
|
@ -169,12 +170,12 @@ public:
|
|||
virtual void CaptureMouse(bool aCapture) override;
|
||||
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
|
||||
bool aDoCapture) override;
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
||||
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
||||
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override;
|
||||
virtual MOZ_MUST_USE nsresult OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override;
|
||||
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags,
|
||||
|
|
Загрузка…
Ссылка в новой задаче