Bug 658714 Part 7: DeCOMtaminate nsEventListenerManager. r=smaug

This commit is contained in:
Jonas Sicking 2011-06-23 19:18:01 -07:00
Родитель b065d276a3
Коммит 2d5bd7162c
56 изменённых файлов: 218 добавлений и 606 удалений

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

@ -50,7 +50,7 @@
#include "nsIChannel.h"
#include "nsIContentViewer.h"
#include "nsIDOMDocument.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMWindow.h"
#include "nsIInterfaceRequestorUtils.h"
@ -392,7 +392,7 @@ nsAccDocManager::AddListeners(nsIDocument *aDocument,
{
nsPIDOMWindow *window = aDocument->GetWindow();
nsIDOMEventTarget *target = window->GetChromeEventHandler();
nsIEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
NS_EVENT_FLAG_CAPTURE, nsnull);

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

@ -52,7 +52,7 @@
#include "nsIDOMXULElement.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIScrollableFrame.h"
@ -78,7 +78,7 @@ PRBool
nsCoreUtils::HasClickListener(nsIContent *aContent)
{
NS_ENSURE_TRUE(aContent, PR_FALSE);
nsIEventListenerManager* listenerManager =
nsEventListenerManager* listenerManager =
aContent->GetListenerManager(PR_FALSE);
return listenerManager &&

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

@ -65,7 +65,7 @@
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIFrame.h"
#include "nsIMenuFrame.h"
#include "nsIHTMLDocument.h"

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

@ -41,7 +41,7 @@
#include "nsWinUtils.h"
#include "nsIDOMEventTarget.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
////////////////////////////////////////////////////////////////////////////////
// Constructor/desctructor

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

@ -112,7 +112,7 @@ class nsIContentPolicy;
class nsILineBreaker;
class nsIWordBreaker;
class nsIJSRuntimeService;
class nsIEventListenerManager;
class nsEventListenerManager;
class nsIScriptContext;
class nsIRunnable;
class nsIInterfaceRequestor;
@ -1000,8 +1000,8 @@ public:
* @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
* one already exists.
*/
static nsIEventListenerManager* GetListenerManager(nsINode* aNode,
PRBool aCreateIfNotFound);
static nsEventListenerManager* GetListenerManager(nsINode* aNode,
PRBool aCreateIfNotFound);
/**
* Remove the eventlistener manager for aNode.

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

@ -48,7 +48,7 @@
class nsIAtom;
class nsIDOMEvent;
class nsIContent;
class nsIEventListenerManager;
class nsEventListenerManager;
class nsIURI;
class nsRuleWalker;
class nsAttrValue;

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

@ -59,7 +59,7 @@ class nsIPresShell;
class nsEventChainVisitor;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
class nsIEventListenerManager;
class nsEventListenerManager;
class nsIPrincipal;
class nsIMutationObserver;
class nsChildContentList;

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

@ -130,7 +130,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsXBLPrototypeBinding.h"
#include "nsEscape.h"
#include "nsICharsetConverterManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsAttrName.h"
#include "nsIDOMUserDataHandler.h"
#include "nsContentCreatorFunctions.h"
@ -277,7 +277,7 @@ private:
const void *mKey; // must be first, to look like PLDHashEntryStub
public:
nsCOMPtr<nsIEventListenerManager> mListenerManager;
nsRefPtr<nsEventListenerManager> mListenerManager;
};
static PRBool
@ -3244,7 +3244,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
if (aNode->IsInDoc()) {
nsCOMPtr<nsIDOMEventTarget> piTarget(do_QueryInterface(window));
if (piTarget) {
nsIEventListenerManager* manager = piTarget->GetListenerManager(PR_FALSE);
nsEventListenerManager* manager = piTarget->GetListenerManager(PR_FALSE);
if (manager) {
PRBool hasListeners = PR_FALSE;
manager->HasMutationListeners(&hasListeners);
@ -3259,7 +3259,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) {
nsIEventListenerManager* manager = aNode->GetListenerManager(PR_FALSE);
nsEventListenerManager* manager = aNode->GetListenerManager(PR_FALSE);
if (manager) {
PRBool hasListeners = PR_FALSE;
manager->HasMutationListeners(&hasListeners);
@ -3355,12 +3355,13 @@ nsContentUtils::TraverseListenerManager(nsINode *aNode,
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[via hash] mListenerManager");
cb.NoteXPCOMChild(entry->mListenerManager);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR(entry->mListenerManager,
nsEventListenerManager,
"[via hash] mListenerManager")
}
}
nsIEventListenerManager*
nsEventListenerManager*
nsContentUtils::GetListenerManager(nsINode *aNode,
PRBool aCreateIfNotFound)
{
@ -3396,16 +3397,7 @@ nsContentUtils::GetListenerManager(nsINode *aNode,
}
if (!entry->mListenerManager) {
nsresult rv =
NS_NewEventListenerManager(getter_AddRefs(entry->mListenerManager));
if (NS_FAILED(rv)) {
PL_DHashTableRawRemove(&sEventListenerManagersHash, entry);
return nsnull;
}
entry->mListenerManager->SetListenerTarget(aNode);
entry->mListenerManager = new nsEventListenerManager(aNode);
aNode->SetFlags(NODE_HAS_LISTENERMANAGER);
}
@ -3423,7 +3415,7 @@ nsContentUtils::RemoveListenerManager(nsINode *aNode)
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
nsCOMPtr<nsIEventListenerManager> listenerManager;
nsRefPtr<nsEventListenerManager> listenerManager;
listenerManager.swap(entry->mListenerManager);
// Remove the entry and *then* do operations that could cause further
// modification of sEventListenerManagersHash. See bug 334177.

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

@ -56,7 +56,7 @@
#include "nsGkAtoms.h"
#include "nsCOMArray.h"
#include "nsNodeUtils.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsTextNode.h"
#include "mozAutoDocUpdate.h"
#include "nsMutationEvent.h"

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

@ -1851,7 +1851,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
// Traverse all nsDocument nsCOMPtrs.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParser)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptGlobalObject)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager,
nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMStyleSheets)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptLoader)
@ -6209,18 +6210,14 @@ nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
return nsINode::GetOwnerDocument(aOwnerDocument);
}
nsIEventListenerManager*
nsEventListenerManager*
nsDocument::GetListenerManager(PRBool aCreateIfNotFound)
{
if (mListenerManager || !aCreateIfNotFound) {
return mListenerManager;
if (!mListenerManager && aCreateIfNotFound) {
mListenerManager =
new nsEventListenerManager(static_cast<nsIDOMEventTarget*>(this));
}
nsresult rv = NS_NewEventListenerManager(getter_AddRefs(mListenerManager));
NS_ENSURE_SUCCESS(rv, nsnull);
mListenerManager->SetListenerTarget(static_cast<nsIDocument *>(this));
return mListenerManager;
}
@ -6246,7 +6243,7 @@ nsDocument::AddGroupedEventListener(const nsAString& aType,
PRBool aUseCapture,
nsIDOMEventGroup *aEvtGrp)
{
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
return manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp);
@ -7001,7 +6998,7 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
// Check our event listener manager for unload/beforeunload listeners.
nsCOMPtr<nsIDOMEventTarget> piTarget = do_QueryInterface(mScriptGlobalObject);
if (piTarget) {
nsIEventListenerManager* manager =
nsEventListenerManager* manager =
piTarget->GetListenerManager(PR_FALSE);
if (manager && manager->HasUnloadListeners()) {
return PR_FALSE;

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

@ -59,7 +59,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsIDOMEventTarget.h"
#include "nsIContent.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMNodeSelector.h"
#include "nsIPrincipal.h"
#include "nsIParser.h"
@ -110,7 +110,7 @@
#define XML_DECLARATION_BITS_STANDALONE_YES (1 << 3)
class nsIEventListenerManager;
class nsEventListenerManager;
class nsDOMStyleSheetList;
class nsDOMStyleSheetSetList;
class nsIOutputStream;
@ -776,7 +776,7 @@ public:
// nsIDOMEventTarget
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsIEventListenerManager*
virtual nsEventListenerManager*
GetListenerManager(PRBool aCreateIfNotFound);
// nsIDOM3EventTarget
@ -1054,7 +1054,7 @@ protected:
// is a weak reference to avoid leaks due to circular references.
nsWeakPtr mScopeObject;
nsCOMPtr<nsIEventListenerManager> mListenerManager;
nsRefPtr<nsEventListenerManager> mListenerManager;
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
nsRefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
nsRefPtr<nsScriptLoader> mScriptLoader;

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

@ -43,7 +43,7 @@
#include "nsGenericDOMDataNode.h"
#include "nsGenericElement.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMDocument.h"
#include "nsReadableUtils.h"
#include "nsMutationEvent.h"

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

@ -47,7 +47,7 @@
#include "nsIDOMCharacterData.h"
#include "nsTextFragment.h"
#include "nsDOMError.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsGenericElement.h"
#include "nsCycleCollectionParticipant.h"
#include "nsContentUtils.h"

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

@ -54,7 +54,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMText.h"
#include "nsIContentIterator.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsFocusManager.h"
#include "nsILinkHandler.h"
#include "nsIScriptGlobalObject.h"
@ -960,7 +960,7 @@ nsINode::AddEventListener(const nsAString& aType,
"aWantsUntrusted to PR_FALSE or make the aWantsUntrusted "
"explicit by making aOptionalArgc non-zero.");
nsIEventListenerManager* listener_manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* listener_manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(listener_manager);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
@ -980,11 +980,9 @@ nsINode::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
nsCOMPtr<nsIDOMEventTarget> event_target =
do_QueryInterface(GetListenerManager(PR_TRUE));
NS_ENSURE_STATE(event_target);
return event_target->RemoveEventListener(aType, aListener, aUseCapture);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->RemoveEventListener(aType, aListener, aUseCapture);
}
nsresult
@ -998,10 +996,9 @@ nsINode::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
nsresult
nsINode::DispatchEvent(nsIDOMEvent *aEvent, PRBool* aRetVal)
{
nsCOMPtr<nsIDOMEventTarget> target =
do_QueryInterface(GetListenerManager(PR_TRUE));
NS_ENSURE_STATE(target);
return target->DispatchEvent(aEvent, aRetVal);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->DispatchEvent(aEvent, aRetVal);
}
nsresult
@ -1024,7 +1021,7 @@ nsresult
nsINode::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsIEventListenerManager* elm = GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
@ -1033,13 +1030,13 @@ nsresult
nsINode::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsIEventListenerManager* elm = GetListenerManager(PR_FALSE);
nsEventListenerManager* elm = GetListenerManager(PR_FALSE);
return elm ?
elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE) :
NS_OK;
}
nsIEventListenerManager*
nsEventListenerManager*
nsINode::GetListenerManager(PRBool aCreateIfNotFound)
{
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound);
@ -1048,7 +1045,7 @@ nsINode::GetListenerManager(PRBool aCreateIfNotFound)
nsresult
nsINode::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
{
nsIEventListenerManager* elm = GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->GetSystemEventGroupLM(aGroup);
}
@ -2120,15 +2117,6 @@ nsDOMEventRTTearoff::LastRelease()
delete this;
}
nsresult
nsDOMEventRTTearoff::GetDOM3EventTarget(nsIDOM3EventTarget **aTarget)
{
nsIEventListenerManager* listener_manager =
mNode->GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(listener_manager);
return CallQueryInterface(listener_manager, aTarget);
}
// nsIDOM3EventTarget
NS_IMETHODIMP
nsDOMEventRTTearoff::AddGroupedEventListener(const nsAString& aType,
@ -2136,12 +2124,9 @@ nsDOMEventRTTearoff::AddGroupedEventListener(const nsAString& aType,
PRBool aUseCapture,
nsIDOMEventGroup *aEvtGrp)
{
nsCOMPtr<nsIDOM3EventTarget> event_target;
nsresult rv = GetDOM3EventTarget(getter_AddRefs(event_target));
NS_ENSURE_SUCCESS(rv, rv);
return event_target->AddGroupedEventListener(aType, aListener, aUseCapture,
aEvtGrp);
nsEventListenerManager* elm = mNode->GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->AddGroupedEventListener(aType, aListener, aUseCapture, aEvtGrp);
}
NS_IMETHODIMP
@ -2150,12 +2135,10 @@ nsDOMEventRTTearoff::RemoveGroupedEventListener(const nsAString& aType,
PRBool aUseCapture,
nsIDOMEventGroup *aEvtGrp)
{
nsCOMPtr<nsIDOM3EventTarget> event_target;
nsresult rv = GetDOM3EventTarget(getter_AddRefs(event_target));
NS_ENSURE_SUCCESS(rv, rv);
return event_target->RemoveGroupedEventListener(aType, aListener,
aUseCapture, aEvtGrp);
nsEventListenerManager* elm = mNode->GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->RemoveGroupedEventListener(aType, aListener, aUseCapture,
aEvtGrp);
}
NS_IMETHODIMP
@ -4453,7 +4436,7 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aEventName,
NS_PRECONDITION(aEventName, "Must have event name!");
nsCOMPtr<nsISupports> target;
PRBool defer = PR_TRUE;
nsCOMPtr<nsIEventListenerManager> manager;
nsRefPtr<nsEventListenerManager> manager;
GetEventListenerManagerForAttr(getter_AddRefs(manager),
getter_AddRefs(target),
@ -4734,7 +4717,7 @@ nsGenericElement::SetMappedAttribute(nsIDocument* aDocument,
}
nsresult
nsGenericElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
nsGenericElement::GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer)
{

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

@ -78,7 +78,7 @@ class nsIDOMCSSStyleDeclaration;
class nsIURI;
class nsINodeInfo;
class nsIControllers;
class nsIEventListenerManager;
class nsEventListenerManager;
class nsIScrollableFrame;
class nsContentList;
class nsDOMTokenList;
@ -231,8 +231,6 @@ private:
*/
void LastRelease();
nsresult GetDOM3EventTarget(nsIDOM3EventTarget **aTarget);
public:
virtual ~nsDOMEventRTTearoff();
@ -850,11 +848,11 @@ protected:
}
/**
* Hook to allow subclasses to produce a different nsIEventListenerManager if
* Hook to allow subclasses to produce a different nsEventListenerManager if
* needed for attachment of attribute-defined handlers
*/
virtual nsresult
GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer);

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

@ -45,7 +45,7 @@
#include "nsIMutationObserver2.h"
#include "nsIDocument.h"
#include "nsIDOMUserDataHandler.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIAttribute.h"
#include "nsIXPConnect.h"
#include "nsGenericElement.h"
@ -287,7 +287,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
if (aNode->HasFlag(NODE_HAS_LISTENERMANAGER)) {
#ifdef DEBUG
if (nsContentUtils::IsInitialized()) {
nsIEventListenerManager* manager =
nsEventListenerManager* manager =
nsContentUtils::GetListenerManager(aNode, PR_FALSE);
if (!manager) {
NS_ERROR("Huh, our bit says we have a listener manager list, "
@ -559,7 +559,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
nsPIDOMWindow* window = newDoc->GetInnerWindow();
if (window) {
nsIEventListenerManager* elm = aNode->GetListenerManager(PR_FALSE);
nsEventListenerManager* elm = aNode->GetListenerManager(PR_FALSE);
if (elm) {
window->SetMutationListeners(elm->MutationListenerBits());
if (elm->MayHavePaintEventListener()) {

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

@ -47,7 +47,6 @@ XPIDL_MODULE = content_events
EXPORTS = \
nsMutationEvent.h \
nsIEventListenerManager.h \
nsIPrivateDOMEvent.h \
nsIPrivateTextEvent.h \
nsIPrivateTextRange.h \

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

@ -1,236 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIEventListenerManager_h__
#define nsIEventListenerManager_h__
#include "nsEvent.h"
#include "nsISupports.h"
class nsPresContext;
class nsIDOMEventListener;
class nsIScriptContext;
class nsIDOMEventTarget;
class nsIDOMEventGroup;
class nsIAtom;
class nsIEventListenerInfo;
template<class E> class nsCOMArray;
class nsCxPusher;
/*
* Event listener manager interface.
*/
#define NS_IEVENTLISTENERMANAGER_IID \
{ 0x8e8667ed, 0x10d3, 0x41e8, \
{ 0x93, 0xfa, 0xa4, 0xc4, 0xea, 0x16, 0x85, 0xd5 } }
class nsIEventListenerManager : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENERMANAGER_IID)
nsIEventListenerManager() : mMayHavePaintEventListener(PR_FALSE),
mMayHaveMutationListeners(PR_FALSE),
mMayHaveCapturingListeners(PR_FALSE),
mMayHaveSystemGroupListeners(PR_FALSE),
mMayHaveAudioAvailableEventListener(PR_FALSE),
mMayHaveTouchEventListener(PR_FALSE),
mNoListenerForEvent(0)
{}
/**
* Sets events listeners of all types.
* @param an event listener
*/
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID, PRInt32 flags) = 0;
/**
* Removes events listeners of all types.
* @param an event listener
*/
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID, PRInt32 flags) = 0;
/**
* Sets events listeners of all types.
* @param an event listener
*/
NS_IMETHOD AddEventListenerByType(nsIDOMEventListener *aListener,
const nsAString& type,
PRInt32 flags,
nsIDOMEventGroup* aEvtGrp) = 0;
/**
* Removes events listeners of all types.
* @param an event listener
*/
NS_IMETHOD RemoveEventListenerByType(nsIDOMEventListener *aListener,
const nsAString& type,
PRInt32 flags,
nsIDOMEventGroup* aEvtGrp) = 0;
/**
* Creates a script event listener for the given script object with
* name aName and function body aFunc.
* @param an event listener
*/
NS_IMETHOD AddScriptEventListener(nsISupports *aObject,
nsIAtom *aName,
const nsAString& aFunc,
PRUint32 aLanguage,
PRBool aDeferCompilation,
PRBool aPermitUntrustedEvents) = 0;
NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName) = 0;
/**
* Registers an event listener that already exists on the given
* script object with the event listener manager. If the event
* listener is registerd from chrome code, the event listener will
* only ever receive trusted events.
* @param the name of an event listener
*/
NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext,
void *aScopeObject,
nsISupports *aObject,
nsIAtom* aName) = 0;
/**
* Compiles any event listeners that already exists on the given
* script object for a given event type.
* @param an event listener */
NS_IMETHOD CompileScriptEventListener(nsIScriptContext *aContext,
void *aScopeObject,
nsISupports *aObject,
nsIAtom* aName,
PRBool *aDidCompile) = 0;
/**
* Tells the event listener manager that its target (which owns it) is
* no longer using it (and could go away).
*
* It also clears the weak pointer set by the call to
* |SetListenerTarget|.
*/
NS_IMETHOD Disconnect() = 0;
/**
* Tells the event listener manager what its target is. This must be
* followed by a call to |Disconnect| before the target is destroyed.
*/
NS_IMETHOD SetListenerTarget(nsISupports* aTarget) = 0;
/**
* Allows us to quickly determine if we have mutation listeners registered.
*/
NS_IMETHOD HasMutationListeners(PRBool* aListener) = 0;
/**
* Gets the EventGroup registered for use by system event listeners.
* This is a special EventGroup which is used in the secondary DOM Event
* Loop pass for evaluation of system event listeners.
*/
NS_IMETHOD GetSystemEventGroupLM(nsIDOMEventGroup** aGroup) = 0;
/**
* Allows us to quickly determine whether we have unload or beforeunload
* listeners registered.
*/
virtual PRBool HasUnloadListeners() = 0;
/**
* Returns the mutation bits depending on which mutation listeners are
* registered to this listener manager.
* @note If a listener is an nsIDOMMutationListener, all possible mutation
* event bits are returned. All bits are also returned if one of the
* event listeners is registered to handle DOMSubtreeModified events.
*/
virtual PRUint32 MutationListenerBits() = 0;
/**
* Sets aList to the list of nsIEventListenerInfo objects representing the
* listeners managed by this listener manager.
*/
virtual nsresult GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList) = 0;
/**
* Returns PR_TRUE if there is at least one event listener for aEventName.
*/
virtual PRBool HasListenersFor(const nsAString& aEventName) = 0;
/**
* Returns PR_TRUE if there is at least one event listener.
*/
virtual PRBool HasListeners() = 0;
/**
* Returns PR_TRUE if there may be a paint event listener registered,
* PR_FALSE if there definitely isn't.
*/
PRBool MayHavePaintEventListener() { return mMayHavePaintEventListener; }
/**
* Returns PR_TRUE if there may be a MozAudioAvailable event listener registered,
* PR_FALSE if there definitely isn't.
*/
PRBool MayHaveAudioAvailableEventListener() { return mMayHaveAudioAvailableEventListener; }
/**
* Returns PR_TRUE if there may be a touch event listener registered,
* PR_FALSE if there definitely isn't.
*/
PRBool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; }
protected:
PRUint32 mMayHavePaintEventListener : 1;
PRUint32 mMayHaveMutationListeners : 1;
PRUint32 mMayHaveCapturingListeners : 1;
PRUint32 mMayHaveSystemGroupListeners : 1;
PRUint32 mMayHaveAudioAvailableEventListener : 1;
PRUint32 mMayHaveTouchEventListener : 1;
PRUint32 mNoListenerForEvent : 26;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventListenerManager,
NS_IEVENTLISTENERMANAGER_IID)
nsresult
NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult);
#endif // nsIEventListenerManager_h__

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

@ -48,6 +48,7 @@ LIBXUL_LIBRARY = 1
EXPORTS = \
nsEventStateManager.h \
nsEventListenerManager.h \
$(NULL)
CPPSRCS = \

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

@ -68,7 +68,8 @@ nsDOMEventListenerWrapper::HandleEvent(nsIDOMEvent* aEvent)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager,
nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -94,7 +95,7 @@ nsDOMEventTargetHelper::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
nsIEventListenerManager* elm = GetListenerManager(PR_FALSE);
nsEventListenerManager* elm = GetListenerManager(PR_FALSE);
if (elm) {
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
elm->RemoveEventListenerByType(aListener, aType, flags, nsnull);
@ -115,7 +116,7 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
"aWantsUntrusted to PR_FALSE or make the aWantsUntrusted "
"explicit by making aOptionalArgc non-zero.");
nsIEventListenerManager* elm = GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
@ -202,16 +203,11 @@ nsDOMEventTargetHelper::DispatchDOMEvent(nsEvent* aEvent,
aEventStatus);
}
nsIEventListenerManager*
nsEventListenerManager*
nsDOMEventTargetHelper::GetListenerManager(PRBool aCreateIfNotFound)
{
if (!mListenerManager) {
if (!aCreateIfNotFound) {
return nsnull;
}
nsresult rv = NS_NewEventListenerManager(getter_AddRefs(mListenerManager));
NS_ENSURE_SUCCESS(rv, nsnull);
mListenerManager->SetListenerTarget(this);
if (!mListenerManager && aCreateIfNotFound) {
mListenerManager = new nsEventListenerManager(this);
}
return mListenerManager;
@ -221,7 +217,7 @@ nsresult
nsDOMEventTargetHelper::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsIEventListenerManager* elm = GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
@ -230,7 +226,7 @@ nsresult
nsDOMEventTargetHelper::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsIEventListenerManager* elm = GetListenerManager(PR_FALSE);
nsEventListenerManager* elm = GetListenerManager(PR_FALSE);
return elm ?
elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE) :
NS_OK;
@ -239,7 +235,7 @@ nsDOMEventTargetHelper::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
nsresult
nsDOMEventTargetHelper::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
{
nsIEventListenerManager* elm = GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elm);
return elm->GetSystemEventGroupLM(aGroup);
}

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

@ -46,7 +46,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsPIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIScriptContext.h"
class nsDOMEventListenerWrapper : public nsIDOMEventListener
@ -98,7 +98,7 @@ public:
return NS_OK;
}
protected:
nsCOMPtr<nsIEventListenerManager> mListenerManager;
nsRefPtr<nsEventListenerManager> mListenerManager;
// These may be null (native callers or xpcshell).
nsCOMPtr<nsIScriptContext> mScriptContext;
nsCOMPtr<nsPIDOMWindow> mOwner; // Inner window.

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

@ -186,7 +186,7 @@ public:
/**
* If the current item in the event target chain has an event listener
* manager, this method calls nsIEventListenerManager::HandleEvent().
* manager, this method calls nsEventListenerManager::HandleEvent().
*/
nsresult HandleEvent(nsEventChainPostVisitor& aVisitor, PRUint32 aFlags,
PRBool aMayHaveNewListenerManagers,

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

@ -278,9 +278,11 @@ nsIDOMEventGroup* gDOM2EventGroup = nsnull;
PRUint32 nsEventListenerManager::mInstanceCount = 0;
PRUint32 nsEventListenerManager::sCreatedCount = 0;
nsEventListenerManager::nsEventListenerManager() :
mTarget(nsnull)
nsEventListenerManager::nsEventListenerManager(nsISupports* aTarget) :
mTarget(aTarget)
{
NS_ASSERTION(aTarget, "unexpected null pointer");
++mInstanceCount;
++sCreatedCount;
}
@ -331,17 +333,10 @@ nsEventListenerManager::GetSystemEventGroup()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventListenerManager)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventListenerManager)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsEventListenerManager, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsEventListenerManager, Release)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsEventListenerManager)
PRUint32 count = tmp->mListeners.Length();
for (PRUint32 i = 0; i < count; i++) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mListeners[i] mListener");
@ -349,7 +344,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEventListenerManager)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsEventListenerManager)
tmp->Disconnect();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -1262,16 +1257,6 @@ nsEventListenerManager::Disconnect()
return RemoveAllListeners();
}
NS_IMETHODIMP
nsEventListenerManager::SetListenerTarget(nsISupports* aTarget)
{
NS_PRECONDITION(aTarget, "unexpected null pointer");
//WEAK reference, must be set back to nsnull when done by calling Disconnect
mTarget = aTarget;
return NS_OK;
}
NS_IMETHODIMP
nsEventListenerManager::GetSystemEventGroupLM(nsIDOMEventGroup **aGroup)
{
@ -1300,28 +1285,7 @@ nsEventListenerManager::GetDOM2EventGroup(nsIDOMEventGroup **aGroup)
}
// nsIDOMEventTarget interface
NS_IMETHODIMP
nsEventListenerManager::AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture,
PRBool aWantsUntrusted,
PRUint8 optional_argc)
{
NS_ASSERTION(optional_argc == 2,
"Don't want to try to get caller from the the ELM");
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
if (aWantsUntrusted) {
flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
}
nsresult rv = AddEventListenerByType(aListener, aType, flags, nsnull);
NS_ASSERTION(NS_FAILED(rv) || HasListenersFor(aType),
"Adding event listener didn't work!");
return rv;
}
NS_IMETHODIMP
NS_IMETHODIMP
nsEventListenerManager::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
@ -1365,96 +1329,6 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
return rv;
}
nsIDOMEventTarget *
nsEventListenerManager::GetTargetForDOMEvent()
{
NS_ERROR("Should not be called");
return nsnull;
}
nsIDOMEventTarget *
nsEventListenerManager::GetTargetForEventTargetChain()
{
NS_ERROR("Should not be called");
return nsnull;
}
nsresult
nsEventListenerManager::PreHandleEvent(nsEventChainPreVisitor & aVisitor)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsEventListenerManager::WillHandleEvent(nsEventChainPostVisitor & aVisitor)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsEventListenerManager::PostHandleEvent(nsEventChainPostVisitor & aVisitor)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsEventListenerManager::DispatchDOMEvent(nsEvent *aEvent,
nsIDOMEvent *aDOMEvent,
nsPresContext *aPresContext,
nsEventStatus *aEventStatus)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIEventListenerManager*
nsEventListenerManager::GetListenerManager(PRBool aMayCreate)
{
NS_ERROR("Should not be called");
return nsnull;
}
nsresult
nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID & aIID)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID & aIID)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsEventListenerManager::GetSystemEventGroup(nsIDOMEventGroup **_retval)
{
NS_ERROR("Should not be called");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIScriptContext*
nsEventListenerManager::GetContextForEventHandlers(nsresult *aRv)
{
NS_ERROR("Should not be called");
*aRv = NS_ERROR_NOT_IMPLEMENTED;
return nsnull;
}
JSContext*
nsEventListenerManager::GetJSContextForEventHandlers()
{
NS_ERROR("Should not be called");
return nsnull;
}
// nsIDOM3EventTarget interface
NS_IMETHODIMP
nsEventListenerManager::AddGroupedEventListener(const nsAString& aType,
@ -1651,15 +1525,3 @@ nsEventListenerManager::HasUnloadListeners()
}
return PR_FALSE;
}
nsresult
NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult)
{
nsIEventListenerManager* l = new nsEventListenerManager();
if (!l) {
return NS_ERROR_OUT_OF_MEMORY;
}
return CallQueryInterface(l, aInstancePtrResult);
}

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

@ -38,10 +38,13 @@
#ifndef nsEventListenerManager_h__
#define nsEventListenerManager_h__
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "jsapi.h"
#include "nsCOMPtr.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventListener.h"
#include "nsAutoPtr.h"
#include "nsCOMArray.h"
#include "nsIDOM3EventTarget.h"
#include "nsHashtable.h"
#include "nsIScriptContext.h"
@ -56,6 +59,8 @@ struct nsPoint;
struct EventTypeData;
class nsEventTargetChainItem;
class nsPIDOMWindow;
class nsCxPusher;
class nsIEventListenerInfo;
typedef struct {
nsRefPtr<nsIDOMEventListener> mListener;
@ -71,16 +76,21 @@ typedef struct {
* Event listener manager
*/
class nsEventListenerManager : public nsIEventListenerManager,
public nsIDOMEventTarget,
public nsIDOM3EventTarget
class nsEventListenerManager
{
public:
nsEventListenerManager();
nsEventListenerManager(nsISupports* aTarget);
virtual ~nsEventListenerManager();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_INLINE_DECL_REFCOUNTING(nsEventListenerManager)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsEventListenerManager)
NS_IMETHOD RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval);
/**
* Sets events listeners of all types.
@ -156,8 +166,6 @@ public:
NS_IMETHOD Disconnect();
NS_IMETHOD SetListenerTarget(nsISupports* aTarget);
NS_IMETHOD HasMutationListeners(PRBool* aListener);
NS_IMETHOD GetSystemEventGroupLM(nsIDOMEventGroup** aGroup);
@ -174,9 +182,6 @@ public:
static PRUint32 GetIdentifierForEvent(nsIAtom* aEvent);
// nsIDOMEventTarget
NS_DECL_NSIDOMEVENTTARGET
// nsIDOM3EventTarget
NS_DECL_NSIDOM3EVENTTARGET
@ -184,8 +189,23 @@ public:
static nsIDOMEventGroup* GetSystemEventGroup();
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEventListenerManager,
nsIEventListenerManager)
/**
* Returns PR_TRUE if there may be a paint event listener registered,
* PR_FALSE if there definitely isn't.
*/
PRBool MayHavePaintEventListener() { return mMayHavePaintEventListener; }
/**
* Returns PR_TRUE if there may be a MozAudioAvailable event listener registered,
* PR_FALSE if there definitely isn't.
*/
PRBool MayHaveAudioAvailableEventListener() { return mMayHaveAudioAvailableEventListener; }
/**
* Returns PR_TRUE if there may be a touch event listener registered,
* PR_FALSE if there definitely isn't.
*/
PRBool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; }
protected:
nsresult HandleEventSubType(nsListenerStruct* aListenerStruct,
@ -226,6 +246,14 @@ protected:
PRBool ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent);
nsPIDOMWindow* GetInnerWindowForTarget();
PRUint32 mMayHavePaintEventListener : 1;
PRUint32 mMayHaveMutationListeners : 1;
PRUint32 mMayHaveCapturingListeners : 1;
PRUint32 mMayHaveSystemGroupListeners : 1;
PRUint32 mMayHaveAudioAvailableEventListener : 1;
PRUint32 mMayHaveTouchEventListener : 1;
PRUint32 mNoListenerForEvent : 26;
nsAutoTObserverArray<nsListenerStruct, 2> mListeners;
nsISupports* mTarget; //WEAK
nsCOMPtr<nsIAtom> mNoListenerForEventAtom;

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

@ -201,7 +201,7 @@ nsEventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
*aCount = 0;
*aOutArray = nsnull;
nsCOMArray<nsIEventListenerInfo> listenerInfos;
nsIEventListenerManager* elm =
nsEventListenerManager* elm =
aEventTarget->GetListenerManager(PR_FALSE);
if (elm) {
elm->GetListenerInfo(&listenerInfos);

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

@ -53,7 +53,7 @@
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsMappedAttributes.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLDocument.h"
@ -1124,7 +1124,7 @@ nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
}
nsresult
nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
nsGenericHTMLElement::GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer)
{
@ -1236,7 +1236,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
}
else if (nsContentUtils::IsEventAttributeName(aAttribute,
EventNameType_HTML)) {
nsIEventListenerManager* manager = GetListenerManager(PR_FALSE);
nsEventListenerManager* manager = GetListenerManager(PR_FALSE);
if (manager) {
manager->RemoveScriptEventListener(aAttribute);
}

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

@ -580,7 +580,7 @@ protected:
const nsAString* aValue, PRBool aNotify);
virtual nsresult
GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer);

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

@ -89,7 +89,7 @@
#include "nsIDOMMutationEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsMutationEvent.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsRuleData.h"

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

@ -101,7 +101,7 @@
#include "mozilla/css/Loader.h"
#include "nsIHttpChannel.h"
#include "nsIFile.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsFrameSelection.h"
#include "nsISelectionPrivate.h"//for toStringwithformat code

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

@ -44,7 +44,7 @@
#include "nsSMILParserUtils.h"
#include "nsISMILAnimationElement.h"
#include "nsContentUtils.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventGroup.h"
#include "nsGUIEvent.h"
#include "nsIDOMTimeEvent.h"
@ -338,7 +338,7 @@ nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget)
}
nsCOMPtr<nsIDOMEventGroup> sysGroup;
nsIEventListenerManager* elm =
nsEventListenerManager* elm =
GetEventListenerManager(aTarget, getter_AddRefs(sysGroup));
if (!elm)
return;
@ -357,7 +357,7 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget)
return;
nsCOMPtr<nsIDOMEventGroup> sysGroup;
nsIEventListenerManager* elm =
nsEventListenerManager* elm =
GetEventListenerManager(aTarget, getter_AddRefs(sysGroup));
if (!elm)
return;
@ -369,7 +369,7 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget)
sysGroup);
}
nsIEventListenerManager*
nsEventListenerManager*
nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget,
nsIDOMEventGroup** aSystemGroup)
{
@ -393,7 +393,7 @@ nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget,
if (!target)
return nsnull;
nsIEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
if (!elm)
return nsnull;

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

@ -95,7 +95,7 @@ protected:
nsSMILTimedElement* GetTimedElement(Element* aElement);
void RegisterEventListener(Element* aElement);
void UnregisterEventListener(Element* aElement);
nsIEventListenerManager* GetEventListenerManager(Element* aElement,
nsEventListenerManager* GetEventListenerManager(Element* aElement,
nsIDOMEventGroup** aSystemGroup);
void HandleEvent(nsIDOMEvent* aEvent);
PRBool CheckEventDetail(nsIDOMEvent* aEvent);

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

@ -62,7 +62,7 @@
#include "nsGenericHTMLElement.h"
#include "nsNodeInfoManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsSVGUtils.h"
#include "nsSVGLength2.h"
#include "nsSVGNumber2.h"
@ -598,7 +598,7 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
mContentStyleRule = nsnull;
if (IsEventName(aName)) {
nsIEventListenerManager* manager = GetListenerManager(PR_FALSE);
nsEventListenerManager* manager = GetListenerManager(PR_FALSE);
if (manager) {
nsIAtom* eventName = GetEventNameForAttr(aName);
manager->RemoveScriptEventListener(eventName);

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

@ -72,7 +72,7 @@
#include "nsCRT.h"
// Event listeners
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseMotionListener.h"
#include "nsIDOMLoadListener.h"
@ -94,7 +94,7 @@
#include "nsXBLBinding.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsGUIEvent.h"
#include "prprf.h"
@ -836,7 +836,7 @@ nsXBLBinding::InstallEventHandlers()
nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
if (handlerChain) {
nsIEventListenerManager* manager =
nsEventListenerManager* manager =
mBoundElement->GetListenerManager(PR_TRUE);
if (!manager)
return;
@ -996,7 +996,7 @@ nsXBLBinding::UnhookEventHandlers()
nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
if (handlerChain) {
nsCOMPtr<nsIEventListenerManager> manager =
nsEventListenerManager* manager =
mBoundElement->GetListenerManager(PR_FALSE);
if (!manager) {
return;

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

@ -58,7 +58,7 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMText.h"
#include "nsFocusManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventListener.h"
#include "nsIPrivateDOMEvent.h"

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

@ -73,7 +73,7 @@
#include "nsCExternalHandlerService.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "nsJSUtils.h"
@ -407,7 +407,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
// 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.
nsCOMPtr<nsIEventListenerManager> elm(mListenerManager);
nsRefPtr<nsEventListenerManager> elm(mListenerManager);
mListenerManager = nsnull;
// When we are called from JS we can find the load group for the page,

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

@ -49,7 +49,7 @@
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEvent.h"
#include "nsGUIEvent.h"
#include "nsContentUtils.h"

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

@ -80,7 +80,7 @@
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsEventStateManager.h"
#include "nsFocusManager.h"
#include "nsHTMLStyleSheet.h"
@ -516,7 +516,7 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
}
nsresult
nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
nsXULElement::GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer)
{

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

@ -49,7 +49,7 @@
#ifndef nsXULElement_h__
#define nsXULElement_h__
// XXX because nsIEventListenerManager has broken includes
// XXX because nsEventListenerManager has broken includes
#include "nsIDOMEvent.h"
#include "nsIServiceManager.h"
#include "nsIAtom.h"
@ -60,7 +60,7 @@
#include "nsIDOM3EventTarget.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFResource.h"
#include "nsIScriptObjectOwner.h"
@ -659,7 +659,7 @@ protected:
nsAttrValue& aResult);
virtual nsresult
GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer);

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

@ -177,7 +177,7 @@
#include "nsGenericElement.h"
// Event related includes
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventTarget.h"
// CSS related includes
@ -7757,7 +7757,7 @@ nsEventReceiverSH::RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
return NS_OK;
}
nsIEventListenerManager* manager = target->GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = target->GetListenerManager(PR_TRUE);
NS_ENSURE_TRUE(manager, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIAtom> atom(do_GetAtom(nsDependentJSString(id)));

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

@ -74,7 +74,7 @@
#include "mozilla/Preferences.h"
// Other Classes
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsEscape.h"
#include "nsStyleCoord.h"
#include "nsMimeTypeArray.h"
@ -1370,7 +1370,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOuterWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOpenerScriptPrincipal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager,
nsEventListenerManager)
for (nsTimeout* timeout = tmp->FirstTimeout();
tmp->IsTimeout(timeout);
@ -7257,7 +7258,7 @@ nsGlobalWindow::AddGroupedEventListener(const nsAString & aType,
(aType, aListener, aUseCapture, aEvtGrp),
NS_ERROR_NOT_AVAILABLE);
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
return manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp);
@ -7310,7 +7311,7 @@ nsGlobalWindow::AddEventListener(const nsAString& aType,
return NS_ERROR_DOM_SECURITY_ERR;
}
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
@ -7327,7 +7328,7 @@ nsresult
nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener,
const nsIID& aIID)
{
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
@ -7347,24 +7348,14 @@ nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener,
return NS_ERROR_FAILURE;
}
nsIEventListenerManager*
nsEventListenerManager*
nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound)
{
FORWARD_TO_INNER_CREATE(GetListenerManager, (aCreateIfNotFound), nsnull);
if (!mListenerManager) {
if (!aCreateIfNotFound) {
return nsnull;
}
static NS_DEFINE_CID(kEventListenerManagerCID,
NS_EVENTLISTENERMANAGER_CID);
mListenerManager = do_CreateInstance(kEventListenerManagerCID);
if (mListenerManager) {
mListenerManager->SetListenerTarget(
static_cast<nsIDOMEventTarget*>(this));
}
if (!mListenerManager && aCreateIfNotFound) {
mListenerManager =
new nsEventListenerManager(static_cast<nsIDOMEventTarget*>(this));
}
return mListenerManager;
@ -7373,7 +7364,7 @@ nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound)
nsresult
nsGlobalWindow::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
{
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
return manager->GetSystemEventGroupLM(aGroup);
}

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

@ -82,7 +82,7 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMModalContentWindow.h"
#include "nsIScriptSecurityManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMDocument.h"
#ifndef MOZ_DISABLE_DOMCRYPTO
#include "nsIDOMCrypto.h"
@ -901,7 +901,7 @@ protected:
// whether to clear scope
// These member variable are used only on inner windows.
nsCOMPtr<nsIEventListenerManager> mListenerManager;
nsRefPtr<nsEventListenerManager> mListenerManager;
PRCList mTimeouts;
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
nsTimeout* mTimeoutInsertionPoint;

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

@ -100,7 +100,7 @@ class nsIAtom;
/**
* Associate a compiled event handler with its target object, which owns it
* This is an adjunct to nsIScriptObjectOwner that nsIEventListenerManager's
* This is an adjunct to nsIScriptObjectOwner that nsEventListenerManager's
* implementation queries for, in order to avoid recompiling a recurrent or
* prototype-inherited event handler.
*/

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

@ -43,7 +43,7 @@
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsPresContext.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
@ -79,8 +79,20 @@ nsWindowRoot::~nsWindowRoot()
}
}
NS_IMPL_CYCLE_COLLECTION_3(nsWindowRoot, mListenerManager, mPopupNode,
mParent)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsWindowRoot)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsWindowRoot)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager,
nsEventListenerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPopupNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsWindowRoot)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPopupNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mParent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowRoot)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventTarget)
@ -125,7 +137,7 @@ NS_IMETHODIMP
nsWindowRoot::AddGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener,
PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp)
{
nsCOMPtr<nsIEventListenerManager> manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
return manager->AddEventListenerByType(aListener, aType, flags, aEvtGrp);
@ -166,7 +178,7 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
"aWantsUntrusted to PR_FALSE or make the aWantsUntrusted "
"explicit by making optional_argc non-zero.");
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
@ -181,7 +193,7 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
nsresult
nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
{
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
@ -189,7 +201,7 @@ nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID&
nsresult
nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
{
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
if (manager) {
return manager->RemoveEventListenerByIID(aListener, aIID,
NS_EVENT_FLAG_BUBBLE);
@ -197,19 +209,12 @@ nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsI
return NS_OK;
}
nsIEventListenerManager*
nsEventListenerManager*
nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound)
{
if (!mListenerManager) {
if (!aCreateIfNotFound) {
return nsnull;
}
mListenerManager = do_CreateInstance(kEventListenerManagerCID);
if (mListenerManager) {
mListenerManager->SetListenerTarget(
static_cast<nsIDOMEventTarget*>(this));
}
if (!mListenerManager && aCreateIfNotFound) {
mListenerManager =
new nsEventListenerManager(static_cast<nsIDOMEventTarget*>(this));
}
return mListenerManager;
@ -218,7 +223,7 @@ nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound)
nsresult
nsWindowRoot::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
{
nsIEventListenerManager* manager = GetListenerManager(PR_TRUE);
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(manager);
return manager->GetSystemEventGroupLM(aGroup);
}

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

@ -42,14 +42,14 @@
class nsPIDOMWindow;
class nsIDOMEventListener;
class nsIEventListenerManager;
class nsEventListenerManager;
class nsIDOMEvent;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsPIWindowRoot.h"
#include "nsCycleCollectionParticipant.h"
@ -86,7 +86,7 @@ public:
protected:
// Members
nsPIDOMWindow* mWindow; // [Weak]. The window will hold on to us and let go when it dies.
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [Strong]. We own the manager, which owns event listeners attached
nsRefPtr<nsEventListenerManager> mListenerManager; // [Strong]. We own the manager, which owns event listeners attached
// to us.
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]

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

@ -46,6 +46,7 @@ class nsPresContext;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
struct JSContext;
class nsEventListenerManager;
%}
/**
@ -62,8 +63,8 @@ struct JSContext;
[ptr] native nsPresContextPtr(nsPresContext);
[ptr] native nsEventStatusPtr(nsEventStatus);
[ptr] native JSContextPtr(JSContext);
[ptr] native nsEventListenerManagerPtr(nsEventListenerManager);
interface nsIEventListenerManager;
interface nsIScriptContext;
interface nsIDOMEventListener;
interface nsIDOMEventGroup;
@ -243,7 +244,7 @@ interface nsIDOMEventTarget : nsISupports
* one already exists.
*/
[notxpcom, nostdcall]
nsIEventListenerManager GetListenerManager(in boolean aMayCreate);
nsEventListenerManagerPtr GetListenerManager(in boolean aMayCreate);
/**
* Add an event listener for nsIID.

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

@ -88,7 +88,7 @@
#include "nsSerializationHelper.h"
#include "nsIFrame.h"
#include "nsIView.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "PCOMContentPermissionRequestChild.h"
#include "xpcpublic.h"
@ -478,7 +478,7 @@ TabChild::~TabChild()
DestroyCx();
}
nsIEventListenerManager* elm = mTabChildGlobal->GetListenerManager(PR_FALSE);
nsEventListenerManager* elm = mTabChildGlobal->GetListenerManager(PR_FALSE);
if (elm) {
elm->Disconnect();
}

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

@ -401,7 +401,7 @@ nsDOMWorkerMessageHandler::DispatchDOMEvent(nsEvent *aEvent, nsIDOMEvent *aDOMEv
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIEventListenerManager*
nsEventListenerManager*
nsDOMWorkerMessageHandler::GetListenerManager(PRBool aMayCreate)
{
NS_ERROR("Should not be called");

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

@ -165,7 +165,7 @@ private:
virtual nsresult WillHandleEvent(nsEventChainPostVisitor & aVisitor) { return _to WillHandleEvent(aVisitor); } \
virtual nsresult PostHandleEvent(nsEventChainPostVisitor & aVisitor) { return _to PostHandleEvent(aVisitor); } \
virtual nsresult DispatchDOMEvent(nsEvent *aEvent, nsIDOMEvent *aDOMEvent, nsPresContext *aPresContext, nsEventStatus *aEventStatus) { return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); } \
virtual nsIEventListenerManager * GetListenerManager(PRBool aMayCreate) { return _to GetListenerManager(aMayCreate); } \
virtual nsEventListenerManager * GetListenerManager(PRBool aMayCreate) { return _to GetListenerManager(aMayCreate); } \
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID & aIID) { return _to AddEventListenerByIID(aListener, aIID); } \
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID & aIID) { return _to RemoveEventListenerByIID(aListener, aIID); } \
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup **_retval NS_OUTPARAM) { return _to GetSystemEventGroup(_retval); } \

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

@ -56,7 +56,7 @@
#include "nsIEditorMailSupport.h"
#include "nsILookAndFeel.h"
#include "nsFocusManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventGroup.h"
#include "mozilla/Preferences.h"
@ -133,7 +133,7 @@ nsEditorEventListener::InstallToEditor()
nsCOMPtr<nsIDOMEventGroup> sysGroup;
piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup));
NS_ENSURE_STATE(sysGroup);
nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
NS_ENSURE_STATE(elmP);
nsCOMPtr<nsIDOMEventListener> listenerBase;
@ -208,7 +208,7 @@ nsEditorEventListener::UninstallFromEditor()
return;
}
nsCOMPtr<nsIEventListenerManager> elmP =
nsEventListenerManager* elmP =
piTarget->GetListenerManager(PR_TRUE);
if (!elmP) {
return;

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

@ -101,7 +101,7 @@
#include "nsPresContext.h"
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMEventGroup.h"
#include "nsIDOMDragEvent.h"
#include "nsIConstraintValidation.h"
@ -890,7 +890,7 @@ nsDocShellTreeOwner::AddChromeListeners()
nsCOMPtr<nsIDOMEventGroup> sysGroup;
target->GetSystemEventGroup(getter_AddRefs(sysGroup));
nsIEventListenerManager* elmP = target->GetListenerManager(PR_TRUE);
nsEventListenerManager* elmP = target->GetListenerManager(PR_TRUE);
if (sysGroup && elmP)
{
rv = elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
@ -926,7 +926,7 @@ nsDocShellTreeOwner::RemoveChromeListeners()
nsCOMPtr<nsIDOMEventGroup> sysGroup;
piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup));
nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
if (sysGroup && elmP)
{
nsresult rv =

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

@ -93,7 +93,7 @@
#include "nsThreadUtils.h"
#include "nsUnicharUtils.h"
#include "nsIContent.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsGUIEvent.h"
// Set to spew messages to the console about what is happening.
@ -647,7 +647,7 @@ mozInlineSpellChecker::RegisterEventListeners()
nsCOMPtr<nsIDOMEventTarget> piTarget = do_QueryInterface(doc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsIEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
if (elmP) {
// Focus event doesn't bubble so adding the listener to capturing phase
elmP->AddEventListenerByIID(static_cast<nsIDOMFocusListener *>(this),
@ -680,7 +680,7 @@ mozInlineSpellChecker::UnregisterEventListeners()
nsCOMPtr<nsIDOMEventTarget> piTarget = do_QueryInterface(doc);
NS_ENSURE_TRUE(piTarget, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIEventListenerManager> elmP =
nsEventListenerManager* elmP =
piTarget->GetListenerManager(PR_TRUE);
if (elmP) {
elmP->RemoveEventListenerByIID(static_cast<nsIDOMFocusListener *>(this),

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

@ -86,7 +86,7 @@
#include "gfxPlatform.h"
#include "nsCSSRules.h"
#include "nsFontFaceLoader.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsStyleStructInlines.h"
#include "nsIAppShell.h"
#include "prenv.h"
@ -2070,7 +2070,7 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow)
if (!parentTarget)
return PR_FALSE;
nsIEventListenerManager* manager = nsnull;
nsEventListenerManager* manager = nsnull;
if ((manager = parentTarget->GetListenerManager(PR_FALSE)) &&
manager->MayHavePaintEventListener()) {
return PR_TRUE;

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

@ -61,7 +61,6 @@
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
#include "nsIDocumentViewer.h"
#include "nsIEventListenerManager.h"
#include "nsIFactory.h"
#include "nsIFrameUtil.h"
#include "nsIFragmentContentSink.h"
@ -512,7 +511,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
MAKE_CTOR(CreateEventListenerManager, nsIEventListenerManager, NS_NewEventListenerManager)
MAKE_CTOR(CreateDOMEventGroup, nsIDOMEventGroup, NS_NewDOMEventGroup)
MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
@ -758,7 +756,6 @@ NS_DEFINE_NAMED_CID(IN_FLASHER_CID);
NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CID);
NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
NS_DEFINE_NAMED_CID(NS_NAMESPACEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_EVENTLISTENERMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DOMEVENTGROUP_CID);
NS_DEFINE_NAMED_CID(NS_DOCUMENT_VIEWER_CID);
NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
@ -903,7 +900,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kIN_CSSVALUESEARCH_CID, false, NULL, inCSSValueSearchConstructor },
{ &kIN_DOMUTILS_CID, false, NULL, inDOMUtilsConstructor },
{ &kNS_NAMESPACEMANAGER_CID, false, NULL, CreateNameSpaceManager },
{ &kNS_EVENTLISTENERMANAGER_CID, false, NULL, CreateEventListenerManager },
{ &kNS_DOMEVENTGROUP_CID, false, NULL, CreateDOMEventGroup },
{ &kNS_DOCUMENT_VIEWER_CID, false, NULL, CreateDocumentViewer },
{ &kNS_HTMLDOCUMENT_CID, false, NULL, CreateHTMLDocument },

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

@ -59,7 +59,7 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsEventDispatcher.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMNode.h"
#include "nsIPrivateDOMEvent.h"
#include "nsISelectControlFrame.h"

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

@ -60,7 +60,7 @@
#include "nsIDOMEventTarget.h"
#include "nsEventDispatcher.h"
#include "nsEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsEventListenerManager.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIPrivateDOMEvent.h"

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

@ -56,7 +56,6 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMEventTarget.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMFocusListener.h"
#include "nsIWebNavigation.h"
#include "nsIWindowWatcher.h"