[Bug 857884] Use dom::EventTarget more instead of nsIDOMEventTarget Part 6 r=Ms2ger

This commit is contained in:
David Zbarsky 2013-04-19 18:18:33 -04:00
Родитель dd6ace641b
Коммит b1ad5f5a1f
45 изменённых файлов: 115 добавлений и 189 удалений

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

@ -25,7 +25,6 @@
#include "nsIContentViewer.h"
#include "nsIDOMDocument.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMWindow.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebNavigation.h"
@ -33,6 +32,7 @@
using namespace mozilla;
using namespace mozilla::a11y;
using namespace mozilla::dom;
////////////////////////////////////////////////////////////////////////////////
// DocManager
@ -326,8 +326,8 @@ void
DocManager::AddListeners(nsIDocument* aDocument,
bool aAddDOMContentLoadedListener)
{
nsPIDOMWindow *window = aDocument->GetWindow();
nsIDOMEventTarget *target = window->GetChromeEventHandler();
nsPIDOMWindow* window = aDocument->GetWindow();
EventTarget* target = window->GetChromeEventHandler();
nsEventListenerManager* elm = target->GetListenerManager(true);
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
dom::TrustedEventsAtCapture());
@ -354,7 +354,7 @@ DocManager::RemoveListeners(nsIDocument* aDocument)
if (!window)
return;
nsIDOMEventTarget* target = window->GetChromeEventHandler();
EventTarget* target = window->GetChromeEventHandler();
nsEventListenerManager* elm = target->GetListenerManager(true);
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
dom::TrustedEventsAtCapture());

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

@ -1099,10 +1099,10 @@ WebSocket::UpdateMustKeepAlive()
if (mKeepingAlive && !shouldKeepAlive) {
mKeepingAlive = false;
static_cast<nsIDOMEventTarget*>(this)->Release();
static_cast<EventTarget*>(this)->Release();
} else if (!mKeepingAlive && shouldKeepAlive) {
mKeepingAlive = true;
static_cast<nsIDOMEventTarget*>(this)->AddRef();
static_cast<EventTarget*>(this)->AddRef();
}
}
@ -1112,7 +1112,7 @@ WebSocket::DontKeepAliveAnyMore()
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
if (mKeepingAlive) {
mKeepingAlive = false;
static_cast<nsIDOMEventTarget*>(this)->Release();
static_cast<EventTarget*>(this)->Release();
}
mCheckMustKeepAlive = false;
}

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

@ -135,7 +135,7 @@ MarkMessageManagers()
static_cast<nsFrameMessageManager*>(tabMM)->GetCallback();
if (cb) {
nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
nsIDOMEventTarget* et = fl->GetTabChildGlobalAsEventTarget();
EventTarget* et = fl->GetTabChildGlobalAsEventTarget();
if (!et) {
continue;
}

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

@ -95,7 +95,7 @@ void
nsDOMFileReader::RootResultArrayBuffer()
{
nsContentUtils::PreserveWrapper(
static_cast<nsIDOMEventTarget*>(
static_cast<EventTarget*>(
static_cast<nsDOMEventTargetHelper*>(this)), this);
}
@ -104,7 +104,7 @@ nsDOMFileReader::RootResultArrayBuffer()
nsDOMFileReader::nsDOMFileReader()
: mFileData(nullptr),
mDataLen(0), mDataFormat(FILE_AS_BINARY),
mResultArrayBuffer(nullptr)
mResultArrayBuffer(nullptr)
{
nsLayoutStatics::AddRef();
SetDOMStringToNull(mResult);

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

@ -246,10 +246,9 @@ nsInProcessTabChildGlobal::DelayedDisconnect()
if (mListenerManager) {
mListenerManager->Disconnect();
}
if (!mLoadingScript) {
nsContentUtils::ReleaseWrapper(static_cast<nsIDOMEventTarget*>(this),
this);
nsContentUtils::ReleaseWrapper(static_cast<EventTarget*>(this), this);
if (mCx) {
DestroyCx();
}
@ -309,8 +308,7 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
id.AppendLiteral("?ownedBy=");
id.Append(u);
}
nsISupports* scopeSupports =
NS_ISUPPORTS_CAST(nsIDOMEventTarget*, this);
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(EventTarget*, this);
NS_ENSURE_STATE(InitTabChildGlobalInternal(scopeSupports, id));
return NS_OK;
}

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

@ -460,7 +460,7 @@ nsDOMEvent::StopImmediatePropagation()
static nsIDocument* GetDocumentForReport(nsEvent* aEvent)
{
nsIDOMEventTarget* target = aEvent->currentTarget;
EventTarget* target = aEvent->currentTarget;
if (nsCOMPtr<nsINode> node = do_QueryInterface(target)) {
return node->OwnerDoc();
}

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

@ -14,6 +14,7 @@
#include "mozilla/dom/Touch.h"
using namespace mozilla;
using namespace mozilla::dom;
// TouchList
nsDOMTouchList::nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
@ -195,7 +196,7 @@ nsDOMTouchEvent::GetTargetTouches(nsIDOMTouchList** aTargetTouches)
// touch that is ending
if ((mEvent->message != NS_TOUCH_END &&
mEvent->message != NS_TOUCH_CANCEL) || !touches[i]->mChanged) {
nsIDOMEventTarget* targetPtr = touches[i]->GetTarget();
EventTarget* targetPtr = touches[i]->GetTarget();
if (targetPtr == mEvent->originalTarget) {
targetTouches.AppendElement(touches[i]);
}

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

@ -2785,7 +2785,7 @@ IsLTR(Element* aElement)
}
bool
HTMLInputElement::ShouldPreventDOMActivateDispatch(nsIDOMEventTarget* aOriginalTarget)
HTMLInputElement::ShouldPreventDOMActivateDispatch(EventTarget* aOriginalTarget)
{
/*
* For the moment, there is only one situation where we actually want to

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

@ -1070,7 +1070,7 @@ protected:
* This is used in situations where the anonymous subtree should already have
* sent a DOMActivate and prevents firing more than once.
*/
bool ShouldPreventDOMActivateDispatch(nsIDOMEventTarget* aOriginalTarget);
bool ShouldPreventDOMActivateDispatch(EventTarget* aOriginalTarget);
nsCOMPtr<nsIControllers> mControllers;

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

@ -78,7 +78,7 @@ nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt, bool *aRetVal)
{
nsEventStatus status = nsEventStatus_eIgnore;
nsresult rv = nsEventDispatcher::DispatchDOMEvent(
static_cast<nsIDOMEventTarget*>(this), nullptr, aEvt, nullptr, &status);
static_cast<EventTarget*>(this), nullptr, aEvt, nullptr, &status);
*aRetVal = (status != nsEventStatus_eConsumeNoDefault);
return rv;
}
@ -89,7 +89,7 @@ nsWindowRoot::DispatchDOMEvent(nsEvent* aEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
return nsEventDispatcher::DispatchDOMEvent(static_cast<nsIDOMEventTarget*>(this),
return nsEventDispatcher::DispatchDOMEvent(static_cast<EventTarget*>(this),
aEvent, aDOMEvent,
aPresContext, aEventStatus);
}
@ -149,7 +149,7 @@ nsWindowRoot::GetListenerManager(bool aCreateIfNotFound)
{
if (!mListenerManager && aCreateIfNotFound) {
mListenerManager =
new nsEventListenerManager(static_cast<nsIDOMEventTarget*>(this));
new nsEventListenerManager(static_cast<EventTarget*>(this));
}
return mListenerManager;

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

@ -41,23 +41,16 @@ public:
void Notify(const BluetoothSignal& aParam);
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<BluetoothAdapter*>(this));
}
nsISupports*
ToISupports() const
ToISupports()
{
return ToIDOMEventTarget();
return static_cast<EventTarget*>(this);
}
void Unroot();
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue);
private:
BluetoothAdapter(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
~BluetoothAdapter();

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

@ -42,17 +42,10 @@ public:
void Notify(const BluetoothSignal& aParam);
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<BluetoothDevice*>(this));
}
nsISupports*
ToISupports() const
ToISupports()
{
return ToIDOMEventTarget();
return static_cast<EventTarget*>(this);
}
void SetPropertyByValue(const BluetoothNamedValue& aValue);
@ -63,7 +56,7 @@ private:
const BluetoothValue& aValue);
~BluetoothDevice();
void Root();
JSObject* mJsUuids;
JSObject* mJsServices;

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

@ -181,7 +181,7 @@ IccManager::NotifyStkCommand(const nsAString& aMessage)
nsRefPtr<StkCommandEvent> event = StkCommandEvent::Create(this, aMessage);
NS_ASSERTION(event, "This should never fail!");
return event->Dispatch(ToIDOMEventTarget(), NS_LITERAL_STRING("stkcommand"));
return event->Dispatch(this, NS_LITERAL_STRING("stkcommand"));
}
NS_IMETHODIMP

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

@ -40,13 +40,6 @@ public:
private:
nsCOMPtr<nsIIccProvider> mProvider;
nsRefPtr<Listener> mListener;
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<IccManager*>(this));
}
};
} // namespace icc

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

@ -24,10 +24,10 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(StkCommandEvent, nsDOMEvent)
static already_AddRefed<StkCommandEvent>
Create(mozilla::dom::EventTarget* aOwner, const nsAString& aMessage);
Create(EventTarget* aOwner, const nsAString& aMessage);
nsresult
Dispatch(nsIDOMEventTarget* aTarget, const nsAString& aEventType)
Dispatch(EventTarget* aTarget, const nsAString& aEventType)
{
NS_ASSERTION(aTarget, "Null pointer!");
NS_ASSERTION(!aEventType.IsEmpty(), "Empty event type!");

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

@ -102,7 +102,7 @@ HelperBase::~HelperBase()
NS_WARN_IF_FALSE(mainThread, "Couldn't get the main thread!");
if (mainThread) {
NS_ProxyRelease(mainThread, static_cast<nsIDOMEventTarget*>(request));
NS_ProxyRelease(mainThread, static_cast<EventTarget*>(request));
}
}
}

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

@ -25,6 +25,7 @@
#include <algorithm>
using namespace mozilla;
using namespace mozilla::dom;
USING_INDEXEDDB_NAMESPACE
USING_QUOTA_NAMESPACE
@ -2247,7 +2248,7 @@ OpenDatabaseHelper::GetSuccessResult(JSContext* aCx,
NS_ENSURE_SUCCESS(rv, rv);
}
return WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMEventTarget*, mDatabase),
return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, mDatabase),
aVal);
}
@ -2382,7 +2383,7 @@ SetVersionHelper::GetSuccessResult(JSContext* aCx,
mOpenRequest->SetTransaction(mTransaction);
return WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMEventTarget*, mDatabase),
return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, mDatabase),
aVal);
}

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

@ -1296,7 +1296,7 @@ IPCOpenDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsresult
IPCOpenDatabaseHelper::GetSuccessResult(JSContext* aCx, jsval* aVal)
{
return WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMEventTarget*, mDatabase),
return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, mDatabase),
aVal);
}
@ -1335,7 +1335,7 @@ IPCSetVersionHelper::GetSuccessResult(JSContext* aCx, jsval* aVal)
{
mOpenRequest->SetTransaction(mTransaction);
return WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMEventTarget*, mDatabase),
return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, mDatabase),
aVal);
}

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

@ -257,22 +257,20 @@ IndexedDBDatabaseParent::SetOpenRequest(IDBOpenDBRequest* aRequest)
MOZ_ASSERT(aRequest);
MOZ_ASSERT(!mOpenRequest);
nsIDOMEventTarget* target = static_cast<nsIDOMEventTarget*>(aRequest);
nsresult rv = target->AddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR),
mEventListener, false);
nsresult rv = aRequest->EventTarget::AddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR),
mEventListener, false);
NS_ENSURE_SUCCESS(rv, rv);
rv = target->AddEventListener(NS_LITERAL_STRING(ERROR_EVT_STR),
mEventListener, false);
rv = aRequest->EventTarget::AddEventListener(NS_LITERAL_STRING(ERROR_EVT_STR),
mEventListener, false);
NS_ENSURE_SUCCESS(rv, rv);
rv = target->AddEventListener(NS_LITERAL_STRING(BLOCKED_EVT_STR),
mEventListener, false);
rv = aRequest->EventTarget::AddEventListener(NS_LITERAL_STRING(BLOCKED_EVT_STR),
mEventListener, false);
NS_ENSURE_SUCCESS(rv, rv);
rv = target->AddEventListener(NS_LITERAL_STRING(UPGRADENEEDED_EVT_STR),
mEventListener, false);
rv = aRequest->EventTarget::AddEventListener(NS_LITERAL_STRING(UPGRADENEEDED_EVT_STR),
mEventListener, false);
NS_ENSURE_SUCCESS(rv, rv);
mOpenRequest = aRequest;
@ -296,7 +294,7 @@ IndexedDBDatabaseParent::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<EventTarget> target = aEvent->InternalDOMEvent()->GetTarget();
if (mDatabase &&
SameCOMIdentity(target, NS_ISUPPORTS_CAST(nsIDOMEventTarget*,
SameCOMIdentity(target, NS_ISUPPORTS_CAST(EventTarget*,
mDatabase))) {
rv = HandleDatabaseEvent(aEvent, type);
NS_ENSURE_SUCCESS(rv, rv);
@ -305,7 +303,7 @@ IndexedDBDatabaseParent::HandleEvent(nsIDOMEvent* aEvent)
}
if (mOpenRequest &&
SameCOMIdentity(target, NS_ISUPPORTS_CAST(nsIDOMEventTarget*,
SameCOMIdentity(target, NS_ISUPPORTS_CAST(EventTarget*,
mOpenRequest))) {
rv = HandleRequestEvent(aEvent, type);
NS_ENSURE_SUCCESS(rv, rv);
@ -438,8 +436,8 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
nsRefPtr<IDBOpenDBRequest> request;
mOpenRequest.swap(request);
nsIDOMEventTarget* target =
static_cast<nsIDOMEventTarget*>(databaseConcrete);
EventTarget* target =
static_cast<EventTarget*>(databaseConcrete);
#ifdef DEBUG
{
@ -672,7 +670,7 @@ IndexedDBTransactionParent::SetTransaction(IDBTransaction* aTransaction)
MOZ_ASSERT(aTransaction);
MOZ_ASSERT(!mTransaction);
nsIDOMEventTarget* target = static_cast<nsIDOMEventTarget*>(aTransaction);
EventTarget* target = static_cast<EventTarget*>(aTransaction);
NS_NAMED_LITERAL_STRING(complete, COMPLETE_EVT_STR);
nsresult rv = target->AddEventListener(complete, mEventListener, false);
@ -714,7 +712,7 @@ IndexedDBTransactionParent::HandleEvent(nsIDOMEvent* aEvent)
#ifdef DEBUG
{
nsCOMPtr<EventTarget> target = aEvent->InternalDOMEvent()->GetTarget();
MOZ_ASSERT(SameCOMIdentity(target, NS_ISUPPORTS_CAST(nsIDOMEventTarget*,
MOZ_ASSERT(SameCOMIdentity(target, NS_ISUPPORTS_CAST(EventTarget*,
mTransaction)));
}
#endif
@ -2180,7 +2178,7 @@ IndexedDBDeleteDatabaseRequestParent::SetOpenRequest(
MOZ_ASSERT(aOpenRequest);
MOZ_ASSERT(!mOpenRequest);
nsIDOMEventTarget* target = static_cast<nsIDOMEventTarget*>(aOpenRequest);
EventTarget* target = static_cast<EventTarget*>(aOpenRequest);
nsresult rv = target->AddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR),
mEventListener, false);

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

@ -1418,7 +1418,7 @@ TabChild::DispatchMessageManagerMessage(const nsAString& aMessageName,
// content manipulate the frame state.
nsRefPtr<nsFrameMessageManager> mm =
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
mm->ReceiveMessage(static_cast<nsIDOMEventTarget*>(mTabChildGlobal),
mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal),
aMessageName, false, &cloneData, nullptr, nullptr);
}
@ -1956,7 +1956,7 @@ TabChild::RecvAsyncMessage(const nsString& aMessage,
StructuredCloneData cloneData = UnpackClonedMessageDataForChild(aData);
nsRefPtr<nsFrameMessageManager> mm =
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
mm->ReceiveMessage(static_cast<nsIDOMEventTarget*>(mTabChildGlobal),
mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal),
aMessage, false, &cloneData, nullptr, nullptr);
}
return true;
@ -2054,7 +2054,7 @@ TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
nsRefPtr<TabChildGlobal> scope = new TabChildGlobal(this);
mTabChildGlobal = scope;
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(nsIDOMEventTarget*, scope);
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(EventTarget*, scope);
NS_NAMED_LITERAL_CSTRING(globalId, "outOfProcessTabChildGlobal");
NS_ENSURE_TRUE(InitTabChildGlobalInternal(scopeSupports, globalId), false);

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

@ -51,13 +51,6 @@ private:
nsCOMPtr<nsIMobileConnectionProvider> mProvider;
nsRefPtr<Listener> mListener;
nsRefPtr<icc::IccManager> mIccManager;
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<MobileConnection*>(this));
}
};
} // namespace network

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

@ -21,6 +21,7 @@
#include "nsIPermissionManager.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace hal;
#undef near
@ -217,8 +218,8 @@ nsDeviceSensors::Notify(const mozilla::hal::SensorData& aSensorData)
if (domdoc) {
nsCOMPtr<mozilla::dom::EventTarget> target = do_QueryInterface(windowListeners[i]);
if (type == nsIDeviceSensorData::TYPE_ACCELERATION ||
type == nsIDeviceSensorData::TYPE_LINEAR_ACCELERATION ||
if (type == nsIDeviceSensorData::TYPE_ACCELERATION ||
type == nsIDeviceSensorData::TYPE_LINEAR_ACCELERATION ||
type == nsIDeviceSensorData::TYPE_GYROSCOPE)
FireDOMMotionEvent(domdoc, target, type, x, y, z);
else if (type == nsIDeviceSensorData::TYPE_ORIENTATION)
@ -305,8 +306,8 @@ nsDeviceSensors::FireDOMUserProximityEvent(mozilla::dom::EventTarget* aTarget,
}
void
nsDeviceSensors::FireDOMOrientationEvent(nsIDOMDocument *domdoc,
nsIDOMEventTarget *target,
nsDeviceSensors::FireDOMOrientationEvent(nsIDOMDocument* domdoc,
EventTarget* target,
double alpha,
double beta,
double gamma)
@ -330,18 +331,19 @@ nsDeviceSensors::FireDOMOrientationEvent(nsIDOMDocument *domdoc,
true);
event->SetTrusted(true);
target->DispatchEvent(event, &defaultActionEnabled);
}
void
nsDeviceSensors::FireDOMMotionEvent(nsIDOMDocument *domdoc,
nsIDOMEventTarget *target,
uint32_t type,
double x,
double y,
double z) {
EventTarget* target,
uint32_t type,
double x,
double y,
double z)
{
// Attempt to coalesce events
bool fireEvent = TimeStamp::Now() > mLastDOMMotionEventTime + TimeDuration::FromMilliseconds(DEFAULT_SENSOR_POLL);

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

@ -29,6 +29,12 @@
class nsIDOMWindow;
namespace mozilla {
namespace dom {
class EventTarget;
}
}
class nsDeviceSensors : public nsIDeviceSensors, public mozilla::hal::ISensorObserver
{
public:
@ -56,14 +62,14 @@ private:
void FireDOMUserProximityEvent(mozilla::dom::EventTarget* aTarget,
bool aNear);
void FireDOMOrientationEvent(class nsIDOMDocument *domDoc,
class nsIDOMEventTarget *target,
void FireDOMOrientationEvent(class nsIDOMDocument *domDoc,
mozilla::dom::EventTarget* target,
double alpha,
double beta,
double gamma);
void FireDOMMotionEvent(class nsIDOMDocument *domDoc,
class nsIDOMEventTarget *target,
void FireDOMMotionEvent(class nsIDOMDocument *domDoc,
mozilla::dom::EventTarget* target,
uint32_t type,
double x,
double y,

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

@ -55,17 +55,10 @@ public:
static already_AddRefed<Telephony>
Create(nsPIDOMWindow* aOwner, nsITelephonyProvider* aProvider);
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<Telephony*>(this));
}
nsISupports*
ToISupports() const
ToISupports()
{
return ToIDOMEventTarget();
return static_cast<EventTarget*>(this);
}
void

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

@ -40,17 +40,10 @@ public:
Create(Telephony* aTelephony, const nsAString& aNumber, uint16_t aCallState,
uint32_t aCallIndex = kOutgoingPlaceholderCallIndex);
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<TelephonyCall*>(this));
}
nsISupports*
ToISupports() const
ToISupports()
{
return ToIDOMEventTarget();
return static_cast<EventTarget*>(this);
}
void

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

@ -27,7 +27,6 @@
#include "nsWeakReference.h"
#include "nsIWebBrowser.h"
#include "nsIObserverService.h"
#include "nsIDOMEventTarget.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMCompositionListener.h"
@ -77,7 +76,7 @@ public:
private:
nsresult Init(void);
void RemoveWindowListeners(nsIDOMWindow *aDOMWin);
void GetChromeEventHandler(nsIDOMWindow *aDOMWin, nsIDOMEventTarget **aChromeTarget);
EventTarget* GetChromeEventHandler(nsIDOMWindow *aDOMWin);
void AttachWindowListeners(nsIDOMWindow *aDOMWin);
bool IsXULNode(nsIDOMNode *aNode, uint32_t *aType = 0);
nsresult GetDOMWindowByNode(nsIDOMNode *aNode, nsIDOMWindow * *aDOMWindow);
@ -128,10 +127,10 @@ nsWidgetUtils::UpdateFromEvent(nsIDOMEvent *aDOMEvent)
nsCOMPtr<nsIDOMNode> mOrigNode;
uint32_t type = 0;
nsDOMEvent* event = aDOMEvent->InternalDOMEvent();
bool isXul = false;
{
nsCOMPtr<nsIDOMEventTarget> eventOrigTarget;
aDOMEvent->GetOriginalTarget(getter_AddRefs(eventOrigTarget));
nsCOMPtr<EventTarget> eventOrigTarget = event->GetOriginalTarget();
if (eventOrigTarget)
mOrigNode = do_QueryInterface(eventOrigTarget);
isXul = IsXULNode(mOrigNode, &type);
@ -140,8 +139,7 @@ nsWidgetUtils::UpdateFromEvent(nsIDOMEvent *aDOMEvent)
if (isXul)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMEventTarget> eventTarget;
aDOMEvent->GetTarget(getter_AddRefs(eventTarget));
nsCOMPtr<EventTarget> eventTarget = event->GetTarget();
if (eventTarget)
mNode = do_QueryInterface(eventTarget);
@ -364,25 +362,18 @@ nsWidgetUtils::GetDOMWindowByNode(nsIDOMNode* aNode, nsIDOMWindow** aDOMWindow)
return rv;
}
void
nsWidgetUtils::GetChromeEventHandler(nsIDOMWindow *aDOMWin,
nsIDOMEventTarget **aChromeTarget)
EventTarget*
nsWidgetUtils::GetChromeEventHandler(nsIDOMWindow* aDOMWin)
{
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aDOMWin));
nsIDOMEventTarget* chromeEventHandler = nullptr;
if (privateDOMWindow) {
chromeEventHandler = privateDOMWindow->GetChromeEventHandler();
}
NS_IF_ADDREF(*aChromeTarget = chromeEventHandler);
nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_QueryInterface(aDOMWin);
return privateDOMWindow ? privateDOMWindow->GetChromeEventHandler() : nullptr;
}
void
nsWidgetUtils::RemoveWindowListeners(nsIDOMWindow *aDOMWin)
{
nsresult rv;
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
GetChromeEventHandler(aDOMWin, getter_AddRefs(chromeEventHandler));
EventTarget* chromeEventHandler = GetChromeEventHandler(aDOMWin);
if (!chromeEventHandler) {
return;
}
@ -402,8 +393,7 @@ void
nsWidgetUtils::AttachWindowListeners(nsIDOMWindow *aDOMWin)
{
nsresult rv;
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
GetChromeEventHandler(aDOMWin, getter_AddRefs(chromeEventHandler));
EventHandler* chromeEventHandler = GetChromeEventHandler(aDOMWin);
if (!chromeEventHandler) {
return;
}

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

@ -56,7 +56,6 @@
#include "nsStyleStructInlines.h"
#include "nsIAppShell.h"
#include "prenv.h"
#include "nsIDOMEventTarget.h"
#include "nsObjectFrame.h"
#include "nsTransitionManager.h"
#include "nsAnimationManager.h"
@ -2136,7 +2135,7 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow)
if (aInnerWindow->HasPaintEventListeners())
return true;
nsIDOMEventTarget* parentTarget = aInnerWindow->GetParentTarget();
EventTarget* parentTarget = aInnerWindow->GetParentTarget();
if (!parentTarget)
return false;
@ -2166,7 +2165,7 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow)
return MayHavePaintEventListener(window);
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(parentTarget);
nsIDOMEventTarget* tabChildGlobal;
EventTarget* tabChildGlobal;
return root &&
(tabChildGlobal = root->GetParentTarget()) &&
(manager = tabChildGlobal->GetListenerManager(false)) &&

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

@ -5,7 +5,6 @@
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsComboboxControlFrame.h"
#include "nsIDOMEventTarget.h"
#include "nsFocusManager.h"
#include "nsFormControlFrame.h"
#include "nsFrameManager.h"

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

@ -26,7 +26,6 @@
#include "nsIFilePicker.h"
#include "nsIDOMMouseEvent.h"
#include "nsINodeInfo.h"
#include "nsIDOMEventTarget.h"
#include "nsIFile.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "nsNodeInfoManager.h"

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

@ -22,7 +22,6 @@
#include "nsWidgetsCID.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIDOMEventTarget.h"
#include "nsEventDispatcher.h"
#include "nsEventStateManager.h"
#include "nsEventListenerManager.h"

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

@ -48,7 +48,6 @@
#include "nsBoxLayoutState.h"
#include <algorithm>
//for keylistener for "return" check
#include "nsIDOMEventTarget.h"
#include "nsIDocument.h" //observe documents to send onchangenotifications
#include "nsIStyleSheet.h"//observe documents to send onchangenotifications
#include "nsIStyleRule.h"//observe documents to send onchangenotifications

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

@ -20,7 +20,6 @@
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsIDOMEventTarget.h"
#include "nsIPresShell.h"
#include "nsImageFrame.h"
#include "nsCoord.h"

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

@ -43,7 +43,6 @@
#include "nsIDOMHTMLEmbedElement.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIDOMWindow.h"
#include "nsIDOMEventTarget.h"
#include "nsIDocumentEncoder.h"
#include "nsXPIDLString.h"
#include "nsIDOMRange.h"

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

@ -21,8 +21,6 @@
#include "nsIDOMElement.h"
#include "nsTextFragment.h"
#include "nsIDOMEventTarget.h"
#include "nsMathMLmactionFrame.h"
#include "nsAutoPtr.h"
#include "nsStyleSet.h"

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

@ -71,7 +71,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIDocument.h"
// Focus
#include "nsIDOMEventTarget.h"
#include "nsISelectionController.h"
// Misc

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

@ -14,7 +14,6 @@
#include "nsIContent.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"

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

@ -12,7 +12,6 @@
#include "nsCSSRendering.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIDOMEventTarget.h"
#include "nsGkAtoms.h"
#include "nsMenuFrame.h"
#include "nsMenuPopupFrame.h"

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

@ -116,7 +116,7 @@ protected:
// be null if no menu is active.
nsMenuFrame* mCurrentMenu;
nsIDOMEventTarget* mTarget;
mozilla::dom::EventTarget* mTarget;
}; // class nsMenuBarFrame

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

@ -6,7 +6,6 @@
#define nsMenuBarListener_h__
#include "nsIDOMEventListener.h"
#include "nsIDOMEventTarget.h"
// X.h defines KeyPress
#ifdef KeyPress

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

@ -15,7 +15,6 @@
#include "nsGkAtoms.h"
#include "nsCOMPtr.h"
#include "nsMenuFrame.h"
#include "nsIDOMEventTarget.h"
#include "nsBoxFrame.h"
#include "nsMenuParent.h"

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

@ -21,7 +21,6 @@
#include "nsIPresShell.h"
#include "nsCSSRendering.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMMouseEvent.h"
#include "nsScrollbarButtonFrame.h"
#include "nsISliderListener.h"

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

@ -19,7 +19,6 @@
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsScrollbarButtonFrame.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMMouseEvent.h"
#include "nsIPresShell.h"

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

@ -7,7 +7,6 @@
#include "nsDOMEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIDocument.h"

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

@ -17,7 +17,6 @@
#include "nsPIDOMWindow.h"
#include "nsIWebNavigation.h"
#include "nsIContentViewer.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
@ -35,6 +34,9 @@
#include "nsIDOMNSEditableElement.h"
#include "mozilla/dom/Element.h"
#include "nsContentUtils.h"
#include "nsDOMEvent.h"
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS5(nsFormFillController,
nsIFormFillController,
@ -543,7 +545,7 @@ nsFormFillController::OnTextEntered(bool* aPrevent)
// code.
event->SetTrusted(true);
nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(mFocusedInput);
nsCOMPtr<EventTarget> targ = do_QueryInterface(mFocusedInput);
bool defaultActionEnabled;
targ->DispatchEvent(event, &defaultActionEnabled);
@ -755,21 +757,17 @@ nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
if (type.EqualsLiteral("pagehide")) {
nsCOMPtr<nsIDOMEventTarget> target;
aEvent->GetTarget(getter_AddRefs(target));
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(target);
if (!domDoc)
nsCOMPtr<nsIDocument> doc = do_QueryInterface(
aEvent->InternalDOMEvent()->GetTarget());
if (!doc)
return NS_OK;
if (mFocusedInput) {
nsCOMPtr<nsIDOMDocument> inputDoc;
mFocusedInput->GetOwnerDocument(getter_AddRefs(inputDoc));
if (domDoc == inputDoc)
if (doc == mFocusedInputNode->OwnerDoc())
StopControllingInput();
}
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
PwmgrInputsEnumData ed(this, doc);
mPwmgrInputs.Enumerate(RemoveForDocumentEnumerator, &ed);
}
@ -797,11 +795,9 @@ nsFormFillController::RemoveForDocumentEnumerator(const nsINode* aKey,
nsresult
nsFormFillController::Focus(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMEventTarget> target;
aEvent->GetTarget(getter_AddRefs(target));
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(target);
nsCOMPtr<nsINode> inputNode = do_QueryInterface(input);
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(
aEvent->InternalDOMEvent()->GetTarget());
nsCOMPtr<nsINode> inputNode = do_QueryInterface(input);
if (!inputNode)
return NS_OK;
@ -909,9 +905,8 @@ nsFormFillController::MouseDown(nsIDOMEvent* aEvent)
if (!mouseEvent)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMEventTarget> target;
aEvent->GetTarget(getter_AddRefs(target));
nsCOMPtr<nsIDOMHTMLInputElement> targetInput = do_QueryInterface(target);
nsCOMPtr<nsIDOMHTMLInputElement> targetInput = do_QueryInterface(
aEvent->InternalDOMEvent()->GetTarget());
if (!targetInput)
return NS_OK;
@ -956,7 +951,7 @@ nsFormFillController::AddWindowListeners(nsIDOMWindow *aWindow)
return;
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
nsIDOMEventTarget* target = nullptr;
EventTarget* target = nullptr;
if (privateDOMWindow)
target = privateDOMWindow->GetChromeEventHandler();
@ -999,7 +994,7 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
mPwmgrInputs.Enumerate(RemoveForDocumentEnumerator, &ed);
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
nsIDOMEventTarget* target = nullptr;
EventTarget* target = nullptr;
if (privateDOMWindow)
target = privateDOMWindow->GetChromeEventHandler();
@ -1019,25 +1014,19 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
}
void
nsFormFillController::AddKeyListener(nsIDOMHTMLInputElement *aInput)
nsFormFillController::AddKeyListener(nsINode* aInput)
{
if (!aInput)
return;
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aInput);
target->AddEventListener(NS_LITERAL_STRING("keypress"), this,
aInput->AddEventListener(NS_LITERAL_STRING("keypress"), this,
true, false);
}
void
nsFormFillController::RemoveKeyListener()
{
if (!mFocusedInput)
if (!mFocusedInputNode)
return;
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFocusedInput);
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, true);
mFocusedInputNode->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, true);
}
void
@ -1060,8 +1049,8 @@ nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
return;
}
AddKeyListener(aInput);
AddKeyListener(node);
node->AddMutationObserverUnlessExists(this);
mFocusedInputNode = node;
mFocusedInput = aInput;

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

@ -54,7 +54,7 @@ protected:
void AddWindowListeners(nsIDOMWindow *aWindow);
void RemoveWindowListeners(nsIDOMWindow *aWindow);
void AddKeyListener(nsIDOMHTMLInputElement *aInput);
void AddKeyListener(nsINode* aInput);
void RemoveKeyListener();
void StartControllingInput(nsIDOMHTMLInputElement *aInput);