diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 20b339d657db..8b858394687b 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -347,9 +347,6 @@ class nsChildView final : public nsBaseWidget { virtual LayoutDeviceIntPoint WidgetToScreenOffset() override; virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override { return false; } - static bool ConvertStatus(nsEventStatus aStatus) { - return aStatus == nsEventStatus_eConsumeNoDefault; - } virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override; virtual bool WidgetTypeSupportsAcceleration() override; @@ -413,9 +410,6 @@ class nsChildView final : public nsBaseWidget { uint32_t aModifierFlags) override; // Mac specific methods - - virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event); - void WillPaintWindow(); bool PaintWindow(LayoutDeviceIntRegion aRegion); bool PaintWindowInDrawTarget(mozilla::gfx::DrawTarget* aDT, const LayoutDeviceIntRegion& aRegion, diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index ae3b45b59873..70afb19c844d 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -1298,12 +1298,6 @@ nsresult nsChildView::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatu return NS_OK; } -bool nsChildView::DispatchWindowEvent(WidgetGUIEvent& event) { - nsEventStatus status; - DispatchEvent(&event, status); - return ConvertStatus(status); -} - nsIWidget* nsChildView::GetWidgetForListenerEvents() { // If there is no listener, use the parent popup's listener if that exists. if (!mWidgetListener && mParentWidget && mParentWidget->WindowType() == eWindowType_popup) { diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 16421040f826..f2322937fa1a 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1141,6 +1141,12 @@ void nsBaseWidget::DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) { } } +bool nsBaseWidget::DispatchWindowEvent(WidgetGUIEvent& event) { + nsEventStatus status; + DispatchEvent(&event, status); + return ConvertStatus(status); +} + Document* nsBaseWidget::GetDocument() const { if (mWidgetListener) { if (PresShell* presShell = mWidgetListener->GetPresShell()) { diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index 45b090df17e1..53bc756cd050 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -312,6 +312,8 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference { mozilla::WidgetInputEvent* aEvent) override; void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) override; + bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event) override; + void SetConfirmedTargetAPZC( uint64_t aInputBlockId, const nsTArray& aTargets) const override; @@ -637,6 +639,10 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference { void DispatchPanGestureInput(mozilla::PanGestureInput& aInput); void DispatchPinchGestureInput(mozilla::PinchGestureInput& aInput); + static bool ConvertStatus(nsEventStatus aStatus) { + return aStatus == nsEventStatus_eConsumeNoDefault; + } + protected: // Returns whether compositing should use an external surface size. virtual bool UseExternalCompositingSurface() const { return false; } diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 85d883098098..6a9c62919ec0 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1330,6 +1330,12 @@ class nsIWidget : public nsISupports { */ virtual void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) = 0; + /* + * Dispatch a gecko event for this widget. + * Returns true if it's consumed. Otherwise, false. + */ + virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event) = 0; + // A structure that groups the statuses from APZ dispatch and content // dispatch. struct ContentAndAPZEventStatus { diff --git a/widget/windows/IMMHandler.cpp b/widget/windows/IMMHandler.cpp index 2c7da1dcdf7d..fead38fc42d7 100644 --- a/widget/windows/IMMHandler.cpp +++ b/widget/windows/IMMHandler.cpp @@ -1579,7 +1579,7 @@ void IMMHandler::DispatchEvent(nsWindow* aWindow, WidgetGUIEvent& aEvent) { return; } - aWindow->DispatchWindowEvent(&aEvent); + aWindow->DispatchWindowEvent(aEvent); } void IMMHandler::DispatchCompositionChangeEvent(nsWindow* aWindow, diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index df9dd6e92af9..9cd6d12e2e77 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2167,7 +2167,7 @@ bool NativeKey::DispatchCommandEvent(uint32_t aEventCommand) const { "%s app command event...", this, nsAtomCString(command).get())); bool ok = - mWidget->DispatchWindowEvent(&appCommandEvent) || mWidget->Destroyed(); + mWidget->DispatchWindowEvent(appCommandEvent) || mWidget->Destroyed(); MOZ_LOG( gKeyLog, LogLevel::Info, ("%p NativeKey::DispatchCommandEvent(), dispatched app command event, " @@ -2319,7 +2319,7 @@ bool NativeKey::HandleAppCommandMessage() const { gKeyLog, LogLevel::Info, ("%p NativeKey::HandleAppCommandMessage(), dispatching %s event...", this, ToChar(contentCommandMessage))); - mWidget->DispatchWindowEvent(&contentCommandEvent); + mWidget->DispatchWindowEvent(contentCommandEvent); MOZ_LOG(gKeyLog, LogLevel::Info, ("%p NativeKey::HandleAppCommandMessage(), dispatched %s event", this, ToChar(contentCommandMessage))); diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index 177d11c92ba4..643eef8c5a82 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -2260,7 +2260,7 @@ void TSFTextStore::DispatchEvent(WidgetGUIEvent& aEvent) { if (!aEvent.AsQueryContentEvent()) { mDeferNotifyingTSF = true; } - mWidget->DispatchWindowEvent(&aEvent); + mWidget->DispatchWindowEvent(aEvent); } void TSFTextStore::FlushPendingActions() { diff --git a/widget/windows/WinIMEHandler.cpp b/widget/windows/WinIMEHandler.cpp index 8d69c8d2aa56..f36b37460af5 100644 --- a/widget/windows/WinIMEHandler.cpp +++ b/widget/windows/WinIMEHandler.cpp @@ -1069,7 +1069,7 @@ bool IMEHandler::MaybeCreateNativeCaret(nsWindow* aWindow) { options.mRelativeToInsertionPoint = true; queryCaretRectEvent.InitForQueryCaretRect(0, options); - aWindow->DispatchWindowEvent(&queryCaretRectEvent); + aWindow->DispatchWindowEvent(queryCaretRectEvent); if (NS_WARN_IF(queryCaretRectEvent.Failed())) { return false; } diff --git a/widget/windows/WinMouseScrollHandler.cpp b/widget/windows/WinMouseScrollHandler.cpp index 09270622c24a..712f101cb494 100644 --- a/widget/windows/WinMouseScrollHandler.cpp +++ b/widget/windows/WinMouseScrollHandler.cpp @@ -1303,7 +1303,7 @@ bool MouseScrollHandler::Device::Elantech::HandleKeyMessage( // nullptr as an argument to indicate using the coordinate from the last // available window message. InitEvent(aWidget, appCommandEvent, nullptr); - aWidget->DispatchWindowEvent(&appCommandEvent); + aWidget->DispatchWindowEvent(appCommandEvent); } else { MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Elantech::HandleKeyMessage(): Consumed")); diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index bd717c2d9d0c..fdbfdf4d5a05 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -4292,7 +4292,7 @@ bool nsWindow::DispatchStandardEvent(EventMessage aMsg) { WidgetGUIEvent event(true, aMsg, this); InitEvent(event); - bool result = DispatchWindowEvent(&event); + bool result = DispatchWindowEvent(event); return result; } @@ -4313,12 +4313,6 @@ bool nsWindow::DispatchWheelEvent(WidgetWheelEvent* aEvent) { return ConvertStatus(status); } -bool nsWindow::DispatchWindowEvent(WidgetGUIEvent* event) { - nsEventStatus status; - DispatchEvent(event, status); - return ConvertStatus(status); -} - // Recursively dispatch synchronous paints for nsIWidget // descendants with invalidated rectangles. BOOL CALLBACK nsWindow::DispatchStarvedPaints(HWND aWnd, LPARAM aMsg) { @@ -4707,10 +4701,6 @@ bool nsWindow::IsTopLevelMouseExit(HWND aWnd) { return WinUtils::GetTopLevelHWND(aWnd) != mouseTopLevel; } -bool nsWindow::ConvertStatus(nsEventStatus aStatus) { - return aStatus == nsEventStatus_eConsumeNoDefault; -} - /************************************************************** * * SECTION: IPC @@ -6149,38 +6139,38 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, case WM_CLEAR: { WidgetContentCommandEvent command(true, eContentCommandDelete, this); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); result = true; } break; case WM_CUT: { WidgetContentCommandEvent command(true, eContentCommandCut, this); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); result = true; } break; case WM_COPY: { WidgetContentCommandEvent command(true, eContentCommandCopy, this); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); result = true; } break; case WM_PASTE: { WidgetContentCommandEvent command(true, eContentCommandPaste, this); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); result = true; } break; case EM_UNDO: { WidgetContentCommandEvent command(true, eContentCommandUndo, this); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled); result = true; } break; case EM_REDO: { WidgetContentCommandEvent command(true, eContentCommandRedo, this); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled); result = true; } break; @@ -6191,7 +6181,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, if (wParam == 0 || wParam == CF_TEXT || wParam == CF_UNICODETEXT) { WidgetContentCommandEvent command(true, eContentCommandPaste, this, true); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled); result = true; } @@ -6199,14 +6189,14 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, case EM_CANUNDO: { WidgetContentCommandEvent command(true, eContentCommandUndo, this, true); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled); result = true; } break; case EM_CANREDO: { WidgetContentCommandEvent command(true, eContentCommandRedo, this, true); - DispatchWindowEvent(&command); + DispatchWindowEvent(command); *aRetValue = (LRESULT)(command.mSucceeded && command.mIsEnabled); result = true; } break; diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index 1de0af5e0177..7f02ab994a08 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -120,7 +120,6 @@ class nsWindow final : public nsWindowBase { virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent, LayoutDeviceIntPoint* aPoint = nullptr) override; virtual WidgetEventTime CurrentMessageWidgetEventTime() const override; - virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) override; virtual bool DispatchKeyboardEvent( mozilla::WidgetKeyboardEvent* aEvent) override; virtual bool DispatchWheelEvent(mozilla::WidgetWheelEvent* aEvent) override; @@ -455,8 +454,6 @@ class nsWindow final : public nsWindowBase { static bool EventIsInsideWindow( nsWindow* aWindow, mozilla::Maybe aEventPoint = mozilla::Nothing()); - // Convert nsEventStatus value to a windows boolean - static bool ConvertStatus(nsEventStatus aStatus); static void PostSleepWakeNotification(const bool aIsSleepMode); int32_t ClientMarginHitTestPoint(int32_t mx, int32_t my); void SetWindowButtonRect(WindowButtonType aButtonType, diff --git a/widget/windows/nsWindowBase.h b/widget/windows/nsWindowBase.h index b5934f1a1b04..aa2891428b2b 100644 --- a/widget/windows/nsWindowBase.h +++ b/widget/windows/nsWindowBase.h @@ -52,12 +52,6 @@ class nsWindowBase : public nsBaseWidget { */ virtual WidgetEventTime CurrentMessageWidgetEventTime() const = 0; - /* - * Dispatch a gecko event for this widget. - * Returns true if it's consumed. Otherwise, false. - */ - virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) = 0; - /* * Dispatch a gecko keyboard event for this widget. This * is called by KeyboardLayout to dispatch gecko events.