зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1754367 - Get rid of `WidgetGUIEvent::mPluginEvent` r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D138257
This commit is contained in:
Родитель
6fb72d4a3f
Коммит
37e94b914c
|
@ -4391,7 +4391,6 @@ static UniquePtr<WidgetMouseEvent> CreateMouseOrPointerWidgetEvent(
|
|||
newEvent->mButton = aMouseEvent->mButton;
|
||||
newEvent->mButtons = aMouseEvent->mButtons;
|
||||
newEvent->mPressure = aMouseEvent->mPressure;
|
||||
newEvent->mPluginEvent = aMouseEvent->mPluginEvent;
|
||||
newEvent->mInputSource = aMouseEvent->mInputSource;
|
||||
newEvent->pointerId = aMouseEvent->pointerId;
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ using mozilla::EventMessage from "mozilla/EventForwards.h";
|
|||
using nsEventStatus from "mozilla/EventForwards.h";
|
||||
using mozilla::Modifiers from "mozilla/EventForwards.h";
|
||||
using struct mozilla::widget::CandidateWindowPosition from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::NativeEventData from "ipc/nsGUIEventIPC.h";
|
||||
using struct mozilla::FontRange from "ipc/nsGUIEventIPC.h";
|
||||
using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/IPCTypes.h";
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
|
|
|
@ -1009,50 +1009,6 @@ class WidgetEvent : public WidgetEventTime {
|
|||
bool IsUserAction() const;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::NativeEventData
|
||||
*
|
||||
* WidgetGUIEvent's mPluginEvent member used to be a void* pointer,
|
||||
* used to reference external, OS-specific data structures.
|
||||
*
|
||||
* That void* pointer wasn't serializable by itself, causing
|
||||
* certain plugin events not to function in e10s. See bug 586656.
|
||||
*
|
||||
* To make this serializable, we changed this void* pointer into
|
||||
* a proper buffer, and copy these external data structures into this
|
||||
* buffer.
|
||||
*
|
||||
* That buffer is NativeEventData::mBuffer below.
|
||||
*
|
||||
* We wrap this in that NativeEventData class providing operators to
|
||||
* be compatible with existing code that was written around
|
||||
* the old void* field.
|
||||
******************************************************************************/
|
||||
|
||||
class NativeEventData final {
|
||||
CopyableTArray<uint8_t> mBuffer;
|
||||
|
||||
friend struct IPC::ParamTraits<mozilla::NativeEventData>;
|
||||
|
||||
public:
|
||||
explicit operator bool() const { return !mBuffer.IsEmpty(); }
|
||||
|
||||
template <typename T>
|
||||
explicit operator const T*() const {
|
||||
return mBuffer.IsEmpty() ? nullptr
|
||||
: reinterpret_cast<const T*>(mBuffer.Elements());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Copy(const T& other) {
|
||||
static_assert(!std::is_pointer_v<T>, "Don't want a pointer!");
|
||||
mBuffer.SetLength(sizeof(T));
|
||||
memcpy(mBuffer.Elements(), &other, mBuffer.Length());
|
||||
}
|
||||
|
||||
void Clear() { mBuffer.Clear(); }
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::WidgetGUIEvent
|
||||
******************************************************************************/
|
||||
|
@ -1084,25 +1040,9 @@ class WidgetGUIEvent : public WidgetEvent {
|
|||
// Originator of the event
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
|
||||
/*
|
||||
* Ideally though, we wouldn't allow arbitrary reinterpret_cast'ing here;
|
||||
* instead, we would at least store type information here so that
|
||||
* this class can't be used to reinterpret one structure type into another.
|
||||
* We can also wonder if it would be possible to properly extend
|
||||
* WidgetGUIEvent and other Event classes to remove the need for this
|
||||
* mPluginEvent field.
|
||||
*/
|
||||
typedef NativeEventData PluginEvent;
|
||||
|
||||
// Event for NPAPI plugin
|
||||
PluginEvent mPluginEvent;
|
||||
|
||||
void AssignGUIEventData(const WidgetGUIEvent& aEvent, bool aCopyTargets) {
|
||||
AssignEventData(aEvent, aCopyTargets);
|
||||
|
||||
// widget should be initialized with the constructor.
|
||||
|
||||
mPluginEvent = aEvent.mPluginEvent;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -412,8 +412,6 @@ struct EventFlags;
|
|||
|
||||
class WidgetEventTime;
|
||||
|
||||
class NativeEventData;
|
||||
|
||||
// TextEvents.h
|
||||
enum class AccessKeyType;
|
||||
|
||||
|
|
|
@ -644,9 +644,8 @@ bool TextEventDispatcher::DispatchKeyboardEventInternal(
|
|||
keyEvent.mNativeKeyEvent = aKeyboardEvent.mNativeKeyEvent;
|
||||
} else {
|
||||
// If it's not a keyboard event for native key event, we should ensure that
|
||||
// mNativeKeyEvent and mPluginEvent are null/empty.
|
||||
// mNativeKeyEvent is null.
|
||||
keyEvent.mNativeKeyEvent = nullptr;
|
||||
keyEvent.mPluginEvent.Clear();
|
||||
}
|
||||
// TODO: Manage mUniqueId here.
|
||||
|
||||
|
|
|
@ -1861,7 +1861,6 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
|
|||
// so link to the GdkEvent (which will vanish soon after return from the
|
||||
// event callback) to give plugins access to hardware_keycode and state.
|
||||
// (An XEvent would be nice but the GdkEvent is good enough.)
|
||||
aKeyEvent.mPluginEvent.Copy(*aGdkKeyEvent);
|
||||
aKeyEvent.mTime = aGdkKeyEvent->time;
|
||||
aKeyEvent.mNativeKeyEvent = static_cast<void*>(aGdkKeyEvent);
|
||||
aKeyEvent.mIsRepeat =
|
||||
|
|
|
@ -83,34 +83,17 @@ struct ParamTraits<mozilla::WidgetEvent> {
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::NativeEventData> {
|
||||
typedef mozilla::NativeEventData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mBuffer);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mBuffer);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::WidgetGUIEvent> {
|
||||
typedef mozilla::WidgetGUIEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mPluginEvent);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPluginEvent);
|
||||
return ReadParam(aMsg, aIter, static_cast<mozilla::WidgetEvent*>(aResult));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ class nsIScreen;
|
|||
class nsIRunnable;
|
||||
|
||||
namespace mozilla {
|
||||
class NativeEventData;
|
||||
class WidgetGUIEvent;
|
||||
class WidgetInputEvent;
|
||||
class WidgetKeyboardEvent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче