making keybinding conform to the spec, and switching to event capturing instead of bubbling

This commit is contained in:
saari%netscape.com 1999-07-07 02:28:21 +00:00
parent a01ef8fd3c
commit 0ff93b5771
2 changed files with 18 additions and 19 deletions

View File

@ -2700,9 +2700,9 @@ RDFXULBuilderImpl::CreateXULElement(nsINameSpace* aContainingNameSpace,
nsIDOMEventTarget* target;
document->QueryInterface(kIDOMEventReceiverIID, (void**) &target);
if(target) {
target->AddEventListener("keypress", domEventListener, PR_FALSE, PR_FALSE);
target->AddEventListener("keydown", domEventListener, PR_FALSE, PR_FALSE);
target->AddEventListener("keyup", domEventListener, PR_FALSE, PR_FALSE);
target->AddEventListener("keypress", domEventListener, PR_FALSE, PR_TRUE);
target->AddEventListener("keydown", domEventListener, PR_FALSE, PR_TRUE);
target->AddEventListener("keyup", domEventListener, PR_FALSE, PR_TRUE);
}
NS_RELEASE(target);
}

View File

@ -17,23 +17,22 @@
*/
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nsIXULKeyListener.h"
#include "nsIDOMFocusListener.h"
#include "nsIDOMKeyListener.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMFocusListener.h"
#include "nsRDFCID.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMWindow.h"
#include "nsIScriptContextOwner.h"
#include "nsIDOMXULDocument.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsIDOMUIEvent.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIDOMWindow.h"
#include "nsIDOMXULDocument.h"
#include "nsINSEvent.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIScriptContextOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIXULKeyListener.h"
#include "nsRDFCID.h"
////////////////////////////////////////////////////////////////////////
@ -268,10 +267,10 @@ nsresult nsXULKeyListenerImpl::KeyPress(nsIDOMEvent* aKeyEvent)
keyName.ToUpperCase();
tempChar2.ToUpperCase();
if (tempChar2 == keyName) {
keyElement->GetAttribute(nsAutoString("modifiercommand"), modCommand);
keyElement->GetAttribute(nsAutoString("modifiercontrol"), modControl);
keyElement->GetAttribute(nsAutoString("modifiershift"), modShift);
keyElement->GetAttribute(nsAutoString("modifieralt"), modAlt);
keyElement->GetAttribute(nsAutoString("command"), modCommand);
keyElement->GetAttribute(nsAutoString("control"), modControl);
keyElement->GetAttribute(nsAutoString("shift"), modShift);
keyElement->GetAttribute(nsAutoString("alt"), modAlt);
keyElement->GetAttribute(nsAutoString("onkeypress"), cmdToExecute);
//printf("onkeypress [%s] \n", cmdToExecute.ToNewCString()); // this leaks
do {