mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1815273 - WidgetEvent::Duplicate triggers extra TimeStamp::Now() call, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D185608
This commit is contained in:
parent
7ccc1f6be6
commit
32d9cd7454
@ -18,15 +18,18 @@ class InternalMutationEvent : public WidgetEvent {
|
||||
public:
|
||||
virtual InternalMutationEvent* AsMutationEvent() override { return this; }
|
||||
|
||||
InternalMutationEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eMutationEventClass), mAttrChange(0) {
|
||||
InternalMutationEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eMutationEventClass, aTime),
|
||||
mAttrChange(0) {
|
||||
mFlags.mCancelable = false;
|
||||
}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eMutationEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalMutationEvent* result = new InternalMutationEvent(false, mMessage);
|
||||
InternalMutationEvent* result =
|
||||
new InternalMutationEvent(false, mMessage, this);
|
||||
result->AssignMutationEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
@ -417,6 +417,12 @@ class WidgetEventTime {
|
||||
|
||||
WidgetEventTime() : mTimeStamp(TimeStamp::Now()) {}
|
||||
|
||||
explicit WidgetEventTime(const WidgetEventTime* aTime)
|
||||
: mTimeStamp(aTime ? aTime->mTimeStamp : TimeStamp::Now()) {
|
||||
MOZ_ASSERT(aTime != this);
|
||||
MOZ_ASSERT_IF(aTime, !aTime->mTimeStamp.IsNull());
|
||||
}
|
||||
|
||||
explicit WidgetEventTime(TimeStamp aTimeStamp) : mTimeStamp(aTimeStamp) {}
|
||||
|
||||
void AssignEventTime(const WidgetEventTime& aOther) {
|
||||
@ -485,8 +491,9 @@ class WidgetEvent : public WidgetEventTime {
|
||||
|
||||
protected:
|
||||
WidgetEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetEventTime(),
|
||||
EventClassID aEventClassID,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEventTime(aTime),
|
||||
mClass(aEventClassID),
|
||||
mMessage(aMessage),
|
||||
mRefPoint(0, 0),
|
||||
@ -508,8 +515,9 @@ class WidgetEvent : public WidgetEventTime {
|
||||
}
|
||||
|
||||
public:
|
||||
WidgetEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eBasicEventClass) {}
|
||||
WidgetEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eBasicEventClass, aTime) {}
|
||||
|
||||
MOZ_COUNTED_DTOR_VIRTUAL(WidgetEvent)
|
||||
|
||||
@ -542,7 +550,7 @@ class WidgetEvent : public WidgetEventTime {
|
||||
virtual WidgetEvent* Duplicate() const {
|
||||
MOZ_ASSERT(mClass == eBasicEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
WidgetEvent* result = new WidgetEvent(false, mMessage);
|
||||
WidgetEvent* result = new WidgetEvent(false, mMessage, this);
|
||||
result->AssignEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -1006,22 +1014,26 @@ class WidgetEvent : public WidgetEventTime {
|
||||
class WidgetGUIEvent : public WidgetEvent {
|
||||
protected:
|
||||
WidgetGUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetEvent(aIsTrusted, aMessage, aEventClassID), mWidget(aWidget) {}
|
||||
EventClassID aEventClassID,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, aEventClassID, aTime),
|
||||
mWidget(aWidget) {}
|
||||
|
||||
WidgetGUIEvent() = default;
|
||||
|
||||
public:
|
||||
virtual WidgetGUIEvent* AsGUIEvent() override { return this; }
|
||||
|
||||
WidgetGUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eGUIEventClass), mWidget(aWidget) {}
|
||||
WidgetGUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eGUIEventClass, aTime),
|
||||
mWidget(aWidget) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eGUIEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetGUIEvent* result = new WidgetGUIEvent(false, mMessage, nullptr);
|
||||
WidgetGUIEvent* result = new WidgetGUIEvent(false, mMessage, nullptr, this);
|
||||
result->AssignGUIEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -1153,8 +1165,9 @@ class MOZ_STACK_CLASS GetModifiersName final : public nsAutoCString {
|
||||
class WidgetInputEvent : public WidgetGUIEvent {
|
||||
protected:
|
||||
WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID),
|
||||
EventClassID aEventClassID,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID, aTime),
|
||||
mModifiers(0) {}
|
||||
|
||||
WidgetInputEvent() : mModifiers(0) {}
|
||||
@ -1162,15 +1175,17 @@ class WidgetInputEvent : public WidgetGUIEvent {
|
||||
public:
|
||||
virtual WidgetInputEvent* AsInputEvent() override { return this; }
|
||||
|
||||
WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eInputEventClass),
|
||||
WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eInputEventClass, aTime),
|
||||
mModifiers(0) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eInputEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetInputEvent* result = new WidgetInputEvent(false, mMessage, nullptr);
|
||||
WidgetInputEvent* result =
|
||||
new WidgetInputEvent(false, mMessage, nullptr, this);
|
||||
result->AssignInputEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -1264,14 +1279,16 @@ class InternalUIEvent : public WidgetGUIEvent {
|
||||
InternalUIEvent() : mDetail(0), mCausedByUntrustedEvent(false) {}
|
||||
|
||||
InternalUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID),
|
||||
EventClassID aEventClassID,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID, aTime),
|
||||
mDetail(0),
|
||||
mCausedByUntrustedEvent(false) {}
|
||||
|
||||
InternalUIEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, aEventClassID),
|
||||
EventClassID aEventClassID,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, aEventClassID, aTime),
|
||||
mDetail(0),
|
||||
mCausedByUntrustedEvent(false) {}
|
||||
|
||||
@ -1284,8 +1301,9 @@ class InternalUIEvent : public WidgetGUIEvent {
|
||||
* this should be nullptr.
|
||||
*/
|
||||
InternalUIEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEvent* aEventCausesThisEvent)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eUIEventClass),
|
||||
const WidgetEvent* aEventCausesThisEvent,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eUIEventClass, aTime),
|
||||
mDetail(0),
|
||||
mCausedByUntrustedEvent(aEventCausesThisEvent &&
|
||||
!aEventCausesThisEvent->IsTrusted()) {}
|
||||
@ -1293,7 +1311,8 @@ class InternalUIEvent : public WidgetGUIEvent {
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eUIEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalUIEvent* result = new InternalUIEvent(false, mMessage, nullptr);
|
||||
InternalUIEvent* result =
|
||||
new InternalUIEvent(false, mMessage, nullptr, this);
|
||||
result->AssignUIEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
@ -30,8 +30,10 @@ class InternalScrollPortEvent : public WidgetGUIEvent {
|
||||
enum OrientType { eVertical, eHorizontal, eBoth };
|
||||
|
||||
InternalScrollPortEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eScrollPortEventClass),
|
||||
nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eScrollPortEventClass,
|
||||
aTime),
|
||||
mOrient(eVertical) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
@ -39,7 +41,7 @@ class InternalScrollPortEvent : public WidgetGUIEvent {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
InternalScrollPortEvent* result =
|
||||
new InternalScrollPortEvent(false, mMessage, nullptr);
|
||||
new InternalScrollPortEvent(false, mMessage, nullptr, this);
|
||||
result->AssignScrollPortEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -64,15 +66,17 @@ class InternalScrollAreaEvent : public WidgetGUIEvent {
|
||||
virtual InternalScrollAreaEvent* AsScrollAreaEvent() override { return this; }
|
||||
|
||||
InternalScrollAreaEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eScrollAreaEventClass) {}
|
||||
nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eScrollAreaEventClass,
|
||||
aTime) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eScrollAreaEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
InternalScrollAreaEvent* result =
|
||||
new InternalScrollAreaEvent(false, mMessage, nullptr);
|
||||
new InternalScrollAreaEvent(false, mMessage, nullptr, this);
|
||||
result->AssignScrollAreaEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -99,14 +103,15 @@ class InternalFormEvent : public WidgetEvent {
|
||||
public:
|
||||
virtual InternalFormEvent* AsFormEvent() override { return this; }
|
||||
|
||||
InternalFormEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eFormEventClass),
|
||||
InternalFormEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eFormEventClass, aTime),
|
||||
mOriginator(nullptr) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eFormEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalFormEvent* result = new InternalFormEvent(false, mMessage);
|
||||
InternalFormEvent* result = new InternalFormEvent(false, mMessage, this);
|
||||
result->AssignFormEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -129,14 +134,15 @@ class InternalClipboardEvent : public WidgetEvent {
|
||||
public:
|
||||
virtual InternalClipboardEvent* AsClipboardEvent() override { return this; }
|
||||
|
||||
InternalClipboardEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eClipboardEventClass) {}
|
||||
InternalClipboardEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eClipboardEventClass, aTime) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eClipboardEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalClipboardEvent* result =
|
||||
new InternalClipboardEvent(false, mMessage);
|
||||
new InternalClipboardEvent(false, mMessage, this);
|
||||
result->AssignClipboardEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -160,15 +166,16 @@ class InternalFocusEvent : public InternalUIEvent {
|
||||
public:
|
||||
virtual InternalFocusEvent* AsFocusEvent() override { return this; }
|
||||
|
||||
InternalFocusEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, eFocusEventClass),
|
||||
InternalFocusEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, eFocusEventClass, aTime),
|
||||
mFromRaise(false),
|
||||
mIsRefocus(false) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eFocusEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalFocusEvent* result = new InternalFocusEvent(false, mMessage);
|
||||
InternalFocusEvent* result = new InternalFocusEvent(false, mMessage, this);
|
||||
result->AssignFocusEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -194,8 +201,9 @@ class InternalTransitionEvent : public WidgetEvent {
|
||||
public:
|
||||
virtual InternalTransitionEvent* AsTransitionEvent() override { return this; }
|
||||
|
||||
InternalTransitionEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eTransitionEventClass),
|
||||
InternalTransitionEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eTransitionEventClass, aTime),
|
||||
mElapsedTime(0.0) {}
|
||||
|
||||
InternalTransitionEvent(const InternalTransitionEvent& aOther) = delete;
|
||||
@ -209,7 +217,7 @@ class InternalTransitionEvent : public WidgetEvent {
|
||||
MOZ_ASSERT(mClass == eTransitionEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalTransitionEvent* result =
|
||||
new InternalTransitionEvent(false, mMessage);
|
||||
new InternalTransitionEvent(false, mMessage, this);
|
||||
result->AssignTransitionEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -237,8 +245,9 @@ class InternalAnimationEvent : public WidgetEvent {
|
||||
public:
|
||||
virtual InternalAnimationEvent* AsAnimationEvent() override { return this; }
|
||||
|
||||
InternalAnimationEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eAnimationEventClass),
|
||||
InternalAnimationEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eAnimationEventClass, aTime),
|
||||
mElapsedTime(0.0) {}
|
||||
|
||||
InternalAnimationEvent(const InternalAnimationEvent& aOther) = delete;
|
||||
@ -251,7 +260,7 @@ class InternalAnimationEvent : public WidgetEvent {
|
||||
MOZ_ASSERT(mClass == eAnimationEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalAnimationEvent* result =
|
||||
new InternalAnimationEvent(false, mMessage);
|
||||
new InternalAnimationEvent(false, mMessage, this);
|
||||
result->AssignAnimationEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -279,13 +288,15 @@ class InternalSMILTimeEvent : public InternalUIEvent {
|
||||
public:
|
||||
virtual InternalSMILTimeEvent* AsSMILTimeEvent() override { return this; }
|
||||
|
||||
InternalSMILTimeEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, eSMILTimeEventClass) {}
|
||||
InternalSMILTimeEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, eSMILTimeEventClass, aTime) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eSMILTimeEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
InternalSMILTimeEvent* result = new InternalSMILTimeEvent(false, mMessage);
|
||||
InternalSMILTimeEvent* result =
|
||||
new InternalSMILTimeEvent(false, mMessage, this);
|
||||
result->AssignSMILTimeEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
@ -100,9 +100,9 @@ class WidgetCommandEvent : public WidgetGUIEvent {
|
||||
|
||||
protected:
|
||||
WidgetCommandEvent(bool aIsTrusted, nsAtom* aEventType, nsAtom* aCommand,
|
||||
nsIWidget* aWidget)
|
||||
nsIWidget* aWidget, const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, eUnidentifiedEvent, aWidget,
|
||||
eCommandEventClass),
|
||||
eCommandEventClass, aTime),
|
||||
mCommand(aCommand) {
|
||||
mSpecifiedEventType = aEventType;
|
||||
}
|
||||
@ -112,21 +112,23 @@ class WidgetCommandEvent : public WidgetGUIEvent {
|
||||
* Constructor to initialize an app command. This is the only case to
|
||||
* initialize this class as a command in C++ stack.
|
||||
*/
|
||||
WidgetCommandEvent(bool aIsTrusted, nsAtom* aCommand, nsIWidget* aWidget)
|
||||
WidgetCommandEvent(bool aIsTrusted, nsAtom* aCommand, nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetCommandEvent(aIsTrusted, nsGkAtoms::onAppCommand, aCommand,
|
||||
aWidget) {}
|
||||
aWidget, aTime) {}
|
||||
|
||||
/**
|
||||
* Constructor to initialize as internal event of dom::CommandEvent.
|
||||
*/
|
||||
WidgetCommandEvent() : WidgetCommandEvent(false, nullptr, nullptr, nullptr) {}
|
||||
WidgetCommandEvent()
|
||||
: WidgetCommandEvent(false, nullptr, nullptr, nullptr, nullptr) {}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
MOZ_ASSERT(mClass == eCommandEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetCommandEvent* result =
|
||||
new WidgetCommandEvent(false, mSpecifiedEventType, mCommand, nullptr);
|
||||
WidgetCommandEvent* result = new WidgetCommandEvent(
|
||||
false, mSpecifiedEventType, mCommand, nullptr, this);
|
||||
result->AssignCommandEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
@ -103,8 +103,9 @@ class WidgetMouseEventBase : public WidgetInputEvent {
|
||||
// we have to hardcode MouseEvent_Binding::MOZ_SOURCE_MOUSE.
|
||||
|
||||
WidgetMouseEventBase(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget, EventClassID aEventClassID)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID),
|
||||
nsIWidget* aWidget, EventClassID aEventClassID,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID, aTime),
|
||||
mPressure(0),
|
||||
mButton(0),
|
||||
mButtons(0),
|
||||
@ -208,8 +209,10 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
||||
mClickEventPrevented(false) {}
|
||||
|
||||
WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID, Reason aReason)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID),
|
||||
EventClassID aEventClassID, Reason aReason,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID,
|
||||
aTime),
|
||||
mReason(aReason),
|
||||
mContextMenuTrigger(eNormal),
|
||||
mClickCount(0),
|
||||
@ -226,8 +229,10 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
||||
|
||||
WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
Reason aReason,
|
||||
ContextMenuTrigger aContextMenuTrigger = eNormal)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass),
|
||||
ContextMenuTrigger aContextMenuTrigger = eNormal,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass,
|
||||
aTime),
|
||||
mReason(aReason),
|
||||
mContextMenuTrigger(aContextMenuTrigger),
|
||||
mClickCount(0),
|
||||
@ -249,7 +254,7 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetMouseEvent* result = new WidgetMouseEvent(
|
||||
false, mMessage, nullptr, mReason, mContextMenuTrigger);
|
||||
false, mMessage, nullptr, mReason, mContextMenuTrigger, this);
|
||||
result->AssignMouseEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -337,8 +342,10 @@ class WidgetDragEvent : public WidgetMouseEvent {
|
||||
public:
|
||||
virtual WidgetDragEvent* AsDragEvent() override { return this; }
|
||||
|
||||
WidgetDragEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetMouseEvent(aIsTrusted, aMessage, aWidget, eDragEventClass, eReal),
|
||||
WidgetDragEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEvent(aIsTrusted, aMessage, aWidget, eDragEventClass, eReal,
|
||||
aTime),
|
||||
mUserCancelled(false),
|
||||
mDefaultPreventedOnContent(false) {}
|
||||
|
||||
@ -346,7 +353,8 @@ class WidgetDragEvent : public WidgetMouseEvent {
|
||||
MOZ_ASSERT(mClass == eDragEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetDragEvent* result = new WidgetDragEvent(false, mMessage, nullptr);
|
||||
WidgetDragEvent* result =
|
||||
new WidgetDragEvent(false, mMessage, nullptr, this);
|
||||
result->AssignDragEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -397,9 +405,10 @@ class WidgetMouseScrollEvent : public WidgetMouseEventBase {
|
||||
virtual WidgetMouseScrollEvent* AsMouseScrollEvent() override { return this; }
|
||||
|
||||
WidgetMouseScrollEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget,
|
||||
eMouseScrollEventClass),
|
||||
eMouseScrollEventClass, aTime),
|
||||
mDelta(0),
|
||||
mIsHorizontal(false) {}
|
||||
|
||||
@ -408,7 +417,7 @@ class WidgetMouseScrollEvent : public WidgetMouseEventBase {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetMouseScrollEvent* result =
|
||||
new WidgetMouseScrollEvent(false, mMessage, nullptr);
|
||||
new WidgetMouseScrollEvent(false, mMessage, nullptr, this);
|
||||
result->AssignMouseScrollEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -470,8 +479,10 @@ class WidgetWheelEvent : public WidgetMouseEventBase {
|
||||
public:
|
||||
virtual WidgetWheelEvent* AsWheelEvent() override { return this; }
|
||||
|
||||
WidgetWheelEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eWheelEventClass),
|
||||
WidgetWheelEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eWheelEventClass,
|
||||
aTime),
|
||||
mDeltaX(0.0),
|
||||
mDeltaY(0.0),
|
||||
mDeltaZ(0.0),
|
||||
@ -497,7 +508,8 @@ class WidgetWheelEvent : public WidgetMouseEventBase {
|
||||
MOZ_ASSERT(mClass == eWheelEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetWheelEvent* result = new WidgetWheelEvent(false, mMessage, nullptr);
|
||||
WidgetWheelEvent* result =
|
||||
new WidgetWheelEvent(false, mMessage, nullptr, this);
|
||||
result->AssignWheelEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -695,8 +707,9 @@ class WidgetPointerEvent : public WidgetMouseEvent {
|
||||
public:
|
||||
virtual WidgetPointerEvent* AsPointerEvent() override { return this; }
|
||||
|
||||
WidgetPointerEvent(bool aIsTrusted, EventMessage aMsg, nsIWidget* w)
|
||||
: WidgetMouseEvent(aIsTrusted, aMsg, w, ePointerEventClass, eReal),
|
||||
WidgetPointerEvent(bool aIsTrusted, EventMessage aMsg, nsIWidget* w,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEvent(aIsTrusted, aMsg, w, ePointerEventClass, eReal, aTime),
|
||||
mWidth(1),
|
||||
mHeight(1),
|
||||
mIsPrimary(true),
|
||||
@ -716,7 +729,7 @@ class WidgetPointerEvent : public WidgetMouseEvent {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetPointerEvent* result =
|
||||
new WidgetPointerEvent(false, mMessage, nullptr);
|
||||
new WidgetPointerEvent(false, mMessage, nullptr, this);
|
||||
result->AssignPointerEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
@ -194,8 +194,9 @@ class WidgetKeyboardEvent final : public WidgetInputEvent {
|
||||
|
||||
WidgetKeyboardEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget,
|
||||
EventClassID aEventClassID = eKeyboardEventClass)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID),
|
||||
EventClassID aEventClassID = eKeyboardEventClass,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID, aTime),
|
||||
mNativeKeyEvent(nullptr),
|
||||
mKeyCode(0),
|
||||
mCharCode(0),
|
||||
@ -294,8 +295,8 @@ class WidgetKeyboardEvent final : public WidgetInputEvent {
|
||||
MOZ_ASSERT(mClass == eKeyboardEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetKeyboardEvent* result =
|
||||
new WidgetKeyboardEvent(false, mMessage, nullptr);
|
||||
WidgetKeyboardEvent* result = new WidgetKeyboardEvent(
|
||||
false, mMessage, nullptr, eKeyboardEventClass, this);
|
||||
result->AssignKeyEventData(*this, true);
|
||||
result->mEditCommandsForSingleLineEditor =
|
||||
mEditCommandsForSingleLineEditor.Clone();
|
||||
@ -887,8 +888,10 @@ class WidgetCompositionEvent : public WidgetGUIEvent {
|
||||
virtual WidgetCompositionEvent* AsCompositionEvent() override { return this; }
|
||||
|
||||
WidgetCompositionEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eCompositionEventClass),
|
||||
nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eCompositionEventClass,
|
||||
aTime),
|
||||
mNativeIMEContext(aWidget),
|
||||
mOriginalMessage(eVoidEvent) {}
|
||||
|
||||
@ -897,7 +900,7 @@ class WidgetCompositionEvent : public WidgetGUIEvent {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetCompositionEvent* result =
|
||||
new WidgetCompositionEvent(false, mMessage, nullptr);
|
||||
new WidgetCompositionEvent(false, mMessage, nullptr, this);
|
||||
result->AssignCompositionEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -1431,8 +1434,10 @@ class InternalEditorInputEvent : public InternalUIEvent {
|
||||
}
|
||||
|
||||
InternalEditorInputEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget = nullptr)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, aWidget, eEditorInputEventClass),
|
||||
nsIWidget* aWidget = nullptr,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, aWidget, eEditorInputEventClass,
|
||||
aTime),
|
||||
mData(VoidString()),
|
||||
mInputType(EditorInputType::eUnknown) {}
|
||||
|
||||
@ -1441,7 +1446,7 @@ class InternalEditorInputEvent : public InternalUIEvent {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
InternalEditorInputEvent* result =
|
||||
new InternalEditorInputEvent(false, mMessage, nullptr);
|
||||
new InternalEditorInputEvent(false, mMessage, nullptr, this);
|
||||
result->AssignEditorInputEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
@ -34,8 +34,10 @@ class WidgetGestureNotifyEvent : public WidgetGUIEvent {
|
||||
}
|
||||
|
||||
WidgetGestureNotifyEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eGestureNotifyEventClass),
|
||||
nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eGestureNotifyEventClass,
|
||||
aTime),
|
||||
mPanDirection(ePanNone),
|
||||
mDisplayPanFeedback(false) {}
|
||||
|
||||
@ -49,7 +51,7 @@ class WidgetGestureNotifyEvent : public WidgetGUIEvent {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetGestureNotifyEvent* result =
|
||||
new WidgetGestureNotifyEvent(false, mMessage, nullptr);
|
||||
new WidgetGestureNotifyEvent(false, mMessage, nullptr, this);
|
||||
result->AssignGestureNotifyEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -86,9 +88,10 @@ class WidgetSimpleGestureEvent : public WidgetMouseEventBase {
|
||||
}
|
||||
|
||||
WidgetSimpleGestureEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget,
|
||||
eSimpleGestureEventClass),
|
||||
eSimpleGestureEventClass, aTime),
|
||||
mAllowedDirections(0),
|
||||
mDirection(0),
|
||||
mClickCount(0),
|
||||
@ -107,7 +110,7 @@ class WidgetSimpleGestureEvent : public WidgetMouseEventBase {
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetSimpleGestureEvent* result =
|
||||
new WidgetSimpleGestureEvent(false, mMessage, nullptr);
|
||||
new WidgetSimpleGestureEvent(false, mMessage, nullptr, this);
|
||||
result->AssignSimpleGestureEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
@ -176,8 +179,10 @@ class WidgetTouchEvent final : public WidgetInputEvent {
|
||||
|
||||
WidgetTouchEvent& operator=(WidgetTouchEvent&&) = default;
|
||||
|
||||
WidgetTouchEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass) {
|
||||
WidgetTouchEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
const WidgetEventTime* aTime = nullptr)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass,
|
||||
aTime) {
|
||||
MOZ_COUNT_CTOR(WidgetTouchEvent);
|
||||
mFlags.mCancelable = mMessage != eTouchCancel;
|
||||
}
|
||||
@ -188,7 +193,8 @@ class WidgetTouchEvent final : public WidgetInputEvent {
|
||||
MOZ_ASSERT(mClass == eTouchEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetTouchEvent* result = new WidgetTouchEvent(false, mMessage, nullptr);
|
||||
WidgetTouchEvent* result =
|
||||
new WidgetTouchEvent(false, mMessage, nullptr, this);
|
||||
result->AssignTouchEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user