зеркало из https://github.com/mozilla/gecko-dev.git
Bug 981261 part.5 Rename nsEventListenerManager to mozilla::EventListenerManager r=smaug
--HG-- rename : dom/events/nsEventListenerManager.cpp => dom/events/EventListenerManager.cpp rename : dom/events/nsEventListenerManager.h => dom/events/EventListenerManager.h
This commit is contained in:
Родитель
ecf5704455
Коммит
fbf7cdeb19
|
@ -15,12 +15,12 @@
|
|||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsDocShellLoadTypes.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
@ -329,7 +329,7 @@ DocManager::AddListeners(nsIDocument* aDocument,
|
|||
{
|
||||
nsPIDOMWindow* window = aDocument->GetWindow();
|
||||
EventTarget* target = window->GetChromeEventHandler();
|
||||
nsEventListenerManager* elm = target->GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = target->GetOrCreateListenerManager();
|
||||
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
|
||||
TrustedEventsAtCapture());
|
||||
|
||||
|
@ -359,7 +359,7 @@ DocManager::RemoveListeners(nsIDocument* aDocument)
|
|||
if (!target)
|
||||
return;
|
||||
|
||||
nsEventListenerManager* elm = target->GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = target->GetOrCreateListenerManager();
|
||||
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
|
||||
TrustedEventsAtCapture());
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "nsIBoxObject.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
|
@ -24,6 +23,7 @@
|
|||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "nsView.h"
|
||||
|
@ -45,7 +45,7 @@ bool
|
|||
nsCoreUtils::HasClickListener(nsIContent *aContent)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent, false);
|
||||
nsEventListenerManager* listenerManager =
|
||||
EventListenerManager* listenerManager =
|
||||
aContent->GetExistingListenerManager();
|
||||
|
||||
return listenerManager &&
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include "nsCoreUtils.h"
|
||||
#include "nsWinUtils.h"
|
||||
|
||||
#include "nsEventListenerManager.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -45,7 +45,6 @@ class nsIURI;
|
|||
class nsINodeInfo;
|
||||
class nsIControllers;
|
||||
class nsEventChainVisitor;
|
||||
class nsEventListenerManager;
|
||||
class nsIScrollableFrame;
|
||||
class nsAttrValueOrString;
|
||||
class ContentUnbinder;
|
||||
|
@ -103,6 +102,8 @@ enum {
|
|||
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET);
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Link;
|
||||
|
@ -1060,10 +1061,10 @@ protected:
|
|||
}
|
||||
|
||||
/**
|
||||
* Hook to allow subclasses to produce a different nsEventListenerManager if
|
||||
* Hook to allow subclasses to produce a different EventListenerManager if
|
||||
* needed for attachment of attribute-defined handlers
|
||||
*/
|
||||
virtual nsEventListenerManager*
|
||||
virtual EventListenerManager*
|
||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,6 @@ class imgIRequest;
|
|||
class imgLoader;
|
||||
class imgRequestProxy;
|
||||
class nsAutoScriptBlockerSuppressNodeRemoved;
|
||||
class nsEventListenerManager;
|
||||
class nsHtml5StringParser;
|
||||
class nsIChannel;
|
||||
class nsIConsoleService;
|
||||
|
@ -109,6 +108,7 @@ template<class T> class nsReadingIterator;
|
|||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
class EventListenerManager;
|
||||
class Selection;
|
||||
|
||||
namespace dom {
|
||||
|
@ -1074,14 +1074,16 @@ public:
|
|||
*
|
||||
* @param aNode The node for which to get the eventlistener manager.
|
||||
*/
|
||||
static nsEventListenerManager* GetListenerManagerForNode(nsINode* aNode);
|
||||
static mozilla::EventListenerManager*
|
||||
GetListenerManagerForNode(nsINode* aNode);
|
||||
/**
|
||||
* Get the eventlistener manager for aNode, returning null if it does not
|
||||
* already exist.
|
||||
*
|
||||
* @param aNode The node for which to get the eventlistener manager.
|
||||
*/
|
||||
static nsEventListenerManager* GetExistingListenerManagerForNode(const nsINode* aNode);
|
||||
static mozilla::EventListenerManager*
|
||||
GetExistingListenerManagerForNode(const nsINode* aNode);
|
||||
|
||||
static void UnmarkGrayJSListenersInCCGenerationDocuments(uint32_t aGeneration);
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ class nsXPCClassInfo;
|
|||
class nsDOMMutationObserver;
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
namespace dom {
|
||||
/**
|
||||
* @return true if aChar is what the DOM spec defines as 'space character'.
|
||||
|
@ -805,10 +806,10 @@ public:
|
|||
*/
|
||||
NS_DECL_NSIDOMEVENTTARGET
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual nsEventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
|
||||
using mozilla::dom::EventTarget::RemoveEventListener;
|
||||
using nsIDOMEventTarget::AddEventListener;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "nsCOMArray.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsTextNode.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIContentIterator.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -50,6 +49,7 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
@ -1660,8 +1660,8 @@ Element::SetEventHandler(nsIAtom* aEventName,
|
|||
|
||||
NS_PRECONDITION(aEventName, "Must have event name!");
|
||||
bool defer = true;
|
||||
nsEventListenerManager* manager = GetEventListenerManagerForAttr(aEventName,
|
||||
&defer);
|
||||
EventListenerManager* manager =
|
||||
GetEventListenerManagerForAttr(aEventName, &defer);
|
||||
if (!manager) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1971,7 +1971,7 @@ Element::SetMappedAttribute(nsIDocument* aDocument,
|
|||
return false;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
Element::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
bool* aDefer)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "mozilla/dom/FragmentOrElement.h"
|
||||
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/Attr.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -25,7 +26,6 @@
|
|||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIContentIterator.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -1324,7 +1324,7 @@ FragmentOrElement::MarkNodeChildren(nsINode* aNode)
|
|||
JS::ExposeObjectToActiveJS(o);
|
||||
}
|
||||
|
||||
nsEventListenerManager* elm = aNode->GetExistingListenerManager();
|
||||
EventListenerManager* elm = aNode->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->MarkForCC();
|
||||
}
|
||||
|
|
|
@ -21,17 +21,18 @@
|
|||
#include "nsIXULWindow.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsAppShellCID.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsInProcessTabChildGlobal.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsObserverService.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static bool sInited = 0;
|
||||
|
@ -145,7 +146,7 @@ MarkMessageManagers()
|
|||
continue;
|
||||
}
|
||||
static_cast<nsInProcessTabChildGlobal*>(et)->MarkForCC();
|
||||
nsEventListenerManager* elm = et->GetExistingListenerManager();
|
||||
EventListenerManager* elm = et->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->MarkForCC();
|
||||
}
|
||||
|
@ -189,7 +190,7 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
|
|||
doc->GetMarkedCCGeneration() != nsCCUncollectableMarker::sGeneration) {
|
||||
doc->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
|
||||
if (aCleanupJS) {
|
||||
nsEventListenerManager* elm = doc->GetExistingListenerManager();
|
||||
EventListenerManager* elm = doc->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->MarkForCC();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "mozilla/dom/TextDecoder.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/IMEStateManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
@ -74,7 +75,6 @@
|
|||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
@ -269,7 +269,7 @@ public:
|
|||
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
|
||||
nsISupports* aData)
|
||||
{
|
||||
// We don't measure the |nsEventListenerManager| objects pointed to by the
|
||||
// We don't measure the |EventListenerManager| objects pointed to by the
|
||||
// entries because those references are non-owning.
|
||||
int64_t amount = sEventListenerManagersHash.ops
|
||||
? PL_DHashTableSizeOfExcludingThis(
|
||||
|
@ -302,7 +302,7 @@ protected: // declared protected to silence clang warnings
|
|||
const void *mKey; // must be first, to look like PLDHashEntryStub
|
||||
|
||||
public:
|
||||
nsRefPtr<nsEventListenerManager> mListenerManager;
|
||||
nsRefPtr<EventListenerManager> mListenerManager;
|
||||
};
|
||||
|
||||
static bool
|
||||
|
@ -3561,7 +3561,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
|||
|
||||
// global object will be null for documents that don't have windows.
|
||||
nsPIDOMWindow* window = doc->GetInnerWindow();
|
||||
// This relies on nsEventListenerManager::AddEventListener, which sets
|
||||
// This relies on EventListenerManager::AddEventListener, which sets
|
||||
// all mutation bits when there is a listener for DOMSubtreeModified event.
|
||||
if (window && !window->HasMutationListeners(aType)) {
|
||||
return false;
|
||||
|
@ -3578,7 +3578,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
|||
if (aNode->IsInDoc()) {
|
||||
nsCOMPtr<EventTarget> piTarget(do_QueryInterface(window));
|
||||
if (piTarget) {
|
||||
nsEventListenerManager* manager = piTarget->GetExistingListenerManager();
|
||||
EventListenerManager* manager = piTarget->GetExistingListenerManager();
|
||||
if (manager && manager->HasMutationListeners()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -3589,7 +3589,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
|||
// might not be in our chain. If we don't have a window, we might have a
|
||||
// mutation listener. Check quickly to see.
|
||||
while (aNode) {
|
||||
nsEventListenerManager* manager = aNode->GetExistingListenerManager();
|
||||
EventListenerManager* manager = aNode->GetExistingListenerManager();
|
||||
if (manager && manager->HasMutationListeners()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -3616,7 +3616,7 @@ nsContentUtils::HasMutationListeners(nsIDocument* aDocument,
|
|||
nsPIDOMWindow* window = aDocument ?
|
||||
aDocument->GetInnerWindow() : nullptr;
|
||||
|
||||
// This relies on nsEventListenerManager::AddEventListener, which sets
|
||||
// This relies on EventListenerManager::AddEventListener, which sets
|
||||
// all mutation bits when there is a listener for DOMSubtreeModified event.
|
||||
return !window || window->HasMutationListeners(aType);
|
||||
}
|
||||
|
@ -3710,7 +3710,7 @@ nsContentUtils::TraverseListenerManager(nsINode *aNode,
|
|||
}
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsContentUtils::GetListenerManagerForNode(nsINode *aNode)
|
||||
{
|
||||
if (!sEventListenerManagersHash.ops) {
|
||||
|
@ -3730,7 +3730,7 @@ nsContentUtils::GetListenerManagerForNode(nsINode *aNode)
|
|||
}
|
||||
|
||||
if (!entry->mListenerManager) {
|
||||
entry->mListenerManager = new nsEventListenerManager(aNode);
|
||||
entry->mListenerManager = new EventListenerManager(aNode);
|
||||
|
||||
aNode->SetFlags(NODE_HAS_LISTENERMANAGER);
|
||||
}
|
||||
|
@ -3738,7 +3738,7 @@ nsContentUtils::GetListenerManagerForNode(nsINode *aNode)
|
|||
return entry->mListenerManager;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsContentUtils::GetExistingListenerManagerForNode(const nsINode *aNode)
|
||||
{
|
||||
if (!aNode->HasFlag(NODE_HAS_LISTENERMANAGER)) {
|
||||
|
@ -3773,7 +3773,7 @@ nsContentUtils::RemoveListenerManager(nsINode *aNode)
|
|||
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
|
||||
PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
nsRefPtr<nsEventListenerManager> listenerManager;
|
||||
nsRefPtr<EventListenerManager> listenerManager;
|
||||
listenerManager.swap(entry->mListenerManager);
|
||||
// Remove the entry and *then* do operations that could cause further
|
||||
// modification of sEventListenerManagersHash. See bug 334177.
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsCxPusher.h"
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
|
||||
|
@ -1713,7 +1714,7 @@ nsDocument::DeleteCycleCollectable()
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDocument)
|
||||
if (Element::CanSkip(tmp, aRemovingAllowed)) {
|
||||
nsEventListenerManager* elm = tmp->GetExistingListenerManager();
|
||||
EventListenerManager* elm = tmp->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->MarkForCC();
|
||||
}
|
||||
|
@ -7615,19 +7616,19 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
|||
}
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsDocument::GetOrCreateListenerManager()
|
||||
{
|
||||
if (!mListenerManager) {
|
||||
mListenerManager =
|
||||
new nsEventListenerManager(static_cast<EventTarget*>(this));
|
||||
new EventListenerManager(static_cast<EventTarget*>(this));
|
||||
SetFlags(NODE_HAS_LISTENERMANAGER);
|
||||
}
|
||||
|
||||
return mListenerManager;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsDocument::GetExistingListenerManager() const
|
||||
{
|
||||
return mListenerManager;
|
||||
|
@ -8321,7 +8322,7 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
|
|||
// Check our event listener manager for unload/beforeunload listeners.
|
||||
nsCOMPtr<EventTarget> piTarget = do_QueryInterface(mScriptGlobalObject);
|
||||
if (piTarget) {
|
||||
nsEventListenerManager* manager = piTarget->GetExistingListenerManager();
|
||||
EventListenerManager* manager = piTarget->GetExistingListenerManager();
|
||||
if (manager && manager->HasUnloadListeners()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -11838,7 +11839,7 @@ nsIDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||
mExtraPropertyTables[i]->SizeOfExcludingThis(aWindowSizes->mMallocSizeOf);
|
||||
}
|
||||
|
||||
if (nsEventListenerManager* elm = GetExistingListenerManager()) {
|
||||
if (EventListenerManager* elm = GetExistingListenerManager()) {
|
||||
aWindowSizes->mDOMEventListenersCount += elm->ListenerCount();
|
||||
}
|
||||
|
||||
|
@ -11904,7 +11905,7 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||
|
||||
*p += nodeSize;
|
||||
|
||||
if (nsEventListenerManager* elm = node->GetExistingListenerManager()) {
|
||||
if (EventListenerManager* elm = node->GetExistingListenerManager()) {
|
||||
aWindowSizes->mDOMEventListenersCount += elm->ListenerCount();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "nsISecurityEventSink.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/DOMImplementation.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
|
@ -76,7 +77,6 @@
|
|||
#define XML_DECLARATION_BITS_STANDALONE_YES (1 << 3)
|
||||
|
||||
|
||||
class nsEventListenerManager;
|
||||
class nsDOMStyleSheetList;
|
||||
class nsDOMStyleSheetSetList;
|
||||
class nsIOutputStream;
|
||||
|
@ -903,8 +903,10 @@ public:
|
|||
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsEventListenerManager* GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual nsEventListenerManager* GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
|
||||
// nsIScriptObjectPrincipal
|
||||
virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE;
|
||||
|
@ -1420,7 +1422,7 @@ public:
|
|||
// The "registry" from the web components spec.
|
||||
nsRefPtr<Registry> mRegistry;
|
||||
|
||||
nsRefPtr<nsEventListenerManager> mListenerManager;
|
||||
nsRefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
|
||||
nsRefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
|
||||
nsRefPtr<nsScriptLoader> mScriptLoader;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "jsapi.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
@ -39,7 +40,6 @@
|
|||
#include "nsDOMString.h"
|
||||
#include "nsDOMTokenList.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsFrameManager.h"
|
||||
|
@ -1066,7 +1066,7 @@ nsINode::AddEventListener(const nsAString& aType,
|
|||
aWantsUntrusted = true;
|
||||
}
|
||||
|
||||
nsEventListenerManager* listener_manager = GetOrCreateListenerManager();
|
||||
EventListenerManager* listener_manager = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(listener_manager);
|
||||
listener_manager->AddEventListener(aType, aListener, aUseCapture,
|
||||
aWantsUntrusted);
|
||||
|
@ -1087,7 +1087,7 @@ nsINode::AddEventListener(const nsAString& aType,
|
|||
wantsUntrusted = aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
nsEventListenerManager* listener_manager = GetOrCreateListenerManager();
|
||||
EventListenerManager* listener_manager = GetOrCreateListenerManager();
|
||||
if (!listener_manager) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
|
@ -1123,7 +1123,7 @@ nsINode::RemoveEventListener(const nsAString& aType,
|
|||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
nsEventListenerManager* elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->RemoveEventListener(aType, aListener, aUseCapture);
|
||||
}
|
||||
|
@ -1184,13 +1184,13 @@ nsINode::DispatchDOMEvent(WidgetEvent* aEvent,
|
|||
aPresContext, aEventStatus);
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsINode::GetOrCreateListenerManager()
|
||||
{
|
||||
return nsContentUtils::GetListenerManagerForNode(this);
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsINode::GetExistingListenerManager() const
|
||||
{
|
||||
return nsContentUtils::GetExistingListenerManagerForNode(this);
|
||||
|
@ -2202,7 +2202,7 @@ size_t
|
|||
nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
nsEventListenerManager* elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
if (elm) {
|
||||
n += elm->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
@ -2220,13 +2220,13 @@ nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
|||
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
EventHandlerNonNull* nsINode::GetOn##name_() { \
|
||||
nsEventListenerManager *elm = GetExistingListenerManager(); \
|
||||
EventListenerManager *elm = GetExistingListenerManager(); \
|
||||
return elm ? elm->GetEventHandler(nsGkAtoms::on##name_, EmptyString()) \
|
||||
: nullptr; \
|
||||
} \
|
||||
void nsINode::SetOn##name_(EventHandlerNonNull* handler) \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
EventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
if (elm) { \
|
||||
elm->SetEventHandler(nsGkAtoms::on##name_, EmptyString(), handler); \
|
||||
} \
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "nsIMutationObserver.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "pldhash.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
|
@ -34,6 +34,7 @@
|
|||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::AutoJSContext;
|
||||
|
||||
|
@ -236,7 +237,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
|||
aNode->HasFlag(NODE_HAS_LISTENERMANAGER)) {
|
||||
#ifdef DEBUG
|
||||
if (nsContentUtils::IsInitialized()) {
|
||||
nsEventListenerManager* manager =
|
||||
EventListenerManager* manager =
|
||||
nsContentUtils::GetExistingListenerManagerForNode(aNode);
|
||||
if (!manager) {
|
||||
NS_ERROR("Huh, our bit says we have a listener manager list, "
|
||||
|
@ -488,7 +489,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
|
||||
nsPIDOMWindow* window = newDoc->GetInnerWindow();
|
||||
if (window) {
|
||||
nsEventListenerManager* elm = aNode->GetExistingListenerManager();
|
||||
EventListenerManager* elm = aNode->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
window->SetMutationListeners(elm->MutationListenerBits());
|
||||
if (elm->MayHavePaintEventListener()) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -2157,7 +2158,7 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
|||
NS_ASSERTION(!(mState & XML_HTTP_REQUEST_SYNCLOOPING),
|
||||
"We weren't supposed to support HTML parsing with XHR!");
|
||||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(mResponseXML);
|
||||
nsEventListenerManager* manager =
|
||||
EventListenerManager* manager =
|
||||
eventTarget->GetOrCreateListenerManager();
|
||||
manager->AddEventListenerByType(new nsXHRParseEndListener(this),
|
||||
NS_LITERAL_STRING("DOMContentLoaded"),
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
||||
#include "nsRuleData.h"
|
||||
#include <algorithm>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLOptGroupElement.h"
|
||||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
|
@ -811,7 +811,7 @@ nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
|||
aValue, aNotify);
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
bool* aDefer)
|
||||
{
|
||||
|
@ -1010,7 +1010,7 @@ nsGenericHTMLElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
|||
UnsetFlags(NODE_HAS_ACCESSKEY);
|
||||
}
|
||||
else if (IsEventAttributeName(aAttribute)) {
|
||||
if (nsEventListenerManager* manager = GetExistingListenerManager()) {
|
||||
if (EventListenerManager* manager = GetExistingListenerManager()) {
|
||||
manager->RemoveEventHandler(aAttribute, EmptyString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ class nsIDOMHTMLCollection;
|
|||
class nsDOMSettableTokenList;
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
namespace dom {
|
||||
class HTMLFormElement;
|
||||
class HTMLPropertiesCollection;
|
||||
|
@ -987,8 +988,9 @@ protected:
|
|||
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer) MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
bool* aDefer) MOZ_OVERRIDE;
|
||||
|
||||
virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "nsIEditor.h"
|
||||
#include "nsTextEditRules.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsTextNode.h"
|
||||
|
@ -1525,7 +1525,7 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
|
|||
mTextListener->SetFrame(nullptr);
|
||||
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(mTextCtrlElement);
|
||||
nsEventListenerManager* manager = target->GetExistingListenerManager();
|
||||
EventListenerManager* manager = target->GetExistingListenerManager();
|
||||
if (manager) {
|
||||
manager->RemoveEventListenerByType(mTextListener,
|
||||
NS_LITERAL_STRING("keydown"),
|
||||
|
@ -1930,7 +1930,7 @@ nsTextEditorState::InitializeKeyboardEventListeners()
|
|||
{
|
||||
//register key listeners
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(mTextCtrlElement);
|
||||
nsEventListenerManager* manager = target->GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = target->GetOrCreateListenerManager();
|
||||
if (manager) {
|
||||
manager->AddEventListenerByType(mTextListener,
|
||||
NS_LITERAL_STRING("keydown"),
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "mozilla/css/Loader.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsISelectionPrivate.h"//for toStringwithformat code
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "mozilla/css/Declaration.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsSVGAnimatedTransformList.h"
|
||||
#include "nsSVGLength2.h"
|
||||
|
@ -667,7 +667,7 @@ nsSVGElement::UnsetAttrInternal(int32_t aNamespaceID, nsIAtom* aName,
|
|||
mContentStyleRule = nullptr;
|
||||
|
||||
if (IsEventAttributeName(aName)) {
|
||||
nsEventListenerManager* manager = GetExistingListenerManager();
|
||||
EventListenerManager* manager = GetExistingListenerManager();
|
||||
if (manager) {
|
||||
nsIAtom* eventName = GetEventNameForAttr(aName);
|
||||
manager->RemoveEventHandler(eventName, EmptyString());
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "XMLStylesheetProcessingInstruction.h"
|
||||
#include "mozilla/dom/XMLStylesheetProcessingInstructionBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ProcessingInstruction.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsStyleLinkElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "mozilla/dom/Attr.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
@ -399,7 +399,7 @@ XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
|
|||
// be loaded. Note that we need to hold a strong ref to |principal|
|
||||
// here, because ResetToURI will null out our node principal before
|
||||
// setting the new one.
|
||||
nsRefPtr<nsEventListenerManager> elm(mListenerManager);
|
||||
nsRefPtr<EventListenerManager> elm(mListenerManager);
|
||||
mListenerManager = nullptr;
|
||||
|
||||
// When we are called from JS we can find the load group for the page,
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
|
@ -483,7 +483,7 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
|
|||
return list.forget();
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsXULElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer)
|
||||
{
|
||||
// XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc()
|
||||
|
@ -1680,7 +1680,7 @@ nsXULElement::AddPopupListener(nsIAtom* aName)
|
|||
new nsXULPopupListener(this, isContext);
|
||||
|
||||
// Add the popup as a listener on this element.
|
||||
nsEventListenerManager* manager = GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = GetOrCreateListenerManager();
|
||||
SetFlags(listenerFlag);
|
||||
|
||||
if (isContext) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef nsXULElement_h__
|
||||
#define nsXULElement_h__
|
||||
|
||||
// XXX because nsEventListenerManager has broken includes
|
||||
#include "js/Tracer.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
@ -22,7 +22,6 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIURI.h"
|
||||
|
@ -45,10 +44,12 @@ class nsXULPrototypeDocument;
|
|||
|
||||
class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
class nsIOffThreadScriptReceiver;
|
||||
class nsXULPrototypeNode;
|
||||
typedef nsTArray<nsRefPtr<nsXULPrototypeNode> > nsPrototypeArray;
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
namespace css {
|
||||
class StyleRule;
|
||||
}
|
||||
|
@ -661,8 +662,9 @@ protected:
|
|||
const nsAString& aValue,
|
||||
nsAttrValue& aResult) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer) MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
||||
bool* aDefer) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Add a listener for the specified attribute, if appropriate.
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsIXULBuilderListener.h"
|
||||
#include "nsIRDFRemoteDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "mozilla/unused.h"
|
||||
|
||||
// Other Classes
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/dom/BarProps.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsLayoutStatics.h"
|
||||
|
@ -60,6 +59,7 @@
|
|||
#include "nsJSPrincipals.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Debug.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "AudioChannelService.h"
|
||||
|
||||
|
@ -1674,7 +1674,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
|
|||
if (tmp->mCachedXBLPrototypeHandlers) {
|
||||
tmp->mCachedXBLPrototypeHandlers->Enumerate(MarkXBLHandlers, nullptr);
|
||||
}
|
||||
if (nsEventListenerManager* elm = tmp->GetExistingListenerManager()) {
|
||||
if (EventListenerManager* elm = tmp->GetExistingListenerManager()) {
|
||||
elm->MarkForCC();
|
||||
}
|
||||
tmp->UnmarkGrayTimers();
|
||||
|
@ -9159,7 +9159,7 @@ nsGlobalWindow::RemoveEventListener(const nsAString& aType,
|
|||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
if (nsRefPtr<nsEventListenerManager> elm = GetExistingListenerManager()) {
|
||||
if (nsRefPtr<EventListenerManager> elm = GetExistingListenerManager()) {
|
||||
elm->RemoveEventListener(aType, aListener, aUseCapture);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -9220,7 +9220,7 @@ nsGlobalWindow::AddEventListener(const nsAString& aType,
|
|||
aWantsUntrusted = true;
|
||||
}
|
||||
|
||||
nsEventListenerManager* manager = GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(manager);
|
||||
manager->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
return NS_OK;
|
||||
|
@ -9246,7 +9246,7 @@ nsGlobalWindow::AddEventListener(const nsAString& aType,
|
|||
wantsUntrusted = aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
nsEventListenerManager* manager = GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = GetOrCreateListenerManager();
|
||||
if (!manager) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
|
@ -9280,20 +9280,20 @@ nsGlobalWindow::AddSystemEventListener(const nsAString& aType,
|
|||
aWantsUntrusted);
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsGlobalWindow::GetOrCreateListenerManager()
|
||||
{
|
||||
FORWARD_TO_INNER_CREATE(GetOrCreateListenerManager, (), nullptr);
|
||||
|
||||
if (!mListenerManager) {
|
||||
mListenerManager =
|
||||
new nsEventListenerManager(static_cast<EventTarget*>(this));
|
||||
new EventListenerManager(static_cast<EventTarget*>(this));
|
||||
}
|
||||
|
||||
return mListenerManager;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsGlobalWindow::GetExistingListenerManager() const
|
||||
{
|
||||
FORWARD_TO_INNER(GetExistingListenerManager, (), nullptr);
|
||||
|
@ -12869,7 +12869,7 @@ CollectSizeAndListenerCount(
|
|||
iSizeOf->SizeOfEventTargetIncludingThis(windowSizes->mMallocSizeOf);
|
||||
}
|
||||
|
||||
if (nsEventListenerManager* elm = et->GetExistingListenerManager()) {
|
||||
if (EventListenerManager* elm = et->GetExistingListenerManager()) {
|
||||
windowSizes->mDOMEventListenersCount += elm->ListenerCount();
|
||||
}
|
||||
|
||||
|
@ -12882,7 +12882,7 @@ nsGlobalWindow::AddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
|||
aWindowSizes->mDOMOtherSize += aWindowSizes->mMallocSizeOf(this);
|
||||
|
||||
if (IsInnerWindow()) {
|
||||
nsEventListenerManager* elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
if (elm) {
|
||||
aWindowSizes->mDOMOtherSize +=
|
||||
elm->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
|
@ -13597,7 +13597,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
|
||||
JS::MutableHandle<JS::Value> vp) { \
|
||||
nsEventListenerManager *elm = GetExistingListenerManager(); \
|
||||
EventListenerManager *elm = GetExistingListenerManager(); \
|
||||
if (elm) { \
|
||||
OnErrorEventHandlerNonNull* h = elm->GetOnErrorEventHandler(); \
|
||||
if (h) { \
|
||||
|
@ -13610,7 +13610,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
} \
|
||||
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
|
||||
JS::Handle<JS::Value> v) { \
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
EventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
if (!elm) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
|
@ -13627,7 +13627,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
|
||||
JS::MutableHandle<JS::Value> vp) { \
|
||||
nsEventListenerManager *elm = GetExistingListenerManager(); \
|
||||
EventListenerManager *elm = GetExistingListenerManager(); \
|
||||
if (elm) { \
|
||||
OnBeforeUnloadEventHandlerNonNull* h = \
|
||||
elm->GetOnBeforeUnloadEventHandler(); \
|
||||
|
@ -13641,7 +13641,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
} \
|
||||
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
|
||||
JS::Handle<JS::Value> v) { \
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
EventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
if (!elm) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIDOMModalContentWindow.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsSize.h"
|
||||
#include "mozFlushType.h"
|
||||
|
@ -384,11 +384,11 @@ public:
|
|||
// nsIDOMEventTarget
|
||||
NS_DECL_NSIDOMEVENTTARGET
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
|
||||
using mozilla::dom::EventTarget::RemoveEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
|
@ -727,13 +727,13 @@ public:
|
|||
#define EVENT(name_, id_, type_, struct_) \
|
||||
mozilla::dom::EventHandlerNonNull* GetOn##name_() \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetExistingListenerManager(); \
|
||||
mozilla::EventListenerManager* elm = GetExistingListenerManager(); \
|
||||
return elm ? elm->GetEventHandler(nsGkAtoms::on##name_, EmptyString()) \
|
||||
: nullptr; \
|
||||
} \
|
||||
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler) \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \
|
||||
if (elm) { \
|
||||
elm->SetEventHandler(nsGkAtoms::on##name_, EmptyString(), handler); \
|
||||
} \
|
||||
|
@ -741,12 +741,12 @@ public:
|
|||
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
||||
mozilla::dom::OnErrorEventHandlerNonNull* GetOn##name_() \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetExistingListenerManager(); \
|
||||
mozilla::EventListenerManager* elm = GetExistingListenerManager(); \
|
||||
return elm ? elm->GetOnErrorEventHandler() : nullptr; \
|
||||
} \
|
||||
void SetOn##name_(mozilla::dom::OnErrorEventHandlerNonNull* handler) \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \
|
||||
if (elm) { \
|
||||
elm->SetEventHandler(handler); \
|
||||
} \
|
||||
|
@ -754,12 +754,12 @@ public:
|
|||
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
||||
mozilla::dom::OnBeforeUnloadEventHandlerNonNull* GetOn##name_() \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetExistingListenerManager(); \
|
||||
mozilla::EventListenerManager* elm = GetExistingListenerManager(); \
|
||||
return elm ? elm->GetOnBeforeUnloadEventHandler() : nullptr; \
|
||||
} \
|
||||
void SetOn##name_(mozilla::dom::OnBeforeUnloadEventHandlerNonNull* handler) \
|
||||
{ \
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \
|
||||
if (elm) { \
|
||||
elm->SetEventHandler(handler); \
|
||||
} \
|
||||
|
@ -1464,7 +1464,7 @@ protected:
|
|||
nsCOMPtr<nsIXPConnectJSObjectHolder> mInnerWindowHolder;
|
||||
|
||||
// These member variable are used only on inner windows.
|
||||
nsRefPtr<nsEventListenerManager> mListenerManager;
|
||||
nsRefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||
// mTimeouts is generally sorted by mWhen, unless mTimeoutInsertionPoint is
|
||||
// non-null. In that case, the dummy timeout pointed to by
|
||||
// mTimeoutInsertionPoint may have a later mWhen than some of the timeouts
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWindowRoot.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsContentCID.h"
|
||||
|
@ -64,7 +64,7 @@ NS_IMPL_DOMTARGET_DEFAULTS(nsWindowRoot)
|
|||
NS_IMETHODIMP
|
||||
nsWindowRoot::RemoveEventListener(const nsAString& aType, nsIDOMEventListener* aListener, bool aUseCapture)
|
||||
{
|
||||
if (nsRefPtr<nsEventListenerManager> elm = GetExistingListenerManager()) {
|
||||
if (nsRefPtr<EventListenerManager> elm = GetExistingListenerManager()) {
|
||||
elm->RemoveEventListener(aType, aListener, aUseCapture);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -104,7 +104,7 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
|
|||
"aWantsUntrusted to false or make the aWantsUntrusted "
|
||||
"explicit by making optional_argc non-zero.");
|
||||
|
||||
nsEventListenerManager* elm = GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(elm);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
return NS_OK;
|
||||
|
@ -118,7 +118,7 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
|
|||
ErrorResult& aRv)
|
||||
{
|
||||
bool wantsUntrusted = !aWantsUntrusted.IsNull() && aWantsUntrusted.Value();
|
||||
nsEventListenerManager* elm = GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
if (!elm) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
|
@ -143,18 +143,18 @@ nsWindowRoot::AddSystemEventListener(const nsAString& aType,
|
|||
aWantsUntrusted);
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsWindowRoot::GetOrCreateListenerManager()
|
||||
{
|
||||
if (!mListenerManager) {
|
||||
mListenerManager =
|
||||
new nsEventListenerManager(static_cast<EventTarget*>(this));
|
||||
new EventListenerManager(static_cast<EventTarget*>(this));
|
||||
}
|
||||
|
||||
return mListenerManager;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsWindowRoot::GetExistingListenerManager() const
|
||||
{
|
||||
return mListenerManager;
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
class nsPIDOMWindow;
|
||||
class nsIDOMEventListener;
|
||||
class nsEventListenerManager;
|
||||
class nsIDOMEvent;
|
||||
class nsEventChainPreVisitor;
|
||||
class nsEventChainPostVisitor;
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -29,10 +29,10 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIDOMEVENTTARGET
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual nsEventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
|
||||
using mozilla::dom::EventTarget::RemoveEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
|
@ -65,9 +65,8 @@ public:
|
|||
protected:
|
||||
// Members
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsRefPtr<nsEventListenerManager> mListenerManager; // [Strong]. We own the manager, which owns event listeners attached
|
||||
// to us.
|
||||
|
||||
// We own the manager, which owns event listeners attached to us.
|
||||
nsRefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
|
||||
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
|
||||
|
||||
nsCOMPtr<mozilla::dom::EventTarget> mParent;
|
||||
|
|
|
@ -27,6 +27,7 @@ class DeviceStorageFile;
|
|||
class nsIInputStream;
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
namespace dom {
|
||||
class DeviceStorageEnumerationParameters;
|
||||
class DOMCursor;
|
||||
|
@ -170,10 +171,10 @@ public:
|
|||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIDOMEVENTTARGET
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual nsEventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
AddEventListener(const nsAString& aType,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/dom/PContentPermissionRequestChild.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
|
@ -4303,13 +4304,13 @@ nsDOMDeviceStorage::DispatchDOMEvent(WidgetEvent* aEvent,
|
|||
aEventStatus);
|
||||
}
|
||||
|
||||
nsEventListenerManager *
|
||||
EventListenerManager*
|
||||
nsDOMDeviceStorage::GetOrCreateListenerManager()
|
||||
{
|
||||
return nsDOMEventTargetHelper::GetOrCreateListenerManager();
|
||||
}
|
||||
|
||||
nsEventListenerManager *
|
||||
EventListenerManager*
|
||||
nsDOMDeviceStorage::GetExistingListenerManager() const
|
||||
{
|
||||
return nsDOMEventTargetHelper::GetExistingListenerManager();
|
||||
|
|
|
@ -3,46 +3,47 @@
|
|||
* 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 "mozilla/BasicEvents.h"
|
||||
#ifdef MOZ_B2G
|
||||
#include "mozilla/Hal.h"
|
||||
#endif
|
||||
#include "mozilla/HalSensor.h"
|
||||
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#ifdef MOZ_B2G
|
||||
#include "mozilla/Hal.h"
|
||||
#endif // #ifdef MOZ_B2G
|
||||
#include "mozilla/HalSensor.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
#include "EventListenerService.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "EventListenerService.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::hal;
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
using namespace hal;
|
||||
|
||||
#define EVENT_TYPE_EQUALS(ls, type, userType, typeString, allEvents) \
|
||||
((ls->mEventType == type && \
|
||||
|
@ -84,21 +85,21 @@ MutationBitForEventType(uint32_t aEventType)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t nsEventListenerManager::sMainThreadCreatedCount = 0;
|
||||
uint32_t EventListenerManager::sMainThreadCreatedCount = 0;
|
||||
|
||||
nsEventListenerManager::nsEventListenerManager(EventTarget* aTarget) :
|
||||
mMayHavePaintEventListener(false),
|
||||
mMayHaveMutationListeners(false),
|
||||
mMayHaveCapturingListeners(false),
|
||||
mMayHaveSystemGroupListeners(false),
|
||||
mMayHaveAudioAvailableEventListener(false),
|
||||
mMayHaveTouchEventListener(false),
|
||||
mMayHaveMouseEnterLeaveEventListener(false),
|
||||
mMayHavePointerEnterLeaveEventListener(false),
|
||||
mClearingListeners(false),
|
||||
mIsMainThreadELM(NS_IsMainThread()),
|
||||
mNoListenerForEvent(0),
|
||||
mTarget(aTarget)
|
||||
EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
: mMayHavePaintEventListener(false)
|
||||
, mMayHaveMutationListeners(false)
|
||||
, mMayHaveCapturingListeners(false)
|
||||
, mMayHaveSystemGroupListeners(false)
|
||||
, mMayHaveAudioAvailableEventListener(false)
|
||||
, mMayHaveTouchEventListener(false)
|
||||
, mMayHaveMouseEnterLeaveEventListener(false)
|
||||
, mMayHavePointerEnterLeaveEventListener(false)
|
||||
, mClearingListeners(false)
|
||||
, mIsMainThreadELM(NS_IsMainThread())
|
||||
, mNoListenerForEvent(0)
|
||||
, mTarget(aTarget)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "unexpected null pointer");
|
||||
|
||||
|
@ -107,7 +108,7 @@ nsEventListenerManager::nsEventListenerManager(EventTarget* aTarget) :
|
|||
}
|
||||
}
|
||||
|
||||
nsEventListenerManager::~nsEventListenerManager()
|
||||
EventListenerManager::~EventListenerManager()
|
||||
{
|
||||
// If your code fails this assertion, a possible reason is that
|
||||
// a class did not call our Disconnect() manually. Note that
|
||||
|
@ -120,11 +121,10 @@ nsEventListenerManager::~nsEventListenerManager()
|
|||
// from right here, if not previously called?
|
||||
NS_ASSERTION(!mTarget, "didn't call Disconnect");
|
||||
RemoveAllListeners();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveAllListeners()
|
||||
EventListenerManager::RemoveAllListeners()
|
||||
{
|
||||
if (mClearingListeners) {
|
||||
return;
|
||||
|
@ -135,17 +135,17 @@ nsEventListenerManager::RemoveAllListeners()
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::Shutdown()
|
||||
EventListenerManager::Shutdown()
|
||||
{
|
||||
Event::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsEventListenerManager, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsEventListenerManager, Release)
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(EventListenerManager, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(EventListenerManager, Release)
|
||||
|
||||
inline void
|
||||
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||
nsEventListenerManager::Listener& aField,
|
||||
EventListenerManager::Listener& aField,
|
||||
const char* aName,
|
||||
unsigned aFlags)
|
||||
{
|
||||
|
@ -167,19 +167,19 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventListenerManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(EventListenerManager)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEventListenerManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EventListenerManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListeners)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsEventListenerManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EventListenerManager)
|
||||
tmp->Disconnect();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
||||
nsPIDOMWindow*
|
||||
nsEventListenerManager::GetInnerWindowForTarget()
|
||||
EventListenerManager::GetInnerWindowForTarget()
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
|
||||
if (node) {
|
||||
|
@ -193,7 +193,7 @@ nsEventListenerManager::GetInnerWindowForTarget()
|
|||
}
|
||||
|
||||
already_AddRefed<nsPIDOMWindow>
|
||||
nsEventListenerManager::GetTargetAsInnerWindow() const
|
||||
EventListenerManager::GetTargetAsInnerWindow() const
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mTarget);
|
||||
if (!window) {
|
||||
|
@ -205,14 +205,14 @@ nsEventListenerManager::GetTargetAsInnerWindow() const
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::AddEventListenerInternal(
|
||||
const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler,
|
||||
bool aAllEvents)
|
||||
EventListenerManager::AddEventListenerInternal(
|
||||
const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler,
|
||||
bool aAllEvents)
|
||||
{
|
||||
MOZ_ASSERT((NS_IsMainThread() && aType && aTypeAtom) || // Main thread
|
||||
(!NS_IsMainThread() && aType && !aTypeString.IsEmpty()) || // non-main-thread
|
||||
|
@ -386,7 +386,7 @@ nsEventListenerManager::AddEventListenerInternal(
|
|||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::IsDeviceType(uint32_t aType)
|
||||
EventListenerManager::IsDeviceType(uint32_t aType)
|
||||
{
|
||||
switch (aType) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
|
@ -402,7 +402,7 @@ nsEventListenerManager::IsDeviceType(uint32_t aType)
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::EnableDevice(uint32_t aType)
|
||||
EventListenerManager::EnableDevice(uint32_t aType)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (!window) {
|
||||
|
@ -432,7 +432,7 @@ nsEventListenerManager::EnableDevice(uint32_t aType)
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::DisableDevice(uint32_t aType)
|
||||
EventListenerManager::DisableDevice(uint32_t aType)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (!window) {
|
||||
|
@ -462,13 +462,13 @@ nsEventListenerManager::DisableDevice(uint32_t aType)
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveEventListenerInternal(
|
||||
const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aAllEvents)
|
||||
EventListenerManager::RemoveEventListenerInternal(
|
||||
const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aAllEvents)
|
||||
{
|
||||
if (!aListener || !aType || mClearingListeners) {
|
||||
return;
|
||||
|
@ -492,7 +492,7 @@ nsEventListenerManager::RemoveEventListenerInternal(
|
|||
++typeCount;
|
||||
if (listener->mListener == aListener &&
|
||||
listener->mFlags.EqualsIgnoringTrustness(aFlags)) {
|
||||
nsRefPtr<nsEventListenerManager> kungFuDeathGrip = this;
|
||||
nsRefPtr<EventListenerManager> kungFuDeathGrip(this);
|
||||
mListeners.RemoveElementAt(i);
|
||||
--count;
|
||||
mNoListenerForEvent = NS_EVENT_NULL;
|
||||
|
@ -531,8 +531,8 @@ nsEventListenerManager::RemoveEventListenerInternal(
|
|||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::ListenerCanHandle(Listener* aListener,
|
||||
WidgetEvent* aEvent)
|
||||
EventListenerManager::ListenerCanHandle(Listener* aListener,
|
||||
WidgetEvent* aEvent)
|
||||
{
|
||||
// This is slightly different from EVENT_TYPE_EQUALS in that it returns
|
||||
// true even when aEvent->message == NS_USER_DEFINED_EVENT and
|
||||
|
@ -552,9 +552,10 @@ nsEventListenerManager::ListenerCanHandle(Listener* aListener,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::AddEventListenerByType(const EventListenerHolder& aListener,
|
||||
const nsAString& aType,
|
||||
const EventListenerFlags& aFlags)
|
||||
EventListenerManager::AddEventListenerByType(
|
||||
const EventListenerHolder& aListener,
|
||||
const nsAString& aType,
|
||||
const EventListenerFlags& aFlags)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
|
||||
|
@ -563,10 +564,10 @@ nsEventListenerManager::AddEventListenerByType(const EventListenerHolder& aListe
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveEventListenerByType(
|
||||
const EventListenerHolder& aListener,
|
||||
const nsAString& aType,
|
||||
const EventListenerFlags& aFlags)
|
||||
EventListenerManager::RemoveEventListenerByType(
|
||||
const EventListenerHolder& aListener,
|
||||
const nsAString& aType,
|
||||
const EventListenerFlags& aFlags)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
|
||||
|
@ -574,10 +575,10 @@ nsEventListenerManager::RemoveEventListenerByType(
|
|||
RemoveEventListenerInternal(aListener, type, atom, aType, aFlags);
|
||||
}
|
||||
|
||||
nsEventListenerManager::Listener*
|
||||
nsEventListenerManager::FindEventHandler(uint32_t aEventType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString)
|
||||
EventListenerManager::Listener*
|
||||
EventListenerManager::FindEventHandler(uint32_t aEventType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
// Run through the listeners for this type and see if a script
|
||||
// listener is registered
|
||||
|
@ -594,12 +595,13 @@ nsEventListenerManager::FindEventHandler(uint32_t aEventType,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsEventListenerManager::Listener*
|
||||
nsEventListenerManager::SetEventHandlerInternal(JS::Handle<JSObject*> aScopeObject,
|
||||
nsIAtom* aName,
|
||||
const nsAString& aTypeString,
|
||||
const nsEventHandler& aHandler,
|
||||
bool aPermitUntrustedEvents)
|
||||
EventListenerManager::Listener*
|
||||
EventListenerManager::SetEventHandlerInternal(
|
||||
JS::Handle<JSObject*> aScopeObject,
|
||||
nsIAtom* aName,
|
||||
const nsAString& aTypeString,
|
||||
const nsEventHandler& aHandler,
|
||||
bool aPermitUntrustedEvents)
|
||||
{
|
||||
MOZ_ASSERT(aScopeObject || aHandler.HasEventHandler(),
|
||||
"Must have one or the other!");
|
||||
|
@ -646,12 +648,12 @@ nsEventListenerManager::SetEventHandlerInternal(JS::Handle<JSObject*> aScopeObje
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsEventListenerManager::SetEventHandler(nsIAtom *aName,
|
||||
const nsAString& aBody,
|
||||
uint32_t aLanguage,
|
||||
bool aDeferCompilation,
|
||||
bool aPermitUntrustedEvents,
|
||||
Element* aElement)
|
||||
EventListenerManager::SetEventHandler(nsIAtom* aName,
|
||||
const nsAString& aBody,
|
||||
uint32_t aLanguage,
|
||||
bool aDeferCompilation,
|
||||
bool aPermitUntrustedEvents,
|
||||
Element* aElement)
|
||||
{
|
||||
NS_PRECONDITION(aLanguage != nsIProgrammingLanguage::UNKNOWN,
|
||||
"Must know the language for the script event listener");
|
||||
|
@ -764,8 +766,8 @@ nsEventListenerManager::SetEventHandler(nsIAtom *aName,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveEventHandler(nsIAtom* aName,
|
||||
const nsAString& aTypeString)
|
||||
EventListenerManager::RemoveEventHandler(nsIAtom* aName,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
if (mClearingListeners) {
|
||||
return;
|
||||
|
@ -785,10 +787,9 @@ nsEventListenerManager::RemoveEventHandler(nsIAtom* aName,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsEventListenerManager::CompileEventHandlerInternal(
|
||||
Listener* aListener,
|
||||
const nsAString* aBody,
|
||||
Element* aElement)
|
||||
EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
|
||||
const nsAString* aBody,
|
||||
Element* aElement)
|
||||
{
|
||||
NS_PRECONDITION(aListener->GetJSListener(),
|
||||
"Why do we not have a JS listener?");
|
||||
|
@ -942,9 +943,9 @@ nsEventListenerManager::CompileEventHandlerInternal(
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsEventListenerManager::HandleEventSubType(Listener* aListener,
|
||||
nsIDOMEvent* aDOMEvent,
|
||||
EventTarget* aCurrentTarget)
|
||||
EventListenerManager::HandleEventSubType(Listener* aListener,
|
||||
nsIDOMEvent* aDOMEvent,
|
||||
EventTarget* aCurrentTarget)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
EventListenerHolder listenerHolder(aListener->mListener); // strong ref
|
||||
|
@ -984,11 +985,11 @@ nsEventListenerManager::HandleEventSubType(Listener* aListener,
|
|||
*/
|
||||
|
||||
void
|
||||
nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
EventTarget* aCurrentTarget,
|
||||
nsEventStatus* aEventStatus)
|
||||
EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
EventTarget* aCurrentTarget,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
//Set the value of the internal PreventDefault flag properly based on aEventStatus
|
||||
if (*aEventStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
|
@ -1016,7 +1017,7 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
|||
listener->mFlags.mAllowUntrustedEvents)) {
|
||||
if (!*aDOMEvent) {
|
||||
// This is tiny bit slow, but happens only once per event.
|
||||
nsCOMPtr<mozilla::dom::EventTarget> et =
|
||||
nsCOMPtr<EventTarget> et =
|
||||
do_QueryInterface(aEvent->originalTarget);
|
||||
nsEventDispatcher::CreateEvent(et, aPresContext,
|
||||
aEvent, EmptyString(), aDOMEvent);
|
||||
|
@ -1051,17 +1052,17 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::Disconnect()
|
||||
EventListenerManager::Disconnect()
|
||||
{
|
||||
mTarget = nullptr;
|
||||
RemoveAllListeners();
|
||||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::AddEventListener(const nsAString& aType,
|
||||
const EventListenerHolder& aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
EventListenerManager::AddEventListener(const nsAString& aType,
|
||||
const EventListenerHolder& aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
{
|
||||
EventListenerFlags flags;
|
||||
flags.mCapture = aUseCapture;
|
||||
|
@ -1070,9 +1071,9 @@ nsEventListenerManager::AddEventListener(const nsAString& aType,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveEventListener(const nsAString& aType,
|
||||
const EventListenerHolder& aListener,
|
||||
bool aUseCapture)
|
||||
EventListenerManager::RemoveEventListener(const nsAString& aType,
|
||||
const EventListenerHolder& aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
EventListenerFlags flags;
|
||||
flags.mCapture = aUseCapture;
|
||||
|
@ -1080,10 +1081,10 @@ nsEventListenerManager::RemoveEventListener(const nsAString& aType,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::AddListenerForAllEvents(nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted,
|
||||
bool aSystemEventGroup)
|
||||
EventListenerManager::AddListenerForAllEvents(nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted,
|
||||
bool aSystemEventGroup)
|
||||
{
|
||||
EventListenerFlags flags;
|
||||
flags.mCapture = aUseCapture;
|
||||
|
@ -1095,9 +1096,9 @@ nsEventListenerManager::AddListenerForAllEvents(nsIDOMEventListener* aListener,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveListenerForAllEvents(nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aSystemEventGroup)
|
||||
EventListenerManager::RemoveListenerForAllEvents(nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aSystemEventGroup)
|
||||
{
|
||||
EventListenerFlags flags;
|
||||
flags.mCapture = aUseCapture;
|
||||
|
@ -1108,7 +1109,7 @@ nsEventListenerManager::RemoveListenerForAllEvents(nsIDOMEventListener* aListene
|
|||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::HasMutationListeners()
|
||||
EventListenerManager::HasMutationListeners()
|
||||
{
|
||||
if (mMayHaveMutationListeners) {
|
||||
uint32_t count = mListeners.Length();
|
||||
|
@ -1125,7 +1126,7 @@ nsEventListenerManager::HasMutationListeners()
|
|||
}
|
||||
|
||||
uint32_t
|
||||
nsEventListenerManager::MutationListenerBits()
|
||||
EventListenerManager::MutationListenerBits()
|
||||
{
|
||||
uint32_t bits = 0;
|
||||
if (mMayHaveMutationListeners) {
|
||||
|
@ -1145,14 +1146,14 @@ nsEventListenerManager::MutationListenerBits()
|
|||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::HasListenersFor(const nsAString& aEventName)
|
||||
EventListenerManager::HasListenersFor(const nsAString& aEventName)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aEventName);
|
||||
return HasListenersFor(atom);
|
||||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::HasListenersFor(nsIAtom* aEventNameWithOn)
|
||||
EventListenerManager::HasListenersFor(nsIAtom* aEventNameWithOn)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsAutoString name;
|
||||
|
@ -1171,13 +1172,13 @@ nsEventListenerManager::HasListenersFor(nsIAtom* aEventNameWithOn)
|
|||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::HasListeners()
|
||||
EventListenerManager::HasListeners()
|
||||
{
|
||||
return !mListeners.IsEmpty();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
||||
EventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
||||
{
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(mTarget);
|
||||
NS_ENSURE_STATE(target);
|
||||
|
@ -1211,7 +1212,7 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
|||
}
|
||||
|
||||
bool
|
||||
nsEventListenerManager::HasUnloadListeners()
|
||||
EventListenerManager::HasUnloadListeners()
|
||||
{
|
||||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
|
@ -1225,9 +1226,9 @@ nsEventListenerManager::HasUnloadListeners()
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::SetEventHandler(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString,
|
||||
EventHandlerNonNull* aHandler)
|
||||
EventListenerManager::SetEventHandler(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString,
|
||||
EventHandlerNonNull* aHandler)
|
||||
{
|
||||
if (!aHandler) {
|
||||
RemoveEventHandler(aEventName, aTypeString);
|
||||
|
@ -1243,7 +1244,7 @@ nsEventListenerManager::SetEventHandler(nsIAtom* aEventName,
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
|
||||
EventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
|
||||
{
|
||||
if (mIsMainThreadELM) {
|
||||
if (!aHandler) {
|
||||
|
@ -1270,7 +1271,8 @@ nsEventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::SetEventHandler(OnBeforeUnloadEventHandlerNonNull* aHandler)
|
||||
EventListenerManager::SetEventHandler(
|
||||
OnBeforeUnloadEventHandlerNonNull* aHandler)
|
||||
{
|
||||
if (!aHandler) {
|
||||
RemoveEventHandler(nsGkAtoms::onbeforeunload, EmptyString());
|
||||
|
@ -1286,8 +1288,8 @@ nsEventListenerManager::SetEventHandler(OnBeforeUnloadEventHandlerNonNull* aHand
|
|||
}
|
||||
|
||||
const nsEventHandler*
|
||||
nsEventListenerManager::GetEventHandlerInternal(nsIAtom *aEventName,
|
||||
const nsAString& aTypeString)
|
||||
EventListenerManager::GetEventHandlerInternal(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aEventName);
|
||||
Listener* listener = FindEventHandler(eventType, aEventName, aTypeString);
|
||||
|
@ -1311,8 +1313,7 @@ nsEventListenerManager::GetEventHandlerInternal(nsIAtom *aEventName,
|
|||
}
|
||||
|
||||
size_t
|
||||
nsEventListenerManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
|
||||
const
|
||||
EventListenerManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mListeners.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
@ -1327,7 +1328,7 @@ nsEventListenerManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
|
|||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::MarkForCC()
|
||||
EventListenerManager::MarkForCC()
|
||||
{
|
||||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
|
@ -1353,7 +1354,7 @@ nsEventListenerManager::MarkForCC()
|
|||
}
|
||||
|
||||
already_AddRefed<nsIScriptGlobalObject>
|
||||
nsEventListenerManager::GetScriptGlobalAndDocument(nsIDocument** aDoc)
|
||||
EventListenerManager::GetScriptGlobalAndDocument(nsIDocument** aDoc)
|
||||
{
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(mTarget));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
@ -1383,3 +1384,5 @@ nsEventListenerManager::GetScriptGlobalAndDocument(nsIDocument** aDoc)
|
|||
doc.forget(aDoc);
|
||||
return global.forget();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -3,8 +3,8 @@
|
|||
* 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 nsEventListenerManager_h__
|
||||
#define nsEventListenerManager_h__
|
||||
#ifndef mozilla_EventListenerManager_h_
|
||||
#define mozilla_EventListenerManager_h_
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/dom/EventListenerBinding.h"
|
||||
|
@ -16,19 +16,21 @@
|
|||
#include "nsIJSEventListener.h"
|
||||
#include "nsTObserverArray.h"
|
||||
|
||||
class nsIDOMEvent;
|
||||
struct EventTypeData;
|
||||
class ELMCreationDetector;
|
||||
class nsEventTargetChainItem;
|
||||
class nsPIDOMWindow;
|
||||
class nsIDOMEvent;
|
||||
class nsIEventListenerInfo;
|
||||
class nsIScriptContext;
|
||||
class nsPIDOMWindow;
|
||||
|
||||
class nsEventListenerManager;
|
||||
struct EventTypeData;
|
||||
|
||||
template<class T> class nsCOMArray;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventListenerManager;
|
||||
|
||||
namespace dom {
|
||||
class EventTarget;
|
||||
class Element;
|
||||
|
@ -39,7 +41,7 @@ typedef dom::CallbackObjectHolder<dom::EventListener,
|
|||
|
||||
struct EventListenerFlags
|
||||
{
|
||||
friend class ::nsEventListenerManager;
|
||||
friend class EventListenerManager;
|
||||
private:
|
||||
// If mListenerIsJSListener is true, the listener is implemented by JS.
|
||||
// Otherwise, it's implemented by native code or JS but it's wrapped.
|
||||
|
@ -143,18 +145,16 @@ inline EventListenerFlags AllEventsAtSystemGroupCapture()
|
|||
return flags;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/*
|
||||
* Event listener manager
|
||||
*/
|
||||
|
||||
class nsEventListenerManager
|
||||
class EventListenerManager MOZ_FINAL
|
||||
{
|
||||
public:
|
||||
struct Listener
|
||||
{
|
||||
mozilla::EventListenerHolder mListener;
|
||||
EventListenerHolder mListener;
|
||||
nsCOMPtr<nsIAtom> mTypeAtom; // for the main thread
|
||||
nsString mTypeString; // for non-main-threads
|
||||
uint16_t mEventType;
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
bool mHandlerIsString : 1;
|
||||
bool mAllEvents : 1;
|
||||
|
||||
mozilla::EventListenerFlags mFlags;
|
||||
EventListenerFlags mFlags;
|
||||
|
||||
nsIJSEventListener* GetJSListener() const
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE bool IsListening(const mozilla::WidgetEvent* aEvent) const
|
||||
MOZ_ALWAYS_INLINE bool IsListening(const WidgetEvent* aEvent) const
|
||||
{
|
||||
if (mFlags.mInSystemGroup != aEvent->mFlags.mInSystemGroup) {
|
||||
return false;
|
||||
|
@ -209,41 +209,41 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
nsEventListenerManager(mozilla::dom::EventTarget* aTarget);
|
||||
virtual ~nsEventListenerManager();
|
||||
EventListenerManager(dom::EventTarget* aTarget);
|
||||
virtual ~EventListenerManager();
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsEventListenerManager)
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EventListenerManager)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsEventListenerManager)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(EventListenerManager)
|
||||
|
||||
void AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
{
|
||||
mozilla::EventListenerHolder holder(aListener);
|
||||
EventListenerHolder holder(aListener);
|
||||
AddEventListener(aType, holder, aUseCapture, aWantsUntrusted);
|
||||
}
|
||||
void AddEventListener(const nsAString& aType,
|
||||
mozilla::dom::EventListener* aListener,
|
||||
dom::EventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
{
|
||||
mozilla::EventListenerHolder holder(aListener);
|
||||
EventListenerHolder holder(aListener);
|
||||
AddEventListener(aType, holder, aUseCapture, aWantsUntrusted);
|
||||
}
|
||||
void RemoveEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
mozilla::EventListenerHolder holder(aListener);
|
||||
EventListenerHolder holder(aListener);
|
||||
RemoveEventListener(aType, holder, aUseCapture);
|
||||
}
|
||||
void RemoveEventListener(const nsAString& aType,
|
||||
mozilla::dom::EventListener* aListener,
|
||||
dom::EventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
mozilla::EventListenerHolder holder(aListener);
|
||||
EventListenerHolder holder(aListener);
|
||||
RemoveEventListener(aType, holder, aUseCapture);
|
||||
}
|
||||
|
||||
|
@ -261,24 +261,24 @@ public:
|
|||
*/
|
||||
void AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& type,
|
||||
const mozilla::EventListenerFlags& aFlags)
|
||||
const EventListenerFlags& aFlags)
|
||||
{
|
||||
mozilla::EventListenerHolder holder(aListener);
|
||||
EventListenerHolder holder(aListener);
|
||||
AddEventListenerByType(holder, type, aFlags);
|
||||
}
|
||||
void AddEventListenerByType(const mozilla::EventListenerHolder& aListener,
|
||||
void AddEventListenerByType(const EventListenerHolder& aListener,
|
||||
const nsAString& type,
|
||||
const mozilla::EventListenerFlags& aFlags);
|
||||
const EventListenerFlags& aFlags);
|
||||
void RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& type,
|
||||
const mozilla::EventListenerFlags& aFlags)
|
||||
const EventListenerFlags& aFlags)
|
||||
{
|
||||
mozilla::EventListenerHolder holder(aListener);
|
||||
EventListenerHolder holder(aListener);
|
||||
RemoveEventListenerByType(holder, type, aFlags);
|
||||
}
|
||||
void RemoveEventListenerByType(const mozilla::EventListenerHolder& aListener,
|
||||
void RemoveEventListenerByType(const EventListenerHolder& aListener,
|
||||
const nsAString& type,
|
||||
const mozilla::EventListenerFlags& aFlags);
|
||||
const EventListenerFlags& aFlags);
|
||||
|
||||
/**
|
||||
* Sets the current "inline" event listener for aName to be a
|
||||
|
@ -295,16 +295,16 @@ public:
|
|||
uint32_t aLanguage,
|
||||
bool aDeferCompilation,
|
||||
bool aPermitUntrustedEvents,
|
||||
mozilla::dom::Element* aElement);
|
||||
dom::Element* aElement);
|
||||
/**
|
||||
* Remove the current "inline" event listener for aName.
|
||||
*/
|
||||
void RemoveEventHandler(nsIAtom *aName, const nsAString& aTypeString);
|
||||
|
||||
void HandleEvent(nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
WidgetEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
mozilla::dom::EventTarget* aCurrentTarget,
|
||||
dom::EventTarget* aCurrentTarget,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (mListeners.IsEmpty() || aEvent->mFlags.mPropagationStopped) {
|
||||
|
@ -402,7 +402,7 @@ public:
|
|||
bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
|
||||
bool MayHavePointerEnterLeaveEventListener() { return mMayHavePointerEnterLeaveEventListener; }
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
uint32_t ListenerCount() const
|
||||
{
|
||||
|
@ -411,17 +411,18 @@ public:
|
|||
|
||||
void MarkForCC();
|
||||
|
||||
mozilla::dom::EventTarget* GetTarget() { return mTarget; }
|
||||
dom::EventTarget* GetTarget() { return mTarget; }
|
||||
|
||||
protected:
|
||||
void HandleEventInternal(nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
WidgetEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
mozilla::dom::EventTarget* aCurrentTarget,
|
||||
dom::EventTarget* aCurrentTarget,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
nsresult HandleEventSubType(Listener* aListener,
|
||||
nsIDOMEvent* aDOMEvent,
|
||||
mozilla::dom::EventTarget* aCurrentTarget);
|
||||
dom::EventTarget* aCurrentTarget);
|
||||
|
||||
/**
|
||||
* Compile the "inline" event listener for aListener. The
|
||||
|
@ -431,7 +432,7 @@ protected:
|
|||
*/
|
||||
nsresult CompileEventHandlerInternal(Listener* aListener,
|
||||
const nsAString* aBody,
|
||||
mozilla::dom::Element* aElement);
|
||||
dom::Element* aElement);
|
||||
|
||||
/**
|
||||
* Find the Listener for the "inline" event listener for aTypeAtom.
|
||||
|
@ -464,9 +465,9 @@ public:
|
|||
*/
|
||||
void SetEventHandler(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString,
|
||||
mozilla::dom::EventHandlerNonNull* aHandler);
|
||||
void SetEventHandler(mozilla::dom::OnErrorEventHandlerNonNull* aHandler);
|
||||
void SetEventHandler(mozilla::dom::OnBeforeUnloadEventHandlerNonNull* aHandler);
|
||||
dom::EventHandlerNonNull* aHandler);
|
||||
void SetEventHandler(dom::OnErrorEventHandlerNonNull* aHandler);
|
||||
void SetEventHandler(dom::OnBeforeUnloadEventHandlerNonNull* aHandler);
|
||||
|
||||
/**
|
||||
* Get the value of the "inline" event listener for aEventName.
|
||||
|
@ -477,14 +478,15 @@ public:
|
|||
* OnErrorEventHandlerNonNull for some event targets and EventHandlerNonNull
|
||||
* for others.
|
||||
*/
|
||||
mozilla::dom::EventHandlerNonNull* GetEventHandler(nsIAtom *aEventName,
|
||||
const nsAString& aTypeString)
|
||||
dom::EventHandlerNonNull* GetEventHandler(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
const nsEventHandler* handler =
|
||||
GetEventHandlerInternal(aEventName, aTypeString);
|
||||
return handler ? handler->EventHandler() : nullptr;
|
||||
}
|
||||
mozilla::dom::OnErrorEventHandlerNonNull* GetOnErrorEventHandler()
|
||||
|
||||
dom::OnErrorEventHandlerNonNull* GetOnErrorEventHandler()
|
||||
{
|
||||
const nsEventHandler* handler;
|
||||
if (mIsMainThreadELM) {
|
||||
|
@ -494,7 +496,8 @@ public:
|
|||
}
|
||||
return handler ? handler->OnErrorEventHandler() : nullptr;
|
||||
}
|
||||
mozilla::dom::OnBeforeUnloadEventHandlerNonNull* GetOnBeforeUnloadEventHandler()
|
||||
|
||||
dom::OnBeforeUnloadEventHandlerNonNull* GetOnBeforeUnloadEventHandler()
|
||||
{
|
||||
const nsEventHandler* handler =
|
||||
GetEventHandlerInternal(nsGkAtoms::onbeforeunload, EmptyString());
|
||||
|
@ -510,35 +513,33 @@ protected:
|
|||
const nsAString& aTypeString);
|
||||
|
||||
void AddEventListener(const nsAString& aType,
|
||||
const mozilla::EventListenerHolder& aListener,
|
||||
const EventListenerHolder& aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted);
|
||||
void RemoveEventListener(const nsAString& aType,
|
||||
const mozilla::EventListenerHolder& aListener,
|
||||
const EventListenerHolder& aListener,
|
||||
bool aUseCapture);
|
||||
|
||||
void AddEventListenerInternal(
|
||||
const mozilla::EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const mozilla::EventListenerFlags& aFlags,
|
||||
bool aHandler = false,
|
||||
bool aAllEvents = false);
|
||||
void RemoveEventListenerInternal(
|
||||
const mozilla::EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const mozilla::EventListenerFlags& aFlags,
|
||||
bool aAllEvents = false);
|
||||
void AddEventListenerInternal(const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler = false,
|
||||
bool aAllEvents = false);
|
||||
void RemoveEventListenerInternal(const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aAllEvents = false);
|
||||
void RemoveAllListeners();
|
||||
const EventTypeData* GetTypeDataForIID(const nsIID& aIID);
|
||||
const EventTypeData* GetTypeDataForEventName(nsIAtom* aName);
|
||||
nsPIDOMWindow* GetInnerWindowForTarget();
|
||||
already_AddRefed<nsPIDOMWindow> GetTargetAsInnerWindow() const;
|
||||
|
||||
bool ListenerCanHandle(Listener* aListener, mozilla::WidgetEvent* aEvent);
|
||||
bool ListenerCanHandle(Listener* aListener, WidgetEvent* aEvent);
|
||||
|
||||
already_AddRefed<nsIScriptGlobalObject>
|
||||
GetScriptGlobalAndDocument(nsIDocument** aDoc);
|
||||
|
@ -556,13 +557,15 @@ protected:
|
|||
uint32_t mNoListenerForEvent : 22;
|
||||
|
||||
nsAutoTObserverArray<Listener, 2> mListeners;
|
||||
mozilla::dom::EventTarget* mTarget; //WEAK
|
||||
nsCOMPtr<nsIAtom> mNoListenerForEventAtom;
|
||||
dom::EventTarget* mTarget; // WEAK
|
||||
nsCOMPtr<nsIAtom> mNoListenerForEventAtom;
|
||||
|
||||
friend class ELMCreationDetector;
|
||||
static uint32_t sMainThreadCreatedCount;
|
||||
friend class ::ELMCreationDetector;
|
||||
static uint32_t sMainThreadCreatedCount;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* NS_AddSystemEventListener() is a helper function for implementing
|
||||
* EventTarget::AddSystemEventListener().
|
||||
|
@ -574,7 +577,7 @@ NS_AddSystemEventListener(mozilla::dom::EventTarget* aTarget,
|
|||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
{
|
||||
nsEventListenerManager* listenerManager =
|
||||
mozilla::EventListenerManager* listenerManager =
|
||||
aTarget->GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(listenerManager);
|
||||
mozilla::EventListenerFlags flags;
|
||||
|
@ -585,4 +588,4 @@ NS_AddSystemEventListener(mozilla::dom::EventTarget* aTarget,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif // nsEventListenerManager_h__
|
||||
#endif // mozilla_EventListenerManager_h_
|
|
@ -8,12 +8,12 @@
|
|||
#include "jsdIDebuggerService.h"
|
||||
#endif
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventListenerManager.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"
|
||||
|
@ -175,7 +175,7 @@ EventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
|
|||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aEventTarget);
|
||||
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
nsEventListenerManager* elm = eventTarget->GetExistingListenerManager();
|
||||
EventListenerManager* elm = eventTarget->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->GetListenerInfo(&listenerInfos);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ EventListenerService::HasListenersFor(nsIDOMEventTarget* aEventTarget,
|
|||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aEventTarget);
|
||||
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
nsEventListenerManager* elm = eventTarget->GetExistingListenerManager();
|
||||
EventListenerManager* elm = eventTarget->GetExistingListenerManager();
|
||||
*aRetVal = elm && elm->HasListenersFor(aType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ EventListenerService::AddSystemEventListener(nsIDOMEventTarget *aTarget,
|
|||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
nsEventListenerManager* manager = eventTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = eventTarget->GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(manager);
|
||||
|
||||
EventListenerFlags flags =
|
||||
|
@ -275,7 +275,7 @@ EventListenerService::RemoveSystemEventListener(nsIDOMEventTarget *aTarget,
|
|||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
nsEventListenerManager* manager = eventTarget->GetExistingListenerManager();
|
||||
EventListenerManager* manager = eventTarget->GetExistingListenerManager();
|
||||
if (manager) {
|
||||
EventListenerFlags flags =
|
||||
aUseCapture ? TrustedEventsAtSystemGroupCapture() :
|
||||
|
@ -298,7 +298,7 @@ EventListenerService::AddListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
|||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
nsEventListenerManager* manager = eventTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = eventTarget->GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(manager);
|
||||
manager->AddListenerForAllEvents(aListener, aUseCapture, aWantsUntrusted,
|
||||
aSystemEventGroup);
|
||||
|
@ -316,7 +316,7 @@ EventListenerService::RemoveListenerForAllEvents(nsIDOMEventTarget* aTarget,
|
|||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
nsEventListenerManager* manager = eventTarget->GetExistingListenerManager();
|
||||
EventListenerManager* manager = eventTarget->GetExistingListenerManager();
|
||||
if (manager) {
|
||||
manager->RemoveListenerForAllEvents(aListener, aUseCapture, aSystemEventGroup);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* 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 "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -16,7 +16,7 @@ EventTarget::RemoveEventListener(const nsAString& aType,
|
|||
bool aUseCapture,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsEventListenerManager* elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->RemoveEventListener(aType, aListener, aUseCapture);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ EventTarget::RemoveEventListener(const nsAString& aType,
|
|||
EventHandlerNonNull*
|
||||
EventTarget::GetEventHandler(nsIAtom* aType, const nsAString& aTypeString)
|
||||
{
|
||||
nsEventListenerManager* elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
return elm ? elm->GetEventHandler(aType, aTypeString) : nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ class nsIDOMEventListener;
|
|||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
class EventListenerManager;
|
||||
|
||||
namespace dom {
|
||||
|
||||
|
@ -73,13 +74,13 @@ public:
|
|||
/**
|
||||
* Get the event listener manager, creating it if it does not already exist.
|
||||
*/
|
||||
virtual nsEventListenerManager* GetOrCreateListenerManager() = 0;
|
||||
virtual EventListenerManager* GetOrCreateListenerManager() = 0;
|
||||
|
||||
/**
|
||||
* Get the event listener manager, returning null if it does not already
|
||||
* exist.
|
||||
*/
|
||||
virtual nsEventListenerManager* GetExistingListenerManager() const = 0;
|
||||
virtual EventListenerManager* GetExistingListenerManager() const = 0;
|
||||
|
||||
protected:
|
||||
EventHandlerNonNull* GetEventHandler(nsIAtom* aType,
|
||||
|
|
|
@ -18,7 +18,6 @@ EXPORTS += [
|
|||
'nsDOMEventTargetHelper.h',
|
||||
'nsDOMKeyNameList.h',
|
||||
'nsEventDispatcher.h',
|
||||
'nsEventListenerManager.h',
|
||||
'nsEventNameList.h',
|
||||
'nsEventStateManager.h',
|
||||
'nsEventStates.h',
|
||||
|
@ -27,6 +26,7 @@ EXPORTS += [
|
|||
]
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'EventListenerManager.h',
|
||||
'IMEStateManager.h',
|
||||
'InternalMutationEvent.h',
|
||||
]
|
||||
|
@ -77,6 +77,7 @@ UNIFIED_SOURCES += [
|
|||
'DeviceMotionEvent.cpp',
|
||||
'DragEvent.cpp',
|
||||
'Event.cpp',
|
||||
'EventListenerManager.cpp',
|
||||
'EventListenerService.cpp',
|
||||
'EventTarget.cpp',
|
||||
'FocusEvent.cpp',
|
||||
|
@ -92,7 +93,6 @@ UNIFIED_SOURCES += [
|
|||
'nsAsyncDOMEvent.cpp',
|
||||
'nsDOMEventTargetHelper.cpp',
|
||||
'nsEventDispatcher.cpp',
|
||||
'nsEventListenerManager.cpp',
|
||||
'nsJSEventListener.cpp',
|
||||
'nsPaintRequest.cpp',
|
||||
'PointerEvent.cpp',
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "prprf.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "ScriptSettings.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -156,7 +157,7 @@ nsDOMEventTargetHelper::RemoveEventListener(const nsAString& aType,
|
|||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
nsEventListenerManager* elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->RemoveEventListener(aType, aListener, aUseCapture);
|
||||
}
|
||||
|
@ -183,7 +184,7 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsEventListenerManager* elm = GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(elm);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
return NS_OK;
|
||||
|
@ -207,7 +208,7 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
|
|||
wantsUntrusted = aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
nsEventListenerManager* elm = GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
if (!elm) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
|
@ -320,17 +321,17 @@ nsDOMEventTargetHelper::DispatchDOMEvent(WidgetEvent* aEvent,
|
|||
aEventStatus);
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsDOMEventTargetHelper::GetOrCreateListenerManager()
|
||||
{
|
||||
if (!mListenerManager) {
|
||||
mListenerManager = new nsEventListenerManager(this);
|
||||
mListenerManager = new EventListenerManager(this);
|
||||
}
|
||||
|
||||
return mListenerManager;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsDOMEventTargetHelper::GetExistingListenerManager() const
|
||||
{
|
||||
return mListenerManager;
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
|
||||
class JSCompartment;
|
||||
|
@ -59,10 +59,10 @@ public:
|
|||
|
||||
NS_DECL_NSIDOMEVENTTARGET
|
||||
|
||||
virtual nsEventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual nsEventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetExistingListenerManager() const MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
|
||||
using mozilla::dom::EventTarget::RemoveEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
|
@ -151,7 +151,7 @@ public:
|
|||
protected:
|
||||
nsresult WantsUntrusted(bool* aRetVal);
|
||||
|
||||
nsRefPtr<nsEventListenerManager> mListenerManager;
|
||||
nsRefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||
// Dispatch a trusted, non-cancellable and non-bubbling event to |this|.
|
||||
nsresult DispatchTrustedEvent(const nsAString& aEventName);
|
||||
// Make |event| trusted and dispatch |aEvent| to |this|.
|
||||
|
@ -250,10 +250,10 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMEventTargetHelper,
|
|||
virtual nsresult DispatchDOMEvent(mozilla::WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent, nsPresContext* aPresContext, nsEventStatus* aEventStatus) { \
|
||||
return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); \
|
||||
} \
|
||||
virtual nsEventListenerManager * GetOrCreateListenerManager() { \
|
||||
virtual mozilla::EventListenerManager* GetOrCreateListenerManager() { \
|
||||
return _to GetOrCreateListenerManager(); \
|
||||
} \
|
||||
virtual nsEventListenerManager * GetExistingListenerManager() const { \
|
||||
virtual mozilla::EventListenerManager* GetExistingListenerManager() const { \
|
||||
return _to GetExistingListenerManager(); \
|
||||
} \
|
||||
virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv) { \
|
||||
|
@ -267,11 +267,11 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMEventTargetHelper,
|
|||
using _class::AddEventListener; \
|
||||
using _class::RemoveEventListener; \
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(_class::) \
|
||||
virtual nsEventListenerManager* \
|
||||
virtual mozilla::EventListenerManager* \
|
||||
GetOrCreateListenerManager() { \
|
||||
return _class::GetOrCreateListenerManager(); \
|
||||
} \
|
||||
virtual nsEventListenerManager* \
|
||||
virtual mozilla::EventListenerManager* \
|
||||
GetExistingListenerManager() const { \
|
||||
return _class::GetExistingListenerManager(); \
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsError.h"
|
||||
#include <new>
|
||||
|
@ -19,6 +18,7 @@
|
|||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/MiscEvents.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
|
@ -36,14 +36,14 @@ public:
|
|||
// We can do this optimization only in the main thread.
|
||||
mNonMainThread(!NS_IsMainThread()),
|
||||
mInitialCount(mNonMainThread ?
|
||||
0 : nsEventListenerManager::sMainThreadCreatedCount)
|
||||
0 : EventListenerManager::sMainThreadCreatedCount)
|
||||
{
|
||||
}
|
||||
|
||||
bool MayHaveNewListenerManager()
|
||||
{
|
||||
return mNonMainThread ||
|
||||
mInitialCount != nsEventListenerManager::sMainThreadCreatedCount;
|
||||
mInitialCount != EventListenerManager::sMainThreadCreatedCount;
|
||||
}
|
||||
|
||||
bool IsMainThread()
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
/**
|
||||
* If the current item in the event target chain has an event listener
|
||||
* manager, this method calls nsEventListenerManager::HandleEvent().
|
||||
* manager, this method calls EventListenerManager::HandleEvent().
|
||||
*/
|
||||
void HandleEvent(nsEventChainPostVisitor& aVisitor,
|
||||
ELMCreationDetector& aCd)
|
||||
|
@ -209,7 +209,7 @@ public:
|
|||
// Event retargeting must happen whenever mNewTarget is non-null.
|
||||
nsCOMPtr<EventTarget> mNewTarget;
|
||||
// Cache mTarget's event listener manager.
|
||||
nsRefPtr<nsEventListenerManager> mManager;
|
||||
nsRefPtr<EventListenerManager> mManager;
|
||||
};
|
||||
|
||||
nsEventTargetChainItem::nsEventTargetChainItem(EventTarget* aTarget)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
using mozilla::dom::Nullable;
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
namespace dom {
|
||||
class EventTarget;
|
||||
} // namespace dom
|
||||
|
@ -21,7 +22,6 @@ class EventTarget;
|
|||
class nsPresContext;
|
||||
class nsEventChainPreVisitor;
|
||||
class nsEventChainPostVisitor;
|
||||
class nsEventListenerManager;
|
||||
%}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ class nsEventListenerManager;
|
|||
[ptr] native nsPresContextPtr(nsPresContext);
|
||||
[ptr] native nsEventStatusPtr(nsEventStatus);
|
||||
[ptr] native JSContextPtr(JSContext);
|
||||
[ptr] native nsEventListenerManagerPtr(nsEventListenerManager);
|
||||
[ptr] native EventListenerManagerPtr(mozilla::EventListenerManager);
|
||||
[ptr] native EventTargetPtr(mozilla::dom::EventTarget);
|
||||
|
||||
interface nsIScriptContext;
|
||||
|
@ -296,7 +296,8 @@ aClass::RemoveSystemEventListener(const nsAString& aType, \
|
|||
nsIDOMEventListener *aListener, \
|
||||
bool aUseCapture) \
|
||||
{ \
|
||||
nsEventListenerManager* listenerManager = GetExistingListenerManager(); \
|
||||
mozilla::EventListenerManager* listenerManager = \
|
||||
GetExistingListenerManager(); \
|
||||
if (!listenerManager) { \
|
||||
return NS_OK; \
|
||||
} \
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "IndexedDBChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/IntentionalCrash.h"
|
||||
#include "mozilla/docshell/OfflineCacheUpdateChild.h"
|
||||
#include "mozilla/ipc/DocumentRendererChild.h"
|
||||
|
@ -32,7 +33,6 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsEmbedCID.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include <algorithm>
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
|
@ -1157,7 +1157,7 @@ TabChild::~TabChild()
|
|||
mGlobal = nullptr;
|
||||
|
||||
if (mTabChildGlobal) {
|
||||
nsEventListenerManager* elm = mTabChildGlobal->GetExistingListenerManager();
|
||||
EventListenerManager* elm = mTabChildGlobal->GetExistingListenerManager();
|
||||
if (elm) {
|
||||
elm->Disconnect();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* 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 "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/SVGAnimationElement.h"
|
||||
#include "nsSMILTimeValueSpec.h"
|
||||
#include "nsSMILInterval.h"
|
||||
|
@ -11,12 +12,12 @@
|
|||
#include "nsSMILTimedElement.h"
|
||||
#include "nsSMILInstanceTime.h"
|
||||
#include "nsSMILParserUtils.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMTimeEvent.h"
|
||||
#include "nsString.h"
|
||||
#include <limits>
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -315,7 +316,7 @@ nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget)
|
|||
mEventListener = new EventListener(this);
|
||||
}
|
||||
|
||||
nsEventListenerManager* elm = GetEventListenerManager(aTarget);
|
||||
EventListenerManager* elm = GetEventListenerManager(aTarget);
|
||||
if (!elm)
|
||||
return;
|
||||
|
||||
|
@ -330,7 +331,7 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget)
|
|||
if (!aTarget || !mEventListener)
|
||||
return;
|
||||
|
||||
nsEventListenerManager* elm = GetEventListenerManager(aTarget);
|
||||
EventListenerManager* elm = GetEventListenerManager(aTarget);
|
||||
if (!elm)
|
||||
return;
|
||||
|
||||
|
@ -339,7 +340,7 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget)
|
|||
AllEventsAtSystemGroupBubble());
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
EventListenerManager*
|
||||
nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager");
|
||||
|
|
|
@ -19,6 +19,10 @@ class nsSMILTimeContainer;
|
|||
class nsSMILInstanceTime;
|
||||
class nsSMILInterval;
|
||||
|
||||
namespace mozilla {
|
||||
class EventListenerManager;
|
||||
} // namespace mozilla
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSMILTimeValueSpec class
|
||||
//
|
||||
|
@ -65,7 +69,7 @@ protected:
|
|||
bool IsWhitelistedEvent();
|
||||
void RegisterEventListener(Element* aElement);
|
||||
void UnregisterEventListener(Element* aElement);
|
||||
nsEventListenerManager* GetEventListenerManager(Element* aElement);
|
||||
mozilla::EventListenerManager* GetEventListenerManager(Element* aElement);
|
||||
void HandleEvent(nsIDOMEvent* aEvent);
|
||||
bool CheckEventDetail(nsIDOMEvent* aEvent);
|
||||
bool CheckRepeatEventDetail(nsIDOMEvent* aEvent);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "WorkerScope.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/SharedWorkerGlobalScopeBinding.h"
|
||||
|
@ -142,7 +143,7 @@ WorkerGlobalScope::GetOnerror()
|
|||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
nsEventListenerManager *elm = GetExistingListenerManager();
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
return elm ? elm->GetOnErrorEventHandler() : nullptr;
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,7 @@ WorkerGlobalScope::SetOnerror(OnErrorEventHandlerNonNull* aHandler)
|
|||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
nsEventListenerManager *elm = GetOrCreateListenerManager();
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
if (elm) {
|
||||
elm->SetEventHandler(aHandler);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "nsCRT.h"
|
||||
|
||||
// Event listeners
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsAttrName.h"
|
||||
|
||||
|
@ -531,7 +531,7 @@ nsXBLBinding::InstallEventHandlers()
|
|||
nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
|
||||
|
||||
if (handlerChain) {
|
||||
nsEventListenerManager* manager = mBoundElement->GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = mBoundElement->GetOrCreateListenerManager();
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
|
@ -680,8 +680,7 @@ nsXBLBinding::UnhookEventHandlers()
|
|||
nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
|
||||
|
||||
if (handlerChain) {
|
||||
nsEventListenerManager* manager =
|
||||
mBoundElement->GetExistingListenerManager();
|
||||
EventListenerManager* manager = mBoundElement->GetExistingListenerManager();
|
||||
if (!manager) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
|
|
|
@ -45,13 +45,13 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsXBLSerialize.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULPrototypeCache.h"
|
||||
#endif
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
@ -562,7 +562,7 @@ nsXBLService::AttachGlobalKeyHandler(EventTarget* aTarget)
|
|||
piTarget = doc; // We're a XUL keyset. Attach to our document.
|
||||
}
|
||||
|
||||
nsEventListenerManager* manager = piTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = piTarget->GetOrCreateListenerManager();
|
||||
|
||||
if (!piTarget || !manager)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -613,7 +613,7 @@ nsXBLService::DetachGlobalKeyHandler(EventTarget* aTarget)
|
|||
if (doc)
|
||||
piTarget = do_QueryInterface(doc);
|
||||
|
||||
nsEventListenerManager* manager = piTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* manager = piTarget->GetOrCreateListenerManager();
|
||||
|
||||
if (!piTarget || !manager)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "txMozillaXMLOutput.h"
|
||||
#include "nsTextNode.h"
|
||||
#include "mozilla/dom/DocumentFragment.h"
|
||||
#include "prtime.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* 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 "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/EventListenerManager.h" // for EventListenerManager
|
||||
#include "mozilla/IMEStateManager.h" // for IMEStateManager
|
||||
#include "mozilla/Preferences.h" // for Preferences
|
||||
#include "mozilla/TextEvents.h" // for WidgetCompositionEvent
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "nsDebug.h" // for NS_ENSURE_TRUE, etc
|
||||
#include "nsEditor.h" // for nsEditor, etc
|
||||
#include "nsEditorEventListener.h"
|
||||
#include "nsEventListenerManager.h" // for nsEventListenerManager
|
||||
#include "nsFocusManager.h" // for nsFocusManager
|
||||
#include "nsGkAtoms.h" // for nsGkAtoms, nsGkAtoms::input
|
||||
#include "nsIClipboard.h" // for nsIClipboard, etc
|
||||
|
@ -141,7 +141,7 @@ nsEditorEventListener::InstallToEditor()
|
|||
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
|
||||
|
||||
// register the event listeners with the listener manager
|
||||
nsEventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(elmP);
|
||||
|
||||
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
|
||||
|
@ -235,7 +235,7 @@ nsEditorEventListener::UninstallFromEditor()
|
|||
return;
|
||||
}
|
||||
|
||||
nsEventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
|
||||
if (!elmP) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,10 +61,10 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsView.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -866,7 +866,7 @@ nsDocShellTreeOwner::AddChromeListeners()
|
|||
nsCOMPtr<EventTarget> target;
|
||||
GetDOMEventTarget(mWebBrowser, getter_AddRefs(target));
|
||||
|
||||
nsEventListenerManager* elmP = target->GetOrCreateListenerManager();
|
||||
EventListenerManager* elmP = target->GetOrCreateListenerManager();
|
||||
if (elmP) {
|
||||
elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
|
||||
TrustedEventsAtSystemGroupBubble());
|
||||
|
@ -896,7 +896,7 @@ nsDocShellTreeOwner::RemoveChromeListeners()
|
|||
if (!piTarget)
|
||||
return NS_OK;
|
||||
|
||||
nsEventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
|
||||
EventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
|
||||
if (elmP)
|
||||
{
|
||||
elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("dragover"),
|
||||
|
|
|
@ -58,13 +58,13 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsRange.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEditor.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsITextControlElement.h"
|
||||
#include "prtime.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
|
|
@ -600,7 +600,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp
|
|||
/*
|
||||
* The reason for checking fun->environment() below is that certain
|
||||
* consumers of JS::CompileFunction, namely
|
||||
* nsEventListenerManager::CompileEventHandlerInternal, passes in a
|
||||
* EventListenerManager::CompileEventHandlerInternal, passes in a
|
||||
* nullptr environment. This compiled function is never used, but
|
||||
* instead is cloned immediately onto the right scope chain.
|
||||
*/
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include "PositionedEventTargeting.h"
|
||||
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsRegion.h"
|
||||
|
@ -118,7 +118,7 @@ GetPrefsFor(nsEventStructType aEventStructType)
|
|||
static bool
|
||||
HasMouseListener(nsIContent* aContent)
|
||||
{
|
||||
if (nsEventListenerManager* elm = aContent->GetExistingListenerManager()) {
|
||||
if (EventListenerManager* elm = aContent->GetExistingListenerManager()) {
|
||||
return elm->HasListenersFor(nsGkAtoms::onclick) ||
|
||||
elm->HasListenersFor(nsGkAtoms::onmousedown) ||
|
||||
elm->HasListenersFor(nsGkAtoms::onmouseup);
|
||||
|
@ -133,7 +133,7 @@ static int32_t gTouchEventsEnabled = 0;
|
|||
static bool
|
||||
HasTouchListener(nsIContent* aContent)
|
||||
{
|
||||
nsEventListenerManager* elm = aContent->GetExistingListenerManager();
|
||||
EventListenerManager* elm = aContent->GetExistingListenerManager();
|
||||
if (!elm) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "gfxPlatform.h"
|
||||
#include "nsCSSRules.h"
|
||||
#include "nsFontFaceLoader.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "prenv.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsTransitionManager.h"
|
||||
|
@ -2305,7 +2305,7 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow)
|
|||
if (!parentTarget)
|
||||
return false;
|
||||
|
||||
nsEventListenerManager* manager = nullptr;
|
||||
EventListenerManager* manager = nullptr;
|
||||
if ((manager = parentTarget->GetExistingListenerManager()) &&
|
||||
manager->MayHavePaintEventListener()) {
|
||||
return true;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "mozilla/dom/Attr.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsEditorEventListener.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -306,7 +306,7 @@ nsLayoutStatics::Shutdown()
|
|||
DOMStorageObserver::Shutdown();
|
||||
txMozillaXSLTProcessor::Shutdown();
|
||||
Attr::Shutdown();
|
||||
nsEventListenerManager::Shutdown();
|
||||
EventListenerManager::Shutdown();
|
||||
IMEStateManager::Shutdown();
|
||||
nsComputedDOMStyle::Shutdown();
|
||||
nsCSSParser::Shutdown();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsContentList.h"
|
||||
#include "nsView.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsISelectControlFrame.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
|
|
@ -77,8 +77,8 @@
|
|||
#include "gfxASurface.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
|
@ -1871,7 +1871,7 @@ CheckForTouchEventHandler(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
|||
if (!content) {
|
||||
return;
|
||||
}
|
||||
nsEventListenerManager* elm = nsContentUtils::GetExistingListenerManagerForNode(content);
|
||||
EventListenerManager* elm = nsContentUtils::GetExistingListenerManagerForNode(content);
|
||||
if (!elm) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsScrollbarButtonFrame.h"
|
||||
#include "nsISliderListener.h"
|
||||
|
|
|
@ -81,7 +81,7 @@ enum nsEventStructType
|
|||
#define NS_EVENT_NULL 0
|
||||
|
||||
// This is a dummy event message for all event listener implementation in
|
||||
// nsEventListenerManager.
|
||||
// EventListenerManager.
|
||||
#define NS_EVENT_ALL 1
|
||||
|
||||
#define NS_WINDOW_START 100
|
||||
|
|
|
@ -3983,7 +3983,7 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam,
|
|||
nsToolkit::gMouseTrailer->Enable();
|
||||
|
||||
// Release the widget with NS_IF_RELEASE() just in case
|
||||
// the context menu key code in nsEventListenerManager::HandleEvent()
|
||||
// the context menu key code in EventListenerManager::HandleEvent()
|
||||
// released it already.
|
||||
return result;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче