Partially fix bug 28323 by changing the text field editor keypress listener to not add characters into the text field if the user has cancelled the event. r:jst

This commit is contained in:
joki%netscape.com 2000-09-15 06:09:26 +00:00
Родитель 0067f48168
Коммит dc08d4dbd9
2 изменённых файлов: 12 добавлений и 12 удалений

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

@ -42,7 +42,7 @@
#include "nsIPrivateCompositionEvent.h"
#include "nsIEditorMailSupport.h"
#include "nsIDocumentEncoder.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIPref.h"
#include "nsILookAndFeel.h"
#include "nsIPresContext.h"
@ -158,12 +158,12 @@ nsTextEditorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aKeyEvent);
if(privateEvent)
nsCOMPtr<nsIDOMNSUIEvent> nsUIEvent = do_QueryInterface(aKeyEvent);
if(nsUIEvent)
{
PRBool dispatchStopped;
privateEvent->IsDispatchStopped(&dispatchStopped);
if(dispatchStopped)
PRBool defaultPrevented;
nsUIEvent->GetPreventDefault(&defaultPrevented);
if(defaultPrevented)
return NS_OK;
}

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

@ -42,7 +42,7 @@
#include "nsIPrivateCompositionEvent.h"
#include "nsIEditorMailSupport.h"
#include "nsIDocumentEncoder.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIPref.h"
#include "nsILookAndFeel.h"
#include "nsIPresContext.h"
@ -158,12 +158,12 @@ nsTextEditorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aKeyEvent);
if(privateEvent)
nsCOMPtr<nsIDOMNSUIEvent> nsUIEvent = do_QueryInterface(aKeyEvent);
if(nsUIEvent)
{
PRBool dispatchStopped;
privateEvent->IsDispatchStopped(&dispatchStopped);
if(dispatchStopped)
PRBool defaultPrevented;
nsUIEvent->GetPreventDefault(&defaultPrevented);
if(defaultPrevented)
return NS_OK;
}