From 75077811f9f057c8f82c82084cf086e55b8ef800 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Wed, 27 Apr 2022 01:15:29 +0000 Subject: [PATCH] Bug 1766350 - Get rid of unused internal event messages r=smaug Differential Revision: https://phabricator.services.mozilla.com/D144683 --- dom/events/EventStateManager.h | 7 +++---- widget/BasicEvents.h | 4 ---- widget/EventMessageList.h | 29 ----------------------------- widget/InputData.h | 2 +- widget/WidgetEventImpl.cpp | 8 +------- widget/windows/KeyboardLayout.cpp | 3 --- 6 files changed, 5 insertions(+), 48 deletions(-) diff --git a/dom/events/EventStateManager.h b/dom/events/EventStateManager.h index f294d1cb917f..2add1e409371 100644 --- a/dom/events/EventStateManager.h +++ b/dom/events/EventStateManager.h @@ -1242,10 +1242,9 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver { // Click and double-click events need to be handled even for content that // has no frame. This is required for Web compatibility. -#define NS_EVENT_NEEDS_FRAME(event) \ - (!(event)->HasPluginActivationEventMessage() && \ - (event)->mMessage != eMouseClick && \ - (event)->mMessage != eMouseDoubleClick && \ +#define NS_EVENT_NEEDS_FRAME(event) \ + ((event)->mMessage != eMouseClick && \ + (event)->mMessage != eMouseDoubleClick && \ (event)->mMessage != eMouseAuxClick) #endif // mozilla_EventStateManager_h_ diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index 0fd00b7d5d18..fde1e9034484 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -790,10 +790,6 @@ class WidgetEvent : public WidgetEventTime { * event. */ bool HasIMEEventMessage() const; - /** - * Returns true if the event mMessage is one of plugin activation events. - */ - bool HasPluginActivationEventMessage() const; /** * Returns true if the event can be sent to remote process. diff --git a/widget/EventMessageList.h b/widget/EventMessageList.h index d5983df21fbc..62417a3f8af1 100644 --- a/widget/EventMessageList.h +++ b/widget/EventMessageList.h @@ -33,20 +33,10 @@ NS_EVENT_MESSAGE(eVoidEvent) // EventListenerManager. NS_EVENT_MESSAGE(eAllEvents) -// Widget may be destroyed -NS_EVENT_MESSAGE(eWindowClose) - NS_EVENT_MESSAGE(eKeyPress) NS_EVENT_MESSAGE(eKeyUp) NS_EVENT_MESSAGE(eKeyDown) -// These messages are dispatched when PluginInstaceChild receives native -// keyboard events directly and it posts the information to the widget. -// These messages shouldn't be handled by content and non-reserved chrome -// event handlers. -NS_EVENT_MESSAGE(eKeyDownOnPlugin) -NS_EVENT_MESSAGE(eKeyUpOnPlugin) - // This message is sent after a content process handles a key event or accesskey // to indicate that an potential accesskey was not found. The parent process may // then respond by, for example, opening menus and processing other shortcuts. @@ -58,17 +48,6 @@ NS_EVENT_MESSAGE(eScroll) NS_EVENT_MESSAGE(eMozVisualResize) NS_EVENT_MESSAGE(eMozVisualScroll) -// Application installation -NS_EVENT_MESSAGE(eInstall) -NS_EVENT_MESSAGE(eAppInstalled) - -// A plugin was clicked or otherwise focused. ePluginActivate should be -// used when the window is not active. ePluginFocus should be used when -// the window is active. In the latter case, the dispatcher of the event -// is expected to ensure that the plugin's widget is focused beforehand. -NS_EVENT_MESSAGE(ePluginActivate) -NS_EVENT_MESSAGE(ePluginFocus) - NS_EVENT_MESSAGE(eOffline) NS_EVENT_MESSAGE(eOnline) @@ -152,7 +131,6 @@ NS_EVENT_MESSAGE_FIRST_LAST(eDragDropEvent, eDragEnter, eDragLeave) // XUL specific events NS_EVENT_MESSAGE(eXULPopupShowing) NS_EVENT_MESSAGE(eXULPopupShown) -NS_EVENT_MESSAGE(eXULPopupPositioned) NS_EVENT_MESSAGE(eXULPopupHiding) NS_EVENT_MESSAGE(eXULPopupHidden) NS_EVENT_MESSAGE(eXULBroadcast) @@ -431,13 +409,6 @@ NS_EVENT_MESSAGE(eWheelOperationStart) // corresponding native event. NS_EVENT_MESSAGE(eWheelOperationEnd) -// System time is changed -NS_EVENT_MESSAGE(eTimeChange) - -// Network packet events. -NS_EVENT_MESSAGE(eNetworkUpload) -NS_EVENT_MESSAGE(eNetworkDownload) - // MediaRecorder events. NS_EVENT_MESSAGE(eMediaRecorderDataAvailable) NS_EVENT_MESSAGE(eMediaRecorderWarning) diff --git a/widget/InputData.h b/widget/InputData.h index e967336304a3..827aac6759e6 100644 --- a/widget/InputData.h +++ b/widget/InputData.h @@ -782,7 +782,7 @@ class KeyboardInput : public InputData { KEY_DOWN, KEY_PRESS, KEY_UP, - // Any other key event such as eKeyDownOnPlugin + // Any other key event such as eAccessKeyNotFound KEY_OTHER, // Used as an upper bound for ContiguousEnumSerializer diff --git a/widget/WidgetEventImpl.cpp b/widget/WidgetEventImpl.cpp index ce64c899ae07..254b176a4365 100644 --- a/widget/WidgetEventImpl.cpp +++ b/widget/WidgetEventImpl.cpp @@ -349,8 +349,6 @@ bool WidgetEvent::IsKeyEventMessage(EventMessage aMessage) { case eKeyDown: case eKeyPress: case eKeyUp: - case eKeyDownOnPlugin: - case eKeyUpOnPlugin: case eAccessKeyNotFound: return true; default: @@ -372,10 +370,6 @@ bool WidgetEvent::HasIMEEventMessage() const { } } -bool WidgetEvent::HasPluginActivationEventMessage() const { - return mMessage == ePluginActivate || mMessage == ePluginFocus; -} - /****************************************************************************** * mozilla::WidgetEvent * @@ -441,7 +435,7 @@ bool WidgetEvent::IsUsingCoordinates() const { return !mouseEvent->IsContextMenuKeyEvent(); } return !HasKeyEventMessage() && !IsIMERelatedEvent() && - !HasPluginActivationEventMessage() && !IsContentCommandEvent(); + !IsContentCommandEvent(); } bool WidgetEvent::IsTargetedAtFocusedWindow() const { diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 5b284381ebe3..9cfc4f0f7939 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2023,15 +2023,12 @@ nsEventStatus NativeKey::InitKeyEvent( if (mCharMessageHasGone) { aKeyEvent.PreventDefaultBeforeDispatch(CrossProcessForwarding::eAllow); } - [[fallthrough]]; - case eKeyDownOnPlugin: aKeyEvent.mKeyCode = mDOMKeyCode; // Unique id for this keydown event and its associated keypress. sUniqueKeyEventId++; aKeyEvent.mUniqueId = sUniqueKeyEventId; break; case eKeyUp: - case eKeyUpOnPlugin: aKeyEvent.mKeyCode = mDOMKeyCode; // Set defaultPrevented of the key event if the VK_MENU is not a system // key release, so that the menu bar does not trigger. This helps avoid