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:
Masayuki Nakano 2016-04-18 23:53:03 +09:00
Родитель 7d1b358c67
Коммит e88a0f30fa
6 изменённых файлов: 21 добавлений и 16 удалений

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

@ -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;