mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1259656 part.3 Rename WidgetEvent::userType to WidgetEvent::mSpecifiedEventType r=smaug
MozReview-Commit-ID: 5ef5lEQ1fZJ --HG-- extra : rebase_source : 0d0f8b7e29db15b41ff6ac68db24b3e7d3df6afc
This commit is contained in:
parent
7d1b358c67
commit
e88a0f30fa
@ -254,8 +254,9 @@ TextInputProcessor::IsValidEventTypeForComposition(
|
||||
return true;
|
||||
}
|
||||
if (aKeyboardEvent.mMessage == eUnidentifiedEvent &&
|
||||
aKeyboardEvent.userType &&
|
||||
nsDependentAtomString(aKeyboardEvent.userType).EqualsLiteral("on")) {
|
||||
aKeyboardEvent.mSpecifiedEventType &&
|
||||
nsDependentAtomString(
|
||||
aKeyboardEvent.mSpecifiedEventType).EqualsLiteral("on")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -267,8 +267,10 @@ Event::GetType(nsAString& aType)
|
||||
if (name) {
|
||||
CopyASCIItoUTF16(name, aType);
|
||||
return NS_OK;
|
||||
} else if (mEvent->mMessage == eUnidentifiedEvent && mEvent->userType) {
|
||||
aType = Substring(nsDependentAtomString(mEvent->userType), 2); // Remove "on"
|
||||
} else if (mEvent->mMessage == eUnidentifiedEvent &&
|
||||
mEvent->mSpecifiedEventType) {
|
||||
// Remove "on"
|
||||
aType = Substring(nsDependentAtomString(mEvent->mSpecifiedEventType), 2);
|
||||
mEvent->typeString = aType;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -548,11 +550,11 @@ Event::SetEventType(const nsAString& aEventTypeArg)
|
||||
{
|
||||
if (mIsMainThreadEvent) {
|
||||
mEvent->typeString.Truncate();
|
||||
mEvent->userType =
|
||||
mEvent->mSpecifiedEventType =
|
||||
nsContentUtils::GetEventMessageAndAtom(aEventTypeArg, mEvent->mClass,
|
||||
&(mEvent->mMessage));
|
||||
} else {
|
||||
mEvent->userType = nullptr;
|
||||
mEvent->mSpecifiedEventType = nullptr;
|
||||
mEvent->mMessage = eUnidentifiedEvent;
|
||||
mEvent->typeString = aEventTypeArg;
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ EventListenerManager::ListenerCanHandle(const Listener* aListener,
|
||||
}
|
||||
if (aEvent->mMessage == eUnidentifiedEvent) {
|
||||
if (mIsMainThreadELM) {
|
||||
return aListener->mTypeAtom == aEvent->userType;
|
||||
return aListener->mTypeAtom == aEvent->mSpecifiedEventType;
|
||||
}
|
||||
return aListener->mTypeString.Equals(aEvent->typeString);
|
||||
}
|
||||
@ -1304,7 +1304,7 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
||||
|
||||
if (mIsMainThreadELM && !hasListener) {
|
||||
mNoListenerForEvent = aEvent->mMessage;
|
||||
mNoListenerForEventAtom = aEvent->userType;
|
||||
mNoListenerForEventAtom = aEvent->mSpecifiedEventType;
|
||||
}
|
||||
|
||||
if (aEvent->DefaultPrevented()) {
|
||||
|
@ -343,7 +343,7 @@ public:
|
||||
// Check if we already know that there is no event listener for the event.
|
||||
if (mNoListenerForEvent == aEvent->mMessage &&
|
||||
(mNoListenerForEvent != eUnidentifiedEvent ||
|
||||
mNoListenerForEventAtom == aEvent->userType)) {
|
||||
mNoListenerForEventAtom == aEvent->mSpecifiedEventType)) {
|
||||
return;
|
||||
}
|
||||
HandleEventInternal(aPresContext, aEvent, aDOMEvent, aCurrentTarget,
|
||||
|
@ -273,7 +273,7 @@ protected:
|
||||
, mMessage(aMessage)
|
||||
, mRefPoint(0, 0)
|
||||
, mLastRefPoint(0, 0)
|
||||
, userType(nullptr)
|
||||
, mSpecifiedEventType(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WidgetEvent);
|
||||
mFlags.Clear();
|
||||
@ -295,7 +295,7 @@ public:
|
||||
, mMessage(aMessage)
|
||||
, mRefPoint(0, 0)
|
||||
, mLastRefPoint(0, 0)
|
||||
, userType(nullptr)
|
||||
, mSpecifiedEventType(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WidgetEvent);
|
||||
mFlags.Clear();
|
||||
@ -335,8 +335,10 @@ public:
|
||||
// See BaseEventFlags definition for the detail.
|
||||
BaseEventFlags mFlags;
|
||||
|
||||
// Additional type info for user defined events
|
||||
nsCOMPtr<nsIAtom> userType;
|
||||
// If JS creates an event with unknown event type or known event type but
|
||||
// for different event interface, the event type is stored to this.
|
||||
// NOTE: This is always used if the instance is a WidgetCommandEvent instance.
|
||||
nsCOMPtr<nsIAtom> mSpecifiedEventType;
|
||||
|
||||
nsString typeString; // always set on non-main-thread events
|
||||
|
||||
@ -353,7 +355,7 @@ public:
|
||||
// mLastRefPoint doesn't need to be copied.
|
||||
AssignEventTime(aEvent);
|
||||
// mFlags should be copied manually if it's necessary.
|
||||
userType = aEvent.userType;
|
||||
mSpecifiedEventType = aEvent.mSpecifiedEventType;
|
||||
// typeString should be copied manually if it's necessary.
|
||||
target = aCopyTargets ? aEvent.target : nullptr;
|
||||
currentTarget = aCopyTargets ? aEvent.currentTarget : nullptr;
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
eCommandEventClass)
|
||||
, command(aCommand)
|
||||
{
|
||||
userType = aEventType;
|
||||
mSpecifiedEventType = aEventType;
|
||||
}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override
|
||||
@ -121,7 +121,7 @@ public:
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetCommandEvent* result =
|
||||
new WidgetCommandEvent(false, userType, command, nullptr);
|
||||
new WidgetCommandEvent(false, mSpecifiedEventType, command, nullptr);
|
||||
result->AssignCommandEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user