зеркало из https://github.com/mozilla/gecko-dev.git
Bug 981261 part.1 Rename nsEventListener(Service|Info) to mozilla::EventListener(Service|Info) r=smaug
--HG-- rename : dom/events/nsEventListenerService.cpp => dom/events/EventListenerService.cpp rename : dom/events/nsEventListenerService.h => dom/events/EventListenerService.h
This commit is contained in:
Родитель
07d954a9e8
Коммит
b7cb239a24
|
@ -2,82 +2,91 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "nsEventListenerService.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
|
||||
#include "EventListenerService.h"
|
||||
#ifdef MOZ_JSDEBUGGER
|
||||
#include "jsdIDebuggerService.h"
|
||||
#endif
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::AutoSafeJSContext;
|
||||
DOMCI_DATA(EventListenerInfo, mozilla::EventListenerInfo)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsEventListenerInfo, mListener)
|
||||
namespace mozilla {
|
||||
|
||||
DOMCI_DATA(EventListenerInfo, nsEventListenerInfo)
|
||||
using namespace dom;
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventListenerInfo)
|
||||
/******************************************************************************
|
||||
* mozilla::EventListenerInfo
|
||||
******************************************************************************/
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(EventListenerInfo, mListener)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EventListenerInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEventListenerInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(EventListenerInfo)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsEventListenerInfo)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsEventListenerInfo)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(EventListenerInfo)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(EventListenerInfo)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::GetType(nsAString& aType)
|
||||
EventListenerInfo::GetType(nsAString& aType)
|
||||
{
|
||||
aType = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::GetCapturing(bool* aCapturing)
|
||||
EventListenerInfo::GetCapturing(bool* aCapturing)
|
||||
{
|
||||
*aCapturing = mCapturing;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::GetAllowsUntrusted(bool* aAllowsUntrusted)
|
||||
EventListenerInfo::GetAllowsUntrusted(bool* aAllowsUntrusted)
|
||||
{
|
||||
*aAllowsUntrusted = mAllowsUntrusted;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::GetInSystemEventGroup(bool* aInSystemEventGroup)
|
||||
EventListenerInfo::GetInSystemEventGroup(bool* aInSystemEventGroup)
|
||||
{
|
||||
*aInSystemEventGroup = mInSystemEventGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::GetListenerObject(JSContext* aCx,
|
||||
EventListenerInfo::GetListenerObject(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aObject)
|
||||
{
|
||||
mozilla::Maybe<JSAutoCompartment> ac;
|
||||
Maybe<JSAutoCompartment> ac;
|
||||
GetJSVal(aCx, ac, aObject);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsEventListenerService, nsIEventListenerService)
|
||||
/******************************************************************************
|
||||
* mozilla::EventListenerService
|
||||
******************************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS1(EventListenerService, nsIEventListenerService)
|
||||
|
||||
bool
|
||||
nsEventListenerInfo::GetJSVal(JSContext* aCx,
|
||||
mozilla::Maybe<JSAutoCompartment>& aAc,
|
||||
EventListenerInfo::GetJSVal(JSContext* aCx,
|
||||
Maybe<JSAutoCompartment>& aAc,
|
||||
JS::MutableHandle<JS::Value> aJSVal)
|
||||
{
|
||||
aJSVal.setNull();
|
||||
|
@ -105,12 +114,12 @@ nsEventListenerInfo::GetJSVal(JSContext* aCx,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::ToSource(nsAString& aResult)
|
||||
EventListenerInfo::ToSource(nsAString& aResult)
|
||||
{
|
||||
aResult.SetIsVoid(true);
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
mozilla::Maybe<JSAutoCompartment> ac;
|
||||
Maybe<JSAutoCompartment> ac;
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (GetJSVal(cx, ac, &v)) {
|
||||
JSString* str = JS_ValueToSource(cx, v);
|
||||
|
@ -125,7 +134,7 @@ nsEventListenerInfo::ToSource(nsAString& aResult)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
||||
EventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
||||
{
|
||||
*aRetVal = nullptr;
|
||||
|
||||
|
@ -140,7 +149,7 @@ nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
|||
NS_ENSURE_TRUE(isOn, NS_OK);
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
mozilla::Maybe<JSAutoCompartment> ac;
|
||||
Maybe<JSAutoCompartment> ac;
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (GetJSVal(cx, ac, &v)) {
|
||||
nsCOMPtr<jsdIValue> jsdValue;
|
||||
|
@ -154,7 +163,7 @@ nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
|
||||
EventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
|
||||
uint32_t* aCount,
|
||||
nsIEventListenerInfo*** aOutArray)
|
||||
{
|
||||
|
@ -189,7 +198,7 @@ nsEventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
|
||||
EventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
|
||||
uint32_t* aCount,
|
||||
nsIDOMEventTarget*** aOutArray)
|
||||
{
|
||||
|
@ -220,7 +229,7 @@ nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::HasListenersFor(nsIDOMEventTarget* aEventTarget,
|
||||
EventListenerService::HasListenersFor(nsIDOMEventTarget* aEventTarget,
|
||||
const nsAString& aType,
|
||||
bool* aRetVal)
|
||||
{
|
||||
|
@ -233,7 +242,7 @@ nsEventListenerService::HasListenersFor(nsIDOMEventTarget* aEventTarget,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::AddSystemEventListener(nsIDOMEventTarget *aTarget,
|
||||
EventListenerService::AddSystemEventListener(nsIDOMEventTarget *aTarget,
|
||||
const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
|
@ -255,7 +264,7 @@ nsEventListenerService::AddSystemEventListener(nsIDOMEventTarget *aTarget,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::RemoveSystemEventListener(nsIDOMEventTarget *aTarget,
|
||||
EventListenerService::RemoveSystemEventListener(nsIDOMEventTarget *aTarget,
|
||||
const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
|
@ -278,7 +287,7 @@ nsEventListenerService::RemoveSystemEventListener(nsIDOMEventTarget *aTarget,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::AddListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
||||
EventListenerService::AddListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted,
|
||||
|
@ -297,7 +306,7 @@ nsEventListenerService::AddListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventListenerService::RemoveListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
||||
EventListenerService::RemoveListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aSystemEventGroup)
|
||||
|
@ -314,10 +323,12 @@ nsEventListenerService::RemoveListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult
|
||||
NS_NewEventListenerService(nsIEventListenerService** aResult)
|
||||
{
|
||||
*aResult = new nsEventListenerService();
|
||||
*aResult = new mozilla::EventListenerService();
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_EventListenerService_h_
|
||||
#define mozilla_EventListenerService_h_
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
template<typename T>
|
||||
class Maybe;
|
||||
|
||||
class EventListenerInfo MOZ_FINAL : public nsIEventListenerInfo
|
||||
{
|
||||
public:
|
||||
EventListenerInfo(const nsAString& aType,
|
||||
already_AddRefed<nsIDOMEventListener> aListener,
|
||||
bool aCapturing,
|
||||
bool aAllowsUntrusted,
|
||||
bool aInSystemEventGroup)
|
||||
: mType(aType)
|
||||
, mListener(aListener)
|
||||
, mCapturing(aCapturing)
|
||||
, mAllowsUntrusted(aAllowsUntrusted)
|
||||
, mInSystemEventGroup(aInSystemEventGroup)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~EventListenerInfo() {}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(EventListenerInfo)
|
||||
NS_DECL_NSIEVENTLISTENERINFO
|
||||
|
||||
protected:
|
||||
bool GetJSVal(JSContext* aCx,
|
||||
Maybe<JSAutoCompartment>& aAc,
|
||||
JS::MutableHandle<JS::Value> aJSVal);
|
||||
|
||||
nsString mType;
|
||||
// nsReftPtr because that is what nsListenerStruct uses too.
|
||||
nsRefPtr<nsIDOMEventListener> mListener;
|
||||
bool mCapturing;
|
||||
bool mAllowsUntrusted;
|
||||
bool mInSystemEventGroup;
|
||||
};
|
||||
|
||||
class EventListenerService MOZ_FINAL : public nsIEventListenerService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIEVENTLISTENERSERVICE
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_EventListenerService_h_
|
|
@ -77,6 +77,7 @@ UNIFIED_SOURCES += [
|
|||
'DeviceMotionEvent.cpp',
|
||||
'DragEvent.cpp',
|
||||
'Event.cpp',
|
||||
'EventListenerService.cpp',
|
||||
'EventTarget.cpp',
|
||||
'FocusEvent.cpp',
|
||||
'IMEContentObserver.cpp',
|
||||
|
@ -92,7 +93,6 @@ UNIFIED_SOURCES += [
|
|||
'nsDOMEventTargetHelper.cpp',
|
||||
'nsEventDispatcher.cpp',
|
||||
'nsEventListenerManager.cpp',
|
||||
'nsEventListenerService.cpp',
|
||||
'nsJSEventListener.cpp',
|
||||
'nsPaintRequest.cpp',
|
||||
'PointerEvent.cpp',
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "nsJSUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsEventListenerService.h"
|
||||
#include "EventListenerService.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
|
@ -1190,8 +1190,8 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
|||
}
|
||||
// EventListenerInfo is defined in XPCOM, so we have to go ahead
|
||||
// and convert to an XPCOM callback here...
|
||||
nsRefPtr<nsEventListenerInfo> info =
|
||||
new nsEventListenerInfo(eventType, ls.mListener.ToXPCOMCallback(),
|
||||
nsRefPtr<EventListenerInfo> info =
|
||||
new EventListenerInfo(eventType, ls.mListener.ToXPCOMCallback(),
|
||||
ls.mFlags.mCapture,
|
||||
ls.mFlags.mAllowUntrustedEvents,
|
||||
ls.mFlags.mInSystemGroup);
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsEventListenerService_h__
|
||||
#define nsEventListenerService_h__
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
template<typename T>
|
||||
class Maybe;
|
||||
} // namespace mozilla
|
||||
|
||||
class nsEventListenerInfo : public nsIEventListenerInfo
|
||||
{
|
||||
public:
|
||||
nsEventListenerInfo(const nsAString& aType,
|
||||
already_AddRefed<nsIDOMEventListener> aListener,
|
||||
bool aCapturing, bool aAllowsUntrusted,
|
||||
bool aInSystemEventGroup)
|
||||
: mType(aType), mListener(aListener), mCapturing(aCapturing),
|
||||
mAllowsUntrusted(aAllowsUntrusted),
|
||||
mInSystemEventGroup(aInSystemEventGroup) {}
|
||||
virtual ~nsEventListenerInfo() {}
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsEventListenerInfo)
|
||||
NS_DECL_NSIEVENTLISTENERINFO
|
||||
protected:
|
||||
bool GetJSVal(JSContext* aCx, mozilla::Maybe<JSAutoCompartment>& aAc,
|
||||
JS::MutableHandle<JS::Value> aJSVal);
|
||||
|
||||
nsString mType;
|
||||
// nsReftPtr because that is what nsListenerStruct uses too.
|
||||
nsRefPtr<nsIDOMEventListener> mListener;
|
||||
bool mCapturing;
|
||||
bool mAllowsUntrusted;
|
||||
bool mInSystemEventGroup;
|
||||
};
|
||||
|
||||
class nsEventListenerService MOZ_FINAL : public nsIEventListenerService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIEVENTLISTENERSERVICE
|
||||
};
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче