diff --git a/mozilla/content/events/public/nsIPrivateDOMEvent.h b/mozilla/content/events/public/nsIPrivateDOMEvent.h index 06e04629333..9041501d2a8 100644 --- a/mozilla/content/events/public/nsIPrivateDOMEvent.h +++ b/mozilla/content/events/public/nsIPrivateDOMEvent.h @@ -32,10 +32,15 @@ class nsIPresContext; 0x80a98c80, 0x2036, 0x11d2, \ {0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } +class nsIDOMNode; + class nsIPrivateDOMEvent : public nsISupports { public: + static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATEDOMEVENT_IID; return iid; } + NS_IMETHOD DuplicatePrivateData() = 0; + NS_IMETHOD SetTarget(nsIDOMNode* aNode) = 0; }; extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext& aPresContext, nsEvent *aEvent); diff --git a/mozilla/content/events/src/nsDOMEvent.cpp b/mozilla/content/events/src/nsDOMEvent.cpp index 494b96adacf..46604844c81 100644 --- a/mozilla/content/events/src/nsDOMEvent.cpp +++ b/mozilla/content/events/src/nsDOMEvent.cpp @@ -346,6 +346,16 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData() return NS_OK; } +NS_METHOD nsDOMEvent::SetTarget(nsIDOMNode* aTarget) +{ + if (mTarget != aTarget) { + NS_IF_RELEASE(mTarget); + NS_IF_ADDREF(aTarget); + mTarget = aTarget; + } + return NS_OK; +} + const char* nsDOMEvent::GetEventName(PRUint32 aEventType) { switch(aEventType) { diff --git a/mozilla/content/events/src/nsDOMEvent.h b/mozilla/content/events/src/nsDOMEvent.h index f26e8327c79..cecf51d4251 100644 --- a/mozilla/content/events/src/nsDOMEvent.h +++ b/mozilla/content/events/src/nsDOMEvent.h @@ -121,6 +121,7 @@ public: // nsIPrivateDOMEvent interface NS_IMETHOD DuplicatePrivateData(); + NS_IMETHOD SetTarget(nsIDOMNode* aNode); protected: diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 86f996ec83d..cb6de17b5a0 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -2238,7 +2238,12 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext, NS_ERROR("Menu/key event will fail without the ability to create the event early."); return ret; } - //domEvent->SetTarget(this); + + nsCOMPtr privateEvent = do_QueryInterface(domEvent); + if (privateEvent) { + privateEvent->SetTarget(this); + } + else return NS_ERROR_FAILURE; } } diff --git a/mozilla/layout/events/public/nsIPrivateDOMEvent.h b/mozilla/layout/events/public/nsIPrivateDOMEvent.h index 06e04629333..9041501d2a8 100644 --- a/mozilla/layout/events/public/nsIPrivateDOMEvent.h +++ b/mozilla/layout/events/public/nsIPrivateDOMEvent.h @@ -32,10 +32,15 @@ class nsIPresContext; 0x80a98c80, 0x2036, 0x11d2, \ {0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } +class nsIDOMNode; + class nsIPrivateDOMEvent : public nsISupports { public: + static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATEDOMEVENT_IID; return iid; } + NS_IMETHOD DuplicatePrivateData() = 0; + NS_IMETHOD SetTarget(nsIDOMNode* aNode) = 0; }; extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext& aPresContext, nsEvent *aEvent); diff --git a/mozilla/layout/events/src/nsDOMEvent.cpp b/mozilla/layout/events/src/nsDOMEvent.cpp index 494b96adacf..46604844c81 100644 --- a/mozilla/layout/events/src/nsDOMEvent.cpp +++ b/mozilla/layout/events/src/nsDOMEvent.cpp @@ -346,6 +346,16 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData() return NS_OK; } +NS_METHOD nsDOMEvent::SetTarget(nsIDOMNode* aTarget) +{ + if (mTarget != aTarget) { + NS_IF_RELEASE(mTarget); + NS_IF_ADDREF(aTarget); + mTarget = aTarget; + } + return NS_OK; +} + const char* nsDOMEvent::GetEventName(PRUint32 aEventType) { switch(aEventType) { diff --git a/mozilla/layout/events/src/nsDOMEvent.h b/mozilla/layout/events/src/nsDOMEvent.h index f26e8327c79..cecf51d4251 100644 --- a/mozilla/layout/events/src/nsDOMEvent.h +++ b/mozilla/layout/events/src/nsDOMEvent.h @@ -121,6 +121,7 @@ public: // nsIPrivateDOMEvent interface NS_IMETHOD DuplicatePrivateData(); + NS_IMETHOD SetTarget(nsIDOMNode* aNode); protected: diff --git a/mozilla/rdf/content/src/nsRDFElement.cpp b/mozilla/rdf/content/src/nsRDFElement.cpp index 86f996ec83d..cb6de17b5a0 100644 --- a/mozilla/rdf/content/src/nsRDFElement.cpp +++ b/mozilla/rdf/content/src/nsRDFElement.cpp @@ -2238,7 +2238,12 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext, NS_ERROR("Menu/key event will fail without the ability to create the event early."); return ret; } - //domEvent->SetTarget(this); + + nsCOMPtr privateEvent = do_QueryInterface(domEvent); + if (privateEvent) { + privateEvent->SetTarget(this); + } + else return NS_ERROR_FAILURE; } } diff --git a/mozilla/rdf/content/src/nsXULElement.cpp b/mozilla/rdf/content/src/nsXULElement.cpp index 86f996ec83d..cb6de17b5a0 100644 --- a/mozilla/rdf/content/src/nsXULElement.cpp +++ b/mozilla/rdf/content/src/nsXULElement.cpp @@ -2238,7 +2238,12 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext, NS_ERROR("Menu/key event will fail without the ability to create the event early."); return ret; } - //domEvent->SetTarget(this); + + nsCOMPtr privateEvent = do_QueryInterface(domEvent); + if (privateEvent) { + privateEvent->SetTarget(this); + } + else return NS_ERROR_FAILURE; } }