Bug 1455052 part 2. Switch async event dispatcher to working with Event, not nsIDOMEvent. r=masayuki

MozReview-Commit-ID: By3duB2tPpl
This commit is contained in:
Boris Zbarsky 2018-04-20 12:53:17 -04:00
parent f1e26dcba7
commit d7e78873a0
3 changed files with 9 additions and 9 deletions

View File

@ -7,10 +7,9 @@
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTarget.h"
#include "nsContentUtils.h"
#include "nsIDOMEvent.h"
namespace mozilla {
@ -56,7 +55,7 @@ AsyncEventDispatcher::Run()
false /* aCancelable */, nullptr /* aDefaultAction */,
mOnlyChromeDispatch);
}
RefPtr<Event> event = mEvent ? mEvent->InternalDOMEvent() : nullptr;
RefPtr<Event> event = mEvent;
if (!event) {
event = NS_NewDOMEvent(mTarget, nullptr, nullptr);
event->InitEvent(mEventType, mBubbles, false);

View File

@ -8,9 +8,10 @@
#define mozilla_AsyncEventDispatcher_h_
#include "mozilla/Attributes.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/Event.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "nsIDOMEvent.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -88,7 +89,7 @@ public:
MOZ_ASSERT(mEventMessage != eUnidentifiedEvent);
}
AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent)
AsyncEventDispatcher(dom::EventTarget* aTarget, dom::Event* aEvent)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEvent(aEvent)
@ -109,7 +110,7 @@ public:
void RequireNodeInDocument();
nsCOMPtr<dom::EventTarget> mTarget;
nsCOMPtr<nsIDOMEvent> mEvent;
RefPtr<dom::Event> mEvent;
// If mEventType is set, mEventMessage will be eUnidentifiedEvent.
// If mEventMessage is set, mEventType will be void.
// They can never both be set at the same time.
@ -136,7 +137,7 @@ public:
}
}
LoadBlockingAsyncEventDispatcher(nsINode* aEventNode, nsIDOMEvent* aEvent)
LoadBlockingAsyncEventDispatcher(nsINode* aEventNode, dom::Event* aEvent)
: AsyncEventDispatcher(aEventNode, aEvent)
, mBlockedDoc(aEventNode->OwnerDoc())
{

View File

@ -621,7 +621,7 @@ PresentationConnection::DispatchConnectionCloseEvent(
}
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(this, static_cast<Event*>(closedEvent));
new AsyncEventDispatcher(this, closedEvent);
return asyncDispatcher->PostDOMEvent();
}
@ -650,7 +650,7 @@ PresentationConnection::DispatchMessageEvent(JS::Handle<JS::Value> aData)
messageEvent->SetTrusted(true);
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(this, static_cast<Event*>(messageEvent));
new AsyncEventDispatcher(this, messageEvent);
return asyncDispatcher->PostDOMEvent();
}