95127 - dispatchEvent() doesn't return a value, r=joki, sr=hyatt

This commit is contained in:
hewitt%netscape.com 2001-09-27 21:43:00 +00:00
Родитель 857123b3d1
Коммит b293c5b0b5
18 изменённых файлов: 50 добавлений и 35 удалений

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

@ -2400,7 +2400,8 @@ nsDocument::SetTitle(const nsAReadableString& aTitle)
CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
if (event) {
event->InitEvent(NS_LITERAL_STRING("DOMTitleChanged"), PR_TRUE, PR_TRUE);
DispatchEvent(event);
PRBool noDefault;
DispatchEvent(event, &noDefault);
}
return NS_OK;
@ -2985,7 +2986,8 @@ nsresult nsDocument::GetListenerManager(nsIEventListenerManager **aInstancePtrRe
nsresult nsDocument::HandleEvent(nsIDOMEvent *aEvent)
{
return DispatchEvent(aEvent);
PRBool noDefault;
return DispatchEvent(aEvent, &noDefault);
}
nsresult nsDocument::HandleDOMEvent(nsIPresContext* aPresContext,
@ -3108,7 +3110,7 @@ nsresult nsDocument::RemoveEventListener(const nsAReadableString& aType, nsIDOME
}
NS_IMETHODIMP
nsDocument::DispatchEvent(nsIDOMEvent* aEvent)
nsDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
{
// Obtain a presentation context
PRInt32 count = GetNumberOfShells();
@ -3124,7 +3126,7 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIEventStateManager> esm;
if (NS_SUCCEEDED(presContext->GetEventStateManager(getter_AddRefs(esm)))) {
return esm->DispatchNewEvent((nsISupports *)(nsIDOMDocument *)this, aEvent);
return esm->DispatchNewEvent((nsISupports *)(nsIDOMDocument *)this, aEvent, _retval);
}
return NS_ERROR_FAILURE;

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

@ -528,7 +528,7 @@ public:
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval);
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,

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

@ -733,13 +733,13 @@ nsDOMEventRTTearoff::RemoveEventListener(const nsAReadableString& type,
}
NS_IMETHODIMP
nsDOMEventRTTearoff::DispatchEvent(nsIDOMEvent *evt)
nsDOMEventRTTearoff::DispatchEvent(nsIDOMEvent *evt, PRBool* _retval)
{
nsCOMPtr<nsIDOMEventReceiver> event_receiver;
nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
NS_ENSURE_SUCCESS(rv, rv);
return event_receiver->DispatchEvent(evt);
return event_receiver->DispatchEvent(evt, _retval);
}

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

@ -113,7 +113,7 @@ public:
NS_IMETHOD SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor) = 0;
//Method for centralized distribution of new DOM events
NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent) = 0;
NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, PRBool* aPreventDefault) = 0;
// Method for moving the focus forward/back.
NS_IMETHOD MoveFocus(PRBool aDirection, nsIContent* aRoot)=0;

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

@ -2628,7 +2628,7 @@ nsEventListenerManager::RemoveEventListener(const nsAReadableString& aType,
}
NS_IMETHODIMP
nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent)
nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
{
//If we don't have a target set this doesn't work.
if (mTarget) {
@ -2652,7 +2652,7 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIEventStateManager> esm;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(esm)))) {
return esm->DispatchNewEvent(mTarget, aEvent);
return esm->DispatchNewEvent(mTarget, aEvent, _retval);
}
}
}
@ -2686,7 +2686,8 @@ nsEventListenerManager::GetListenerManager(nsIEventListenerManager** aInstancePt
NS_IMETHODIMP
nsEventListenerManager::HandleEvent(nsIDOMEvent *aEvent)
{
return DispatchEvent(aEvent);
PRBool noDefault;
return DispatchEvent(aEvent, &noDefault);
}
nsresult

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

@ -171,7 +171,7 @@ public:
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval);
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,

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

@ -3913,7 +3913,7 @@ void nsEventStateManager::ForceViewUpdate(nsIView* aView)
}
NS_IMETHODIMP
nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent)
nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, PRBool *aPreventDefault)
{
nsresult ret = NS_OK;
@ -3945,8 +3945,11 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent)
}
}
}
*aPreventDefault = status == nsEventStatus_eConsumeNoDefault ? PR_FALSE : PR_TRUE;
}
}
return ret;
}

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

@ -126,7 +126,7 @@ public:
NS_IMETHOD SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor);
//Method for centralized distribution of new DOM events
NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent);
NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, PRBool *aPreventDefault);
NS_IMETHOD MoveFocus(PRBool aDirection, nsIContent* aRoot);

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

@ -1686,7 +1686,8 @@ nsHTMLInputElement::FireEventForAccessibility(nsIPresContext* aPresContext,
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(listenerManager));
if ( ! eventReceiver )
return NS_ERROR_FAILURE;
eventReceiver->DispatchEvent(domEvent);
PRBool noDefault;
eventReceiver->DispatchEvent(domEvent, &noDefault);
return NS_OK;
}

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

@ -2008,7 +2008,7 @@ nsXULElement::RemoveEventListener(const nsAReadableString& aType,
}
NS_IMETHODIMP
nsXULElement::DispatchEvent(nsIDOMEvent* aEvent)
nsXULElement::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
{
// Obtain a presentation context
PRInt32 count = mDocument->GetNumberOfShells();
@ -2024,7 +2024,7 @@ nsXULElement::DispatchEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIEventStateManager> esm;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(esm)))) {
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIStyledContent*, this), aEvent);
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIStyledContent*, this), aEvent, _retval);
}
return NS_ERROR_FAILURE;
@ -2052,7 +2052,8 @@ nsXULElement::GetListenerManager(nsIEventListenerManager** aResult)
NS_IMETHODIMP
nsXULElement::HandleEvent(nsIDOMEvent *aEvent)
{
return DispatchEvent(aEvent);
PRBool noDefault;
return DispatchEvent(aEvent, &noDefault);
}
@ -4349,7 +4350,10 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModTy
// "style" attribute anyway.
aHint = NS_STYLE_HINT_FRAMECHANGE;
}
else if (NodeInfo()->Equals(nsXULAtoms::window)) {
else if (NodeInfo()->Equals(nsXULAtoms::window) ||
NodeInfo()->Equals(nsXULAtoms::page) ||
NodeInfo()->Equals(nsXULAtoms::dialog) ||
NodeInfo()->Equals(nsXULAtoms::wizard)) {
// Ignore 'width' and 'height' on a <window>
if (nsXULAtoms::width == aAttribute || nsXULAtoms::height == aAttribute)
aHint = NS_STYLE_HINT_NONE;

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

@ -461,7 +461,7 @@ public:
PRBool aUseCapture);
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool* _retval);
// nsIDOMEventReceiver
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);

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

@ -3077,7 +3077,8 @@ nsXULDocument::SetTitle(const nsAReadableString& aTitle)
CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
if (event) {
event->InitEvent(NS_LITERAL_STRING("DOMTitleChanged"), PR_TRUE, PR_TRUE);
DispatchEvent(event);
PRBool noDefault;
DispatchEvent(event, &noDefault);
}
return NS_OK;
@ -4306,7 +4307,7 @@ nsXULDocument::RemoveEventListener(const nsAReadableString& aType,
}
NS_IMETHODIMP
nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent)
nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
{
// Obtain a presentation context
PRInt32 count = GetNumberOfShells();
@ -4322,7 +4323,7 @@ nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIEventStateManager> esm;
if (NS_SUCCEEDED(presContext->GetEventStateManager(getter_AddRefs(esm)))) {
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDocument*, this), aEvent);
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDocument*, this), aEvent, _retval);
}
return NS_ERROR_FAILURE;
@ -4376,7 +4377,8 @@ nsXULDocument::GetListenerManager(nsIEventListenerManager** aResult)
NS_IMETHODIMP
nsXULDocument::HandleEvent(nsIDOMEvent *aEvent)
{
return DispatchEvent(aEvent);
PRBool noDefault;
return DispatchEvent(aEvent, &noDefault);
}
nsresult

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

@ -375,7 +375,7 @@ public:
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval);
// nsIDOMDocument interface
NS_DECL_NSIDOMDOCUMENT

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

@ -50,5 +50,5 @@ interface nsIDOMEventTarget : nsISupports
void removeEventListener(in DOMString type,
in nsIDOMEventListener listener,
in boolean useCapture);
void dispatchEvent(in nsIDOMEvent evt);
boolean dispatchEvent(in nsIDOMEvent evt);
};

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

@ -2683,7 +2683,7 @@ GlobalWindowImpl::RemoveEventListener(const nsAReadableString& aType,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP GlobalWindowImpl::DispatchEvent(nsIDOMEvent* aEvent)
NS_IMETHODIMP GlobalWindowImpl::DispatchEvent(nsIDOMEvent* aEvent, PRBool* _retval)
{
if (mDocument) {
nsCOMPtr<nsIDocument> idoc(do_QueryInterface(mDocument));
@ -2703,7 +2703,7 @@ NS_IMETHODIMP GlobalWindowImpl::DispatchEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIEventStateManager> esm;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(esm)))) {
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIScriptGlobalObject *,
this), aEvent);
this), aEvent, _retval);
}
}
}
@ -2763,7 +2763,8 @@ GlobalWindowImpl::GetNewListenerManager(nsIEventListenerManager **aResult)
NS_IMETHODIMP GlobalWindowImpl::HandleEvent(nsIDOMEvent *aEvent)
{
return DispatchEvent(aEvent);
PRBool noDefault;
return DispatchEvent(aEvent, &noDefault);
}
//*****************************************************************************

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

@ -156,7 +156,7 @@ public:
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval);
// nsIDOMEventReceiver
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,

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

@ -84,7 +84,7 @@ nsWindowRoot::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventLis
}
NS_IMETHODIMP
nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt)
nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt, PRBool *_retval)
{
// Obtain a presentation context
nsCOMPtr<nsIDOMDocument> domDoc;
@ -106,7 +106,7 @@ nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt)
nsCOMPtr<nsIEventStateManager> esm;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(esm)))) {
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDOMEventReceiver*,this), aEvt);
return esm->DispatchNewEvent(NS_STATIC_CAST(nsIDOMEventReceiver*,this), aEvt, _retval);
}
return NS_ERROR_FAILURE;
@ -153,7 +153,8 @@ nsWindowRoot::GetListenerManager(nsIEventListenerManager** aResult)
NS_IMETHODIMP
nsWindowRoot::HandleEvent(nsIDOMEvent *aEvent)
{
return DispatchEvent(aEvent);
PRBool noDefault;
return DispatchEvent(aEvent, &noDefault);
}
NS_IMETHODIMP nsWindowRoot::HandleChromeEvent(nsIPresContext* aPresContext,

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

@ -227,9 +227,9 @@ nsXMLHttpRequest::RemoveEventListener(const nsAReadableString & type,
return NS_OK;
}
/* void dispatchEvent (in nsIDOMEvent evt); */
/* boolean dispatchEvent (in nsIDOMEvent evt); */
NS_IMETHODIMP
nsXMLHttpRequest::DispatchEvent(nsIDOMEvent *evt)
nsXMLHttpRequest::DispatchEvent(nsIDOMEvent *evt, PRBool *_retval)
{
// Ignored