зеркало из https://github.com/mozilla/gecko-dev.git
Bug 895274 part.3 Make the enum of event messages a named enum IGNORE IDL r=smaug
This commit is contained in:
Родитель
71d2395f86
Коммит
0d22745cda
|
@ -118,11 +118,11 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
|
|||
}
|
||||
|
||||
void
|
||||
nsCoreUtils::DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX, int32_t aY,
|
||||
nsIContent *aContent, nsIFrame *aFrame,
|
||||
nsIPresShell *aPresShell, nsIWidget *aRootWidget)
|
||||
{
|
||||
WidgetMouseEvent event(true, aEventType, aRootWidget,
|
||||
WidgetMouseEvent event(true, aMessage, aRootWidget,
|
||||
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
|
||||
|
||||
event.refPoint = LayoutDeviceIntPoint(aX, aY);
|
||||
|
@ -137,14 +137,14 @@ nsCoreUtils::DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
|||
}
|
||||
|
||||
void
|
||||
nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX, int32_t aY,
|
||||
nsIContent* aContent, nsIFrame* aFrame,
|
||||
nsIPresShell* aPresShell, nsIWidget* aRootWidget)
|
||||
{
|
||||
if (!dom::TouchEvent::PrefEnabled())
|
||||
return;
|
||||
|
||||
WidgetTouchEvent event(true, aEventType, aRootWidget);
|
||||
WidgetTouchEvent event(true, aMessage, aRootWidget);
|
||||
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#ifndef nsCoreUtils_h_
|
||||
#define nsCoreUtils_h_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h" // for GetShell()
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -49,7 +50,7 @@ public:
|
|||
/**
|
||||
* Send mouse event to the given element.
|
||||
*
|
||||
* @param aEventType [in] an event type (see BasicEvents.h for constants)
|
||||
* @param aMessage [in] an event message (see EventForwards.h)
|
||||
* @param aX [in] x coordinate in dev pixels
|
||||
* @param aY [in] y coordinate in dev pixels
|
||||
* @param aContent [in] the element
|
||||
|
@ -57,14 +58,15 @@ public:
|
|||
* @param aPresShell [in] the presshell for the element
|
||||
* @param aRootWidget [in] the root widget of the element
|
||||
*/
|
||||
static void DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
static void DispatchMouseEvent(mozilla::EventMessage aMessage,
|
||||
int32_t aX, int32_t aY,
|
||||
nsIContent *aContent, nsIFrame *aFrame,
|
||||
nsIPresShell *aPresShell, nsIWidget *aRootWidget);
|
||||
|
||||
/**
|
||||
* Send a touch event with a single touch point to the given element.
|
||||
*
|
||||
* @param aEventType [in] an event type (see BasicEvents.h for constants)
|
||||
* @param aMessage [in] an event message (see EventForwards.h)
|
||||
* @param aX [in] x coordinate in dev pixels
|
||||
* @param aY [in] y coordinate in dev pixels
|
||||
* @param aContent [in] the element
|
||||
|
@ -72,7 +74,8 @@ public:
|
|||
* @param aPresShell [in] the presshell for the element
|
||||
* @param aRootWidget [in] the root widget of the element
|
||||
*/
|
||||
static void DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
static void DispatchTouchEvent(mozilla::EventMessage aMessage,
|
||||
int32_t aX, int32_t aY,
|
||||
nsIContent* aContent, nsIFrame* aFrame,
|
||||
nsIPresShell* aPresShell, nsIWidget* aRootWidget);
|
||||
|
||||
|
|
|
@ -833,6 +833,8 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (stopEvent) {
|
||||
|
|
|
@ -670,9 +670,9 @@ nsContentUtils::InitializeModifierStrings()
|
|||
static bool
|
||||
ShouldAddEventToStringEventTable(const EventNameMapping& aMapping)
|
||||
{
|
||||
switch(aMapping.mId) {
|
||||
#define ID_TO_EVENT(name_, id_, type_, struct_) \
|
||||
case id_: return nsGkAtoms::on##name_ == aMapping.mAtom;
|
||||
switch(aMapping.mMessage) {
|
||||
#define ID_TO_EVENT(name_, message_, type_, struct_) \
|
||||
case message_: return nsGkAtoms::on##name_ == aMapping.mAtom;
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef ID_TO_EVENT
|
||||
default:
|
||||
|
@ -687,8 +687,8 @@ nsContentUtils::InitializeEventTable() {
|
|||
NS_ASSERTION(!sStringEventTable, "EventTable already initialized!");
|
||||
|
||||
static const EventNameMapping eventArray[] = {
|
||||
#define EVENT(name_, _id, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _id, _type, _class },
|
||||
#define EVENT(name_, _message, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _type, _message, _class },
|
||||
#define WINDOW_ONLY_EVENT EVENT
|
||||
#define NON_IDL_EVENT EVENT
|
||||
#include "mozilla/EventNameList.h"
|
||||
|
@ -724,9 +724,9 @@ nsContentUtils::InitializeTouchEventTable()
|
|||
if (!sEventTableInitialized && sAtomEventTable && sStringEventTable) {
|
||||
sEventTableInitialized = true;
|
||||
static const EventNameMapping touchEventArray[] = {
|
||||
#define EVENT(name_, _id, _type, _class)
|
||||
#define TOUCH_EVENT(name_, _id, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _id, _type, _class },
|
||||
#define EVENT(name_, _message, _type, _class)
|
||||
#define TOUCH_EVENT(name_, _message, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _type, _message, _class },
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
@ -3655,13 +3655,13 @@ nsContentUtils::IsEventAttributeName(nsIAtom* aName, int32_t aType)
|
|||
}
|
||||
|
||||
// static
|
||||
uint32_t
|
||||
nsContentUtils::GetEventId(nsIAtom* aName)
|
||||
EventMessage
|
||||
nsContentUtils::GetEventMessage(nsIAtom* aName)
|
||||
{
|
||||
if (aName) {
|
||||
EventNameMapping mapping;
|
||||
if (sAtomEventTable->Get(aName, &mapping)) {
|
||||
return mapping.mId;
|
||||
return mapping.mMessage;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3680,14 +3680,15 @@ nsContentUtils::GetEventClassID(const nsAString& aName)
|
|||
}
|
||||
|
||||
nsIAtom*
|
||||
nsContentUtils::GetEventIdAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
uint32_t* aEventID)
|
||||
nsContentUtils::GetEventMessageAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
EventMessage* aEventMessage)
|
||||
{
|
||||
EventNameMapping mapping;
|
||||
if (sStringEventTable->Get(aName, &mapping)) {
|
||||
*aEventID = mapping.mEventClassID == aEventClassID ? mapping.mId :
|
||||
NS_USER_DEFINED_EVENT;
|
||||
*aEventMessage =
|
||||
mapping.mEventClassID == aEventClassID ? mapping.mMessage :
|
||||
NS_USER_DEFINED_EVENT;
|
||||
return mapping.mAtom;
|
||||
}
|
||||
|
||||
|
@ -3700,11 +3701,11 @@ nsContentUtils::GetEventIdAndAtom(const nsAString& aName,
|
|||
}
|
||||
}
|
||||
|
||||
*aEventID = NS_USER_DEFINED_EVENT;
|
||||
*aEventMessage = NS_USER_DEFINED_EVENT;
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aName);
|
||||
sUserDefinedEvents->AppendObject(atom);
|
||||
mapping.mAtom = atom;
|
||||
mapping.mId = NS_USER_DEFINED_EVENT;
|
||||
mapping.mMessage = NS_USER_DEFINED_EVENT;
|
||||
mapping.mType = EventNameType_None;
|
||||
mapping.mEventClassID = eBasicEventClass;
|
||||
sStringEventTable->Put(aName, mapping);
|
||||
|
@ -7706,7 +7707,7 @@ nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
|
|||
if (!aWidget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("keydown"))
|
||||
msg = NS_KEY_DOWN;
|
||||
else if (aType.EqualsLiteral("keyup"))
|
||||
|
@ -7819,7 +7820,7 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
|
|||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
bool contextMenuKey = false;
|
||||
if (aType.EqualsLiteral("mousedown"))
|
||||
msg = NS_MOUSE_BUTTON_DOWN;
|
||||
|
|
|
@ -165,8 +165,8 @@ struct EventNameMapping
|
|||
// This holds pointers to nsGkAtoms members, and is therefore safe as a
|
||||
// non-owning reference.
|
||||
nsIAtom* MOZ_NON_OWNING_REF mAtom;
|
||||
uint32_t mId;
|
||||
int32_t mType;
|
||||
mozilla::EventMessage mMessage;
|
||||
mozilla::EventClassID mEventClassID;
|
||||
};
|
||||
|
||||
|
@ -1100,13 +1100,13 @@ public:
|
|||
static bool IsEventAttributeName(nsIAtom* aName, int32_t aType);
|
||||
|
||||
/**
|
||||
* Return the event id for the event with the given name. The name is the
|
||||
* event name with the 'on' prefix. Returns NS_USER_DEFINED_EVENT if the
|
||||
* Return the event message for the event with the given name. The name is
|
||||
* the event name with the 'on' prefix. Returns NS_USER_DEFINED_EVENT if the
|
||||
* event doesn't match a known event name.
|
||||
*
|
||||
* @param aName the event name to look up
|
||||
*/
|
||||
static uint32_t GetEventId(nsIAtom* aName);
|
||||
static mozilla::EventMessage GetEventMessage(nsIAtom* aName);
|
||||
|
||||
/**
|
||||
* Return the EventClassID for the event with the given name. The name is the
|
||||
|
@ -1118,7 +1118,7 @@ public:
|
|||
static mozilla::EventClassID GetEventClassID(const nsAString& aName);
|
||||
|
||||
/**
|
||||
* Return the event id and atom for the event with the given name.
|
||||
* Return the event message and atom for the event with the given name.
|
||||
* The name is the event name *without* the 'on' prefix.
|
||||
* Returns NS_USER_DEFINED_EVENT on the aEventID if the
|
||||
* event doesn't match a known event name in the category.
|
||||
|
@ -1126,9 +1126,9 @@ public:
|
|||
* @param aName the event name to look up
|
||||
* @param aEventClassID only return event id for aEventClassID
|
||||
*/
|
||||
static nsIAtom* GetEventIdAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
uint32_t* aEventID);
|
||||
static nsIAtom* GetEventMessageAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
mozilla::EventMessage* aEventMessage);
|
||||
|
||||
/**
|
||||
* Used only during traversal of the XPCOM graph by the cycle
|
||||
|
|
|
@ -621,14 +621,18 @@ IsSelectionInsideRuby(nsISelection* aSelection)
|
|||
}
|
||||
|
||||
bool
|
||||
nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPresShell* aPresShell,
|
||||
nsISelection* aSelection, bool* aActionTaken)
|
||||
nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
|
||||
int32_t aClipboardType,
|
||||
nsIPresShell* aPresShell,
|
||||
nsISelection* aSelection,
|
||||
bool* aActionTaken)
|
||||
{
|
||||
if (aActionTaken) {
|
||||
*aActionTaken = false;
|
||||
}
|
||||
|
||||
NS_ASSERTION(aType == NS_CUT || aType == NS_COPY || aType == NS_PASTE,
|
||||
NS_ASSERTION(aEventMessage == NS_CUT || aEventMessage == NS_COPY ||
|
||||
aEventMessage == NS_PASTE,
|
||||
"Invalid clipboard event type");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = aPresShell;
|
||||
|
@ -684,10 +688,11 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
|||
nsRefPtr<DataTransfer> clipboardData;
|
||||
if (chromeShell || Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
|
||||
clipboardData =
|
||||
new DataTransfer(piWindow, aType, aType == NS_PASTE, aClipboardType);
|
||||
new DataTransfer(piWindow, aEventMessage, aEventMessage == NS_PASTE,
|
||||
aClipboardType);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
InternalClipboardEvent evt(true, aType);
|
||||
InternalClipboardEvent evt(true, aEventMessage);
|
||||
evt.clipboardData = clipboardData;
|
||||
EventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt,
|
||||
nullptr, &status);
|
||||
|
@ -698,7 +703,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
|||
// No need to do anything special during a paste. Either an event listener
|
||||
// took care of it and cancelled the event, or the caller will handle it.
|
||||
// Return true to indicate that the event wasn't cancelled.
|
||||
if (aType == NS_PASTE) {
|
||||
if (aEventMessage == NS_PASTE) {
|
||||
// Clear and mark the clipboardData as readonly. This prevents someone
|
||||
// from reading the clipboard contents after the paste event has fired.
|
||||
if (clipboardData) {
|
||||
|
@ -738,7 +743,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
|||
|
||||
// when cutting non-editable content, do nothing
|
||||
// XXX this is probably the wrong editable flag to check
|
||||
if (aType != NS_CUT || content->IsEditable()) {
|
||||
if (aEventMessage != NS_CUT || content->IsEditable()) {
|
||||
// get the data from the selection if any
|
||||
bool isCollapsed;
|
||||
sel->GetIsCollapsed(&isCollapsed);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#ifndef nsCopySupport_h__
|
||||
#define nsCopySupport_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
class nsINode;
|
||||
class nsISelection;
|
||||
|
@ -64,7 +64,7 @@ class nsCopySupport
|
|||
|
||||
/**
|
||||
* Fires a cut, copy or paste event, on the given presshell, depending
|
||||
* on the value of aType, which should be either NS_CUT, NS_COPY or
|
||||
* on the value of aEventMessage, which should be either NS_CUT, NS_COPY or
|
||||
* NS_PASTE, and perform the default copy action if the event was not
|
||||
* cancelled.
|
||||
*
|
||||
|
@ -88,7 +88,7 @@ class nsCopySupport
|
|||
*
|
||||
* If the event is cancelled or an error occurs, false will be returned.
|
||||
*/
|
||||
static bool FireClipboardEvent(int32_t aType,
|
||||
static bool FireClipboardEvent(mozilla::EventMessage aEventMessage,
|
||||
int32_t aClipboardType,
|
||||
nsIPresShell* aPresShell,
|
||||
nsISelection* aSelection,
|
||||
|
|
|
@ -700,7 +700,7 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("pointerdown")) {
|
||||
msg = NS_POINTER_DOWN;
|
||||
} else if (aType.EqualsLiteral("pointerup")) {
|
||||
|
@ -979,7 +979,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
|
|||
if (!widget) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("touchstart")) {
|
||||
msg = NS_TOUCH_START;
|
||||
} else if (aType.EqualsLiteral("touchmove")) {
|
||||
|
@ -1314,7 +1314,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
|||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("MozSwipeGestureStart"))
|
||||
msg = NS_SIMPLE_GESTURE_SWIPE_START;
|
||||
else if (aType.EqualsLiteral("MozSwipeGestureUpdate"))
|
||||
|
@ -1941,13 +1941,28 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aType != NS_QUERY_SELECTED_TEXT &&
|
||||
aType != NS_QUERY_TEXT_CONTENT &&
|
||||
aType != NS_QUERY_CARET_RECT &&
|
||||
aType != NS_QUERY_TEXT_RECT &&
|
||||
aType != NS_QUERY_EDITOR_RECT &&
|
||||
aType != NS_QUERY_CHARACTER_AT_POINT) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
EventMessage message;
|
||||
switch (aType) {
|
||||
case QUERY_SELECTED_TEXT:
|
||||
message = NS_QUERY_SELECTED_TEXT;
|
||||
break;
|
||||
case QUERY_TEXT_CONTENT:
|
||||
message = NS_QUERY_TEXT_CONTENT;
|
||||
break;
|
||||
case QUERY_CARET_RECT:
|
||||
message = NS_QUERY_CARET_RECT;
|
||||
break;
|
||||
case QUERY_TEXT_RECT:
|
||||
message = NS_QUERY_TEXT_RECT;
|
||||
break;
|
||||
case QUERY_EDITOR_RECT:
|
||||
message = NS_QUERY_EDITOR_RECT;
|
||||
break;
|
||||
case QUERY_CHARACTER_AT_POINT:
|
||||
message = NS_QUERY_CHARACTER_AT_POINT;
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> targetWidget = widget;
|
||||
|
@ -1956,7 +1971,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
|||
bool useNativeLineBreak =
|
||||
!(aAdditionalFlags & QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
|
||||
|
||||
if (aType == QUERY_CHARACTER_AT_POINT) {
|
||||
if (message == NS_QUERY_CHARACTER_AT_POINT) {
|
||||
// Looking for the widget at the point.
|
||||
WidgetQueryContentEvent dummyEvent(true, NS_QUERY_CONTENT_STATE, widget);
|
||||
dummyEvent.mUseNativeLineBreak = useNativeLineBreak;
|
||||
|
@ -1983,10 +1998,10 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
|||
|
||||
pt += widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset();
|
||||
|
||||
WidgetQueryContentEvent queryEvent(true, aType, targetWidget);
|
||||
WidgetQueryContentEvent queryEvent(true, message, targetWidget);
|
||||
InitEvent(queryEvent, &pt);
|
||||
|
||||
switch (aType) {
|
||||
switch (message) {
|
||||
case NS_QUERY_TEXT_CONTENT:
|
||||
queryEvent.InitForQueryTextContent(aOffset, aLength, useNativeLineBreak);
|
||||
break;
|
||||
|
@ -2056,7 +2071,7 @@ nsDOMWindowUtils::SendContentCommandEvent(const nsAString& aType,
|
|||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("cut"))
|
||||
msg = NS_CONTENT_COMMAND_CUT;
|
||||
else if (aType.EqualsLiteral("copy"))
|
||||
|
|
|
@ -97,25 +97,29 @@ PRLogModuleInfo* gFocusNavigationLog;
|
|||
|
||||
struct nsDelayedBlurOrFocusEvent
|
||||
{
|
||||
nsDelayedBlurOrFocusEvent(uint32_t aType,
|
||||
nsDelayedBlurOrFocusEvent(EventMessage aEventMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIDocument* aDocument,
|
||||
EventTarget* aTarget)
|
||||
: mType(aType),
|
||||
mPresShell(aPresShell),
|
||||
mDocument(aDocument),
|
||||
mTarget(aTarget) { }
|
||||
: mPresShell(aPresShell)
|
||||
, mDocument(aDocument)
|
||||
, mTarget(aTarget)
|
||||
, mEventMessage(aEventMessage)
|
||||
{
|
||||
}
|
||||
|
||||
nsDelayedBlurOrFocusEvent(const nsDelayedBlurOrFocusEvent& aOther)
|
||||
: mType(aOther.mType),
|
||||
mPresShell(aOther.mPresShell),
|
||||
mDocument(aOther.mDocument),
|
||||
mTarget(aOther.mTarget) { }
|
||||
: mPresShell(aOther.mPresShell)
|
||||
, mDocument(aOther.mDocument)
|
||||
, mTarget(aOther.mTarget)
|
||||
, mEventMessage(aOther.mEventMessage)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t mType;
|
||||
nsCOMPtr<nsIPresShell> mPresShell;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<EventTarget> mTarget;
|
||||
EventMessage mEventMessage;
|
||||
};
|
||||
|
||||
inline void ImplCycleCollectionUnlink(nsDelayedBlurOrFocusEvent& aField)
|
||||
|
@ -1038,11 +1042,11 @@ nsFocusManager::FireDelayedEvents(nsIDocument* aDocument)
|
|||
mDelayedBlurFocusEvents.RemoveElementAt(i);
|
||||
--i;
|
||||
} else if (!aDocument->EventHandlingSuppressed()) {
|
||||
uint32_t type = mDelayedBlurFocusEvents[i].mType;
|
||||
EventMessage message = mDelayedBlurFocusEvents[i].mEventMessage;
|
||||
nsCOMPtr<EventTarget> target = mDelayedBlurFocusEvents[i].mTarget;
|
||||
nsCOMPtr<nsIPresShell> presShell = mDelayedBlurFocusEvents[i].mPresShell;
|
||||
mDelayedBlurFocusEvents.RemoveElementAt(i);
|
||||
SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, false);
|
||||
SendFocusOrBlurEvent(message, presShell, aDocument, target, 0, false);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
@ -1961,15 +1965,20 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
|||
class FocusBlurEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
FocusBlurEvent(nsISupports* aTarget, uint32_t aType,
|
||||
FocusBlurEvent(nsISupports* aTarget, EventMessage aEventMessage,
|
||||
nsPresContext* aContext, bool aWindowRaised,
|
||||
bool aIsRefocus)
|
||||
: mTarget(aTarget), mType(aType), mContext(aContext),
|
||||
mWindowRaised(aWindowRaised), mIsRefocus(aIsRefocus) {}
|
||||
: mTarget(aTarget)
|
||||
, mContext(aContext)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mWindowRaised(aWindowRaised)
|
||||
, mIsRefocus(aIsRefocus)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
InternalFocusEvent event(true, mType);
|
||||
InternalFocusEvent event(true, mEventMessage);
|
||||
event.mFlags.mBubbles = false;
|
||||
event.fromRaise = mWindowRaised;
|
||||
event.isRefocus = mIsRefocus;
|
||||
|
@ -1977,14 +1986,14 @@ public:
|
|||
}
|
||||
|
||||
nsCOMPtr<nsISupports> mTarget;
|
||||
uint32_t mType;
|
||||
nsRefPtr<nsPresContext> mContext;
|
||||
EventMessage mEventMessage;
|
||||
bool mWindowRaised;
|
||||
bool mIsRefocus;
|
||||
};
|
||||
|
||||
void
|
||||
nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
||||
nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIDocument* aDocument,
|
||||
nsISupports* aTarget,
|
||||
|
@ -1992,7 +2001,8 @@ nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
|||
bool aWindowRaised,
|
||||
bool aIsRefocus)
|
||||
{
|
||||
NS_ASSERTION(aType == NS_FOCUS_CONTENT || aType == NS_BLUR_CONTENT,
|
||||
NS_ASSERTION(aEventMessage == NS_FOCUS_CONTENT ||
|
||||
aEventMessage == NS_BLUR_CONTENT,
|
||||
"Wrong event type for SendFocusOrBlurEvent");
|
||||
|
||||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
|
@ -2015,7 +2025,7 @@ nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
|||
|
||||
for (uint32_t i = mDelayedBlurFocusEvents.Length(); i > 0; --i) {
|
||||
// if this event was already queued, remove it and append it to the end
|
||||
if (mDelayedBlurFocusEvents[i - 1].mType == aType &&
|
||||
if (mDelayedBlurFocusEvents[i - 1].mEventMessage == aEventMessage &&
|
||||
mDelayedBlurFocusEvents[i - 1].mPresShell == aPresShell &&
|
||||
mDelayedBlurFocusEvents[i - 1].mDocument == aDocument &&
|
||||
mDelayedBlurFocusEvents[i - 1].mTarget == eventTarget) {
|
||||
|
@ -2024,23 +2034,25 @@ nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
|||
}
|
||||
|
||||
mDelayedBlurFocusEvents.AppendElement(
|
||||
nsDelayedBlurOrFocusEvent(aType, aPresShell, aDocument, eventTarget));
|
||||
nsDelayedBlurOrFocusEvent(aEventMessage, aPresShell,
|
||||
aDocument, eventTarget));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
nsAccessibilityService* accService = GetAccService();
|
||||
if (accService) {
|
||||
if (aType == NS_FOCUS_CONTENT)
|
||||
if (aEventMessage == NS_FOCUS_CONTENT) {
|
||||
accService->NotifyOfDOMFocus(aTarget);
|
||||
else
|
||||
} else {
|
||||
accService->NotifyOfDOMBlur(aTarget);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dontDispatchEvent) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new FocusBlurEvent(aTarget, aType, aPresShell->GetPresContext(),
|
||||
new FocusBlurEvent(aTarget, aEventMessage, aPresShell->GetPresContext(),
|
||||
aWindowRaised, aIsRefocus));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,12 +280,12 @@ protected:
|
|||
/**
|
||||
* Fires a focus or blur event at aTarget.
|
||||
*
|
||||
* aType should be either NS_FOCUS_CONTENT or NS_BLUR_CONTENT. For blur
|
||||
* events, aFocusMethod should normally be non-zero.
|
||||
* aEventMessage should be either NS_FOCUS_CONTENT or NS_BLUR_CONTENT.
|
||||
* For blur events, aFocusMethod should normally be non-zero.
|
||||
*
|
||||
* aWindowRaised should only be true if called from WindowRaised.
|
||||
*/
|
||||
void SendFocusOrBlurEvent(uint32_t aType,
|
||||
void SendFocusOrBlurEvent(mozilla::EventMessage aEventMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIDocument* aDocument,
|
||||
nsISupports* aTarget,
|
||||
|
|
|
@ -3044,7 +3044,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
{
|
||||
NS_PRECONDITION(IsInnerWindow(), "PreHandleEvent is used on outer window!?");
|
||||
static uint32_t count = 0;
|
||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
|
||||
aVisitor.mCanHandle = true;
|
||||
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
|
||||
|
@ -14533,7 +14533,7 @@ nsGlobalWindow::GetIsPrerendered()
|
|||
|
||||
#ifdef MOZ_B2G
|
||||
void
|
||||
nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
||||
nsGlobalWindow::EnableNetworkEvent(EventMessage aEventMessage)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
|
@ -14558,7 +14558,7 @@ nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_NETWORK_UPLOAD_EVENT:
|
||||
if (!mNetworkUploadObserverEnabled) {
|
||||
mNetworkUploadObserverEnabled = true;
|
||||
|
@ -14571,11 +14571,13 @@ nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
|||
os->AddObserver(mObserver, NS_NETWORK_ACTIVITY_BLIP_DOWNLOAD_TOPIC, false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
||||
nsGlobalWindow::DisableNetworkEvent(EventMessage aEventMessage)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
|
@ -14584,7 +14586,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_NETWORK_UPLOAD_EVENT:
|
||||
if (mNetworkUploadObserverEnabled) {
|
||||
mNetworkUploadObserverEnabled = false;
|
||||
|
@ -14597,6 +14599,8 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
os->RemoveObserver(mObserver, NS_NETWORK_ACTIVITY_BLIP_DOWNLOAD_TOPIC);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // MOZ_B2G
|
||||
|
|
|
@ -677,8 +677,9 @@ public:
|
|||
|
||||
#ifdef MOZ_B2G
|
||||
// Inner windows only.
|
||||
virtual void EnableNetworkEvent(uint32_t aType) override;
|
||||
virtual void DisableNetworkEvent(uint32_t aType) override;
|
||||
virtual void EnableNetworkEvent(mozilla::EventMessage aEventMessage) override;
|
||||
virtual void DisableNetworkEvent(
|
||||
mozilla::EventMessage aEventMessage) override;
|
||||
#endif // MOZ_B2G
|
||||
|
||||
virtual nsresult SetArguments(nsIArray* aArguments) override;
|
||||
|
|
|
@ -520,13 +520,15 @@ nsClipboardCommand::DoCommand(const char *aCommandName, nsISupports *aContext)
|
|||
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
|
||||
int32_t eventType = NS_COPY;
|
||||
EventMessage eventMessage = NS_COPY;
|
||||
if (strcmp(aCommandName, "cmd_cut") == 0) {
|
||||
eventType = NS_CUT;
|
||||
eventMessage = NS_CUT;
|
||||
}
|
||||
|
||||
bool actionTaken = false;
|
||||
nsCopySupport::FireClipboardEvent(eventType, nsIClipboard::kGlobalClipboard, presShell, nullptr, &actionTaken);
|
||||
nsCopySupport::FireClipboardEvent(eventMessage,
|
||||
nsIClipboard::kGlobalClipboard,
|
||||
presShell, nullptr, &actionTaken);
|
||||
|
||||
if (!strcmp(aCommandName, "cmd_copyAndCollapseToEnd")) {
|
||||
dom::Selection *sel =
|
||||
|
|
|
@ -62,8 +62,8 @@ enum UIStateChangeType
|
|||
};
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x2aebbbd7, 0x154b, 0x4341, \
|
||||
{ 0x8d, 0x02, 0x7f, 0x70, 0xf8, 0x3e, 0xf7, 0xa1 } }
|
||||
{ 0x052e675a, 0xacd3, 0x48d1, \
|
||||
{ 0x8a, 0xcd, 0xbf, 0xff, 0xbd, 0x24, 0x4c, 0xed } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
|
@ -643,7 +643,7 @@ public:
|
|||
*
|
||||
* Inner windows only.
|
||||
*/
|
||||
virtual void EnableNetworkEvent(uint32_t aType) = 0;
|
||||
virtual void EnableNetworkEvent(mozilla::EventMessage aEventMessage) = 0;
|
||||
|
||||
/**
|
||||
* Tell the window that it should stop to listen to the network event of the
|
||||
|
@ -651,7 +651,7 @@ public:
|
|||
*
|
||||
* Inner windows only.
|
||||
*/
|
||||
virtual void DisableNetworkEvent(uint32_t aType) = 0;
|
||||
virtual void DisableNetworkEvent(mozilla::EventMessage aEventMessage) = 0;
|
||||
#endif // MOZ_B2G
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,10 +59,10 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
|||
nsContentUtils::GetContextForContent(cont);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
uint32_t type = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR;
|
||||
WidgetEvent event(true, type);
|
||||
EventMessage message = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR;
|
||||
WidgetEvent event(true, message);
|
||||
// Load event doesn't bubble.
|
||||
event.mFlags.mBubbles = (type != NS_LOAD);
|
||||
event.mFlags.mBubbles = (message != NS_LOAD);
|
||||
|
||||
EventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalAnimationEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalAnimationEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalAnimationEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -17,7 +17,8 @@ BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
|
|||
InternalBeforeAfterKeyboardEvent* aEvent)
|
||||
: KeyboardEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent :
|
||||
new InternalBeforeAfterKeyboardEvent(false, 0,
|
||||
new InternalBeforeAfterKeyboardEvent(false,
|
||||
NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
MOZ_ASSERT(mEvent->mClass == eBeforeAfterKeyboardEventClass,
|
||||
|
|
|
@ -16,7 +16,7 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalClipboardEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalClipboardEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalClipboardEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -15,7 +15,8 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetCompositionEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetCompositionEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetCompositionEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == eCompositionEventClass,
|
||||
"event type mismatch");
|
||||
|
|
|
@ -155,9 +155,9 @@ DataTransfer::Constructor(const GlobalObject& aGlobal,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t eventType = nsContentUtils::GetEventId(eventTypeAtom);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(eventTypeAtom);
|
||||
nsRefPtr<DataTransfer> transfer = new DataTransfer(aGlobal.GetAsSupports(),
|
||||
eventType, aIsExternal,
|
||||
eventMessage, aIsExternal,
|
||||
-1);
|
||||
return transfer.forget();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ DragEvent::DragEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetDragEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetDragEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -106,7 +106,7 @@ Event::ConstructorInit(EventTarget* aOwner,
|
|||
...
|
||||
}
|
||||
*/
|
||||
mEvent = new WidgetEvent(false, 0);
|
||||
mEvent = new WidgetEvent(false, NS_EVENT_NULL);
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
|
||||
|
@ -563,8 +563,8 @@ Event::SetEventType(const nsAString& aEventTypeArg)
|
|||
if (mIsMainThreadEvent) {
|
||||
mEvent->typeString.Truncate();
|
||||
mEvent->userType =
|
||||
nsContentUtils::GetEventIdAndAtom(aEventTypeArg, mEvent->mClass,
|
||||
&(mEvent->mMessage));
|
||||
nsContentUtils::GetEventMessageAndAtom(aEventTypeArg, mEvent->mClass,
|
||||
&(mEvent->mMessage));
|
||||
} else {
|
||||
mEvent->userType = nullptr;
|
||||
mEvent->mMessage = NS_USER_DEFINED_EVENT;
|
||||
|
@ -726,6 +726,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -740,6 +742,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -757,6 +761,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
case NS_XUL_COMMAND:
|
||||
abuse = openControlled;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -785,6 +791,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -801,6 +809,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -832,6 +842,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -851,6 +863,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
|||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1026,7 +1040,7 @@ Event::GetOffsetCoords(nsPresContext* aPresContext,
|
|||
// logic for handling user-defined events).
|
||||
// static
|
||||
const char*
|
||||
Event::GetEventName(uint32_t aEventType)
|
||||
Event::GetEventName(EventMessage aEventType)
|
||||
{
|
||||
switch(aEventType) {
|
||||
#define ID_TO_EVENT(name_, _id, _type, _struct) \
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
static void Shutdown();
|
||||
|
||||
static const char* GetEventName(uint32_t aEventType);
|
||||
static const char* GetEventName(EventMessage aEventType);
|
||||
static CSSIntPoint GetClientCoords(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
LayoutDeviceIntPoint aPoint,
|
||||
|
|
|
@ -52,11 +52,11 @@ namespace mozilla {
|
|||
using namespace dom;
|
||||
using namespace hal;
|
||||
|
||||
#define EVENT_TYPE_EQUALS(ls, type, userType, typeString, allEvents) \
|
||||
((ls->mEventType == type && \
|
||||
(ls->mEventType != NS_USER_DEFINED_EVENT || \
|
||||
(mIsMainThreadELM && ls->mTypeAtom == userType) || \
|
||||
(!mIsMainThreadELM && ls->mTypeString.Equals(typeString)))) || \
|
||||
#define EVENT_TYPE_EQUALS(ls, message, userType, typeString, allEvents) \
|
||||
((ls->mEventMessage == message && \
|
||||
(ls->mEventMessage != NS_USER_DEFINED_EVENT || \
|
||||
(mIsMainThreadELM && ls->mTypeAtom == userType) || \
|
||||
(!mIsMainThreadELM && ls->mTypeString.Equals(typeString)))) || \
|
||||
(allEvents && ls->mAllEvents))
|
||||
|
||||
static const uint32_t kAllMutationBits =
|
||||
|
@ -69,7 +69,7 @@ static const uint32_t kAllMutationBits =
|
|||
NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED;
|
||||
|
||||
static uint32_t
|
||||
MutationBitForEventType(uint32_t aEventType)
|
||||
MutationBitForEventType(EventMessage aEventType)
|
||||
{
|
||||
switch (aEventType) {
|
||||
case NS_MUTATION_SUBTREEMODIFIED:
|
||||
|
@ -94,8 +94,9 @@ MutationBitForEventType(uint32_t aEventType)
|
|||
|
||||
uint32_t EventListenerManager::sMainThreadCreatedCount = 0;
|
||||
|
||||
EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
: mMayHavePaintEventListener(false)
|
||||
EventListenerManagerBase::EventListenerManagerBase()
|
||||
: mNoListenerForEvent(NS_EVENT_NULL)
|
||||
, mMayHavePaintEventListener(false)
|
||||
, mMayHaveMutationListeners(false)
|
||||
, mMayHaveCapturingListeners(false)
|
||||
, mMayHaveSystemGroupListeners(false)
|
||||
|
@ -106,7 +107,13 @@ EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
|||
, mMayHaveInputOrCompositionEventListener(false)
|
||||
, mClearingListeners(false)
|
||||
, mIsMainThreadELM(NS_IsMainThread())
|
||||
, mNoListenerForEvent(0)
|
||||
{
|
||||
static_assert(sizeof(EventListenerManagerBase) == sizeof(uint32_t),
|
||||
"Keep the size of EventListenerManagerBase size compact!");
|
||||
}
|
||||
|
||||
EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
: EventListenerManagerBase()
|
||||
, mTarget(aTarget)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "unexpected null pointer");
|
||||
|
@ -215,15 +222,17 @@ EventListenerManager::GetTargetAsInnerWindow() const
|
|||
void
|
||||
EventListenerManager::AddEventListenerInternal(
|
||||
const EventListenerHolder& aListenerHolder,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler,
|
||||
bool aAllEvents)
|
||||
{
|
||||
MOZ_ASSERT((NS_IsMainThread() && aType && aTypeAtom) || // Main thread
|
||||
(!NS_IsMainThread() && aType && !aTypeString.IsEmpty()) || // non-main-thread
|
||||
MOZ_ASSERT(// Main thread
|
||||
(NS_IsMainThread() && aEventMessage && aTypeAtom) ||
|
||||
// non-main-thread
|
||||
(!NS_IsMainThread() && aEventMessage && !aTypeString.IsEmpty()) ||
|
||||
aAllEvents, "Missing type"); // all-events listener
|
||||
|
||||
if (!aListenerHolder || mClearingListeners) {
|
||||
|
@ -241,7 +250,7 @@ EventListenerManager::AddEventListenerInternal(
|
|||
// mListener == aListenerHolder is the last one, since it can be a bit slow.
|
||||
if (listener->mListenerIsHandler == aHandler &&
|
||||
listener->mFlags == aFlags &&
|
||||
EVENT_TYPE_EQUALS(listener, aType, aTypeAtom, aTypeString,
|
||||
EVENT_TYPE_EQUALS(listener, aEventMessage, aTypeAtom, aTypeString,
|
||||
aAllEvents) &&
|
||||
listener->mListener == aListenerHolder) {
|
||||
return;
|
||||
|
@ -254,8 +263,7 @@ EventListenerManager::AddEventListenerInternal(
|
|||
listener = aAllEvents ? mListeners.InsertElementAt(0) :
|
||||
mListeners.AppendElement();
|
||||
listener->mListener = aListenerHolder;
|
||||
MOZ_ASSERT(aType < PR_UINT16_MAX);
|
||||
listener->mEventType = aType;
|
||||
listener->mEventMessage = aEventMessage;
|
||||
listener->mTypeString = aTypeString;
|
||||
listener->mTypeAtom = aTypeAtom;
|
||||
listener->mFlags = aFlags;
|
||||
|
@ -284,13 +292,14 @@ EventListenerManager::AddEventListenerInternal(
|
|||
mMayHaveCapturingListeners = true;
|
||||
}
|
||||
|
||||
if (aType == NS_AFTERPAINT) {
|
||||
if (aEventMessage == NS_AFTERPAINT) {
|
||||
mMayHavePaintEventListener = true;
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window) {
|
||||
window->SetHasPaintEventListeners();
|
||||
}
|
||||
} else if (aType >= NS_MUTATION_START && aType <= NS_MUTATION_END) {
|
||||
} else if (aEventMessage >= NS_MUTATION_START &&
|
||||
aEventMessage <= NS_MUTATION_END) {
|
||||
// For mutation listeners, we need to update the global bit on the DOM window.
|
||||
// Otherwise we won't actually fire the mutation event.
|
||||
mMayHaveMutationListeners = true;
|
||||
|
@ -301,11 +310,11 @@ EventListenerManager::AddEventListenerInternal(
|
|||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eMutationEvent);
|
||||
}
|
||||
// If aType is NS_MUTATION_SUBTREEMODIFIED, we need to listen all
|
||||
// If aEventMessage is NS_MUTATION_SUBTREEMODIFIED, we need to listen all
|
||||
// mutations. nsContentUtils::HasMutationListeners relies on this.
|
||||
window->SetMutationListeners((aType == NS_MUTATION_SUBTREEMODIFIED) ?
|
||||
kAllMutationBits :
|
||||
MutationBitForEventType(aType));
|
||||
window->SetMutationListeners(
|
||||
(aEventMessage == NS_MUTATION_SUBTREEMODIFIED) ?
|
||||
kAllMutationBits : MutationBitForEventType(aEventMessage));
|
||||
}
|
||||
} else if (aTypeAtom == nsGkAtoms::ondeviceorientation) {
|
||||
EnableDevice(NS_DEVICE_ORIENTATION);
|
||||
|
@ -343,7 +352,8 @@ EventListenerManager::AddEventListenerInternal(
|
|||
if (window && !aFlags.mInSystemGroup) {
|
||||
window->SetHasTouchEventListeners();
|
||||
}
|
||||
} else if (aType >= NS_POINTER_EVENT_START && aType <= NS_POINTER_LOST_CAPTURE) {
|
||||
} else if (aEventMessage >= NS_POINTER_EVENT_START &&
|
||||
aEventMessage <= NS_POINTER_LOST_CAPTURE) {
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (aTypeAtom == nsGkAtoms::onpointerenter ||
|
||||
aTypeAtom == nsGkAtoms::onpointerleave) {
|
||||
|
@ -372,8 +382,8 @@ EventListenerManager::AddEventListenerInternal(
|
|||
window->SetHasMouseEnterLeaveEventListeners();
|
||||
}
|
||||
#ifdef MOZ_GAMEPAD
|
||||
} else if (aType >= NS_GAMEPAD_START &&
|
||||
aType <= NS_GAMEPAD_END) {
|
||||
} else if (aEventMessage >= NS_GAMEPAD_START &&
|
||||
aEventMessage <= NS_GAMEPAD_END) {
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window) {
|
||||
window->SetHasGamepadEventListener();
|
||||
|
@ -405,9 +415,9 @@ EventListenerManager::AddEventListenerInternal(
|
|||
}
|
||||
|
||||
bool
|
||||
EventListenerManager::IsDeviceType(uint32_t aType)
|
||||
EventListenerManager::IsDeviceType(EventMessage aEventMessage)
|
||||
{
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
case NS_DEVICE_MOTION:
|
||||
case NS_DEVICE_LIGHT:
|
||||
|
@ -421,14 +431,14 @@ EventListenerManager::IsDeviceType(uint32_t aType)
|
|||
}
|
||||
|
||||
void
|
||||
EventListenerManager::EnableDevice(uint32_t aType)
|
||||
EventListenerManager::EnableDevice(EventMessage aEventMessage)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
window->EnableDeviceSensor(SENSOR_ORIENTATION);
|
||||
break;
|
||||
|
@ -451,14 +461,14 @@ EventListenerManager::EnableDevice(uint32_t aType)
|
|||
}
|
||||
|
||||
void
|
||||
EventListenerManager::DisableDevice(uint32_t aType)
|
||||
EventListenerManager::DisableDevice(EventMessage aEventMessage)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
window->DisableDeviceSensor(SENSOR_ORIENTATION);
|
||||
break;
|
||||
|
@ -483,13 +493,13 @@ EventListenerManager::DisableDevice(uint32_t aType)
|
|||
void
|
||||
EventListenerManager::RemoveEventListenerInternal(
|
||||
const EventListenerHolder& aListenerHolder,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aAllEvents)
|
||||
{
|
||||
if (!aListenerHolder || !aType || mClearingListeners) {
|
||||
if (!aListenerHolder || !aEventMessage || mClearingListeners) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -497,16 +507,16 @@ EventListenerManager::RemoveEventListenerInternal(
|
|||
|
||||
uint32_t count = mListeners.Length();
|
||||
uint32_t typeCount = 0;
|
||||
bool deviceType = IsDeviceType(aType);
|
||||
bool deviceType = IsDeviceType(aEventMessage);
|
||||
#ifdef MOZ_B2G
|
||||
bool timeChangeEvent = (aType == NS_MOZ_TIME_CHANGE_EVENT);
|
||||
bool networkEvent = (aType == NS_NETWORK_UPLOAD_EVENT ||
|
||||
aType == NS_NETWORK_DOWNLOAD_EVENT);
|
||||
bool timeChangeEvent = (aEventMessage == NS_MOZ_TIME_CHANGE_EVENT);
|
||||
bool networkEvent = (aEventMessage == NS_NETWORK_UPLOAD_EVENT ||
|
||||
aEventMessage == NS_NETWORK_DOWNLOAD_EVENT);
|
||||
#endif // MOZ_B2G
|
||||
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
listener = &mListeners.ElementAt(i);
|
||||
if (EVENT_TYPE_EQUALS(listener, aType, aUserType, aTypeString,
|
||||
if (EVENT_TYPE_EQUALS(listener, aEventMessage, aUserType, aTypeString,
|
||||
aAllEvents)) {
|
||||
++typeCount;
|
||||
if (listener->mListener == aListenerHolder &&
|
||||
|
@ -537,7 +547,7 @@ EventListenerManager::RemoveEventListenerInternal(
|
|||
}
|
||||
|
||||
if (!aAllEvents && deviceType && typeCount == 0) {
|
||||
DisableDevice(aType);
|
||||
DisableDevice(aEventMessage);
|
||||
#ifdef MOZ_B2G
|
||||
} else if (timeChangeEvent && typeCount == 0) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
|
@ -547,7 +557,7 @@ EventListenerManager::RemoveEventListenerInternal(
|
|||
} else if (!aAllEvents && networkEvent && typeCount == 0) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (window) {
|
||||
window->DisableNetworkEvent(aType);
|
||||
window->DisableNetworkEvent(aEventMessage);
|
||||
}
|
||||
#endif // MOZ_B2G
|
||||
}
|
||||
|
@ -559,7 +569,7 @@ EventListenerManager::ListenerCanHandle(Listener* aListener,
|
|||
{
|
||||
// This is slightly different from EVENT_TYPE_EQUALS in that it returns
|
||||
// true even when aEvent->mMessage == NS_USER_DEFINED_EVENT and
|
||||
// aListener=>mEventType != NS_USER_DEFINED_EVENT as long as the atoms are
|
||||
// aListener=>mEventMessage != NS_USER_DEFINED_EVENT as long as the atoms are
|
||||
// the same
|
||||
if (aListener->mAllEvents) {
|
||||
return true;
|
||||
|
@ -571,7 +581,7 @@ EventListenerManager::ListenerCanHandle(Listener* aListener,
|
|||
return aListener->mTypeString.Equals(aEvent->typeString);
|
||||
}
|
||||
MOZ_ASSERT(mIsMainThreadELM);
|
||||
return aListener->mEventType == aEvent->mMessage;
|
||||
return aListener->mEventMessage == aEvent->mMessage;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -582,8 +592,8 @@ EventListenerManager::AddEventListenerByType(
|
|||
{
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
|
||||
uint32_t type = nsContentUtils::GetEventId(atom);
|
||||
AddEventListenerInternal(aListenerHolder, type, atom, aType, aFlags);
|
||||
EventMessage message = nsContentUtils::GetEventMessage(atom);
|
||||
AddEventListenerInternal(aListenerHolder, message, atom, aType, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -594,12 +604,12 @@ EventListenerManager::RemoveEventListenerByType(
|
|||
{
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
|
||||
uint32_t type = nsContentUtils::GetEventId(atom);
|
||||
RemoveEventListenerInternal(aListenerHolder, type, atom, aType, aFlags);
|
||||
EventMessage message = nsContentUtils::GetEventMessage(atom);
|
||||
RemoveEventListenerInternal(aListenerHolder, message, atom, aType, aFlags);
|
||||
}
|
||||
|
||||
EventListenerManager::Listener*
|
||||
EventListenerManager::FindEventHandler(uint32_t aEventType,
|
||||
EventListenerManager::FindEventHandler(EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
|
@ -610,7 +620,7 @@ EventListenerManager::FindEventHandler(uint32_t aEventType,
|
|||
for (uint32_t i = 0; i < count; ++i) {
|
||||
listener = &mListeners.ElementAt(i);
|
||||
if (listener->mListenerIsHandler &&
|
||||
EVENT_TYPE_EQUALS(listener, aEventType, aTypeAtom, aTypeString,
|
||||
EVENT_TYPE_EQUALS(listener, aEventMessage, aTypeAtom, aTypeString,
|
||||
false)) {
|
||||
return listener;
|
||||
}
|
||||
|
@ -627,8 +637,8 @@ EventListenerManager::SetEventHandlerInternal(
|
|||
{
|
||||
MOZ_ASSERT(aName || !aTypeString.IsEmpty());
|
||||
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aName);
|
||||
Listener* listener = FindEventHandler(eventType, aName, aTypeString);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(aName);
|
||||
Listener* listener = FindEventHandler(eventMessage, aName, aTypeString);
|
||||
|
||||
if (!listener) {
|
||||
// If we didn't find a script listener or no listeners existed
|
||||
|
@ -640,10 +650,10 @@ EventListenerManager::SetEventHandlerInternal(
|
|||
NS_NewJSEventHandler(mTarget, aName,
|
||||
aTypedHandler, getter_AddRefs(jsEventHandler));
|
||||
EventListenerHolder listenerHolder(jsEventHandler);
|
||||
AddEventListenerInternal(listenerHolder, eventType, aName, aTypeString,
|
||||
AddEventListenerInternal(listenerHolder, eventMessage, aName, aTypeString,
|
||||
flags, true);
|
||||
|
||||
listener = FindEventHandler(eventType, aName, aTypeString);
|
||||
listener = FindEventHandler(eventMessage, aName, aTypeString);
|
||||
} else {
|
||||
JSEventHandler* jsEventHandler = listener->GetJSEventHandler();
|
||||
MOZ_ASSERT(jsEventHandler,
|
||||
|
@ -776,8 +786,8 @@ EventListenerManager::RemoveEventHandler(nsIAtom* aName,
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aName);
|
||||
Listener* listener = FindEventHandler(eventType, aName, aTypeString);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(aName);
|
||||
Listener* listener = FindEventHandler(eventMessage, aName, aTypeString);
|
||||
|
||||
if (listener) {
|
||||
mListeners.RemoveElementAt(uint32_t(listener - &mListeners.ElementAt(0)));
|
||||
|
@ -1239,8 +1249,8 @@ EventListenerManager::HasMutationListeners()
|
|||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventType >= NS_MUTATION_START &&
|
||||
listener->mEventType <= NS_MUTATION_END) {
|
||||
if (listener->mEventMessage >= NS_MUTATION_START &&
|
||||
listener->mEventMessage <= NS_MUTATION_END) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1257,12 +1267,12 @@ EventListenerManager::MutationListenerBits()
|
|||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventType >= NS_MUTATION_START &&
|
||||
listener->mEventType <= NS_MUTATION_END) {
|
||||
if (listener->mEventType == NS_MUTATION_SUBTREEMODIFIED) {
|
||||
if (listener->mEventMessage >= NS_MUTATION_START &&
|
||||
listener->mEventMessage <= NS_MUTATION_END) {
|
||||
if (listener->mEventMessage == NS_MUTATION_SUBTREEMODIFIED) {
|
||||
return kAllMutationBits;
|
||||
}
|
||||
bits |= MutationBitForEventType(listener->mEventType);
|
||||
bits |= MutationBitForEventType(listener->mEventMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1352,8 +1362,8 @@ EventListenerManager::HasUnloadListeners()
|
|||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventType == NS_PAGE_UNLOAD ||
|
||||
listener->mEventType == NS_BEFORE_PAGE_UNLOAD) {
|
||||
if (listener->mEventMessage == NS_PAGE_UNLOAD ||
|
||||
listener->mEventMessage == NS_BEFORE_PAGE_UNLOAD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1424,8 +1434,8 @@ const TypedEventHandler*
|
|||
EventListenerManager::GetTypedEventHandler(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aEventName);
|
||||
Listener* listener = FindEventHandler(eventType, aEventName, aTypeString);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(aEventName);
|
||||
Listener* listener = FindEventHandler(eventMessage, aEventName, aTypeString);
|
||||
|
||||
if (!listener) {
|
||||
return nullptr;
|
||||
|
|
|
@ -146,11 +146,31 @@ inline EventListenerFlags AllEventsAtSystemGroupCapture()
|
|||
return flags;
|
||||
}
|
||||
|
||||
class EventListenerManagerBase
|
||||
{
|
||||
protected:
|
||||
EventListenerManagerBase();
|
||||
|
||||
EventMessage mNoListenerForEvent;
|
||||
uint16_t mMayHavePaintEventListener : 1;
|
||||
uint16_t mMayHaveMutationListeners : 1;
|
||||
uint16_t mMayHaveCapturingListeners : 1;
|
||||
uint16_t mMayHaveSystemGroupListeners : 1;
|
||||
uint16_t mMayHaveTouchEventListener : 1;
|
||||
uint16_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint16_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint16_t mMayHaveKeyEventListener : 1;
|
||||
uint16_t mMayHaveInputOrCompositionEventListener : 1;
|
||||
uint16_t mClearingListeners : 1;
|
||||
uint16_t mIsMainThreadELM : 1;
|
||||
// uint16_t mUnused : 5;
|
||||
};
|
||||
|
||||
/*
|
||||
* Event listener manager
|
||||
*/
|
||||
|
||||
class EventListenerManager final
|
||||
class EventListenerManager final : public EventListenerManagerBase
|
||||
{
|
||||
~EventListenerManager();
|
||||
|
||||
|
@ -160,7 +180,7 @@ public:
|
|||
EventListenerHolder mListener;
|
||||
nsCOMPtr<nsIAtom> mTypeAtom; // for the main thread
|
||||
nsString mTypeString; // for non-main-threads
|
||||
uint16_t mEventType;
|
||||
EventMessage mEventMessage;
|
||||
|
||||
enum ListenerType : uint8_t
|
||||
{
|
||||
|
@ -449,7 +469,7 @@ protected:
|
|||
/**
|
||||
* Find the Listener for the "inline" event listener for aTypeAtom.
|
||||
*/
|
||||
Listener* FindEventHandler(uint32_t aEventType,
|
||||
Listener* FindEventHandler(EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString);
|
||||
|
||||
|
@ -465,9 +485,9 @@ protected:
|
|||
const TypedEventHandler& aHandler,
|
||||
bool aPermitUntrustedEvents);
|
||||
|
||||
bool IsDeviceType(uint32_t aType);
|
||||
void EnableDevice(uint32_t aType);
|
||||
void DisableDevice(uint32_t aType);
|
||||
bool IsDeviceType(EventMessage aEventMessage);
|
||||
void EnableDevice(EventMessage aEventMessage);
|
||||
void DisableDevice(EventMessage aEventMessage);
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -529,14 +549,14 @@ protected:
|
|||
bool aUseCapture);
|
||||
|
||||
void AddEventListenerInternal(const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler = false,
|
||||
bool aAllEvents = false);
|
||||
void RemoveEventListenerInternal(const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
|
@ -549,22 +569,14 @@ protected:
|
|||
|
||||
bool ListenerCanHandle(Listener* aListener, WidgetEvent* aEvent);
|
||||
|
||||
// BE AWARE, a lot of instances of EventListenerManager will be created.
|
||||
// Therefor, we need to keep this class compact. When you add integer
|
||||
// members, please add them to EventListemerManagerBase and check the size
|
||||
// at build time.
|
||||
|
||||
already_AddRefed<nsIScriptGlobalObject>
|
||||
GetScriptGlobalAndDocument(nsIDocument** aDoc);
|
||||
|
||||
uint32_t mMayHavePaintEventListener : 1;
|
||||
uint32_t mMayHaveMutationListeners : 1;
|
||||
uint32_t mMayHaveCapturingListeners : 1;
|
||||
uint32_t mMayHaveSystemGroupListeners : 1;
|
||||
uint32_t mMayHaveTouchEventListener : 1;
|
||||
uint32_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHaveKeyEventListener : 1;
|
||||
uint32_t mMayHaveInputOrCompositionEventListener : 1;
|
||||
uint32_t mClearingListeners : 1;
|
||||
uint32_t mIsMainThreadELM : 1;
|
||||
uint32_t mNoListenerForEvent : 21;
|
||||
|
||||
nsAutoTObserverArray<Listener, 2> mListeners;
|
||||
dom::EventTarget* MOZ_NON_OWNING_REF mTarget;
|
||||
nsCOMPtr<nsIAtom> mNoListenerForEventAtom;
|
||||
|
|
|
@ -625,7 +625,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->mMessage = 0;
|
||||
aEvent->mMessage = NS_EVENT_NULL;
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_MOVE:
|
||||
|
@ -836,6 +836,8 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
compositionEvent->mData = selectedText.mReply.mString;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1194,6 +1196,8 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
|
|||
case NS_DRAGDROP_EXIT:
|
||||
case NS_DRAGDROP_DROP:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
|
@ -3332,6 +3336,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Reset target frame to null to avoid mistargeting after reentrant event
|
||||
|
@ -3685,7 +3692,7 @@ EventStateManager::IsHandlingUserInput()
|
|||
|
||||
static void
|
||||
CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aRelatedContent,
|
||||
nsAutoPtr<WidgetMouseEvent>& aNewEvent)
|
||||
{
|
||||
|
@ -3725,7 +3732,7 @@ CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
|
|||
|
||||
nsIFrame*
|
||||
EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent)
|
||||
{
|
||||
|
@ -3814,10 +3821,11 @@ class EnterLeaveDispatcher
|
|||
public:
|
||||
EnterLeaveDispatcher(EventStateManager* aESM,
|
||||
nsIContent* aTarget, nsIContent* aRelatedTarget,
|
||||
WidgetMouseEvent* aMouseEvent, uint32_t aType)
|
||||
WidgetMouseEvent* aMouseEvent,
|
||||
EventMessage aEventMessage)
|
||||
: mESM(aESM)
|
||||
, mMouseEvent(aMouseEvent)
|
||||
, mType(aType)
|
||||
, mEventMessage(aEventMessage)
|
||||
{
|
||||
nsPIDOMWindow* win =
|
||||
aTarget ? aTarget->OwnerDoc()->GetInnerWindow() : nullptr;
|
||||
|
@ -3844,16 +3852,16 @@ public:
|
|||
|
||||
~EnterLeaveDispatcher()
|
||||
{
|
||||
if (mType == NS_MOUSEENTER ||
|
||||
mType == NS_POINTER_ENTER) {
|
||||
if (mEventMessage == NS_MOUSEENTER ||
|
||||
mEventMessage == NS_POINTER_ENTER) {
|
||||
for (int32_t i = mTargets.Count() - 1; i >= 0; --i) {
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mType, mTargets[i],
|
||||
mRelatedTarget);
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mEventMessage,
|
||||
mTargets[i], mRelatedTarget);
|
||||
}
|
||||
} else {
|
||||
for (int32_t i = 0; i < mTargets.Count(); ++i) {
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mType, mTargets[i],
|
||||
mRelatedTarget);
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mEventMessage,
|
||||
mTargets[i], mRelatedTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3862,7 +3870,7 @@ public:
|
|||
nsCOMArray<nsIContent> mTargets;
|
||||
nsCOMPtr<nsIContent> mRelatedTarget;
|
||||
WidgetMouseEvent* mMouseEvent;
|
||||
uint32_t mType;
|
||||
EventMessage mEventMessage;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -4055,7 +4063,8 @@ GetWindowInnerRectCenter(nsPIDOMWindow* aWindow,
|
|||
}
|
||||
|
||||
void
|
||||
EventStateManager::GeneratePointerEnterExit(uint32_t aMessage, WidgetMouseEvent* aEvent)
|
||||
EventStateManager::GeneratePointerEnterExit(EventMessage aMessage,
|
||||
WidgetMouseEvent* aEvent)
|
||||
{
|
||||
WidgetPointerEvent pointerEvent(*aEvent);
|
||||
pointerEvent.mMessage = aMessage;
|
||||
|
@ -4178,6 +4187,8 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
|||
NotifyMouseOut(aMouseEvent, nullptr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// reset mCurretTargetContent to what it was
|
||||
|
@ -4324,6 +4335,9 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//reset mCurretTargetContent to what it was
|
||||
|
@ -4336,13 +4350,13 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
|||
void
|
||||
EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aDragEvent,
|
||||
uint32_t aMsg,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aRelatedTarget,
|
||||
nsIContent* aTargetContent,
|
||||
nsWeakFrame& aTargetFrame)
|
||||
{
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetDragEvent event(aDragEvent->mFlags.mIsTrusted, aMsg,
|
||||
WidgetDragEvent event(aDragEvent->mFlags.mIsTrusted, aMessage,
|
||||
aDragEvent->widget);
|
||||
event.refPoint = aDragEvent->refPoint;
|
||||
event.modifiers = aDragEvent->modifiers;
|
||||
|
@ -4360,15 +4374,19 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// adjust the drag hover if the dragenter event was cancelled or this is a drag exit
|
||||
if (status == nsEventStatus_eConsumeNoDefault || aMsg == NS_DRAGDROP_EXIT)
|
||||
SetContentState((aMsg == NS_DRAGDROP_ENTER) ? aTargetContent : nullptr,
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
aMessage == NS_DRAGDROP_EXIT) {
|
||||
SetContentState((aMessage == NS_DRAGDROP_ENTER) ?
|
||||
aTargetContent : nullptr,
|
||||
NS_EVENT_STATE_DRAGOVER);
|
||||
}
|
||||
|
||||
// collect any changes to moz cursor settings stored in the event's
|
||||
// data transfer.
|
||||
if (aMsg == NS_DRAGDROP_LEAVE || aMsg == NS_DRAGDROP_EXIT ||
|
||||
aMsg == NS_DRAGDROP_ENTER)
|
||||
if (aMessage == NS_DRAGDROP_LEAVE || aMessage == NS_DRAGDROP_EXIT ||
|
||||
aMessage == NS_DRAGDROP_ENTER) {
|
||||
UpdateDragDataTransfer(&event);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally dispatch the event to the frame
|
||||
|
|
|
@ -303,13 +303,14 @@ protected:
|
|||
* if it goes away during the event).
|
||||
*/
|
||||
nsIFrame* DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent);
|
||||
/**
|
||||
* Synthesize DOM pointerover and pointerout events
|
||||
*/
|
||||
void GeneratePointerEnterExit(uint32_t aMessage, WidgetMouseEvent* aEvent);
|
||||
void GeneratePointerEnterExit(EventMessage aMessage,
|
||||
WidgetMouseEvent* aEvent);
|
||||
/**
|
||||
* Synthesize DOM and frame mouseover and mouseout events from this
|
||||
* MOUSE_MOVE or MOUSE_EXIT event.
|
||||
|
@ -351,7 +352,7 @@ protected:
|
|||
*/
|
||||
void FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aDragEvent,
|
||||
uint32_t aMsg,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aRelatedTarget,
|
||||
nsIContent* aTargetContent,
|
||||
nsWeakFrame& aTargetFrame);
|
||||
|
|
|
@ -134,7 +134,7 @@ GetIMEStateSetOpenName(IMEState::Open aOpen)
|
|||
}
|
||||
|
||||
static const char*
|
||||
GetEventMessageName(uint32_t aMessage)
|
||||
GetEventMessageName(EventMessage aMessage)
|
||||
{
|
||||
switch (aMessage) {
|
||||
case NS_COMPOSITION_START:
|
||||
|
|
|
@ -15,7 +15,9 @@ InputEvent::InputEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalEditorInputEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalEditorInputEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new InternalEditorInputEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == eEditorInputEventClass,
|
||||
"event type mismatch");
|
||||
|
|
|
@ -19,7 +19,7 @@ class InternalMutationEvent : public WidgetEvent
|
|||
public:
|
||||
virtual InternalMutationEvent* AsMutationEvent() override { return this; }
|
||||
|
||||
InternalMutationEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalMutationEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eMutationEventClass)
|
||||
, mAttrChange(0)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,8 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetKeyboardEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetKeyboardEvent(false, NS_EVENT_NULL, nullptr))
|
||||
, mInitializedByCtor(false)
|
||||
, mInitializedWhichValue(0)
|
||||
{
|
||||
|
@ -161,6 +162,8 @@ KeyboardEvent::CharCode()
|
|||
return 0;
|
||||
case NS_KEY_PRESS:
|
||||
return mEvent->AsKeyboardEvent()->charCode;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -213,6 +216,8 @@ KeyboardEvent::Which()
|
|||
}
|
||||
return CharCode();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -17,8 +17,9 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetMouseEventBase* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetMouseEvent(false, 0, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
aEvent ? aEvent :
|
||||
new WidgetMouseEvent(false, NS_EVENT_NULL, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
{
|
||||
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
|
||||
// It's not that important, though, since a scroll event is not a real
|
||||
|
|
|
@ -15,7 +15,9 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetMouseScrollEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetMouseScrollEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetMouseScrollEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -17,7 +17,7 @@ MutationEvent::MutationEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalMutationEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalMutationEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalMutationEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
mEventIsInternal = (aEvent == nullptr);
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ namespace dom {
|
|||
NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
: Event(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
if (mEvent) {
|
||||
mEvent->mMessage = aEventType;
|
||||
mEvent->mMessage = aEventMessage;
|
||||
}
|
||||
if (aInvalidateRequests) {
|
||||
mInvalidateRequests.AppendElements(Move(aInvalidateRequests->mRequests));
|
||||
|
@ -166,11 +166,11 @@ already_AddRefed<NotifyPaintEvent>
|
|||
NS_NewDOMNotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
{
|
||||
nsRefPtr<NotifyPaintEvent> it =
|
||||
new NotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType,
|
||||
new NotifyPaintEvent(aOwner, aPresContext, aEvent, aEventMessage,
|
||||
aInvalidateRequests);
|
||||
return it.forget();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
NotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -72,7 +72,9 @@ already_AddRefed<mozilla::dom::NotifyPaintEvent>
|
|||
NS_NewDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
uint32_t aEventType = 0,
|
||||
nsInvalidateRequestList* aInvalidateRequests = nullptr);
|
||||
mozilla::EventMessage aEventMessage =
|
||||
mozilla::NS_EVENT_NULL,
|
||||
nsInvalidateRequestList* aInvalidateRequests =
|
||||
nullptr);
|
||||
|
||||
#endif // mozilla_dom_NotifyPaintEvent_h_
|
||||
|
|
|
@ -17,7 +17,8 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetPointerEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetPointerEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == ePointerEventClass,
|
||||
"event type mismatch ePointerEventClass");
|
||||
|
|
|
@ -16,7 +16,8 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
|
|||
WidgetSimpleGestureEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent :
|
||||
new WidgetSimpleGestureEvent(false, 0, nullptr))
|
||||
new WidgetSimpleGestureEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == eSimpleGestureEventClass,
|
||||
"event type mismatch");
|
||||
|
|
|
@ -100,7 +100,7 @@ TextComposition::MaybeDispatchCompositionUpdate(
|
|||
BaseEventFlags
|
||||
TextComposition::CloneAndDispatchAs(
|
||||
const WidgetCompositionEvent* aCompositionEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsEventStatus* aStatus,
|
||||
EventDispatchingCallback* aCallBack)
|
||||
{
|
||||
|
@ -437,7 +437,7 @@ TextComposition::NotityUpdateComposition(
|
|||
}
|
||||
|
||||
void
|
||||
TextComposition::DispatchCompositionEventRunnable(uint32_t aEventMessage,
|
||||
TextComposition::DispatchCompositionEventRunnable(EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizingCommit)
|
||||
{
|
||||
|
@ -585,13 +585,13 @@ TextComposition::HasEditor() const
|
|||
TextComposition::CompositionEventDispatcher::CompositionEventDispatcher(
|
||||
TextComposition* aComposition,
|
||||
nsINode* aEventTarget,
|
||||
uint32_t aEventMessage,
|
||||
EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizedEvent)
|
||||
: mTextComposition(aComposition)
|
||||
, mEventTarget(aEventTarget)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mData(aData)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mIsSynthesizedEvent(aIsSynthesizedEvent)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ private:
|
|||
*/
|
||||
BaseEventFlags CloneAndDispatchAs(
|
||||
const WidgetCompositionEvent* aCompositionEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsEventStatus* aStatus = nullptr,
|
||||
EventDispatchingCallback* aCallBack = nullptr);
|
||||
|
||||
|
@ -353,7 +353,7 @@ private:
|
|||
public:
|
||||
CompositionEventDispatcher(TextComposition* aTextComposition,
|
||||
nsINode* aEventTarget,
|
||||
uint32_t aEventMessage,
|
||||
EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizedEvent = false);
|
||||
NS_IMETHOD Run() override;
|
||||
|
@ -361,8 +361,8 @@ private:
|
|||
private:
|
||||
nsRefPtr<TextComposition> mTextComposition;
|
||||
nsCOMPtr<nsINode> mEventTarget;
|
||||
uint32_t mEventMessage;
|
||||
nsString mData;
|
||||
EventMessage mEventMessage;
|
||||
bool mIsSynthesizedEvent;
|
||||
|
||||
CompositionEventDispatcher() {};
|
||||
|
@ -381,7 +381,7 @@ private:
|
|||
* commit or cancel composition. Otherwise,
|
||||
* false.
|
||||
*/
|
||||
void DispatchCompositionEventRunnable(uint32_t aEventMessage,
|
||||
void DispatchCompositionEventRunnable(EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizingCommit = false);
|
||||
};
|
||||
|
|
|
@ -63,7 +63,8 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetTouchEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -15,7 +15,7 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalTransitionEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalTransitionEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalTransitionEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -29,7 +29,7 @@ UIEvent::UIEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalUIEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent : new InternalUIEvent(false, NS_EVENT_NULL, nullptr))
|
||||
, mClientPoint(0, 0)
|
||||
, mLayerPoint(0, 0)
|
||||
, mPagePoint(0, 0)
|
||||
|
|
|
@ -16,7 +16,8 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
|
|||
WidgetWheelEvent* aWheelEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aWheelEvent ? aWheelEvent :
|
||||
new WidgetWheelEvent(false, 0, nullptr))
|
||||
new WidgetWheelEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
, mAppUnitsPerDevPixel(0)
|
||||
{
|
||||
if (aWheelEvent) {
|
||||
|
|
|
@ -218,6 +218,8 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
|||
case NS_DRAGDROP_DROP:
|
||||
EndTransaction();
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetInputEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
|
|
@ -200,7 +200,7 @@ HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLButtonElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
HTMLButtonElement::IsDisabledForEvents(EventMessage aMessage)
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
||||
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
|
||||
NS_IMETHOD SaveState() override;
|
||||
bool RestoreState(nsPresState* aState) override;
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage) override;
|
||||
virtual bool IsDisabledForEvents(EventMessage aMessage) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ NS_IMPL_STRING_ATTR(HTMLFieldSetElement, Name, name)
|
|||
NS_IMPL_NSICONSTRAINTVALIDATION(HTMLFieldSetElement)
|
||||
|
||||
bool
|
||||
HTMLFieldSetElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
HTMLFieldSetElement::IsDisabledForEvents(EventMessage aMessage)
|
||||
{
|
||||
return IsElementDisabledForEvents(aMessage, nullptr);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_FIELDSET; }
|
||||
NS_IMETHOD Reset() override;
|
||||
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage) override;
|
||||
virtual bool IsDisabledForEvents(EventMessage aMessage) override;
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
||||
|
||||
const nsIContent* GetFirstLegend() const { return mFirstLegend; }
|
||||
|
|
|
@ -535,7 +535,7 @@ nsresult
|
|||
HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == NS_FORM_SUBMIT) {
|
||||
// let the form know not to defer subsequent submissions
|
||||
mDeferSubmission = false;
|
||||
|
@ -555,8 +555,10 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
mPendingSubmission = nullptr;
|
||||
}
|
||||
DoSubmitOrReset(aVisitor.mEvent, msg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (msg == NS_FORM_SUBMIT) {
|
||||
|
|
|
@ -3040,7 +3040,7 @@ HTMLInputElement::NeedToInitializeEditorForEvent(
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLInputElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
HTMLInputElement::IsDisabledForEvents(EventMessage aMessage)
|
||||
{
|
||||
return IsElementDisabledForEvents(aMessage, GetPrimaryFrame());
|
||||
}
|
||||
|
@ -3662,6 +3662,8 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
mForm->OnSubmitClickEnd();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4156,6 +4158,9 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
|
|||
CancelRangeThumbDrag();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
NS_IMETHOD SaveState() override;
|
||||
virtual bool RestoreState(nsPresState* aState) override;
|
||||
virtual bool AllowDrop() override;
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage) override;
|
||||
virtual bool IsDisabledForEvents(EventMessage aMessage) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
|
|
|
@ -197,6 +197,9 @@ HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
mouseEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mHandlingEvent = false;
|
||||
}
|
||||
|
|
|
@ -224,6 +224,8 @@ HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement,
|
|||
OnFocusBlurPlugin(aElement, false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1487,7 +1487,7 @@ HTMLSelectElement::GetAttributeMappingFunction() const
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLSelectElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
HTMLSelectElement::IsDisabledForEvents(EventMessage aMessage)
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
||||
nsIFrame* formFrame = nullptr;
|
||||
|
|
|
@ -291,7 +291,7 @@ public:
|
|||
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
|
||||
NS_IMETHOD SaveState() override;
|
||||
virtual bool RestoreState(nsPresState* aState) override;
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage) override;
|
||||
virtual bool IsDisabledForEvents(EventMessage aMessage) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ HTMLTextAreaElement::GetAttributeMappingFunction() const
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
HTMLTextAreaElement::IsDisabledForEvents(EventMessage aMessage)
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
||||
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
|
||||
NS_IMETHOD SaveState() override;
|
||||
virtual bool RestoreState(nsPresState* aState) override;
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage) override;
|
||||
virtual bool IsDisabledForEvents(EventMessage aMessage) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
|
|
|
@ -2269,6 +2269,8 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
formControlFrame->SetFocus(false, false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2454,8 +2456,8 @@ nsGenericHTMLFormElement::FormIdUpdated(Element* aOldElement,
|
|||
}
|
||||
|
||||
bool
|
||||
nsGenericHTMLFormElement::IsElementDisabledForEvents(uint32_t aMessage,
|
||||
nsIFrame* aFrame)
|
||||
nsGenericHTMLFormElement::IsElementDisabledForEvents(EventMessage aMessage,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
bool disabled = IsDisabled();
|
||||
if (!disabled && aFrame) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define nsGenericHTMLElement_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsMappedAttributeElement.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsNameSpaceManager.h" // for kNameSpaceID_None
|
||||
|
@ -1408,7 +1409,8 @@ protected:
|
|||
void* aData);
|
||||
|
||||
// Returns true if the event should not be handled from PreHandleEvent
|
||||
bool IsElementDisabledForEvents(uint32_t aMessage, nsIFrame* aFrame);
|
||||
bool IsElementDisabledForEvents(mozilla::EventMessage aMessage,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
// The focusability state of this form control. eUnfocusable means that it
|
||||
// shouldn't be focused at all, eInactiveWindow means it's in an inactive
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#ifndef nsIFormControl_h___
|
||||
#define nsIFormControl_h___
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIDOMHTMLFormElement;
|
||||
class nsPresState;
|
||||
class nsFormSubmission;
|
||||
|
@ -195,7 +197,7 @@ public:
|
|||
*/
|
||||
inline bool AllowDraggableChildren() const;
|
||||
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage)
|
||||
virtual bool IsDisabledForEvents(mozilla::EventMessage aMessage)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1091,8 +1091,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
in long aY,
|
||||
[optional] in unsigned long aAdditionalFlags);
|
||||
|
||||
// NOTE: following values are same as NS_QUERY_* in BasicEvents.h
|
||||
|
||||
/**
|
||||
* QUERY_SELECTED_TEXT queries the first selection range's information.
|
||||
*
|
||||
|
|
|
@ -65,6 +65,7 @@ using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
|
|||
using nsIWidget::TouchPointerState from "nsIWidget.h";
|
||||
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
||||
using struct mozilla::OwningSerializedStructuredCloneBuffer from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::EventMessage from "mozilla/EventForwards.h";
|
||||
using nsEventStatus from "mozilla/EventForwards.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -276,7 +277,7 @@ parent:
|
|||
*
|
||||
* message The message value of the handled event.
|
||||
*/
|
||||
prio(urgent) async OnEventNeedingAckHandled(uint32_t message);
|
||||
prio(urgent) async OnEventNeedingAckHandled(EventMessage message);
|
||||
|
||||
/**
|
||||
* Tells chrome to start plugin IME. If this results in a string getting
|
||||
|
|
|
@ -2110,7 +2110,7 @@ TabParent::RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
|
|||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvOnEventNeedingAckHandled(const uint32_t& aMessage)
|
||||
TabParent::RecvOnEventNeedingAckHandled(const EventMessage& aMessage)
|
||||
{
|
||||
// This is called when the child process receives WidgetCompositionEvent or
|
||||
// WidgetSelectionEvent.
|
||||
|
@ -2891,8 +2891,8 @@ TabParent::InjectTouchEvent(const nsAString& aType,
|
|||
uint32_t aCount,
|
||||
int32_t aModifiers)
|
||||
{
|
||||
uint32_t msg;
|
||||
nsContentUtils::GetEventIdAndAtom(aType, eTouchEventClass, &msg);
|
||||
EventMessage msg;
|
||||
nsContentUtils::GetEventMessageAndAtom(aType, eTouchEventClass, &msg);
|
||||
if (msg != NS_TOUCH_START && msg != NS_TOUCH_MOVE &&
|
||||
msg != NS_TOUCH_END && msg != NS_TOUCH_CANCEL) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -179,7 +179,7 @@ public:
|
|||
bool* aConsumedByIME) override;
|
||||
virtual bool RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
|
||||
const widget::IMENotification& aEventMessage) override;
|
||||
virtual bool RecvOnEventNeedingAckHandled(const uint32_t& aMessage) override;
|
||||
virtual bool RecvOnEventNeedingAckHandled(const EventMessage& aMessage) override;
|
||||
virtual bool RecvEndIMEComposition(const bool& aCancel,
|
||||
bool* aNoCompositionEvent,
|
||||
nsString* aComposition) override;
|
||||
|
|
|
@ -2137,6 +2137,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
pluginEvent.lParam = 0;
|
||||
pPluginEvent = &pluginEvent;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2171,6 +2173,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
case NS_MOUSE_DOUBLECLICK:
|
||||
// Button up/down events sent instead.
|
||||
return rv;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Get reference point relative to plugin origin.
|
||||
|
@ -2263,6 +2267,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
event.same_screen = True;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2294,6 +2300,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
case NS_KEY_UP:
|
||||
event.type = KeyRelease;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2317,8 +2325,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
break;
|
||||
|
||||
default:
|
||||
switch (anEvent.mMessage)
|
||||
{
|
||||
switch (anEvent.mMessage) {
|
||||
case NS_FOCUS_CONTENT:
|
||||
case NS_BLUR_CONTENT:
|
||||
{
|
||||
|
@ -2330,7 +2337,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
event.detail = NotifyDetailNone;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pluginEvent.type) {
|
||||
|
@ -2371,6 +2380,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
case NS_MOUSE_DOUBLECLICK:
|
||||
// Button up/down events sent instead.
|
||||
return rv;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Get reference point relative to plugin origin.
|
||||
|
@ -2412,6 +2423,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
mInstance->HandleEvent(&event, nullptr, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,7 @@ TimeEvent::TimeEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
InternalSMILTimeEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalSMILTimeEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalSMILTimeEvent(false, NS_EVENT_NULL))
|
||||
, mDetail(mEvent->AsSMILTimeEvent()->detail)
|
||||
{
|
||||
if (aEvent) {
|
||||
|
|
|
@ -82,12 +82,15 @@ namespace
|
|||
{
|
||||
protected:
|
||||
nsRefPtr<nsIContent> mTarget;
|
||||
uint32_t mMsg;
|
||||
EventMessage mMsg;
|
||||
int32_t mDetail;
|
||||
|
||||
public:
|
||||
AsyncTimeEventRunner(nsIContent* aTarget, uint32_t aMsg, int32_t aDetail)
|
||||
: mTarget(aTarget), mMsg(aMsg), mDetail(aDetail)
|
||||
AsyncTimeEventRunner(nsIContent* aTarget, EventMessage aMsg,
|
||||
int32_t aDetail)
|
||||
: mTarget(aTarget)
|
||||
, mMsg(aMsg)
|
||||
, mDetail(aDetail)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2365,7 +2368,7 @@ nsSMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval,
|
|||
}
|
||||
|
||||
void
|
||||
nsSMILTimedElement::FireTimeEventAsync(uint32_t aMsg, int32_t aDetail)
|
||||
nsSMILTimedElement::FireTimeEventAsync(EventMessage aMsg, int32_t aDetail)
|
||||
{
|
||||
if (!mAnimationElement)
|
||||
return;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef NS_SMILTIMEDELEMENT_H_
|
||||
#define NS_SMILTIMEDELEMENT_H_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "nsSMILInterval.h"
|
||||
#include "nsSMILInstanceTime.h"
|
||||
|
@ -539,7 +540,8 @@ protected:
|
|||
bool aBeginObjectChanged,
|
||||
bool aEndObjectChanged);
|
||||
|
||||
void FireTimeEventAsync(uint32_t aMsg, int32_t aDetail);
|
||||
void FireTimeEventAsync(mozilla::EventMessage aMsg,
|
||||
int32_t aDetail);
|
||||
const nsSMILInstanceTime* GetEffectiveBeginInstance() const;
|
||||
const nsSMILInterval* GetPreviousInterval() const;
|
||||
bool HasPlayed() const { return !mOldIntervals.IsEmpty(); }
|
||||
|
|
|
@ -469,6 +469,8 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
case NS_COMPOSITION_END:
|
||||
HandleEndComposition(aEvent);
|
||||
return NS_OK;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
nsAutoString eventType;
|
||||
|
|
|
@ -1168,10 +1168,13 @@ nsPlaintextEditor::CanCutOrCopy(PasswordFieldAllowed aPasswordFieldAllowed)
|
|||
}
|
||||
|
||||
bool
|
||||
nsPlaintextEditor::FireClipboardEvent(int32_t aType, int32_t aSelectionType, bool* aActionTaken)
|
||||
nsPlaintextEditor::FireClipboardEvent(EventMessage aEventMessage,
|
||||
int32_t aSelectionType,
|
||||
bool* aActionTaken)
|
||||
{
|
||||
if (aType == NS_PASTE)
|
||||
if (aEventMessage == NS_PASTE) {
|
||||
ForceCompositionEnd();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, false);
|
||||
|
@ -1181,8 +1184,10 @@ nsPlaintextEditor::FireClipboardEvent(int32_t aType, int32_t aSelectionType, boo
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!nsCopySupport::FireClipboardEvent(aType, aSelectionType, presShell, selection, aActionTaken))
|
||||
if (!nsCopySupport::FireClipboardEvent(aEventMessage, aSelectionType,
|
||||
presShell, selection, aActionTaken)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the event handler caused the editor to be destroyed, return false.
|
||||
// Otherwise return true to indicate that the event was not cancelled.
|
||||
|
|
|
@ -207,7 +207,9 @@ protected:
|
|||
ePasswordFieldNotAllowed
|
||||
};
|
||||
bool CanCutOrCopy(PasswordFieldAllowed aPasswordFieldAllowed);
|
||||
bool FireClipboardEvent(int32_t aType, int32_t aSelectionType, bool* aActionTaken = nullptr);
|
||||
bool FireClipboardEvent(mozilla::EventMessage aEventMessage,
|
||||
int32_t aSelectionType,
|
||||
bool* aActionTaken = nullptr);
|
||||
|
||||
bool UpdateMetaCharset(nsIDOMDocument* aDocument,
|
||||
const nsACString& aCharacterSet);
|
||||
|
|
|
@ -847,6 +847,8 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
|
|||
case NS_DRAGDROP_DROP:
|
||||
txn->EndTransaction();
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ APZCCallbackHelper::DispatchWidgetEvent(WidgetGUIEvent& aEvent)
|
|||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCCallbackHelper::DispatchSynthesizedMouseEvent(uint32_t aMsg,
|
||||
APZCCallbackHelper::DispatchSynthesizedMouseEvent(EventMessage aMsg,
|
||||
uint64_t aTime,
|
||||
const LayoutDevicePoint& aRefPoint,
|
||||
Modifiers aModifiers,
|
||||
|
|
|
@ -119,7 +119,7 @@ public:
|
|||
|
||||
/* Synthesize a mouse event with the given parameters, and dispatch it
|
||||
* via the given widget. */
|
||||
static nsEventStatus DispatchSynthesizedMouseEvent(uint32_t aMsg,
|
||||
static nsEventStatus DispatchSynthesizedMouseEvent(EventMessage aMsg,
|
||||
uint64_t aTime,
|
||||
const LayoutDevicePoint& aRefPoint,
|
||||
Modifiers aModifiers,
|
||||
|
|
|
@ -111,7 +111,8 @@ public:
|
|||
EXPECT_EQ(mHub->GetState(), MockAccessibleCaretEventHub::NoActionState());
|
||||
}
|
||||
|
||||
static UniquePtr<WidgetEvent> CreateMouseEvent(uint32_t aMessage, nscoord aX,
|
||||
static UniquePtr<WidgetEvent> CreateMouseEvent(EventMessage aMessage,
|
||||
nscoord aX,
|
||||
nscoord aY)
|
||||
{
|
||||
auto event = MakeUnique<WidgetMouseEvent>(true, aMessage, nullptr,
|
||||
|
@ -143,7 +144,8 @@ public:
|
|||
return CreateMouseEvent(NS_MOUSE_MOZLONGTAP, aX, aY);
|
||||
}
|
||||
|
||||
static UniquePtr<WidgetEvent> CreateTouchEvent(uint32_t aMessage, nscoord aX,
|
||||
static UniquePtr<WidgetEvent> CreateTouchEvent(EventMessage aMessage,
|
||||
nscoord aX,
|
||||
nscoord aY)
|
||||
{
|
||||
auto event = MakeUnique<WidgetTouchEvent>(true, aMessage, nullptr);
|
||||
|
@ -175,7 +177,7 @@ public:
|
|||
return CreateTouchEvent(NS_TOUCH_END, aX, aY);
|
||||
}
|
||||
|
||||
static UniquePtr<WidgetEvent> CreateWheelEvent(uint32_t aMessage)
|
||||
static UniquePtr<WidgetEvent> CreateWheelEvent(EventMessage aMessage)
|
||||
{
|
||||
auto event = MakeUnique<WidgetWheelEvent>(true, aMessage, nullptr);
|
||||
|
||||
|
|
|
@ -6371,6 +6371,8 @@ PresShell::UpdateActivePointerState(WidgetGUIEvent* aEvent)
|
|||
gActivePointersIds->Remove(mouseEvent->pointerId);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6653,7 +6655,7 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
|
|||
nsEventStatus* aStatus,
|
||||
nsIContent** aTargetContent)
|
||||
{
|
||||
uint32_t pointerMessage = 0;
|
||||
EventMessage pointerMessage = NS_EVENT_NULL;
|
||||
if (aEvent->mClass == eMouseEventClass) {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
// if it is not mouse then it is likely will come as touch event
|
||||
|
@ -6838,7 +6840,7 @@ PresShell::DispatchBeforeKeyboardEventInternal(const nsTArray<nsCOMPtr<Element>
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t message =
|
||||
EventMessage message =
|
||||
(aEvent.mMessage == NS_KEY_DOWN) ? NS_KEY_BEFORE_DOWN : NS_KEY_BEFORE_UP;
|
||||
nsCOMPtr<EventTarget> eventTarget;
|
||||
// Dispatch before events from the outermost element.
|
||||
|
@ -6872,7 +6874,7 @@ PresShell::DispatchAfterKeyboardEventInternal(const nsTArray<nsCOMPtr<Element> >
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t message =
|
||||
EventMessage message =
|
||||
(aEvent.mMessage == NS_KEY_DOWN) ? NS_KEY_AFTER_DOWN : NS_KEY_AFTER_UP;
|
||||
bool embeddedCancelled = aEmbeddedCancelled;
|
||||
nsCOMPtr<EventTarget> eventTarget;
|
||||
|
@ -7529,6 +7531,8 @@ PresShell::HandleEvent(nsIFrame* aFrame,
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if we have an active EventStateManager which isn't the
|
||||
|
@ -7884,7 +7888,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
|||
isHandlingUserInput = true;
|
||||
break;
|
||||
|
||||
case NS_DRAGDROP_DROP:
|
||||
case NS_DRAGDROP_DROP: {
|
||||
nsCOMPtr<nsIDragSession> session = nsContentUtils::GetDragSession();
|
||||
if (session) {
|
||||
bool onlyChromeDrop = false;
|
||||
|
@ -7896,6 +7900,10 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
|||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!mTouchManager.PreHandleEvent(aEvent, aStatus,
|
||||
touchIsNew, isHandlingUserInput,
|
||||
mCurrentEventContent)) {
|
||||
|
@ -7987,6 +7995,8 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
|||
case NS_MOUSE_MOVE:
|
||||
nsIPresShell::AllowMouseCapture(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -660,6 +660,8 @@ nsresult nsHTMLFramesetFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
EndMouseDrag(aPresContext);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
} else {
|
||||
|
|
|
@ -1720,7 +1720,8 @@ nsFrameSelection::TakeFocus(nsIContent* aNewFocus,
|
|||
#ifdef DEBUG_TABLE_SELECTION
|
||||
printf(" * TakeFocus - moving into new cell\n");
|
||||
#endif
|
||||
WidgetMouseEvent event(false, 0, nullptr, WidgetMouseEvent::eReal);
|
||||
WidgetMouseEvent event(false, NS_EVENT_NULL, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
// Start selecting in the cell we were in before
|
||||
nsINode* parent = ParentOffset(mCellParent, &offset);
|
||||
|
|
|
@ -236,7 +236,7 @@ CSSAnimation::QueueEvents()
|
|||
mPreviousPhaseOrIteration = PREVIOUS_PHASE_AFTER;
|
||||
}
|
||||
|
||||
uint32_t message;
|
||||
EventMessage message;
|
||||
|
||||
if (!wasActive && isActive) {
|
||||
message = NS_ANIMATION_START;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "AnimationCommon.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "mozilla/dom/Animation.h"
|
||||
|
@ -30,7 +31,7 @@ struct AnimationEventInfo {
|
|||
|
||||
AnimationEventInfo(mozilla::dom::Element *aElement,
|
||||
const nsSubstring& aAnimationName,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
const mozilla::StickyTimeDuration& aElapsedTime,
|
||||
nsCSSPseudoElements::Type aPseudoType)
|
||||
: mElement(aElement), mEvent(true, aMessage)
|
||||
|
|
|
@ -173,6 +173,9 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
|
|
@ -63,14 +63,14 @@ using namespace mozilla::layers;
|
|||
class nsImageBoxFrameEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
nsImageBoxFrameEvent(nsIContent *content, uint32_t message)
|
||||
nsImageBoxFrameEvent(nsIContent *content, EventMessage message)
|
||||
: mContent(content), mMessage(message) {}
|
||||
|
||||
NS_IMETHOD Run() override;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
uint32_t mMessage;
|
||||
EventMessage mMessage;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -103,7 +103,7 @@ nsImageBoxFrameEvent::Run()
|
|||
// asynchronously.
|
||||
|
||||
void
|
||||
FireImageDOMEvent(nsIContent* aContent, uint32_t aMessage)
|
||||
FireImageDOMEvent(nsIContent* aContent, EventMessage aMessage)
|
||||
{
|
||||
NS_ASSERTION(aMessage == NS_LOAD || aMessage == NS_LOAD_ERROR,
|
||||
"invalid message");
|
||||
|
|
|
@ -310,6 +310,9 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!doDefault)
|
||||
|
|
|
@ -111,6 +111,9 @@ nsAutoRepeatBoxFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return nsButtonBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
|
|
@ -73,6 +73,8 @@ nsScrollbarButtonFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
mCursorOnThis = frameRect.Contains(cursor);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return nsButtonBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
|
|
@ -547,6 +547,9 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
//we MUST call nsFrame HandleEvent for mouse ups to maintain the selection state and capture state.
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
|
|
@ -391,13 +391,16 @@ nsSplitterFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
switch (aEvent->mMessage) {
|
||||
case NS_MOUSE_MOVE:
|
||||
mInner->MouseDrag(aPresContext, aEvent);
|
||||
break;
|
||||
break;
|
||||
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
if (aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
|
||||
mInner->MouseUp(aPresContext, aEvent);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
NS_ENSURE_STATE(weakFrame.IsAlive());
|
||||
|
|
|
@ -154,6 +154,9 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( doDefault )
|
||||
|
|
|
@ -171,7 +171,9 @@ struct EventFlags : public BaseEventFlags
|
|||
class WidgetEvent
|
||||
{
|
||||
protected:
|
||||
WidgetEvent(bool aIsTrusted, uint32_t aMessage, EventClassID aEventClassID)
|
||||
WidgetEvent(bool aIsTrusted,
|
||||
EventMessage aMessage,
|
||||
EventClassID aEventClassID)
|
||||
: mClass(aEventClassID)
|
||||
, mMessage(aMessage)
|
||||
, refPoint(0, 0)
|
||||
|
@ -193,7 +195,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
WidgetEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
WidgetEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: mClass(eBasicEventClass)
|
||||
, mMessage(aMessage)
|
||||
, refPoint(0, 0)
|
||||
|
@ -231,8 +233,7 @@ public:
|
|||
}
|
||||
|
||||
EventClassID mClass;
|
||||
// See GUI MESSAGES,
|
||||
uint32_t mMessage;
|
||||
EventMessage mMessage;
|
||||
// Relative to the widget of the event, or if there is no widget then it is
|
||||
// in screen coordinates. Not modified by layout code.
|
||||
LayoutDeviceIntPoint refPoint;
|
||||
|
@ -391,7 +392,7 @@ public:
|
|||
class WidgetGUIEvent : public WidgetEvent
|
||||
{
|
||||
protected:
|
||||
WidgetGUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
|
||||
WidgetGUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetEvent(aIsTrusted, aMessage, aEventClassID)
|
||||
, widget(aWidget)
|
||||
|
@ -405,9 +406,9 @@ protected:
|
|||
public:
|
||||
virtual WidgetGUIEvent* AsGUIEvent() override { return this; }
|
||||
|
||||
WidgetGUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget) :
|
||||
WidgetEvent(aIsTrusted, aMessage, eGUIEventClass),
|
||||
widget(aWidget)
|
||||
WidgetGUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eGUIEventClass)
|
||||
, widget(aWidget)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -555,7 +556,7 @@ typedef uint16_t Modifiers;
|
|||
class WidgetInputEvent : public WidgetGUIEvent
|
||||
{
|
||||
protected:
|
||||
WidgetInputEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
|
||||
WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
|
||||
, modifiers(0)
|
||||
|
@ -569,7 +570,7 @@ protected:
|
|||
public:
|
||||
virtual WidgetInputEvent* AsInputEvent() override { return this; }
|
||||
|
||||
WidgetInputEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
|
||||
WidgetInputEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eInputEventClass)
|
||||
, modifiers(0)
|
||||
{
|
||||
|
@ -723,7 +724,7 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
InternalUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
|
||||
InternalUIEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
|
||||
, detail(0)
|
||||
|
@ -731,7 +732,7 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
InternalUIEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
InternalUIEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
EventClassID aEventClassID)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, aEventClassID)
|
||||
, detail(0)
|
||||
|
@ -747,7 +748,7 @@ public:
|
|||
* aEventCausesThisEvent should be the event. If there is no such event,
|
||||
* this should be nullptr.
|
||||
*/
|
||||
InternalUIEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
InternalUIEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
const WidgetEvent* aEventCausesThisEvent)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eUIEventClass)
|
||||
, detail(0)
|
||||
|
|
|
@ -24,7 +24,7 @@ GetBoolName(bool aBool)
|
|||
}
|
||||
|
||||
static const char*
|
||||
GetEventMessageName(uint32_t aMessage)
|
||||
GetEventMessageName(EventMessage aMessage)
|
||||
{
|
||||
switch (aMessage) {
|
||||
case NS_COMPOSITION_START:
|
||||
|
@ -676,6 +676,8 @@ ContentCacheInParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent,
|
|||
"Succeeded, aEvent={ mReply={ mRect=%s } }",
|
||||
this, GetRectText(aEvent.mReply.mRect).get()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
aEvent.mSucceeded = true;
|
||||
return true;
|
||||
|
@ -915,7 +917,7 @@ ContentCacheInParent::OnSelectionEvent(
|
|||
|
||||
void
|
||||
ContentCacheInParent::OnEventNeedingAckHandled(nsIWidget* aWidget,
|
||||
uint32_t aMessage)
|
||||
EventMessage aMessage)
|
||||
{
|
||||
// This is called when the child process receives WidgetCompositionEvent or
|
||||
// WidgetSelectionEvent.
|
||||
|
|
|
@ -322,7 +322,7 @@ public:
|
|||
* TabParent or aWidget. Therefore, the caller must not destroy
|
||||
* this instance during a call of this method.
|
||||
*/
|
||||
void OnEventNeedingAckHandled(nsIWidget* aWidget, uint32_t aMessage);
|
||||
void OnEventNeedingAckHandled(nsIWidget* aWidget, EventMessage aMessage);
|
||||
|
||||
/**
|
||||
* RequestToCommitComposition() requests to commit or cancel composition to
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
both = 2
|
||||
};
|
||||
|
||||
InternalScrollPortEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
InternalScrollPortEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eScrollPortEventClass)
|
||||
, orient(vertical)
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
InternalScrollAreaEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
InternalScrollAreaEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eScrollAreaEventClass)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ class InternalFormEvent : public WidgetEvent
|
|||
public:
|
||||
virtual InternalFormEvent* AsFormEvent() override { return this; }
|
||||
|
||||
InternalFormEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalFormEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eFormEventClass)
|
||||
, originator(nullptr)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
InternalClipboardEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalClipboardEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eClipboardEventClass)
|
||||
{
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ class InternalFocusEvent : public InternalUIEvent
|
|||
public:
|
||||
virtual InternalFocusEvent* AsFocusEvent() override { return this; }
|
||||
|
||||
InternalFocusEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalFocusEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, eFocusEventClass)
|
||||
, fromRaise(false)
|
||||
, isRefocus(false)
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
InternalTransitionEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalTransitionEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eTransitionEventClass)
|
||||
, elapsedTime(0.0)
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
InternalAnimationEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalAnimationEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eAnimationEventClass)
|
||||
, elapsedTime(0.0)
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ class InternalSVGZoomEvent : public WidgetGUIEvent
|
|||
public:
|
||||
virtual InternalSVGZoomEvent* AsSVGZoomEvent() override { return this; }
|
||||
|
||||
InternalSVGZoomEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalSVGZoomEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eSVGZoomEventClass)
|
||||
{
|
||||
mFlags.mCancelable = false;
|
||||
|
@ -363,7 +363,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
InternalSMILTimeEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalSMILTimeEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: InternalUIEvent(aIsTrusted, aMessage, eSMILTimeEventClass)
|
||||
{
|
||||
mFlags.mBubbles = false;
|
||||
|
|
|
@ -28,11 +28,15 @@ enum nsEventStatus
|
|||
nsEventStatus_eSentinel
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* Event messages
|
||||
*/
|
||||
|
||||
enum
|
||||
typedef uint16_t EventMessageType;
|
||||
|
||||
enum EventMessage : EventMessageType
|
||||
{
|
||||
|
||||
#define NS_EVENT_MESSAGE(aMessage, aValue) aMessage = aValue,
|
||||
|
@ -45,8 +49,6 @@ enum
|
|||
eEventMessage_MaxValue
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* Event class IDs
|
||||
*/
|
||||
|
|
|
@ -418,7 +418,7 @@ struct IMENotification final
|
|||
mTextChangeData.Clear();
|
||||
break;
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
mMouseButtonEventData.mEventMessage = 0;
|
||||
mMouseButtonEventData.mEventMessage = NS_EVENT_NULL;
|
||||
mMouseButtonEventData.mOffset = UINT32_MAX;
|
||||
mMouseButtonEventData.mCursorPos.Set(nsIntPoint(0, 0));
|
||||
mMouseButtonEventData.mCharRect.Set(nsIntRect(0, 0, 0, 0));
|
||||
|
@ -731,8 +731,8 @@ struct IMENotification final
|
|||
|
||||
struct MouseButtonEventData
|
||||
{
|
||||
// The value of WidgetEvent::message
|
||||
uint32_t mEventMessage;
|
||||
// The value of WidgetEvent::mMessage
|
||||
EventMessage mEventMessage;
|
||||
// Character offset from the start of the focused editor under the cursor
|
||||
uint32_t mOffset;
|
||||
// Cursor position in pixels relative to the widget
|
||||
|
|
|
@ -81,27 +81,27 @@ MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const
|
|||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"Can only convert To WidgetTouchEvent on main thread");
|
||||
|
||||
uint32_t touchType = NS_EVENT_NULL;
|
||||
EventMessage touchEventMessage = NS_EVENT_NULL;
|
||||
switch (mType) {
|
||||
case MULTITOUCH_START:
|
||||
touchType = NS_TOUCH_START;
|
||||
touchEventMessage = NS_TOUCH_START;
|
||||
break;
|
||||
case MULTITOUCH_MOVE:
|
||||
touchType = NS_TOUCH_MOVE;
|
||||
touchEventMessage = NS_TOUCH_MOVE;
|
||||
break;
|
||||
case MULTITOUCH_END:
|
||||
touchType = NS_TOUCH_END;
|
||||
touchEventMessage = NS_TOUCH_END;
|
||||
break;
|
||||
case MULTITOUCH_CANCEL:
|
||||
touchType = NS_TOUCH_CANCEL;
|
||||
touchEventMessage = NS_TOUCH_CANCEL;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetTouchEvent in MultiTouchInput");
|
||||
break;
|
||||
}
|
||||
|
||||
WidgetTouchEvent event(true, touchType, aWidget);
|
||||
if (touchType == NS_EVENT_NULL) {
|
||||
WidgetTouchEvent event(true, touchEventMessage, aWidget);
|
||||
if (touchEventMessage == NS_EVENT_NULL) {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -122,24 +122,24 @@ MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
|
|||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"Can only convert To WidgetMouseEvent on main thread");
|
||||
|
||||
uint32_t mouseEventType = NS_EVENT_NULL;
|
||||
EventMessage mouseEventMessage = NS_EVENT_NULL;
|
||||
switch (mType) {
|
||||
case MultiTouchInput::MULTITOUCH_START:
|
||||
mouseEventType = NS_MOUSE_BUTTON_DOWN;
|
||||
mouseEventMessage = NS_MOUSE_BUTTON_DOWN;
|
||||
break;
|
||||
case MultiTouchInput::MULTITOUCH_MOVE:
|
||||
mouseEventType = NS_MOUSE_MOVE;
|
||||
mouseEventMessage = NS_MOUSE_MOVE;
|
||||
break;
|
||||
case MultiTouchInput::MULTITOUCH_CANCEL:
|
||||
case MultiTouchInput::MULTITOUCH_END:
|
||||
mouseEventType = NS_MOUSE_BUTTON_UP;
|
||||
mouseEventMessage = NS_MOUSE_BUTTON_UP;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetMouseEvent");
|
||||
break;
|
||||
}
|
||||
|
||||
WidgetMouseEvent event(true, mouseEventType, aWidget,
|
||||
WidgetMouseEvent event(true, mouseEventMessage, aWidget,
|
||||
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
|
||||
|
||||
const SingleTouchData& firstTouch = mTouches[0];
|
||||
|
@ -151,7 +151,7 @@ MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
|
|||
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
|
||||
event.modifiers = modifiers;
|
||||
|
||||
if (mouseEventType != NS_MOUSE_MOVE) {
|
||||
if (mouseEventMessage != NS_MOUSE_MOVE) {
|
||||
event.clickCount = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
WidgetContentCommandEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
WidgetContentCommandEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget,
|
||||
bool aOnlyEnabledCheck = false)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eContentCommandEventClass)
|
||||
|
@ -145,7 +145,7 @@ class WidgetPluginEvent : public WidgetGUIEvent
|
|||
public:
|
||||
virtual WidgetPluginEvent* AsPluginEvent() override { return this; }
|
||||
|
||||
WidgetPluginEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
|
||||
WidgetPluginEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, ePluginEventClass)
|
||||
, retargetToFocusedDocument(false)
|
||||
{
|
||||
|
|
|
@ -77,8 +77,8 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
WidgetMouseEventBase(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID)
|
||||
WidgetMouseEventBase(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget, EventClassID aEventClassID)
|
||||
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
|
||||
, button(0)
|
||||
, buttons(0)
|
||||
|
@ -193,7 +193,7 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
WidgetMouseEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
|
||||
WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
EventClassID aEventClassID, reasonType aReason)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
|
||||
, acceptActivation(false)
|
||||
|
@ -217,7 +217,7 @@ protected:
|
|||
public:
|
||||
virtual WidgetMouseEvent* AsMouseEvent() override { return this; }
|
||||
|
||||
WidgetMouseEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
|
||||
WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
|
||||
reasonType aReason, contextType aContext = eNormal) :
|
||||
WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass),
|
||||
acceptActivation(false), ignoreRootScrollFrame(false),
|
||||
|
@ -316,7 +316,7 @@ protected:
|
|||
public:
|
||||
virtual WidgetDragEvent* AsDragEvent() override { return this; }
|
||||
|
||||
WidgetDragEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
|
||||
WidgetDragEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetMouseEvent(aIsTrusted, aMessage, aWidget, eDragEventClass, eReal)
|
||||
, userCancelled(false)
|
||||
, mDefaultPreventedOnContent(false)
|
||||
|
@ -379,7 +379,7 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
WidgetMouseScrollEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
WidgetMouseScrollEvent(bool aIsTrusted, EventMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget,
|
||||
eMouseScrollEventClass)
|
||||
|
@ -439,7 +439,7 @@ private:
|
|||
public:
|
||||
virtual WidgetWheelEvent* AsWheelEvent() override { return this; }
|
||||
|
||||
WidgetWheelEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
|
||||
WidgetWheelEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
|
||||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eWheelEventClass)
|
||||
, deltaX(0.0)
|
||||
, deltaY(0.0)
|
||||
|
@ -587,7 +587,7 @@ class WidgetPointerEvent : public WidgetMouseEvent
|
|||
public:
|
||||
virtual WidgetPointerEvent* AsPointerEvent() override { return this; }
|
||||
|
||||
WidgetPointerEvent(bool aIsTrusted, uint32_t aMsg, nsIWidget* w)
|
||||
WidgetPointerEvent(bool aIsTrusted, EventMessage aMsg, nsIWidget* w)
|
||||
: WidgetMouseEvent(aIsTrusted, aMsg, w, ePointerEventClass, eReal)
|
||||
, width(0)
|
||||
, height(0)
|
||||
|
|
|
@ -268,8 +268,8 @@ TextEventDispatcher::CommitComposition(nsEventStatus& aStatus,
|
|||
// End current composition and make this free for other IMEs.
|
||||
mIsComposing = false;
|
||||
|
||||
uint32_t message = aCommitString ? NS_COMPOSITION_COMMIT :
|
||||
NS_COMPOSITION_COMMIT_AS_IS;
|
||||
EventMessage message = aCommitString ? NS_COMPOSITION_COMMIT :
|
||||
NS_COMPOSITION_COMMIT_AS_IS;
|
||||
WidgetCompositionEvent compositionCommitEvent(true, message, widget);
|
||||
InitEvent(compositionCommitEvent);
|
||||
if (message == NS_COMPOSITION_COMMIT) {
|
||||
|
@ -302,7 +302,7 @@ TextEventDispatcher::NotifyIME(const IMENotification& aIMENotification)
|
|||
|
||||
bool
|
||||
TextEventDispatcher::DispatchKeyboardEvent(
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
const WidgetKeyboardEvent& aKeyboardEvent,
|
||||
nsEventStatus& aStatus,
|
||||
DispatchTo aDispatchTo)
|
||||
|
@ -313,7 +313,7 @@ TextEventDispatcher::DispatchKeyboardEvent(
|
|||
|
||||
bool
|
||||
TextEventDispatcher::DispatchKeyboardEventInternal(
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
const WidgetKeyboardEvent& aKeyboardEvent,
|
||||
nsEventStatus& aStatus,
|
||||
DispatchTo aDispatchTo,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче