Bug 363089, Remove nsIDOMEventReceiver (this time passes mochitest), r+sr=jst

This commit is contained in:
Olli.Pettay@helsinki.fi 2007-05-14 02:11:38 -07:00
parent 8e8c2513e1
commit 7817abfbca
123 changed files with 653 additions and 733 deletions

View File

@ -50,7 +50,6 @@
#include "nsISelection.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMMouseEvent.h"
@ -98,6 +97,7 @@
#include "nsContentCID.h"
#include "nsISelectionController.h"
#include "nsFrameSelection.h"
#include "nsIDOMEventTarget.h"
// private clipboard data flavors for html copy, used by editor when pasting
#define kHTMLContext "text/_moz_htmlcontext"
@ -190,9 +190,9 @@ nsContentAreaDragDrop::HookupTo(nsIDOMEventTarget *inAttachPoint,
nsIWebNavigation* inNavigator)
{
NS_ASSERTION(inAttachPoint, "Can't hookup Drag Listeners to NULL receiver");
mEventReceiver = do_QueryInterface(inAttachPoint);
NS_ASSERTION(mEventReceiver,
"Target doesn't implement nsIDOMEventReceiver as needed");
mEventTarget = do_QueryInterface(inAttachPoint);
NS_ASSERTION(mEventTarget,
"Target doesn't implement nsPIDOMEventTarget as needed");
mNavigator = inNavigator;
return AddDragListener();
@ -216,10 +216,10 @@ nsContentAreaDragDrop::AddDragListener()
{
nsresult rv = NS_ERROR_FAILURE;
if ( mEventReceiver ) {
if (mEventTarget) {
nsIDOMDragListener *pListener = NS_STATIC_CAST(nsIDOMDragListener *, this);
rv = mEventReceiver->AddEventListenerByIID(pListener,
NS_GET_IID(nsIDOMDragListener));
rv = mEventTarget->AddEventListenerByIID(pListener,
NS_GET_IID(nsIDOMDragListener));
if (NS_SUCCEEDED(rv))
mListenerInstalled = PR_TRUE;
}
@ -238,14 +238,14 @@ nsContentAreaDragDrop::RemoveDragListener()
{
nsresult rv = NS_ERROR_FAILURE;
if (mEventReceiver) {
if (mEventTarget) {
nsIDOMDragListener *pListener = NS_STATIC_CAST(nsIDOMDragListener *, this);
rv =
mEventReceiver->RemoveEventListenerByIID(pListener,
NS_GET_IID(nsIDOMDragListener));
mEventTarget->RemoveEventListenerByIID(pListener,
NS_GET_IID(nsIDOMDragListener));
if (NS_SUCCEEDED(rv))
mListenerInstalled = PR_FALSE;
mEventReceiver = nsnull;
mEventTarget = nsnull;
}
return rv;

View File

@ -44,7 +44,7 @@
#include "nsIDragDropHandler.h"
#include "nsIDOMDragListener.h"
#include "nsIDOMEventReceiver.h"
#include "nsPIDOMEventTarget.h"
#include "nsITransferable.h"
class nsIDOMNode;
@ -120,7 +120,7 @@ private:
PRPackedBool mListenerInstalled;
nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
// weak ref, this is probably my owning webshell
// FIXME: we set this and never null it out. That's bad! See bug 332187.

View File

@ -107,7 +107,6 @@
#include "nsCRT.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventReceiver.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMDocumentEvent.h"
#ifdef MOZ_XTF
@ -2980,10 +2979,10 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
}
// If we have a window, we can check it for mutation listeners now.
nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(window));
if (rec) {
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(window));
if (piTarget) {
nsCOMPtr<nsIEventListenerManager> manager;
rec->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
piTarget->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
if (manager) {
PRBool hasListeners = PR_FALSE;
manager->HasMutationListeners(&hasListeners);

View File

@ -56,6 +56,7 @@
#include "nsGkAtoms.h"
#include "nsCOMArray.h"
#include "nsNodeUtils.h"
#include "nsIEventListenerManager.h"
//----------------------------------------------------------------------
PRBool nsDOMAttribute::sInitialized;
@ -720,13 +721,48 @@ nsDOMAttribute::DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsresult
nsDOMAttribute::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
}
nsresult
nsDOMAttribute::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> elm;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
if (elm) {
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
return rv;
}
nsresult
nsDOMAttribute::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> elm;
GetListenerManager(PR_FALSE, getter_AddRefs(elm));
if (elm) {
return elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
return NS_OK;
}
nsresult
nsDOMAttribute::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
{
nsCOMPtr<nsIEventListenerManager> elm;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
if (elm) {
return elm->GetSystemEventGroupLM(aGroup);
}
return rv;
}
nsresult
nsDOMAttribute::EnsureChildState(PRBool aSetText, PRBool &aHasChild) const
{

View File

@ -100,8 +100,13 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
static void Initialize();

View File

@ -50,7 +50,6 @@
#include "nsIDOMClassInfo.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsIDOMEventReceiver.h"
#include "nsLoadListenerProxy.h"
#include "nsStreamUtils.h"
#include "nsThreadUtils.h"
@ -224,7 +223,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
NS_ENSURE_SUCCESS(rv, rv);
// Register as a load listener on the document
nsCOMPtr<nsIDOMEventReceiver> target(do_QueryInterface(domDocument));
nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(domDocument));
if (target) {
nsWeakPtr requestWeak(do_GetWeakReference(NS_STATIC_CAST(nsIDOMParser*, this)));
nsLoadListenerProxy* proxy = new nsLoadListenerProxy(requestWeak);

View File

@ -894,7 +894,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentTraversal)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
@ -4518,7 +4517,7 @@ nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsDocument::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aInstancePtrResult)
{
@ -5403,10 +5402,10 @@ PRBool
nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
{
// Check our event listener manager for unload/beforeunload listeners.
nsCOMPtr<nsIDOMEventReceiver> er = do_QueryInterface(mScriptGlobalObject);
if (er) {
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(mScriptGlobalObject);
if (piTarget) {
nsCOMPtr<nsIEventListenerManager> manager;
er->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
piTarget->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
if (manager && manager->HasUnloadListeners()) {
return PR_FALSE;
}

View File

@ -59,7 +59,6 @@
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
#include "nsIDOMStyleSheetList.h"
@ -288,7 +287,7 @@ class nsDocument : public nsIDocument,
public nsIDOMDocumentXBL,
public nsIDOM3Document,
public nsSupportsWeakReference,
public nsIDOMEventReceiver,
public nsIDOMEventTarget,
public nsIDOM3EventTarget,
public nsIDOMNSEventTarget,
public nsIScriptObjectPrincipal,
@ -531,6 +530,13 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
return NS_ERROR_NOT_IMPLEMENTED;
@ -602,15 +608,6 @@ public:
// nsIDOMDocumentXBL
NS_DECL_NSIDOMDOCUMENTXBL
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
// nsIDOMEventTarget
NS_DECL_NSIDOMEVENTTARGET

View File

@ -94,8 +94,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericDOMDataNode)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
@ -713,13 +711,48 @@ nsGenericDOMDataNode::DispatchDOMEvent(nsEvent* aEvent,
aPresContext, aEventStatus);
}
NS_IMETHODIMP
nsresult
nsGenericDOMDataNode::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
}
nsresult
nsGenericDOMDataNode::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> elm;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
if (elm) {
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
return rv;
}
nsresult
nsGenericDOMDataNode::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> elm;
GetListenerManager(PR_FALSE, getter_AddRefs(elm));
if (elm) {
return elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
return NS_OK;
}
nsresult
nsGenericDOMDataNode::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
{
nsCOMPtr<nsIEventListenerManager> elm;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
if (elm) {
return elm->GetSystemEventGroupLM(aGroup);
}
return rv;
}
PRUint32
nsGenericDOMDataNode::GetChildCount() const
{

View File

@ -44,7 +44,7 @@
#define nsGenericDOMDataNode_h___
#include "nsIDOMCharacterData.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsTextFragment.h"
#include "nsVoidArray.h"
#include "nsDOMError.h"
@ -180,8 +180,13 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
// Implementation for nsIContent
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,

View File

@ -51,7 +51,6 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMDocument.h"
#include "nsIDOMText.h"
#include "nsIDOMEventReceiver.h"
#include "nsIContentIterator.h"
#include "nsIEventListenerManager.h"
#include "nsIFocusController.h"
@ -215,13 +214,48 @@ nsINode::UnsetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
aStatus);
}
NS_IMETHODIMP
nsresult
nsGenericElement::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
}
nsresult
nsGenericElement::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> elm;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
if (elm) {
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
return rv;
}
nsresult
nsGenericElement::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> elm;
GetListenerManager(PR_FALSE, getter_AddRefs(elm));
if (elm) {
return elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
return NS_OK;
}
nsresult
nsGenericElement::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
{
nsCOMPtr<nsIEventListenerManager> elm;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
if (elm) {
return elm->GetSystemEventGroupLM(aGroup);
}
return rv;
}
nsINode::nsSlots*
nsINode::CreateSlots()
{
@ -679,7 +713,6 @@ NS_IMPL_CYCLE_COLLECTION_1(nsDOMEventRTTearoff, mContent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEventRTTearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
NS_INTERFACE_MAP_END_AGGREGATED(mContent)
@ -745,17 +778,6 @@ nsDOMEventRTTearoff::LastRelease()
delete this;
}
nsresult
nsDOMEventRTTearoff::GetEventReceiver(nsIDOMEventReceiver **aReceiver)
{
nsCOMPtr<nsIEventListenerManager> listener_manager;
nsresult rv =
mContent->GetListenerManager(PR_TRUE, getter_AddRefs(listener_manager));
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(listener_manager, aReceiver);
}
nsresult
nsDOMEventRTTearoff::GetDOM3EventTarget(nsIDOM3EventTarget **aTarget)
{
@ -767,48 +789,6 @@ nsDOMEventRTTearoff::GetDOM3EventTarget(nsIDOM3EventTarget **aTarget)
return CallQueryInterface(listener_manager, aTarget);
}
NS_IMETHODIMP
nsDOMEventRTTearoff::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIDOMEventReceiver> event_receiver;
nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
NS_ENSURE_SUCCESS(rv, rv);
return event_receiver->AddEventListenerByIID(aListener, aIID);
}
NS_IMETHODIMP
nsDOMEventRTTearoff::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
nsCOMPtr<nsIDOMEventReceiver> event_receiver;
nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
NS_ENSURE_SUCCESS(rv, rv);
return event_receiver->RemoveEventListenerByIID(aListener, aIID);
}
NS_IMETHODIMP
nsDOMEventRTTearoff::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
return mContent->GetListenerManager(aCreateIfNotFound, aResult);
}
NS_IMETHODIMP
nsDOMEventRTTearoff::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
{
nsCOMPtr<nsIEventListenerManager> manager;
GetListenerManager(PR_TRUE, getter_AddRefs(manager));
if (!manager) {
return NS_ERROR_FAILURE;
}
return manager->GetSystemEventGroupLM(aGroup);
}
NS_IMETHODIMP
nsDOMEventRTTearoff::GetScriptTypeID(PRUint32 *aLang)
{
@ -835,25 +815,23 @@ nsDOMEventRTTearoff::AddEventListener(const nsAString& aType,
}
NS_IMETHODIMP
nsDOMEventRTTearoff::RemoveEventListener(const nsAString& type,
nsIDOMEventListener *listener,
PRBool useCapture)
nsDOMEventRTTearoff::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
nsCOMPtr<nsIDOMEventReceiver> event_receiver;
nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
NS_ENSURE_SUCCESS(rv, rv);
return event_receiver->RemoveEventListener(type, listener, useCapture);
return RemoveGroupedEventListener(aType, aListener, aUseCapture, nsnull);
}
NS_IMETHODIMP
nsDOMEventRTTearoff::DispatchEvent(nsIDOMEvent *evt, PRBool* _retval)
nsDOMEventRTTearoff::DispatchEvent(nsIDOMEvent *aEvt, PRBool* _retval)
{
nsCOMPtr<nsIDOMEventReceiver> event_receiver;
nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
nsCOMPtr<nsIEventListenerManager> listener_manager;
nsresult rv =
mContent->GetListenerManager(PR_TRUE, getter_AddRefs(listener_manager));
NS_ENSURE_SUCCESS(rv, rv);
return event_receiver->DispatchEvent(evt, _retval);
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(listener_manager);
NS_ENSURE_STATE(target);
return target->DispatchEvent(aEvt, _retval);
}
// nsIDOM3EventTarget
@ -3095,8 +3073,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericElement)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSElement, new nsNSElementTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,

View File

@ -49,7 +49,7 @@
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOM3Node.h"
#include "nsIDOMNSEventTarget.h"
@ -225,7 +225,7 @@ private:
* @see nsDOMEventRTTearoff::Create
*/
class nsDOMEventRTTearoff : public nsIDOMEventReceiver,
class nsDOMEventRTTearoff : public nsIDOMEventTarget,
public nsIDOM3EventTarget,
public nsIDOMNSEventTarget
{
@ -248,7 +248,6 @@ private:
*/
void LastRelease();
nsresult GetEventReceiver(nsIDOMEventReceiver **aReceiver);
nsresult GetDOM3EventTarget(nsIDOM3EventTarget **aTarget);
public:
@ -274,15 +273,6 @@ public:
// nsIDOM3EventTarget
NS_DECL_NSIDOM3EVENTTARGET
// nsIDOMEventReceiver
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
// nsIDOMNSEventTarget
NS_DECL_NSIDOMNSEVENTTARGET
@ -399,8 +389,13 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
// nsIContent interface methods
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,

View File

@ -51,7 +51,6 @@
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMEventReceiver.h"
#include "nsIPrivateDOMImplementation.h"
#include "nsIScriptSecurityManager.h"
#include "nsContentUtils.h"
@ -225,7 +224,7 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
}
// Register as a load listener on the document
nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(document);
nsCOMPtr<nsPIDOMEventTarget> target = do_QueryInterface(document);
NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
nsWeakPtr requestWeak = do_GetWeakReference(NS_STATIC_CAST(nsIDOMLoadListener*, this));

View File

@ -50,7 +50,6 @@
#include "nsIDOMSerializer.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIDOMEventReceiver.h"
#include "nsIEventListenerManager.h"
#include "nsGUIEvent.h"
#include "nsIPrivateDOMEvent.h"
@ -1302,7 +1301,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
mResponseBody.Truncate();
// Register as a load listener on the document
nsCOMPtr<nsIDOMEventReceiver> target(do_QueryInterface(mDocument));
nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(mDocument));
if (target) {
nsWeakPtr requestWeak =
do_GetWeakReference(NS_STATIC_CAST(nsIXMLHttpRequest*, this));

View File

@ -46,11 +46,13 @@ class nsPresContext;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
class nsIEventListenerManager;
class nsIDOMEventListener;
class nsIDOMEventGroup;
// 360fa72e-c709-42cc-9285-1f755ec90376
#define NS_PIDOMEVENTTARGET_IID \
{ 0x360fa72e, 0xc709, 0x42cc, \
{ 0x92, 0x85, 0x1f, 0x75, 0x5e, 0xc9, 0x03, 0x76 } }
{ 0x44a6597b, 0x9fc3, 0x4a8d, \
{ 0xb7, 0xa4, 0xd9, 0x00, 0x9a, 0xbf, 0x9d, 0x15 } }
class nsPIDOMEventTarget : public nsISupports
{
@ -129,8 +131,24 @@ public:
* one already exists. [IN]
* @param aResult The event listener manager [OUT]
*/
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult) = 0;
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult) = 0;
/**
* Add an event listener for nsIID.
*/
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID) = 0;
/**
* Remove event listener for nsIID.
*/
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID) = 0;
/**
* Get the system event group.
*/
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMEventTarget, NS_PIDOMEVENTTARGET_IID)

View File

@ -43,7 +43,6 @@
#include "nsPIDOMEventTarget.h"
#include "nsPresContext.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIEventListenerManager.h"
#include "nsPIDOMWindow.h"

View File

@ -393,7 +393,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsEventListenerManager, nsIEventListenerManager)
@ -1373,35 +1372,6 @@ nsEventListenerManager::IsRegisteredHere(const nsAString & type, PRBool *_retval
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIDOMEventReceiver interface
NS_IMETHODIMP
nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID)
{
return AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
NS_IMETHODIMP
nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
{
return RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
}
NS_IMETHODIMP
nsEventListenerManager::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
NS_ADDREF(*aResult = this);
return NS_OK;
}
NS_IMETHODIMP
nsEventListenerManager::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
{
return GetSystemEventGroupLM(aGroup);
}
nsresult
nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
nsISupports* aCurrentTarget,

View File

@ -42,7 +42,7 @@
#include "jsapi.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsHashtable.h"
#include "nsIScriptContext.h"
@ -68,7 +68,7 @@ typedef struct {
*/
class nsEventListenerManager : public nsIEventListenerManager,
public nsIDOMEventReceiver,
public nsIDOMEventTarget,
public nsIDOM3EventTarget
{
@ -139,15 +139,6 @@ public:
// nsIDOM3EventTarget
NS_DECL_NSIDOM3EVENTTARGET
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
static void Shutdown();
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEventListenerManager,

View File

@ -41,7 +41,7 @@
#include "nsGkAtoms.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsNetUtil.h"
#include "nsIURL.h"
#include "nsIDOMEventListener.h"

View File

@ -50,7 +50,6 @@
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMAttr.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMNSHTMLElement.h"
@ -1377,10 +1376,10 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** a
nsIDocument *document = GetOwnerDoc();
nsresult rv = NS_OK;
if (document && (win = document->GetInnerWindow())) {
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(win));
NS_ENSURE_TRUE(receiver, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(win));
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
rv = receiver->GetListenerManager(PR_TRUE, aManager);
rv = piTarget->GetListenerManager(PR_TRUE, aManager);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aTarget = win);

View File

@ -41,7 +41,7 @@
#include "nsUnicharUtils.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMNSHTMLAnchorElement2.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIHTMLDocument.h"
#include "nsGenericHTMLElement.h"
#include "nsILink.h"

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMNSHTMLAreaElement2.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsILink.h"
#include "nsIPresShell.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLBRElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -38,7 +38,7 @@
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -37,7 +37,7 @@
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMNSHTMLButtonElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLModElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLDivElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLFieldSetElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"

View File

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIDOMHTMLFontElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsIDeviceContext.h"

View File

@ -42,7 +42,7 @@
#include "nsIDOMNSHTMLFormElement.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMNSHTMLFormControlList.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsEventStateManager.h"
#include "nsGkAtoms.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLHRElement.h"
#include "nsIDOMNSHTMLHRElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLHeadElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLHeadingElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMNSHTMLImageElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsImageLoadingContent.h"
#include "nsGkAtoms.h"

View File

@ -51,7 +51,7 @@
#include "nsContentCID.h"
#include "nsIComponentManager.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
@ -88,7 +88,7 @@
#include "nsLayoutUtils.h"
#include "nsIDOMMutationEvent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsMutationEvent.h"
#include "nsIEventListenerManager.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLLIElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -37,7 +37,7 @@
#include "nsCOMPtr.h"
#include "nsIDOMHTMLLabelElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLLegendElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -36,7 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMLinkStyle.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsILink.h"
#include "nsGkAtoms.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLMetaElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -37,7 +37,7 @@
#include "nsIDOMHTMLOListElement.h"
#include "nsIDOMHTMLDListElement.h"
#include "nsIDOMHTMLUListElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -41,7 +41,7 @@
#include "nsIOptionElement.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLParagraphElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLPreElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -42,7 +42,7 @@
#include "nsIDOMNSHTMLSelectElement.h"
#include "nsIDOMNSXBLFormControl.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsContentCreatorFunctions.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLStyleElement.h"
#include "nsIDOMLinkStyle.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -37,7 +37,7 @@
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsMappedAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLTableColElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsMappedAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"

View File

@ -38,7 +38,7 @@
#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsCOMPtr.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsDOMError.h"
#include "nsContentList.h"
#include "nsMappedAttributes.h"

View File

@ -38,7 +38,7 @@
#include "nsIDOMHTMLTableElement.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsDOMError.h"
#include "nsMappedAttributes.h"
#include "nsGenericHTMLElement.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsMappedAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"

View File

@ -50,7 +50,7 @@
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIFormSubmission.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLTitleElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"

View File

@ -41,7 +41,7 @@
#include "nsIDocument.h"
#include "nsRange.h"
#include "nsIDOMAttr.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "nsBindingManager.h"

View File

@ -49,7 +49,7 @@
class nsIContent;
class nsIDocument;
class nsIDOMEventReceiver;
class nsPIDOMEventTarget;
class nsIDOMNodeList;
class nsXBLBinding;
class nsIXBLDocumentInfo;
@ -57,8 +57,8 @@ class nsIURI;
class nsIAtom;
#define NS_IXBLSERVICE_IID \
{ 0x7157b300, 0xf49b, 0x4e7d, \
{ 0xac, 0x3a, 0xef, 0x8f, 0x20, 0x69, 0x6e, 0xb1 } }
{ 0xefda61b3, 0x5d04, 0x43b0, \
{ 0x98, 0x0c, 0x32, 0x62, 0x72, 0xc8, 0x5c, 0x68 } }
class nsIXBLService : public nsISupports
{
@ -82,7 +82,7 @@ public:
PRBool aForceSyncLoad, nsIXBLDocumentInfo** aResult) = 0;
// Hooks up the global key event handlers to the document root.
NS_IMETHOD AttachGlobalKeyHandler(nsIDOMEventReceiver* aElement)=0;
NS_IMETHOD AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget)=0;
};

View File

@ -45,7 +45,7 @@
#include "nsHashtable.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
@ -815,8 +815,8 @@ nsXBLBinding::UnhookEventHandlers()
nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
if (handlerChain) {
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(mBoundElement);
nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(receiver);
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(mBoundElement);
nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(piTarget);
nsCOMPtr<nsIDOMEventGroup> systemEventGroup;
nsXBLPrototypeHandler* curr;
@ -844,7 +844,7 @@ nsXBLBinding::UnhookEventHandlers()
nsIDOMEventGroup* eventGroup = nsnull;
if (curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) {
if (!systemEventGroup)
receiver->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
piTarget->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
eventGroup = systemEventGroup;
}
@ -873,7 +873,7 @@ nsXBLBinding::UnhookEventHandlers()
nsIDOMEventGroup* eventGroup = nsnull;
if (handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) {
if (!systemEventGroup)
receiver->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
piTarget->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
eventGroup = systemEventGroup;
}

View File

@ -40,7 +40,8 @@
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsIDOMEventGroup.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMText.h"
@ -80,9 +81,9 @@ nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIDOMEventTarget> target;
aEvent->GetCurrentTarget(getter_AddRefs(target));
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(target);
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(target);
mProtoHandler->ExecuteHandler(receiver, aEvent);
mProtoHandler->ExecuteHandler(piTarget, aEvent);
return NS_OK;
}
@ -134,7 +135,7 @@ nsXBLKeyEventHandler::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIDOMEventTarget> target;
aEvent->GetCurrentTarget(getter_AddRefs(target));
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(target);
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(target);
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
@ -153,7 +154,7 @@ nsXBLKeyEventHandler::HandleEvent(nsIDOMEvent* aEvent)
(hasAllowUntrustedAttr && handler->AllowUntrustedEvents()) ||
(!hasAllowUntrustedAttr && !mIsBoundToChrome)) &&
handler->KeyEventMatched(key)) {
handler->ExecuteHandler(receiver, aEvent);
handler->ExecuteHandler(piTarget, aEvent);
}
}

View File

@ -46,7 +46,7 @@
class nsIAtom;
class nsIContent;
class nsIDOM3EventTarget;
class nsIDOMEventReceiver;
class nsPIDOMEventTarget;
class nsXBLPrototypeHandler;
class nsXBLEventHandler : public nsIDOMEventListener

View File

@ -43,7 +43,7 @@
#include "nsINameSpaceManager.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"

View File

@ -60,7 +60,7 @@
#include "nsIDOMText.h"
#include "nsIFocusController.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventListener.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMNSEvent.h"
@ -212,7 +212,7 @@ nsXBLPrototypeHandler::InitAccessKeys()
}
nsresult
nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
nsXBLPrototypeHandler::ExecuteHandler(nsPIDOMEventTarget* aTarget,
nsIDOMEvent* aEvent)
{
nsresult rv = NS_ERROR_FAILURE;
@ -273,14 +273,14 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
nsCOMPtr<nsIController> controller;
nsCOMPtr<nsIFocusController> focusController;
nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(aReceiver));
nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(aTarget));
if (windowRoot) {
windowRoot->GetFocusController(getter_AddRefs(focusController));
}
else {
nsCOMPtr<nsPIDOMWindow> privateWindow(do_QueryInterface(aReceiver));
nsCOMPtr<nsPIDOMWindow> privateWindow(do_QueryInterface(aTarget));
if (!privateWindow) {
nsCOMPtr<nsIContent> elt(do_QueryInterface(aReceiver));
nsCOMPtr<nsIContent> elt(do_QueryInterface(aTarget));
nsCOMPtr<nsIDocument> doc;
// XXXbz sXBL/XBL2 issue -- this should be the "scope doc" or
// something... whatever we use when wrapping DOM nodes
@ -290,7 +290,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
doc = elt->GetOwnerDoc();
if (!doc)
doc = do_QueryInterface(aReceiver);
doc = do_QueryInterface(aTarget);
if (!doc)
return NS_ERROR_FAILURE;
@ -307,7 +307,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
if (focusController)
focusController->GetControllerForCommand(command.get(), getter_AddRefs(controller));
else
controller = GetController(aReceiver); // We're attached to the receiver possibly.
controller = GetController(aTarget); // We're attached to the receiver possibly.
nsAutoString type;
mEventName->ToString(type);
@ -418,7 +418,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
// Compile the handler and bind it to the element.
nsCOMPtr<nsIScriptGlobalObject> boundGlobal;
nsCOMPtr<nsPIWindowRoot> winRoot(do_QueryInterface(aReceiver));
nsCOMPtr<nsPIWindowRoot> winRoot(do_QueryInterface(aTarget));
nsCOMPtr<nsIDOMWindowInternal> focusedWin;
if (winRoot) {
@ -441,13 +441,13 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
boundGlobal = do_QueryInterface(piWin->GetPrivateRoot());
}
else boundGlobal = do_QueryInterface(aReceiver);
else boundGlobal = do_QueryInterface(aTarget);
if (!boundGlobal) {
nsCOMPtr<nsIDocument> boundDocument(do_QueryInterface(aReceiver));
nsCOMPtr<nsIDocument> boundDocument(do_QueryInterface(aTarget));
if (!boundDocument) {
// We must be an element.
nsCOMPtr<nsIContent> content(do_QueryInterface(aReceiver));
nsCOMPtr<nsIContent> content(do_QueryInterface(aTarget));
if (!content)
return NS_OK;
boundDocument = content->GetOwnerDoc();
@ -472,7 +472,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
if (winRoot) {
scriptTarget = boundGlobal;
} else {
scriptTarget = aReceiver;
scriptTarget = aTarget;
}
// XXX - apparently we should not be using the global as the scope - what
// should we use? See bug 339649, which is trying to find out!
@ -522,30 +522,30 @@ nsXBLPrototypeHandler::GetEventName()
}
already_AddRefed<nsIController>
nsXBLPrototypeHandler::GetController(nsIDOMEventReceiver* aReceiver)
nsXBLPrototypeHandler::GetController(nsPIDOMEventTarget* aTarget)
{
// XXX Fix this so there's a generic interface that describes controllers,
// This code should have no special knowledge of what objects might have controllers.
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aReceiver));
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aTarget));
if (xulElement)
xulElement->GetControllers(getter_AddRefs(controllers));
if (!controllers) {
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aReceiver));
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aTarget));
if (htmlTextArea)
htmlTextArea->GetControllers(getter_AddRefs(controllers));
}
if (!controllers) {
nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement(do_QueryInterface(aReceiver));
nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement(do_QueryInterface(aTarget));
if (htmlInputElement)
htmlInputElement->GetControllers(getter_AddRefs(controllers));
}
if (!controllers) {
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(aReceiver));
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(aTarget));
if (domWindow)
domWindow->GetControllers(getter_AddRefs(controllers));
}

View File

@ -52,7 +52,7 @@ class nsIContent;
class nsIDOMUIEvent;
class nsIDOMKeyEvent;
class nsIDOMMouseEvent;
class nsIDOMEventReceiver;
class nsPIDOMEventTarget;
class nsIDOM3EventTarget;
class nsXBLPrototypeBinding;
@ -121,7 +121,7 @@ public:
nsXBLPrototypeHandler* GetNextHandler() { return mNextHandler; }
void SetNextHandler(nsXBLPrototypeHandler* aHandler) { mNextHandler = aHandler; }
nsresult ExecuteHandler(nsIDOMEventReceiver* aReceiver, nsIDOMEvent* aEvent);
nsresult ExecuteHandler(nsPIDOMEventTarget* aTarget, nsIDOMEvent* aEvent);
already_AddRefed<nsIAtom> GetEventName();
void SetEventName(nsIAtom* aName) { mEventName = aName; }
@ -157,7 +157,7 @@ public:
static PRUint32 gRefCnt;
protected:
already_AddRefed<nsIController> GetController(nsIDOMEventReceiver* aReceiver);
already_AddRefed<nsIController> GetController(nsPIDOMEventTarget* aTarget);
inline PRInt32 GetMatchingKeyCode(const nsAString& aKeyName);
void ConstructPrototype(nsIContent* aKeyElement,

View File

@ -429,8 +429,8 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
nsXBLBindingRequest::Destroy(mXBLService->mPool, req);
}
nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(mBindingDocument));
rec->RemoveEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)this, PR_FALSE);
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mBindingDocument));
target->RemoveEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)this, PR_FALSE);
mBindingRequests.Clear();
mDocument = nsnull;
@ -707,34 +707,34 @@ nsXBLService::GetXBLDocumentInfo(nsIURI* aURI, nsIContent* aBoundElement)
// then extra work needs to be done to hook it up to the document (XXX WHY??)
//
NS_IMETHODIMP
nsXBLService::AttachGlobalKeyHandler(nsIDOMEventReceiver* aReceiver)
nsXBLService::AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget)
{
// check if the receiver is a content node (not a document), and hook
// it to the document if that is the case.
nsCOMPtr<nsIDOMEventReceiver> rec = aReceiver;
nsCOMPtr<nsIContent> contentNode(do_QueryInterface(aReceiver));
nsCOMPtr<nsPIDOMEventTarget> piTarget = aTarget;
nsCOMPtr<nsIContent> contentNode(do_QueryInterface(aTarget));
if (contentNode) {
// Only attach if we're really in a document
nsCOMPtr<nsIDocument> doc = contentNode->GetCurrentDoc();
if (doc)
rec = do_QueryInterface(doc); // We're a XUL keyset. Attach to our document.
piTarget = do_QueryInterface(doc); // We're a XUL keyset. Attach to our document.
}
if (!rec)
if (!piTarget)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(contentNode));
// Create the key handler
nsXBLWindowKeyHandler* handler;
NS_NewXBLWindowKeyHandler(elt, rec, &handler); // This addRef's
NS_NewXBLWindowKeyHandler(elt, piTarget, &handler); // This addRef's
if (!handler)
return NS_ERROR_FAILURE;
// listen to these events
nsCOMPtr<nsIDOMEventGroup> systemGroup;
rec->GetSystemEventGroup(getter_AddRefs(systemGroup));
nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(rec);
piTarget->GetSystemEventGroup(getter_AddRefs(systemGroup));
nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(piTarget);
target->AddGroupedEventListener(NS_LITERAL_STRING("keydown"), handler,
PR_FALSE, systemGroup);
@ -1146,8 +1146,10 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
nsXBLStreamListener* xblListener = new nsXBLStreamListener(this, listener, aBoundDocument, doc);
NS_ENSURE_TRUE(xblListener,NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(doc));
rec->AddEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)xblListener, PR_FALSE);
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(doc));
target->AddEventListener(NS_LITERAL_STRING("load"),
NS_STATIC_CAST(nsIDOMLoadListener*, xblListener),
PR_FALSE);
// Add ourselves to the list of loading docs.
nsBindingManager *bindingManager;

View File

@ -81,7 +81,7 @@ class nsXBLService : public nsIXBLService,
PRBool aForceSyncLoad, nsIXBLDocumentInfo** aResult);
// Used by XUL key bindings and for window XBL.
NS_IMETHOD AttachGlobalKeyHandler(nsIDOMEventReceiver* aElement);
NS_IMETHOD AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget);
NS_DECL_NSIOBSERVER

View File

@ -44,7 +44,7 @@
#include "nsIAtom.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsXBLService.h"
#include "nsIServiceManager.h"
@ -175,8 +175,9 @@ nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
nsXBLSpecialDocInfo* nsXBLWindowKeyHandler::sXBLSpecialDocInfo = nsnull;
PRUint32 nsXBLWindowKeyHandler::sRefCnt = 0;
nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver)
: mReceiver(aReceiver),
nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement,
nsPIDOMEventTarget* aTarget)
: mTarget(aTarget),
mHandler(nsnull),
mUserHandler(nsnull)
{
@ -355,7 +356,7 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
// get the DOM window we're attached to
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mReceiver);
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mTarget);
if (root) {
nsCOMPtr<nsIFocusController> fc;
root->GetFocusController(getter_AddRefs(fc));
@ -431,7 +432,7 @@ nsXBLWindowKeyHandler::ShutDown()
PRBool
nsXBLWindowKeyHandler::IsEditor()
{
nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(mReceiver));
nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(mTarget));
NS_ENSURE_TRUE(windowRoot, PR_FALSE);
nsCOMPtr<nsIFocusController> focusController;
windowRoot->GetFocusController(getter_AddRefs(focusController));
@ -534,15 +535,15 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMEvent* aEvent,
}
}
nsCOMPtr<nsIDOMEventReceiver> rec;
nsCOMPtr<nsPIDOMEventTarget> piTarget;
nsCOMPtr<nsIDOMElement> element = GetElement();
if (element) {
rec = do_QueryInterface(commandElt);
piTarget = do_QueryInterface(commandElt);
} else {
rec = mReceiver;
piTarget = mTarget;
}
rv = currHandler->ExecuteHandler(rec, aEvent);
rv = currHandler->ExecuteHandler(piTarget, aEvent);
if (NS_SUCCEEDED(rv)) {
return NS_OK;
}
@ -563,9 +564,10 @@ nsXBLWindowKeyHandler::GetElement()
///////////////////////////////////////////////////////////////////////////////////
nsresult
NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver, nsXBLWindowKeyHandler** aResult)
NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, nsPIDOMEventTarget* aTarget,
nsXBLWindowKeyHandler** aResult)
{
*aResult = new nsXBLWindowKeyHandler(aElement, aReceiver);
*aResult = new nsXBLWindowKeyHandler(aElement, aTarget);
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);

View File

@ -45,7 +45,8 @@
class nsIAtom;
class nsIDOMElement;
class nsIDOMEventReceiver;
class nsIDOMEventTarget;
class nsPIDOMEventTarget;
class nsIXBLDocumentInfo;
class nsXBLSpecialDocInfo;
class nsXBLPrototypeHandler;
@ -53,7 +54,7 @@ class nsXBLPrototypeHandler;
class nsXBLWindowKeyHandler : public nsIDOMKeyListener
{
public:
nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver);
nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsPIDOMEventTarget* aTarget);
virtual ~nsXBLWindowKeyHandler();
// nsIDOMetc.
@ -95,7 +96,7 @@ protected:
already_AddRefed<nsIDOMElement> GetElement();
// Using weak pointer to the DOM Element.
nsWeakPtr mWeakPtrForElement;
nsIDOMEventReceiver* mReceiver; // weak ref
nsPIDOMEventTarget* mTarget; // weak ref
// these are not owning references; the prototype handlers are owned
// by the prototype bindings which are owned by the docinfo.
@ -109,7 +110,7 @@ protected:
nsresult
NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement,
nsIDOMEventReceiver* aReceiver,
nsPIDOMEventTarget* aTarget,
nsXBLWindowKeyHandler** aResult);
#endif

View File

@ -77,7 +77,7 @@
#include "nsIDOMContextMenuListener.h"
#include "nsIDOMDragListener.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMXULElement.h"
@ -523,11 +523,11 @@ nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
if ((!root || root == this) && !mNodeInfo->Equals(nsGkAtoms::overlay)) {
nsPIDOMWindow *window = doc->GetInnerWindow();
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(window);
if (!receiver)
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(window);
if (!piTarget)
return NS_ERROR_UNEXPECTED;
nsresult rv = receiver->GetListenerManager(PR_TRUE, aManager);
nsresult rv = piTarget->GetListenerManager(PR_TRUE, aManager);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aTarget = window);
}

View File

@ -57,7 +57,7 @@
#include "nsIControllers.h"
#include "nsICSSParser.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"

View File

@ -1686,8 +1686,8 @@ nsXULDocument::AddElementToDocumentPost(nsIContent* aElement)
// Create our XUL key listener and hook it up.
nsCOMPtr<nsIXBLService> xblService(do_GetService("@mozilla.org/xbl;1"));
if (xblService) {
nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(aElement));
xblService->AttachGlobalKeyHandler(rec);
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(aElement));
xblService->AttachGlobalKeyHandler(piTarget);
}
}

View File

@ -49,7 +49,7 @@
#include "nsElementMap.h"
#include "nsForwardReference.h"
#include "nsIContent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMXULDocument.h"
#include "nsISupportsArray.h"

View File

@ -45,7 +45,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = dom
EXPORTS = \
nsIDOMEventReceiver.h \
nsIDOMFocusListener.h \
nsIDOMFormListener.h \
nsIDOMKeyListener.h \

View File

@ -1,74 +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 nsIDOMEventReceiver_h__
#define nsIDOMEventReceiver_h__
#include "nsIDOMEventTarget.h"
class nsIDOMEventListener;
class nsIEventListenerManager;
class nsIDOMEvent;
class nsIDOMEventGroup;
/*
* DOM event source class. Object that allow event registration and
* distribution from themselves implement this interface.
*/
/* 025957f3-7b19-452b-89a1-9be652d8d6db */
#define NS_IDOMEVENTRECEIVER_IID \
{ 0x025957f3, 0x7b19, 0x452b, \
{ 0x89, 0xa1, 0x9b, 0xe6, 0x52, 0xd8, 0xd6, 0xdb } }
class nsIDOMEventReceiver : public nsIDOMEventTarget
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMEVENTRECEIVER_IID)
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID) = 0;
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID) = 0;
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult) = 0;
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMEventReceiver, NS_IDOMEVENTRECEIVER_IID)
#endif // nsIDOMEventReceiver_h__

View File

@ -168,7 +168,7 @@
// Event related includes
#include "nsIEventListenerManager.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSEventTarget.h"
// CSS related includes
@ -6706,18 +6706,15 @@ nsEventReceiverSH::RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
nsIScriptContext *script_cx = nsJSUtils::GetStaticScriptContext(cx, obj);
NS_ENSURE_TRUE(script_cx, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryWrappedNative(wrapper));
if (!receiver) {
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryWrappedNative(wrapper));
if (!piTarget) {
// Doesn't do events
#ifdef DEBUG
nsCOMPtr<nsIAttribute> attr = do_QueryWrappedNative(wrapper);
NS_WARN_IF_FALSE(attr, "Non-attr doesn't QI to nsIDOMEventReceiver?");
#endif
NS_WARNING("Doesn't QI to nsPIDOMEventTarget?");
return NS_OK;
}
nsCOMPtr<nsIEventListenerManager> manager;
receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
NS_ENSURE_TRUE(manager, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIAtom> atom(do_GetAtom(nsDependentJSString(id)));
@ -6728,12 +6725,12 @@ nsEventReceiverSH::RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
JSObject *scope = GetGlobalJSObject(cx, obj);
if (compile) {
rv = manager->CompileScriptEventListener(script_cx, scope, receiver, atom,
rv = manager->CompileScriptEventListener(script_cx, scope, piTarget, atom,
did_define);
} else if (remove) {
rv = manager->RemoveScriptEventListener(atom);
} else {
rv = manager->RegisterScriptEventListener(script_cx, scope, receiver,
rv = manager->RegisterScriptEventListener(script_cx, scope, piTarget,
atom);
}

View File

@ -698,7 +698,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
NS_INTERFACE_MAP_ENTRY(nsIDOMJSWindow)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
@ -1293,9 +1292,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
if (internal == NS_STATIC_CAST(nsIDOMWindowInternal *, this)) {
nsCOMPtr<nsIXBLService> xblService = do_GetService("@mozilla.org/xbl;1");
if (xblService) {
nsCOMPtr<nsIDOMEventReceiver> rec =
nsCOMPtr<nsPIDOMEventTarget> piTarget =
do_QueryInterface(mChromeEventHandler);
xblService->AttachGlobalKeyHandler(rec);
xblService->AttachGlobalKeyHandler(piTarget);
}
}
}
@ -5567,12 +5566,7 @@ nsGlobalWindow::AddEventListener(const nsAString& aType,
return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
}
//*****************************************************************************
// nsGlobalWindow::nsIDOMEventReceiver
//*****************************************************************************
NS_IMETHODIMP
nsresult
nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener,
const nsIID& aIID)
{
@ -5585,7 +5579,7 @@ nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener,
const nsIID& aIID)
{
@ -5600,7 +5594,7 @@ nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
@ -5619,7 +5613,7 @@ nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound,
mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mListenerManager->SetListenerTarget(
NS_STATIC_CAST(nsIDOMEventReceiver*, this));
NS_STATIC_CAST(nsPIDOMEventTarget*, this));
}
NS_ADDREF(*aResult = mListenerManager);
@ -5627,7 +5621,7 @@ nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsGlobalWindow::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
{
nsCOMPtr<nsIEventListenerManager> manager;

View File

@ -61,7 +61,7 @@
#include "nsIDocShellTreeItem.h"
#include "nsIDOMClientInformation.h"
#include "nsIDOMViewCSS.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
#include "nsIDOMNavigator.h"
@ -216,7 +216,7 @@ class nsGlobalWindow : public nsPIDOMWindow,
public nsIScriptGlobalObject,
public nsIDOMJSWindow,
public nsIScriptObjectPrincipal,
public nsIDOMEventReceiver,
public nsIDOMEventTarget,
public nsPIDOMEventTarget,
public nsIDOM3EventTarget,
public nsIDOMNSEventTarget,
@ -278,15 +278,6 @@ public:
// nsIDOMNSEventTarget
NS_DECL_NSIDOMNSEVENTTARGET
// nsIDOMEventReceiver
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
// nsPIDOMWindow
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
virtual NS_HIDDEN_(nsresult) Activate();
@ -321,6 +312,13 @@ public:
nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual NS_HIDDEN_(nsresult) GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual NS_HIDDEN_(nsresult) AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual NS_HIDDEN_(nsresult) RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual NS_HIDDEN_(nsresult) GetSystemEventGroup(nsIDOMEventGroup** aGroup);
virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,

View File

@ -67,10 +67,10 @@ nsWindowRoot::nsWindowRoot(nsIDOMWindow* aWindow)
nsFocusController::Create(getter_AddRefs(mFocusController));
nsCOMPtr<nsIDOMFocusListener> focusListener(do_QueryInterface(mFocusController));
mRefCnt.incr(NS_STATIC_CAST(nsIDOMEventReceiver*, this));
mRefCnt.incr(NS_STATIC_CAST(nsIDOMEventTarget*, this));
AddEventListener(NS_LITERAL_STRING("focus"), focusListener, PR_TRUE);
AddEventListener(NS_LITERAL_STRING("blur"), focusListener, PR_TRUE);
mRefCnt.decr(NS_STATIC_CAST(nsIDOMEventReceiver*, this));
mRefCnt.decr(NS_STATIC_CAST(nsIDOMEventTarget*, this));
}
nsWindowRoot::~nsWindowRoot()
@ -83,8 +83,7 @@ nsWindowRoot::~nsWindowRoot()
NS_IMPL_CYCLE_COLLECTION_2(nsWindowRoot, mListenerManager, mFocusController)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowRoot)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsPIWindowRoot)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
@ -184,7 +183,7 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
}
NS_IMETHODIMP
nsresult
nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> manager;
@ -196,7 +195,7 @@ nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID&
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
{
nsCOMPtr<nsIEventListenerManager> manager;
@ -208,7 +207,7 @@ nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsI
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
@ -221,7 +220,7 @@ nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound,
mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
mListenerManager->SetListenerTarget(
NS_STATIC_CAST(nsIDOMEventReceiver*, this));
NS_STATIC_CAST(nsPIDOMEventTarget*, this));
}
*aResult = mListenerManager;
@ -229,7 +228,7 @@ nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWindowRoot::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
{
nsCOMPtr<nsIEventListenerManager> manager;

View File

@ -47,7 +47,7 @@ class nsIDOMEvent;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
#include "nsIEventListenerManager.h"
@ -56,7 +56,7 @@ class nsEventChainPostVisitor;
#include "nsIDOMEventTarget.h"
#include "nsCycleCollectionParticipant.h"
class nsWindowRoot : public nsIDOMEventReceiver,
class nsWindowRoot : public nsIDOMEventTarget,
public nsIDOM3EventTarget,
public nsIDOMNSEventTarget,
public nsPIWindowRoot
@ -76,18 +76,18 @@ public:
nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
// nsIDOMEventReceiver
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
// nsPIWindowRoot
NS_IMETHOD GetFocusController(nsIFocusController** aResult);
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowRoot, nsIDOMEventReceiver)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowRoot, nsIDOMEventTarget)
protected:
// Members

View File

@ -43,7 +43,8 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsPIDOMEventTarget.h"
#include "nsIEventListenerManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
@ -321,9 +322,9 @@ nsEditor::InstallEventListeners()
mCompositionListenerP && mDragListenerP,
NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
if (!erP) {
if (!piTarget) {
RemoveEventListeners();
return NS_ERROR_FAILURE;
}
@ -332,9 +333,9 @@ nsEditor::InstallEventListeners()
// register the event listeners with the listener manager
nsCOMPtr<nsIDOMEventGroup> sysGroup;
erP->GetSystemEventGroup(getter_AddRefs(sysGroup));
piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup));
nsCOMPtr<nsIEventListenerManager> elmP;
erP->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
if (sysGroup && elmP)
{
@ -347,20 +348,20 @@ nsEditor::InstallEventListeners()
"failed to register key listener in system group");
}
rv |= erP->AddEventListenerByIID(mMouseListenerP,
NS_GET_IID(nsIDOMMouseListener));
rv |= piTarget->AddEventListenerByIID(mMouseListenerP,
NS_GET_IID(nsIDOMMouseListener));
rv |= erP->AddEventListenerByIID(mFocusListenerP,
NS_GET_IID(nsIDOMFocusListener));
rv |= piTarget->AddEventListenerByIID(mFocusListenerP,
NS_GET_IID(nsIDOMFocusListener));
rv |= erP->AddEventListenerByIID(mTextListenerP,
NS_GET_IID(nsIDOMTextListener));
rv |= piTarget->AddEventListenerByIID(mTextListenerP,
NS_GET_IID(nsIDOMTextListener));
rv |= erP->AddEventListenerByIID(mCompositionListenerP,
NS_GET_IID(nsIDOMCompositionListener));
rv |= piTarget->AddEventListenerByIID(mCompositionListenerP,
NS_GET_IID(nsIDOMCompositionListener));
rv |= erP->AddEventListenerByIID(mDragListenerP,
NS_GET_IID(nsIDOMDragListener));
rv |= piTarget->AddEventListenerByIID(mDragListenerP,
NS_GET_IID(nsIDOMDragListener));
if (NS_FAILED(rv))
{
@ -380,18 +381,18 @@ nsEditor::RemoveEventListeners()
return;
}
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
if (erP)
if (piTarget)
{
// unregister the event listeners with the DOM event reveiver
if (mKeyListenerP)
{
nsCOMPtr<nsIDOMEventGroup> sysGroup;
erP->GetSystemEventGroup(getter_AddRefs(sysGroup));
piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup));
nsCOMPtr<nsIEventListenerManager> elmP;
erP->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
if (sysGroup && elmP)
{
elmP->RemoveEventListenerByType(mKeyListenerP,
@ -404,32 +405,32 @@ nsEditor::RemoveEventListeners()
if (mMouseListenerP)
{
erP->RemoveEventListenerByIID(mMouseListenerP,
NS_GET_IID(nsIDOMMouseListener));
piTarget->RemoveEventListenerByIID(mMouseListenerP,
NS_GET_IID(nsIDOMMouseListener));
}
if (mFocusListenerP)
{
erP->RemoveEventListenerByIID(mFocusListenerP,
NS_GET_IID(nsIDOMFocusListener));
piTarget->RemoveEventListenerByIID(mFocusListenerP,
NS_GET_IID(nsIDOMFocusListener));
}
if (mTextListenerP)
{
erP->RemoveEventListenerByIID(mTextListenerP,
NS_GET_IID(nsIDOMTextListener));
piTarget->RemoveEventListenerByIID(mTextListenerP,
NS_GET_IID(nsIDOMTextListener));
}
if (mCompositionListenerP)
{
erP->RemoveEventListenerByIID(mCompositionListenerP,
NS_GET_IID(nsIDOMCompositionListener));
piTarget->RemoveEventListenerByIID(mCompositionListenerP,
NS_GET_IID(nsIDOMCompositionListener));
}
if (mDragListenerP)
{
erP->RemoveEventListenerByIID(mDragListenerP,
NS_GET_IID(nsIDOMDragListener));
piTarget->RemoveEventListenerByIID(mDragListenerP,
NS_GET_IID(nsIDOMDragListener));
}
}
}
@ -5208,14 +5209,14 @@ nsEditor::HandleInlineSpellCheck(PRInt32 action,
aEndOffset) : NS_OK;
}
already_AddRefed<nsIDOMEventReceiver>
nsEditor::GetDOMEventReceiver()
already_AddRefed<nsPIDOMEventTarget>
nsEditor::GetPIDOMEventTarget()
{
nsIDOMEventReceiver *erp = mDOMEventReceiver;
if (erp)
nsPIDOMEventTarget* piTarget = mEventTarget;
if (piTarget)
{
NS_ADDREF(erp);
return erp;
NS_ADDREF(piTarget);
return piTarget;
}
nsIDOMElement *rootElement = GetRoot();
@ -5227,9 +5228,9 @@ nsEditor::GetDOMEventReceiver()
if (content && content->IsNativeAnonymous())
{
mDOMEventReceiver = do_QueryInterface(content->GetParent());
erp = mDOMEventReceiver;
NS_IF_ADDREF(erp);
mEventTarget = do_QueryInterface(content->GetParent());
piTarget = mEventTarget;
NS_IF_ADDREF(piTarget);
}
else
{
@ -5238,7 +5239,7 @@ nsEditor::GetDOMEventReceiver()
// ourselves, if it exists.
if (mDocWeak)
{
CallQueryReferent(mDocWeak.get(), &erp);
CallQueryReferent(mDocWeak.get(), &piTarget);
}
else
{
@ -5246,7 +5247,7 @@ nsEditor::GetDOMEventReceiver()
}
}
return erp;
return piTarget;
}
nsIDOMElement *

View File

@ -63,6 +63,7 @@
#include "nsSelectionState.h"
#include "nsIEditorSpellCheck.h"
#include "nsIInlineSpellChecker.h"
#include "nsPIDOMEventTarget.h"
class nsIDOMCharacterData;
class nsIDOMRange;
@ -83,7 +84,7 @@ class AddStyleSheetTxn;
class RemoveStyleSheetTxn;
class nsIFile;
class nsISelectionController;
class nsIDOMEventReceiver;
class nsIDOMEventTarget;
#define kMOZEditorBogusNodeAttr NS_LITERAL_STRING("_moz_editor_bogus_node")
#define kMOZEditorBogusNodeValue NS_LITERAL_STRING("TRUE")
@ -574,7 +575,7 @@ public:
nsIDOMNode *aEndNode,
PRInt32 aEndOffset);
already_AddRefed<nsIDOMEventReceiver> GetDOMEventReceiver();
already_AddRefed<nsPIDOMEventTarget> GetPIDOMEventTarget();
// Fast non-refcounting editor root element accessor
nsIDOMElement *GetRoot();
@ -634,7 +635,7 @@ protected:
PRInt8 mDocDirtyState; // -1 = not initialized
nsWeakPtr mDocWeak; // weak reference to the nsIDOMDocument
// The form field as an event receiver
nsCOMPtr<nsIDOMEventReceiver> mDOMEventReceiver;
nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
nsString* mPhonetic;

View File

@ -57,7 +57,6 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventReceiver.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
@ -403,11 +402,11 @@ nsHTMLEditor::GrabberClicked()
mMouseMotionListenerP = new ResizerMouseMotionListener(this);
if (!mMouseMotionListenerP) {return NS_ERROR_NULL_POINTER;}
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
NS_ENSURE_TRUE(erP, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
res = erP->AddEventListenerByIID(mMouseMotionListenerP,
NS_GET_IID(nsIDOMMouseMotionListener));
res = piTarget->AddEventListenerByIID(mMouseMotionListenerP,
NS_GET_IID(nsIDOMMouseMotionListener));
NS_ASSERTION(NS_SUCCEEDED(res),
"failed to register mouse motion listener");
}
@ -432,13 +431,14 @@ nsHTMLEditor::EndMoving()
DeleteRefToAnonymousNode(mPositioningShadow, rootContent, ps);
mPositioningShadow = nsnull;
}
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
if (erP && mMouseMotionListenerP) {
if (piTarget && mMouseMotionListenerP) {
#ifdef DEBUG
nsresult res =
#endif
erP->RemoveEventListenerByIID(mMouseMotionListenerP, NS_GET_IID(nsIDOMMouseMotionListener));
piTarget->RemoveEventListenerByIID(mMouseMotionListenerP,
NS_GET_IID(nsIDOMMouseMotionListener));
NS_ASSERTION(NS_SUCCEEDED(res), "failed to remove mouse motion listener");
}
mMouseMotionListenerP = nsnull;

View File

@ -51,7 +51,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMAttr.h"
#include "nsIDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMKeyListener.h"

View File

@ -58,7 +58,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMAttr.h"
#include "nsIDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMKeyListener.h"
@ -369,9 +369,10 @@ nsHTMLEditor::RemoveEventListeners()
return;
}
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(piTarget);
if (erP)
if (piTarget && target)
{
// Both mMouseMotionListenerP and mResizeEventListenerP can be
// registerd with other targets than the DOM event receiver that
@ -384,17 +385,17 @@ nsHTMLEditor::RemoveEventListeners()
{
// mMouseMotionListenerP might be registerd either by IID or
// name, unregister by both.
erP->RemoveEventListenerByIID(mMouseMotionListenerP,
NS_GET_IID(nsIDOMMouseMotionListener));
piTarget->RemoveEventListenerByIID(mMouseMotionListenerP,
NS_GET_IID(nsIDOMMouseMotionListener));
erP->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
mMouseMotionListenerP, PR_TRUE);
target->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
mMouseMotionListenerP, PR_TRUE);
}
if (mResizeEventListenerP)
{
erP->RemoveEventListener(NS_LITERAL_STRING("resize"),
mResizeEventListenerP, PR_FALSE);
target->RemoveEventListener(NS_LITERAL_STRING("resize"),
mResizeEventListenerP, PR_FALSE);
}
}

View File

@ -40,7 +40,7 @@
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsPIDOMEventTarget.h"
#include "nsIDOMText.h"
#include "nsIDOMCSSValue.h"
@ -479,12 +479,14 @@ nsHTMLEditor::HideResizers(void)
// don't forget to remove the listeners !
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(piTarget);
nsresult res;
if (erP && mMouseMotionListenerP)
if (target && mMouseMotionListenerP)
{
res = erP->RemoveEventListener(NS_LITERAL_STRING("mousemove"), mMouseMotionListenerP, PR_TRUE);
res = target->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
mMouseMotionListenerP, PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(res), "failed to remove mouse motion listener");
}
mMouseMotionListenerP = nsnull;
@ -493,7 +495,7 @@ nsHTMLEditor::HideResizers(void)
GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (!doc) { return NS_ERROR_NULL_POINTER; }
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
target = do_QueryInterface(doc->GetWindow());
if (!target) { return NS_ERROR_NULL_POINTER; }
if (mResizeEventListenerP) {
@ -612,11 +614,12 @@ nsHTMLEditor::StartResizing(nsIDOMElement *aHandle)
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
NS_ENSURE_TRUE(erP, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(piTarget);
NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
result = erP->AddEventListener(NS_LITERAL_STRING("mousemove"),
mMouseMotionListenerP, PR_TRUE);
result = target->AddEventListener(NS_LITERAL_STRING("mousemove"),
mMouseMotionListenerP, PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(result),
"failed to register mouse motion listener");
}

View File

@ -42,7 +42,7 @@
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsIFormControl.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsISelection.h"

View File

@ -47,7 +47,7 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseListener.h"

View File

@ -647,8 +647,8 @@ EmbedPrivate::Destroy(void)
// detach our event listeners and release the event receiver
DetachListeners();
if (mEventReceiver)
mEventReceiver = nsnull;
if (mEventTarget)
mEventTarget = nsnull;
// destroy our child window
mWindow->ReleaseChildren();
@ -993,7 +993,7 @@ EmbedPrivate::ContentStateChange(void)
GetListener();
if (!mEventReceiver)
if (!mEventTarget)
return;
AttachListeners();
@ -1118,7 +1118,7 @@ EmbedPrivate::ChildFocusOut(void)
void
EmbedPrivate::GetListener(void)
{
if (mEventReceiver)
if (mEventTarget)
return;
nsCOMPtr<nsPIDOMWindow> piWin;
@ -1127,7 +1127,7 @@ EmbedPrivate::GetListener(void)
if (!piWin)
return;
mEventReceiver = do_QueryInterface(piWin->GetChromeEventHandler());
mEventTarget = do_QueryInterface(piWin->GetChromeEventHandler());
}
// attach key and mouse event listeners
@ -1135,7 +1135,7 @@ EmbedPrivate::GetListener(void)
void
EmbedPrivate::AttachListeners(void)
{
if (!mEventReceiver || mListenersAttached)
if (!mEventTarget || mListenersAttached)
return;
nsIDOMEventListener *eventListener =
@ -1144,7 +1144,7 @@ EmbedPrivate::AttachListeners(void)
// add the key listener
nsresult rv;
rv = mEventReceiver->AddEventListenerByIID(
rv = mEventTarget->AddEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMKeyListener));
if (NS_FAILED(rv)) {
@ -1152,7 +1152,7 @@ EmbedPrivate::AttachListeners(void)
return;
}
rv = mEventReceiver->AddEventListenerByIID(
rv = mEventTarget->AddEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMMouseListener));
if (NS_FAILED(rv)) {
@ -1160,7 +1160,7 @@ EmbedPrivate::AttachListeners(void)
return;
}
rv = mEventReceiver->AddEventListenerByIID(
rv = mEventTarget->AddEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMUIListener));
if (NS_FAILED(rv)) {
@ -1168,17 +1168,23 @@ EmbedPrivate::AttachListeners(void)
return;
}
rv = mEventReceiver->AddEventListenerByIID(
rv = mEventTarget->AddEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMMouseMotionListener));
if (NS_FAILED(rv)) {
NS_WARNING("Failed to add Mouse Motion listener\n");
return;
}
rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mEventTarget));
if (!target) {
return;
}
rv = target->AddEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
rv = target->AddEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
rv = target->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
rv = target->AddEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to add Mouse Motion listener\n");
return;
@ -1190,7 +1196,7 @@ EmbedPrivate::AttachListeners(void)
void
EmbedPrivate::DetachListeners(void)
{
if (!mListenersAttached || !mEventReceiver)
if (!mListenersAttached || !mEventTarget)
return;
nsIDOMEventListener *eventListener =
@ -1198,7 +1204,7 @@ EmbedPrivate::DetachListeners(void)
NS_STATIC_CAST(nsIDOMKeyListener *, mEventListener));
nsresult rv;
rv = mEventReceiver->RemoveEventListenerByIID(
rv = mEventTarget->RemoveEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMKeyListener));
if (NS_FAILED(rv)) {
@ -1207,7 +1213,7 @@ EmbedPrivate::DetachListeners(void)
}
rv =
mEventReceiver->RemoveEventListenerByIID(
mEventTarget->RemoveEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMMouseListener));
if (NS_FAILED(rv)) {
@ -1215,7 +1221,7 @@ EmbedPrivate::DetachListeners(void)
return;
}
rv = mEventReceiver->RemoveEventListenerByIID(
rv = mEventTarget->RemoveEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMUIListener));
if (NS_FAILED(rv)) {
@ -1223,17 +1229,23 @@ EmbedPrivate::DetachListeners(void)
return;
}
rv = mEventReceiver->RemoveEventListenerByIID(
rv = mEventTarget->RemoveEventListenerByIID(
eventListener,
NS_GET_IID(nsIDOMMouseMotionListener));
if (NS_FAILED(rv)) {
NS_WARNING("Failed to remove Mouse Motion listener\n");
return;
}
rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mEventTarget));
if (!target) {
return;
}
rv = target->RemoveEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
rv = target->RemoveEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
rv = target->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
rv = target->RemoveEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
mListenersAttached = PR_FALSE;
}

View File

@ -54,7 +54,7 @@
// object.
#include "nsIWebBrowserChrome.h"
#include "nsIAppShell.h"
#include "nsIDOMEventReceiver.h"
#include "nsPIDOMEventTarget.h"
#include "nsVoidArray.h"
// app component registration
@ -190,8 +190,7 @@ class EmbedPrivate {
nsCOMPtr<nsIWebNavigation> mNavigation;
nsCOMPtr<nsISHistory> mSessionHistory;
// our event receiver
nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
// the currently loaded uri
nsString mURI;

View File

@ -71,7 +71,7 @@
#include "nsIDOMEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
@ -98,15 +98,16 @@
#include "nsPresContext.h"
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsPIDOMEventTarget.h"
//
// GetEventReceiver
//
// A helper routine that navigates the tricky path from a |nsWebBrowser| to
// a |nsIDOMEventReceiver| via the window root and chrome event handler.
// a |nsPIDOMEventTarget| via the window root and chrome event handler.
//
static nsresult
GetEventReceiver ( nsWebBrowser* inBrowser, nsIDOMEventReceiver** outEventRcvr )
GetPIDOMEventTarget( nsWebBrowser* inBrowser, nsPIDOMEventTarget** aTarget)
{
nsCOMPtr<nsIDOMWindow> domWindow;
inBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
@ -116,11 +117,11 @@ GetEventReceiver ( nsWebBrowser* inBrowser, nsIDOMEventReceiver** outEventRcvr )
NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE);
nsPIDOMWindow *rootWindow = domWindowPrivate->GetPrivateRoot();
NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMEventReceiver> rcvr =
nsCOMPtr<nsPIDOMEventTarget> piTarget =
do_QueryInterface(rootWindow->GetChromeEventHandler());
NS_ENSURE_TRUE(rcvr, NS_ERROR_FAILURE);
*outEventRcvr = rcvr;
NS_IF_ADDREF(*outEventRcvr);
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
*aTarget = piTarget;
NS_IF_ADDREF(*aTarget);
return NS_OK;
}
@ -905,10 +906,10 @@ nsDocShellTreeOwner::AddChromeListeners()
mChromeDragHandler = do_CreateInstance("@mozilla.org:/content/content-area-dragdrop;1", &rv);
NS_ASSERTION(mChromeDragHandler, "Couldn't create the chrome drag handler");
if ( mChromeDragHandler ) {
nsCOMPtr<nsIDOMEventReceiver> rcvr;
GetEventReceiver(mWebBrowser, getter_AddRefs(rcvr));
nsCOMPtr<nsIDOMEventTarget> rcvrTarget(do_QueryInterface(rcvr));
mChromeDragHandler->HookupTo(rcvrTarget, NS_STATIC_CAST(nsIWebNavigation*, mWebBrowser));
nsCOMPtr<nsPIDOMEventTarget> piTarget;
GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(piTarget));
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(piTarget));
mChromeDragHandler->HookupTo(target, NS_STATIC_CAST(nsIWebNavigation*, mWebBrowser));
}
}
@ -1115,8 +1116,8 @@ ChromeTooltipListener::~ChromeTooltipListener()
NS_IMETHODIMP
ChromeTooltipListener::AddChromeListeners()
{
if ( !mEventReceiver )
GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
if (!mEventTarget)
GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget));
// Register the appropriate events for tooltips, but only if
// the embedding chrome cares.
@ -1143,11 +1144,11 @@ ChromeTooltipListener::AddChromeListeners()
NS_IMETHODIMP
ChromeTooltipListener::AddTooltipListener()
{
if (mEventReceiver) {
if (mEventTarget) {
nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
nsresult rv = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
nsresult rv2 = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
nsresult rv3 = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
nsresult rv = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
nsresult rv2 = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
nsresult rv3 = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
// if all 3 succeed, we're a go!
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2) && NS_SUCCEEDED(rv3))
@ -1171,7 +1172,7 @@ ChromeTooltipListener::RemoveChromeListeners ( )
if ( mTooltipListenerInstalled )
RemoveTooltipListener();
mEventReceiver = nsnull;
mEventTarget = nsnull;
// it really doesn't matter if these fail...
return NS_OK;
@ -1188,11 +1189,11 @@ ChromeTooltipListener::RemoveChromeListeners ( )
NS_IMETHODIMP
ChromeTooltipListener::RemoveTooltipListener()
{
if (mEventReceiver) {
if (mEventTarget) {
nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
nsresult rv = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
nsresult rv2 = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
nsresult rv3 = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
nsresult rv = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
nsresult rv2 = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
nsresult rv3 = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2) && NS_SUCCEEDED(rv3))
mTooltipListenerInstalled = PR_FALSE;
}
@ -1568,9 +1569,9 @@ ChromeContextMenuListener::~ChromeContextMenuListener()
NS_IMETHODIMP
ChromeContextMenuListener::AddContextMenuListener()
{
if (mEventReceiver) {
if (mEventTarget) {
nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
nsresult rv = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
nsresult rv = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
if (NS_SUCCEEDED(rv))
mContextMenuListenerInstalled = PR_TRUE;
}
@ -1587,9 +1588,9 @@ ChromeContextMenuListener::AddContextMenuListener()
NS_IMETHODIMP
ChromeContextMenuListener::RemoveContextMenuListener()
{
if (mEventReceiver) {
if (mEventTarget) {
nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
nsresult rv = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
nsresult rv = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
if (NS_SUCCEEDED(rv))
mContextMenuListenerInstalled = PR_FALSE;
}
@ -1607,8 +1608,8 @@ ChromeContextMenuListener::RemoveContextMenuListener()
NS_IMETHODIMP
ChromeContextMenuListener::AddChromeListeners()
{
if ( !mEventReceiver )
GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
if (!mEventTarget)
GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget));
// Register the appropriate events for context menus, but only if
// the embedding chrome cares.
@ -1635,7 +1636,7 @@ ChromeContextMenuListener::RemoveChromeListeners()
if ( mContextMenuListenerInstalled )
RemoveContextMenuListener();
mEventReceiver = nsnull;
mEventTarget = nsnull;
// it really doesn't matter if these fail...
return NS_OK;

View File

@ -52,7 +52,7 @@
#include "nsIWebBrowserChrome.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebProgressListener.h"
#include "nsWeakReference.h"
@ -66,7 +66,7 @@
#include "nsITooltipTextProvider.h"
#include "nsCTooltipTextProvider.h"
#include "nsIDragDropHandler.h"
#include "nsPIDOMEventTarget.h"
#include "nsCommandHandler.h"
class nsWebBrowser;
@ -228,7 +228,7 @@ private:
NS_IMETHOD HideTooltip ( ) ;
nsWebBrowser* mWebBrowser;
nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
nsCOMPtr<nsITooltipTextProvider> mTooltipTextProvider;
// This must be a strong ref in order to make sure we can hide the tooltip
@ -295,7 +295,7 @@ private:
PRPackedBool mContextMenuListenerInstalled;
nsWebBrowser* mWebBrowser;
nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
nsCOMPtr<nsIWebBrowserChrome> mWebBrowserChrome;
}; // class ChromeContextMenuListener

View File

@ -49,7 +49,7 @@
#include "nsIAtomService.h"
#include "nsIEventListenerManager.h"
#include "nsIScriptTimeoutHandler.h"
#include "nsIDOMEventReceiver.h"
#include "nsPIDOMEventTarget.h"
#include "nsIArray.h"
#include "jscntxt.h"
#include "nsPIDOMWindow.h"
@ -303,11 +303,11 @@ static PyObject *PyAddScriptEventListener(PyObject *self, PyObject *args)
return NULL;
// The receiver, to get the manager.
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(target));
if (!receiver) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(target));
if (!piTarget) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIEventListenerManager> manager;
receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
if (!manager) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
// avoid do_GetAtom - its not part of the XPCOM glue.
@ -374,11 +374,11 @@ static PyObject *PyRegisterScriptEventListener(PyObject *self, PyObject *args)
target = win->GetCurrentInnerWindow();
}
// The receiver, to get the manager.
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(target));
if (!receiver) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(target));
if (!piTarget) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIEventListenerManager> manager;
receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
if (!manager) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsresult rv;
@ -445,11 +445,11 @@ static PyObject *PyCompileScriptEventListener(PyObject *self, PyObject *args)
target = win->GetCurrentInnerWindow();
}
// The receiver, to get the manager.
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(target));
if (!receiver) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(target));
if (!piTarget) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIEventListenerManager> manager;
receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
if (!manager) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
nsresult rv;

View File

@ -38,7 +38,7 @@
#include "nsPyContext.h"
#include "nsICategoryManager.h"
#include "nsIScriptContext.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
extern void init_nsdom();

View File

@ -73,7 +73,8 @@
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsPIDOMEventTarget.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
@ -622,11 +623,13 @@ mozInlineSpellChecker::RegisterEventListeners()
nsresult rv = editor->GetDocument(getter_AddRefs(doc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(doc, &rv);
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(doc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
eventReceiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this), NS_GET_IID(nsIDOMMouseListener));
eventReceiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this), NS_GET_IID(nsIDOMKeyListener));
piTarget->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this),
NS_GET_IID(nsIDOMMouseListener));
piTarget->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this),
NS_GET_IID(nsIDOMKeyListener));
return NS_OK;
}
@ -645,11 +648,13 @@ mozInlineSpellChecker::UnregisterEventListeners()
editor->GetDocument(getter_AddRefs(doc));
NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(doc);
NS_ENSURE_TRUE(eventReceiver, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(doc);
NS_ENSURE_TRUE(piTarget, NS_ERROR_NULL_POINTER);
eventReceiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this), NS_GET_IID(nsIDOMMouseListener));
eventReceiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this), NS_GET_IID(nsIDOMKeyListener));
piTarget->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this),
NS_GET_IID(nsIDOMMouseListener));
piTarget->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this),
NS_GET_IID(nsIDOMKeyListener));
return NS_OK;
}

View File

@ -175,7 +175,7 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
#include "nsIDocument.h"
//focus
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMFocusListener.h"
#include "nsISelectionController.h"
@ -751,17 +751,13 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
// mFocusListener is a strong reference
mFocusListener = focusListener;
// get the DOM event receiver
nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
rv = erP->AddEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
if (mDocument) {
rv = mDocument->AddEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register focus listener");
if (mOldFocusListener) {
rv = erP->RemoveEventListenerByIID(mOldFocusListener,
NS_GET_IID(nsIDOMFocusListener));
rv = mDocument->RemoveEventListenerByIID(mOldFocusListener,
NS_GET_IID(nsIDOMFocusListener));
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to remove focus listener");
}
}
@ -1354,15 +1350,9 @@ DocumentViewerImpl::Open(nsISupports *aState, nsISHEntry *aSHEntry)
SyncParentSubDocMap();
if (mFocusListener) {
// get the DOM event receiver
nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
erP->AddEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
}
if (mFocusListener && mDocument) {
mDocument->AddEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
}
// XXX re-enable image animations once that works correctly
@ -1416,15 +1406,9 @@ DocumentViewerImpl::Close(nsISHEntry *aSHEntry)
mDocument->Destroy();
}
if (mFocusListener) {
// get the DOM event receiver
nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
erP->RemoveEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
}
if (mFocusListener && mDocument) {
mDocument->RemoveEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
}
return NS_OK;
@ -1758,13 +1742,9 @@ DocumentViewerImpl::SetDOMDocument(nsIDOMDocument *aDocument)
mPresShell->BeginObservingDocument();
// Register the focus listener on the new document
nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(mDocument, &rv);
NS_ASSERTION(erP, "No event receiver in document!");
if (erP) {
rv = erP->AddEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
if (mDocument) {
rv = mDocument->AddEventListenerByIID(mFocusListener,
NS_GET_IID(nsIDOMFocusListener));
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register focus listener");
}
}

View File

@ -39,7 +39,7 @@
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsComboboxControlFrame.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventTarget.h"
#include "nsFrameManager.h"
#include "nsFormControlFrame.h"
#include "nsGfxButtonControlFrame.h"
@ -1035,14 +1035,11 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
// make someone to listen to the button. If its pressed by someone like Accessibility
// then open or close the combo box.
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mButtonContent));
if (eventReceiver) {
mButtonListener = new nsComboButtonListener(this);
if (!mButtonListener)
return NS_ERROR_OUT_OF_MEMORY;
eventReceiver->AddEventListenerByIID(mButtonListener,
NS_GET_IID(nsIDOMMouseListener));
}
mButtonListener = new nsComboButtonListener(this);
if (!mButtonListener)
return NS_ERROR_OUT_OF_MEMORY;
mButtonContent->AddEventListenerByIID(mButtonListener,
NS_GET_IID(nsIDOMMouseListener));
mButtonContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("button"), PR_FALSE);

Some files were not shown because too many files have changed in this diff Show More