check if events have been handled already before dispatching them; r=saari; bug #45390

This commit is contained in:
brade%netscape.com 2000-07-20 14:32:30 +00:00
Родитель 663ab84636
Коммит 08e968606d
2 изменённых файлов: 20 добавлений и 0 удалений

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

@ -44,6 +44,7 @@
#include "nsIEventListenerManager.h" #include "nsIEventListenerManager.h"
#include "nsIDOMEventReceiver.h" #include "nsIDOMEventReceiver.h"
#include "nsXBLBinding.h" #include "nsXBLBinding.h"
#include "nsIPrivateDOMEvent.h"
PRUint32 nsXBLEventHandler::gRefCnt = 0; PRUint32 nsXBLEventHandler::gRefCnt = 0;
nsIAtom* nsXBLEventHandler::kKeyCodeAtom = nsnull; nsIAtom* nsXBLEventHandler::kKeyCodeAtom = nsnull;
@ -555,6 +556,15 @@ nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEven
// Stop any other default action from executing. // Stop any other default action from executing.
aEvent->PreventDefault(); aEvent->PreventDefault();
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aEvent);
if(privateEvent)
{
PRBool dispatchStopped;
privateEvent->IsDispatchStopped(&dispatchStopped);
if(dispatchStopped)
return NS_OK;
}
// Instead of executing JS, let's get the controller for the bound // Instead of executing JS, let's get the controller for the bound
// element and call doCommand on it. // element and call doCommand on it.
nsCOMPtr<nsIController> controller; nsCOMPtr<nsIController> controller;

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

@ -44,6 +44,7 @@
#include "nsIEventListenerManager.h" #include "nsIEventListenerManager.h"
#include "nsIDOMEventReceiver.h" #include "nsIDOMEventReceiver.h"
#include "nsXBLBinding.h" #include "nsXBLBinding.h"
#include "nsIPrivateDOMEvent.h"
PRUint32 nsXBLEventHandler::gRefCnt = 0; PRUint32 nsXBLEventHandler::gRefCnt = 0;
nsIAtom* nsXBLEventHandler::kKeyCodeAtom = nsnull; nsIAtom* nsXBLEventHandler::kKeyCodeAtom = nsnull;
@ -555,6 +556,15 @@ nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEven
// Stop any other default action from executing. // Stop any other default action from executing.
aEvent->PreventDefault(); aEvent->PreventDefault();
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aEvent);
if(privateEvent)
{
PRBool dispatchStopped;
privateEvent->IsDispatchStopped(&dispatchStopped);
if(dispatchStopped)
return NS_OK;
}
// Instead of executing JS, let's get the controller for the bound // Instead of executing JS, let's get the controller for the bound
// element and call doCommand on it. // element and call doCommand on it.
nsCOMPtr<nsIController> controller; nsCOMPtr<nsIController> controller;