Bug 895274 part.5 Rename NS_EVENT_NULL to eVoidEvent r=smaug

This commit is contained in:
Masayuki Nakano 2015-08-29 08:58:26 +09:00
parent e3add2adb5
commit efd413f998
36 changed files with 46 additions and 49 deletions

View File

@ -3577,7 +3577,7 @@ nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
while (node) {
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
if (fc && fc->IsDisabledForEvents(NS_EVENT_NULL)) {
if (fc && fc->IsDisabledForEvents(eVoidEvent)) {
*aRetVal = true;
break;
}

View File

@ -15,7 +15,7 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalAnimationEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalAnimationEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalAnimationEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -18,7 +18,7 @@ BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
: KeyboardEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalBeforeAfterKeyboardEvent(false,
NS_EVENT_NULL,
eVoidEvent,
nullptr))
{
MOZ_ASSERT(mEvent->mClass == eBeforeAfterKeyboardEventClass,

View File

@ -16,7 +16,7 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalClipboardEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalClipboardEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalClipboardEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -16,7 +16,7 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
WidgetCompositionEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetCompositionEvent(false, NS_EVENT_NULL, nullptr))
new WidgetCompositionEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == eCompositionEventClass,
"event type mismatch");

View File

@ -17,7 +17,7 @@ DragEvent::DragEvent(EventTarget* aOwner,
WidgetDragEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetDragEvent(false, NS_EVENT_NULL, nullptr))
new WidgetDragEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -106,7 +106,7 @@ Event::ConstructorInit(EventTarget* aOwner,
...
}
*/
mEvent = new WidgetEvent(false, NS_EVENT_NULL);
mEvent = new WidgetEvent(false, eVoidEvent);
mEvent->time = PR_Now();
}

View File

@ -493,7 +493,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
}
#ifdef DEBUG
if (aEvent->mMessage != NS_EVENT_NULL &&
if (aEvent->mMessage != eVoidEvent &&
!nsContentUtils::IsSafeToRunScript()) {
nsresult rv = NS_ERROR_FAILURE;
if (target->GetContextForEventHandlers(&rv) ||

View File

@ -247,7 +247,7 @@ public:
*
* If aTargets is non-null, event target chain will be created, but
* event won't be handled. In this case aEvent->mMessage should be
* NS_EVENT_NULL.
* eVoidEvent.
* @note Use this method when dispatching a WidgetEvent.
*/
static nsresult Dispatch(nsISupports* aTarget,

View File

@ -95,7 +95,7 @@ MutationBitForEventType(EventMessage aEventType)
uint32_t EventListenerManager::sMainThreadCreatedCount = 0;
EventListenerManagerBase::EventListenerManagerBase()
: mNoListenerForEvent(NS_EVENT_NULL)
: mNoListenerForEvent(eVoidEvent)
, mMayHavePaintEventListener(false)
, mMayHaveMutationListeners(false)
, mMayHaveCapturingListeners(false)
@ -257,7 +257,7 @@ EventListenerManager::AddEventListenerInternal(
}
}
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
listener = aAllEvents ? mListeners.InsertElementAt(0) :
@ -524,7 +524,7 @@ EventListenerManager::RemoveEventListenerInternal(
nsRefPtr<EventListenerManager> kungFuDeathGrip(this);
mListeners.RemoveElementAt(i);
--count;
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
if (mTarget && aUserType) {
mTarget->EventListenerRemoved(aUserType);
@ -791,7 +791,7 @@ EventListenerManager::RemoveEventHandler(nsIAtom* aName,
if (listener) {
mListeners.RemoveElementAt(uint32_t(listener - &mListeners.ElementAt(0)));
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
if (mTarget && aName) {
mTarget->EventListenerRemoved(aName);

View File

@ -226,7 +226,7 @@ EventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
*aCount = 0;
*aOutArray = nullptr;
NS_ENSURE_ARG(aEventTarget);
WidgetEvent event(true, NS_EVENT_NULL);
WidgetEvent event(true, eVoidEvent);
nsTArray<EventTarget*> targets;
nsresult rv = EventDispatcher::Dispatch(aEventTarget, nullptr, &event,
nullptr, nullptr, nullptr, &targets);

View File

@ -625,7 +625,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
GenerateMouseEnterExit(mouseEvent);
//This is a window level mouse exit event and should stop here
aEvent->mMessage = NS_EVENT_NULL;
aEvent->mMessage = eVoidEvent;
break;
}
case NS_MOUSE_MOVE:

View File

@ -16,8 +16,7 @@ InputEvent::InputEvent(EventTarget* aOwner,
InternalEditorInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalEditorInputEvent(false, NS_EVENT_NULL,
nullptr))
new InternalEditorInputEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == eEditorInputEventClass,
"event type mismatch");

View File

@ -16,7 +16,7 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
WidgetKeyboardEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetKeyboardEvent(false, NS_EVENT_NULL, nullptr))
new WidgetKeyboardEvent(false, eVoidEvent, nullptr))
, mInitializedByCtor(false)
, mInitializedWhichValue(0)
{

View File

@ -18,7 +18,7 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
WidgetMouseEventBase* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseEvent(false, NS_EVENT_NULL, nullptr,
new WidgetMouseEvent(false, eVoidEvent, nullptr,
WidgetMouseEvent::eReal))
{
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.

View File

@ -16,8 +16,7 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
WidgetMouseScrollEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseScrollEvent(false, NS_EVENT_NULL,
nullptr))
new WidgetMouseScrollEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -17,7 +17,7 @@ MutationEvent::MutationEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalMutationEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalMutationEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalMutationEvent(false, eVoidEvent))
{
mEventIsInternal = (aEvent == nullptr);
}

View File

@ -73,7 +73,7 @@ NS_NewDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
mozilla::EventMessage aEventMessage =
mozilla::NS_EVENT_NULL,
mozilla::eVoidEvent,
nsInvalidateRequestList* aInvalidateRequests =
nullptr);

View File

@ -18,7 +18,7 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
WidgetPointerEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetPointerEvent(false, NS_EVENT_NULL, nullptr))
new WidgetPointerEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == ePointerEventClass,
"event type mismatch ePointerEventClass");

View File

@ -16,7 +16,7 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
WidgetSimpleGestureEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetSimpleGestureEvent(false, NS_EVENT_NULL,
new WidgetSimpleGestureEvent(false, eVoidEvent,
nullptr))
{
NS_ASSERTION(mEvent->mClass == eSimpleGestureEventClass,

View File

@ -64,7 +64,7 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
WidgetTouchEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetTouchEvent(false, NS_EVENT_NULL, nullptr))
new WidgetTouchEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -15,7 +15,7 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalTransitionEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalTransitionEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalTransitionEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -29,7 +29,7 @@ UIEvent::UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, NS_EVENT_NULL, nullptr))
aEvent ? aEvent : new InternalUIEvent(false, eVoidEvent, nullptr))
, mClientPoint(0, 0)
, mLayerPoint(0, 0)
, mPagePoint(0, 0)

View File

@ -16,8 +16,7 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
WidgetWheelEvent* aWheelEvent)
: MouseEvent(aOwner, aPresContext,
aWheelEvent ? aWheelEvent :
new WidgetWheelEvent(false, NS_EVENT_NULL,
nullptr))
new WidgetWheelEvent(false, eVoidEvent, nullptr))
, mAppUnitsPerDevPixel(0)
{
if (aWheelEvent) {

View File

@ -15,7 +15,7 @@ XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
WidgetInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetInputEvent(false, NS_EVENT_NULL, nullptr))
new WidgetInputEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -17,7 +17,7 @@ TimeEvent::TimeEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalSMILTimeEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalSMILTimeEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalSMILTimeEvent(false, eVoidEvent))
, mDetail(mEvent->AsSMILTimeEvent()->detail)
{
if (aEvent) {

View File

@ -8173,7 +8173,7 @@ nsLayoutUtils::HasApzAwareListeners(EventListenerManager* aElm)
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(nsIPresShell* aShell)
{
if (nsIDocument* doc = aShell->GetDocument()) {
WidgetEvent event(true, NS_EVENT_NULL);
WidgetEvent event(true, eVoidEvent);
nsTArray<EventTarget*> targets;
nsresult rv = EventDispatcher::Dispatch(doc, nullptr, &event, nullptr,
nullptr, nullptr, &targets);

View File

@ -6661,7 +6661,7 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
nsEventStatus* aStatus,
nsIContent** aTargetContent)
{
EventMessage pointerMessage = NS_EVENT_NULL;
EventMessage pointerMessage = eVoidEvent;
if (aEvent->mClass == eMouseEventClass) {
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
// if it is not mouse then it is likely will come as touch event

View File

@ -1720,7 +1720,7 @@ nsFrameSelection::TakeFocus(nsIContent* aNewFocus,
#ifdef DEBUG_TABLE_SELECTION
printf(" * TakeFocus - moving into new cell\n");
#endif
WidgetMouseEvent event(false, NS_EVENT_NULL, nullptr,
WidgetMouseEvent event(false, eVoidEvent, nullptr,
WidgetMouseEvent::eReal);
// Start selecting in the cell we were in before

View File

@ -9,7 +9,7 @@
* NS_EVENT_MESSAGE(aMessage, aValue)
*/
NS_EVENT_MESSAGE(NS_EVENT_NULL, 0)
NS_EVENT_MESSAGE(eVoidEvent, 0)
// This is a dummy event message for all event listener implementation in
// EventListenerManager.

View File

@ -418,7 +418,7 @@ struct IMENotification final
mTextChangeData.Clear();
break;
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
mMouseButtonEventData.mEventMessage = NS_EVENT_NULL;
mMouseButtonEventData.mEventMessage = eVoidEvent;
mMouseButtonEventData.mOffset = UINT32_MAX;
mMouseButtonEventData.mCursorPos.Set(nsIntPoint(0, 0));
mMouseButtonEventData.mCharRect.Set(nsIntRect(0, 0, 0, 0));

View File

@ -81,7 +81,7 @@ MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const
MOZ_ASSERT(NS_IsMainThread(),
"Can only convert To WidgetTouchEvent on main thread");
EventMessage touchEventMessage = NS_EVENT_NULL;
EventMessage touchEventMessage = eVoidEvent;
switch (mType) {
case MULTITOUCH_START:
touchEventMessage = NS_TOUCH_START;
@ -101,7 +101,7 @@ MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const
}
WidgetTouchEvent event(true, touchEventMessage, aWidget);
if (touchEventMessage == NS_EVENT_NULL) {
if (touchEventMessage == eVoidEvent) {
return event;
}
@ -122,7 +122,7 @@ MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
MOZ_ASSERT(NS_IsMainThread(),
"Can only convert To WidgetMouseEvent on main thread");
EventMessage mouseEventMessage = NS_EVENT_NULL;
EventMessage mouseEventMessage = eVoidEvent;
switch (mType) {
case MultiTouchInput::MULTITOUCH_START:
mouseEventMessage = NS_MOUSE_BUTTON_DOWN;

View File

@ -689,7 +689,7 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
return mApzInput.ToWidgetTouchEvent(widget);
}
EventMessage type = NS_EVENT_NULL;
EventMessage type = eVoidEvent;
int startIndex = 0;
int endIndex = Count();
@ -735,7 +735,7 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
}
WidgetTouchEvent event(true, type, widget);
if (type == NS_EVENT_NULL) {
if (type == eVoidEvent) {
// An event we don't know about
return event;
}
@ -830,7 +830,7 @@ AndroidGeckoEvent::MakeMultiTouchInput(nsIWidget* widget)
WidgetMouseEvent
AndroidGeckoEvent::MakeMouseEvent(nsIWidget* widget)
{
EventMessage msg = NS_EVENT_NULL;
EventMessage msg = eVoidEvent;
if (Points().Length() > 0) {
switch (Action()) {
case AndroidMotionEvent::ACTION_HOVER_MOVE:
@ -850,7 +850,7 @@ AndroidGeckoEvent::MakeMouseEvent(nsIWidget* widget)
WidgetMouseEvent event(true, msg, widget,
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
if (msg == NS_EVENT_NULL) {
if (msg == eVoidEvent) {
// unknown type, or no point data. abort
return event;
}

View File

@ -966,7 +966,7 @@ nsWindow::OnMouseEvent(AndroidGeckoEvent *ae)
nsRefPtr<nsWindow> kungFuDeathGrip(this);
WidgetMouseEvent event = ae->MakeMouseEvent(this);
if (event.mMessage == NS_EVENT_NULL) {
if (event.mMessage == eVoidEvent) {
// invalid event type, abort
return;
}
@ -1052,7 +1052,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
bool isDownEvent = false;
WidgetTouchEvent event = ae->MakeTouchEvent(this);
if (event.mMessage != NS_EVENT_NULL) {
if (event.mMessage != eVoidEvent) {
nsEventStatus status;
DispatchEvent(&event, status);
// We check mMultipleActionsPrevented because that's what <input type=range>
@ -1118,7 +1118,7 @@ nsWindow::OnNativeGestureEvent(AndroidGeckoEvent *ae)
LayoutDeviceIntPoint pt(ae->Points()[0].x,
ae->Points()[0].y);
double delta = ae->X();
EventMessage msg = NS_EVENT_NULL;
EventMessage msg = eVoidEvent;
switch (ae->Action()) {
case AndroidMotionEvent::ACTION_MAGNIFY_START:

View File

@ -1323,7 +1323,7 @@ NativeKey::HandleAppCommandMessage() const
// supported.
if (!consumed) {
uint32_t appCommand = GET_APPCOMMAND_LPARAM(mMsg.lParam);
EventMessage contentCommandMessage = NS_EVENT_NULL;
EventMessage contentCommandMessage = eVoidEvent;
switch (appCommand) {
case APPCOMMAND_BROWSER_BACKWARD:
case APPCOMMAND_BROWSER_FORWARD:

View File

@ -6507,7 +6507,7 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
}
// Other gestures translate into simple gesture events:
WidgetSimpleGestureEvent event(true, NS_EVENT_NULL, this);
WidgetSimpleGestureEvent event(true, eVoidEvent, this);
if ( !mGesture.ProcessGestureMessage(mWnd, wParam, lParam, event) ) {
return false; // fall through to DefWndProc
}