Fix for the regression described in bug 6823.

This commit is contained in:
hyatt%netscape.com 1999-05-21 19:27:02 +00:00
Родитель a425d2dc74
Коммит 8fb2c9835b
9 изменённых файлов: 50 добавлений и 3 удалений

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

@ -32,10 +32,15 @@ class nsIPresContext;
0x80a98c80, 0x2036, 0x11d2, \ 0x80a98c80, 0x2036, 0x11d2, \
{0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } {0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
class nsIDOMNode;
class nsIPrivateDOMEvent : public nsISupports { class nsIPrivateDOMEvent : public nsISupports {
public: public:
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATEDOMEVENT_IID; return iid; }
NS_IMETHOD DuplicatePrivateData() = 0; NS_IMETHOD DuplicatePrivateData() = 0;
NS_IMETHOD SetTarget(nsIDOMNode* aNode) = 0;
}; };
extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext& aPresContext, nsEvent *aEvent); extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext& aPresContext, nsEvent *aEvent);

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

@ -346,6 +346,16 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
return NS_OK; 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) const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
{ {
switch(aEventType) { switch(aEventType) {

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

@ -121,6 +121,7 @@ public:
// nsIPrivateDOMEvent interface // nsIPrivateDOMEvent interface
NS_IMETHOD DuplicatePrivateData(); NS_IMETHOD DuplicatePrivateData();
NS_IMETHOD SetTarget(nsIDOMNode* aNode);
protected: protected:

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

@ -2238,7 +2238,12 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext,
NS_ERROR("Menu/key event will fail without the ability to create the event early."); NS_ERROR("Menu/key event will fail without the ability to create the event early.");
return ret; return ret;
} }
//domEvent->SetTarget(this);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(domEvent);
if (privateEvent) {
privateEvent->SetTarget(this);
}
else return NS_ERROR_FAILURE;
} }
} }

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

@ -32,10 +32,15 @@ class nsIPresContext;
0x80a98c80, 0x2036, 0x11d2, \ 0x80a98c80, 0x2036, 0x11d2, \
{0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } {0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
class nsIDOMNode;
class nsIPrivateDOMEvent : public nsISupports { class nsIPrivateDOMEvent : public nsISupports {
public: public:
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATEDOMEVENT_IID; return iid; }
NS_IMETHOD DuplicatePrivateData() = 0; NS_IMETHOD DuplicatePrivateData() = 0;
NS_IMETHOD SetTarget(nsIDOMNode* aNode) = 0;
}; };
extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext& aPresContext, nsEvent *aEvent); extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext& aPresContext, nsEvent *aEvent);

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

@ -346,6 +346,16 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
return NS_OK; 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) const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
{ {
switch(aEventType) { switch(aEventType) {

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

@ -121,6 +121,7 @@ public:
// nsIPrivateDOMEvent interface // nsIPrivateDOMEvent interface
NS_IMETHOD DuplicatePrivateData(); NS_IMETHOD DuplicatePrivateData();
NS_IMETHOD SetTarget(nsIDOMNode* aNode);
protected: protected:

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

@ -2238,7 +2238,12 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext,
NS_ERROR("Menu/key event will fail without the ability to create the event early."); NS_ERROR("Menu/key event will fail without the ability to create the event early.");
return ret; return ret;
} }
//domEvent->SetTarget(this);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(domEvent);
if (privateEvent) {
privateEvent->SetTarget(this);
}
else return NS_ERROR_FAILURE;
} }
} }

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

@ -2238,7 +2238,12 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext,
NS_ERROR("Menu/key event will fail without the ability to create the event early."); NS_ERROR("Menu/key event will fail without the ability to create the event early.");
return ret; return ret;
} }
//domEvent->SetTarget(this);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(domEvent);
if (privateEvent) {
privateEvent->SetTarget(this);
}
else return NS_ERROR_FAILURE;
} }
} }