Bug 1683226 - part 16: Get rid of `WidgetPluginEvent` r=smaug

Depends on D100389

Differential Revision: https://phabricator.services.mozilla.com/D100390
This commit is contained in:
Masayuki Nakano 2020-12-29 21:19:45 +00:00
Родитель 1b07095476
Коммит 525ffa0f23
16 изменённых файлов: 4 добавлений и 157 удалений

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

@ -1484,11 +1484,6 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
dropEffect, principal, csp);
return;
}
case ePluginEventClass: {
*aStatus = nsEventStatus_eConsumeNoDefault;
remote->SendPluginEvent(*aEvent->AsPluginEvent());
return;
}
default: {
MOZ_CRASH("Attempt to send non-whitelisted event?");
}

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

@ -1904,14 +1904,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvRealDragEvent(
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserChild::RecvPluginEvent(
const WidgetPluginEvent& aEvent) {
WidgetPluginEvent localEvent(aEvent);
localEvent.mWidget = mPuppetWidget;
DispatchWidgetEventViaAPZ(localEvent);
return IPC_OK();
}
void BrowserChild::RequestEditCommands(nsIWidget::NativeKeyBindingsType aType,
const WidgetKeyboardEvent& aEvent,
nsTArray<CommandInt>& aCommands) {

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

@ -390,8 +390,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
mozilla::ipc::IPCResult RecvNativeSynthesisResponse(
const uint64_t& aObserverId, const nsCString& aResponse);
mozilla::ipc::IPCResult RecvPluginEvent(const WidgetPluginEvent& aEvent);
mozilla::ipc::IPCResult RecvCompositionEvent(
const mozilla::WidgetCompositionEvent& aEvent);

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

@ -2017,12 +2017,6 @@ void BrowserParent::SendRealTouchMoveEvent(
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
}
void BrowserParent::SendPluginEvent(WidgetPluginEvent& aEvent) {
DebugOnly<bool> ret = PBrowserParent::SendPluginEvent(aEvent);
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendPluginEvent() failed");
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
}
bool BrowserParent::SendHandleTap(TapType aType,
const LayoutDevicePoint& aPoint,
Modifiers aModifiers,

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

@ -569,8 +569,6 @@ class BrowserParent final : public PBrowserParent,
void SendRealTouchEvent(WidgetTouchEvent& aEvent);
void SendPluginEvent(WidgetPluginEvent& aEvent);
/**
* Different from above Send*Event(), these methods return true if the
* event has been posted to the remote process or failed to do that but

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

@ -79,7 +79,6 @@ using class mozilla::WidgetDragEvent from "ipc/nsGUIEventIPC.h";
using struct nsRect from "nsRect.h";
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetPluginEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageTypes.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
@ -843,8 +842,6 @@ child:
uint32_t aDropEffect, nsIPrincipal aPrincipal,
nsIContentSecurityPolicy csp);
async PluginEvent(WidgetPluginEvent aEvent);
prio(input) async CompositionEvent(WidgetCompositionEvent event);
async NormalPriorityCompositionEvent(WidgetCompositionEvent event);

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

@ -1515,17 +1515,7 @@ void nsPluginInstanceOwner::HandleNoConsumedCompositionMessage(
}
}
NPEvent npevent;
if (aPluginEvent->lParam & GCS_RESULTSTR) {
// GCS_RESULTSTR's default proc will generate WM_CHAR. So emulate it.
for (size_t i = 0; i < aCompositionEvent->mData.Length(); i++) {
WidgetPluginEvent charEvent(true, ePluginInputEvent, widget);
npevent.event = WM_CHAR;
npevent.wParam = aCompositionEvent->mData[i];
npevent.lParam = 0;
charEvent.mPluginEvent.Copy(npevent);
ProcessEvent(charEvent);
}
return;
}
if (!mSentStartComposition) {

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

@ -1487,14 +1487,6 @@ nsresult nsPluginFrame::HandleEvent(nsPresContext* aPresContext,
}
}
if (mInstanceOwner->SendNativeEvents() &&
anEvent->IsNativeEventDelivererForPlugin()) {
*anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
// Due to plugin code reentering Gecko, this frame may be dead at this
// point.
return rv;
}
#ifdef XP_WIN
rv = nsIFrame::HandleEvent(aPresContext, anEvent, anEventStatus);
return rv;

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

@ -713,8 +713,7 @@ void nsViewManager::DispatchEvent(WidgetGUIEvent* aEvent, nsView* aView,
// create and destroy widgets.
mouseEvent->mMessage != eMouseExitFromWidget &&
mouseEvent->mMessage != eMouseEnterIntoWidget) ||
aEvent->HasKeyEventMessage() || aEvent->HasIMEEventMessage() ||
aEvent->mMessage == ePluginInputEvent) {
aEvent->HasKeyEventMessage() || aEvent->HasIMEEventMessage()) {
gLastUserEventTime = PR_IntervalToMicroseconds(PR_IntervalNow());
}
@ -731,7 +730,6 @@ void nsViewManager::DispatchEvent(WidgetGUIEvent* aEvent, nsView* aView,
nsIFrame* frame = view->GetFrame();
if (!frame && (dispatchUsingCoordinates || aEvent->HasKeyEventMessage() ||
aEvent->IsIMERelatedEvent() ||
aEvent->IsNonRetargetedNativeEventDelivererForPlugin() ||
aEvent->HasPluginActivationEventMessage())) {
while (view && !view->GetFrame()) {
view = view->GetParent();

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

@ -771,10 +771,6 @@ class WidgetEvent : public WidgetEventTime {
* Returns true if the event is a content command event.
*/
bool IsContentCommandEvent() const;
/**
* Returns true if the event is a native event deliverer event for plugin.
*/
bool IsNativeEventDelivererForPlugin() const;
/**
* Returns true if the event mMessage is one of mouse events.
@ -808,16 +804,6 @@ class WidgetEvent : public WidgetEventTime {
* will be posted to the remote process later.
*/
bool WillBeSentToRemoteProcess() const;
/**
* Returns true if the event is native event deliverer event for plugin and
* it should be retarted to focused document.
*/
bool IsRetargetedNativeEventDelivererForPlugin() const;
/**
* Returns true if the event is native event deliverer event for plugin and
* it should NOT be retarted to focused document.
*/
bool IsNonRetargetedNativeEventDelivererForPlugin() const;
/**
* Returns true if the event is related to IME handling. It includes
* IME events, query content events and selection events.

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

@ -53,7 +53,6 @@ NS_EVENT_CLASS(Internal, SMILTimeEvent)
// MiscEvents.h
NS_EVENT_CLASS(Widget, CommandEvent)
NS_EVENT_CLASS(Widget, ContentCommandEvent)
NS_EVENT_CLASS(Widget, PluginEvent)
// InternalMutationEvent.h (dom/events)
NS_EVENT_CLASS(Internal, MutationEvent)

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

@ -316,9 +316,6 @@ NS_EVENT_MESSAGE(eEdgeUIStarted)
NS_EVENT_MESSAGE(eEdgeUICanceled)
NS_EVENT_MESSAGE(eEdgeUICompleted)
// These are used to send native events to plugins.
NS_EVENT_MESSAGE(ePluginInputEvent)
// Events to manipulate selection (WidgetSelectionEvent)
// Clear any previous selection and set the given range as the selection
NS_EVENT_MESSAGE(eSetSelection)

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

@ -137,51 +137,6 @@ class WidgetCommandEvent : public WidgetGUIEvent {
}
};
/******************************************************************************
* mozilla::WidgetPluginEvent
*
* This event delivers only a native event to focused plugin.
******************************************************************************/
class WidgetPluginEvent : public WidgetGUIEvent {
private:
friend class dom::PBrowserParent;
friend class dom::PBrowserChild;
public:
virtual WidgetPluginEvent* AsPluginEvent() override { return this; }
WidgetPluginEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, ePluginEventClass),
mRetargetToFocusedDocument(false) {}
virtual WidgetEvent* Duplicate() const override {
// NOTE: PluginEvent has to be dispatched to nsIFrame::HandleEvent().
// So, this event needs to support Duplicate().
MOZ_ASSERT(mClass == ePluginEventClass,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetPluginEvent* result = new WidgetPluginEvent(false, mMessage, nullptr);
result->AssignPluginEventData(*this, true);
result->mFlags = mFlags;
return result;
}
// If true, this event needs to be retargeted to focused document.
// Otherwise, never retargeted. Defaults to false.
bool mRetargetToFocusedDocument;
void AssignPluginEventData(const WidgetPluginEvent& aEvent,
bool aCopyTargets) {
AssignGUIEventData(aEvent, aCopyTargets);
mRetargetToFocusedDocument = aEvent.mRetargetToFocusedDocument;
}
protected:
WidgetPluginEvent() : mRetargetToFocusedDocument(false) {}
};
} // namespace mozilla
#endif // mozilla_MiscEvents_h__

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

@ -291,10 +291,6 @@ bool WidgetEvent::IsContentCommandEvent() const {
return mClass == eContentCommandEventClass;
}
bool WidgetEvent::IsNativeEventDelivererForPlugin() const {
return mClass == ePluginEventClass;
}
/******************************************************************************
* mozilla::WidgetEvent
*
@ -403,14 +399,6 @@ bool WidgetEvent::CanBeSentToRemoteProcess() const {
case eDragExit:
case eDrop:
return true;
#if defined(XP_WIN)
case ePluginInputEvent: {
auto evt = static_cast<const NPEvent*>(AsPluginEvent()->mPluginEvent);
return evt && evt->event == WM_SETTINGCHANGE &&
(evt->wParam == SPI_SETWHEELSCROLLLINES ||
evt->wParam == SPI_SETWHEELSCROLLCHARS);
}
#endif
default:
return false;
}
@ -432,16 +420,6 @@ bool WidgetEvent::WillBeSentToRemoteProcess() const {
return EventStateManager::IsTopLevelRemoteTarget(originalTarget);
}
bool WidgetEvent::IsRetargetedNativeEventDelivererForPlugin() const {
const WidgetPluginEvent* pluginEvent = AsPluginEvent();
return pluginEvent && pluginEvent->mRetargetToFocusedDocument;
}
bool WidgetEvent::IsNonRetargetedNativeEventDelivererForPlugin() const {
const WidgetPluginEvent* pluginEvent = AsPluginEvent();
return pluginEvent && !pluginEvent->mRetargetToFocusedDocument;
}
bool WidgetEvent::IsIMERelatedEvent() const {
return HasIMEEventMessage() || IsQueryContentEvent() || IsSelectionEvent();
}
@ -452,8 +430,7 @@ bool WidgetEvent::IsUsingCoordinates() const {
return !mouseEvent->IsContextMenuKeyEvent();
}
return !HasKeyEventMessage() && !IsIMERelatedEvent() &&
!HasPluginActivationEventMessage() &&
!IsNativeEventDelivererForPlugin() && !IsContentCommandEvent();
!HasPluginActivationEventMessage() && !IsContentCommandEvent();
}
bool WidgetEvent::IsTargetedAtFocusedWindow() const {
@ -461,8 +438,7 @@ bool WidgetEvent::IsTargetedAtFocusedWindow() const {
if (mouseEvent) {
return mouseEvent->IsContextMenuKeyEvent();
}
return HasKeyEventMessage() || IsIMERelatedEvent() ||
IsContentCommandEvent() || IsRetargetedNativeEventDelivererForPlugin();
return HasKeyEventMessage() || IsIMERelatedEvent() || IsContentCommandEvent();
}
bool WidgetEvent::IsTargetedAtFocusedContent() const {
@ -470,8 +446,7 @@ bool WidgetEvent::IsTargetedAtFocusedContent() const {
if (mouseEvent) {
return mouseEvent->IsContextMenuKeyEvent();
}
return HasKeyEventMessage() || IsIMERelatedEvent() ||
IsRetargetedNativeEventDelivererForPlugin();
return HasKeyEventMessage() || IsIMERelatedEvent();
}
bool WidgetEvent::IsAllowedToDispatchDOMEvent() const {
@ -608,7 +583,6 @@ bool WidgetEvent::IsUserAction() const {
case eTouchEventClass:
case eCommandEventClass:
case eContentCommandEventClass:
case ePluginEventClass:
return true;
case eMouseEventClass:
case eDragEventClass:

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

@ -926,23 +926,6 @@ struct ParamTraits<mozilla::widget::InputContextAction> {
}
};
template <>
struct ParamTraits<mozilla::WidgetPluginEvent> {
typedef mozilla::WidgetPluginEvent paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
WriteParam(aMsg, aParam.mRetargetToFocusedDocument);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return ReadParam(aMsg, aIter,
static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mRetargetToFocusedDocument);
}
};
template <>
struct ParamTraits<mozilla::WritingMode> {
typedef mozilla::WritingMode paramType;

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

@ -62,7 +62,6 @@ class NativeEventData;
class WidgetGUIEvent;
class WidgetInputEvent;
class WidgetKeyboardEvent;
class WidgetPluginEvent;
struct FontRange;
enum class StyleWindowShadow : uint8_t;