Bug 330494, Remove NS_EVENT_FLAG_INIT. Makes NN4 event handling and preventBubble and preventCapture methods no-op. r=sicking, sr=jst

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-04-10 17:04:54 +00:00
Родитель 6d1550b350
Коммит 107fe84cd5
14 изменённых файлов: 126 добавлений и 263 удалений

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

@ -53,8 +53,8 @@ struct JSObject;
* Event listener manager interface.
*/
#define NS_IEVENTLISTENERMANAGER_IID \
{ 0xdbd8fcee, 0xb93e, 0x42f3, \
{ 0x9d, 0xe5, 0xf9, 0x90, 0xfc, 0x66, 0xb7, 0x5a } }
{ 0x68588aa5, 0x41e6, 0x4642, \
{ 0xac, 0x8e, 0x7d, 0x43, 0x9c, 0x7d, 0x2a, 0xaa } }
class nsIEventListenerManager : public nsISupports {
@ -153,18 +153,6 @@ public:
const nsAString& aEventType,
nsIDOMEvent** aDOMEvent) = 0;
/**
* Changes script listener of specified event types from bubbling
* listeners to capturing listeners.
* @param event types */
NS_IMETHOD CaptureEvent(PRInt32 aEventTypes) = 0;
/**
* Changes script listener of specified event types from capturing
* listeners to bubbling listeners.
* @param event types */
NS_IMETHOD ReleaseEvent(PRInt32 aEventTypes) = 0;
/**
* Tells the event listener manager that its target (which owns it) is
* no longer using it (and could go away).

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

@ -54,6 +54,7 @@
#include "nsContentUtils.h"
#include "nsIURI.h"
#include "nsIScriptSecurityManager.h"
#include "nsIScriptError.h"
static const char* const sEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
@ -258,9 +259,9 @@ NS_IMETHODIMP
nsDOMEvent::SetTrusted(PRBool aTrusted)
{
if (aTrusted) {
mEvent->internalAppFlags |= NS_APP_EVENT_FLAG_TRUSTED;
mEvent->flags |= NS_EVENT_FLAG_TRUSTED;
} else {
mEvent->internalAppFlags &= ~NS_APP_EVENT_FLAG_TRUSTED;
mEvent->flags &= ~NS_EVENT_FLAG_TRUSTED;
}
return NS_OK;
@ -315,21 +316,44 @@ nsDOMEvent::StopPropagation()
return NS_OK;
}
static void
ReportUseOfDeprecatedMethod(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
const char* aWarning)
{
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsINode> node = do_QueryInterface(aEvent->currentTarget);
if (node) {
doc = node->GetOwnerDoc();
} else {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aEvent->currentTarget);
if (window) {
doc = do_QueryInterface(window->GetExtantDocument());
}
}
nsAutoString type;
aDOMEvent->GetType(type);
const PRUnichar *strings[] = { type.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
strings, NS_ARRAY_LENGTH(strings),
doc ? doc->GetDocumentURI() : nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events");
}
NS_IMETHODIMP
nsDOMEvent::PreventBubble()
{
if (mEvent->flags & NS_EVENT_FLAG_BUBBLE || mEvent->flags & NS_EVENT_FLAG_INIT) {
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
}
ReportUseOfDeprecatedMethod(mEvent, this, "UseOfPreventBubbleWarning");
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::PreventCapture()
{
if (mEvent->flags & NS_EVENT_FLAG_CAPTURE) {
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
}
ReportUseOfDeprecatedMethod(mEvent, this, "UseOfPreventCaptureWarning");
return NS_OK;
}

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

@ -358,25 +358,18 @@ NS_IMETHODIMP
nsDOMUIEvent::GetCancelBubble(PRBool* aCancelBubble)
{
NS_ENSURE_ARG_POINTER(aCancelBubble);
if (mEvent->flags & NS_EVENT_FLAG_BUBBLE || mEvent->flags & NS_EVENT_FLAG_INIT) {
*aCancelBubble = (mEvent->flags &= NS_EVENT_FLAG_STOP_DISPATCH) ? PR_TRUE : PR_FALSE;
}
else {
*aCancelBubble = PR_FALSE;
}
*aCancelBubble =
(mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) ? PR_TRUE : PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsDOMUIEvent::SetCancelBubble(PRBool aCancelBubble)
{
if (mEvent->flags & NS_EVENT_FLAG_BUBBLE || mEvent->flags & NS_EVENT_FLAG_INIT) {
if (aCancelBubble) {
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
}
else {
mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
}
if (aCancelBubble) {
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
} else {
mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
}
return NS_OK;
}

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

@ -457,8 +457,8 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
}
// Bubble
aVisitor.mEvent->flags &= ~NS_EVENT_FLAG_CAPTURE;
if (!(aVisitor.mEvent->flags & NS_EVENT_FLAG_CANT_BUBBLE)) {
aVisitor.mEvent->flags &= ~NS_EVENT_FLAG_CAPTURE;
item = item->mParent;
while (item) {
nsISupports* newTarget = item->GetNewTarget();

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

@ -750,7 +750,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
ls->mListener.Set(aListener, participant);
ls->mFlags = aFlags;
ls->mSubType = aSubType;
ls->mSubTypeCapture = NS_EVENT_BITS_NONE;
ls->mHandlerIsString = 0;
ls->mGroupFlags = group;
listeners->AppendElement((void*)ls);
@ -1610,35 +1609,20 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
// If this is a script handler and we haven't yet
// compiled the event handler itself
if (aListenerStruct->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) {
// If we're not in the capture phase we must *NOT* have capture flags
// set. Compiled script handlers are one or the other, not both.
if (aPhaseFlags & NS_EVENT_FLAG_BUBBLE && !aPhaseFlags & NS_EVENT_FLAG_INIT) {
if (aListenerStruct->mSubTypeCapture & aSubType) {
return result;
}
}
// If we're in the capture phase we must have capture flags set.
else if (aPhaseFlags & NS_EVENT_FLAG_CAPTURE && !aPhaseFlags & NS_EVENT_FLAG_INIT) {
if (!(aListenerStruct->mSubTypeCapture & aSubType)) {
return result;
}
}
if (aListenerStruct->mHandlerIsString & aSubType) {
if ((aListenerStruct->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) &&
(aListenerStruct->mHandlerIsString & aSubType)) {
nsCOMPtr<nsIJSEventListener> jslistener = do_QueryInterface(aListener);
if (jslistener) {
nsAutoString eventString;
if (NS_SUCCEEDED(aDOMEvent->GetType(eventString))) {
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + eventString);
nsCOMPtr<nsIJSEventListener> jslistener = do_QueryInterface(aListener);
if (jslistener) {
nsAutoString eventString;
if (NS_SUCCEEDED(aDOMEvent->GetType(eventString))) {
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + eventString);
result = CompileEventHandlerInternal(jslistener->GetEventContext(),
jslistener->GetEventScope(),
jslistener->GetEventTarget(),
atom, aListenerStruct,
aCurrentTarget,
aSubType);
}
result = CompileEventHandlerInternal(jslistener->GetEventContext(),
jslistener->GetEventScope(),
jslistener->GetEventTarget(),
atom, aListenerStruct,
aCurrentTarget,
aSubType);
}
}
}
@ -1674,9 +1658,6 @@ nsEventListenerManager::HandleEvent(nsPresContext* aPresContext,
return ret;
}
if (aFlags & NS_EVENT_FLAG_INIT) {
aFlags |= (NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE);
}
//Set the value of the internal PreventDefault flag properly based on aEventStatus
if (*aEventStatus == nsEventStatus_eConsumeNoDefault) {
aEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT;
@ -1782,151 +1763,6 @@ nsEventListenerManager::CreateEvent(nsPresContext* aPresContext,
aEventType, aDOMEvent);
}
/**
* Captures all events designated for descendant objects at the current level.
* @param an event listener
*/
NS_IMETHODIMP
nsEventListenerManager::CaptureEvent(PRInt32 aEventTypes)
{
return FlipCaptureBit(aEventTypes, PR_TRUE);
}
/**
* Releases all events designated for descendant objects at the current level.
* @param an event listener
*/
NS_IMETHODIMP
nsEventListenerManager::ReleaseEvent(PRInt32 aEventTypes)
{
return FlipCaptureBit(aEventTypes, PR_FALSE);
}
nsresult
nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes,
PRBool aInitCapture)
{
// This method exists for Netscape 4.x event handling compatibility.
// New events do not need to be added here.
EventArrayType arrayType = eEventArrayType_None;
PRUint8 bits = 0;
if (aEventTypes & nsIDOMNSEvent::MOUSEDOWN) {
arrayType = eEventArrayType_Mouse;
bits = NS_EVENT_BITS_MOUSE_MOUSEDOWN;
}
if (aEventTypes & nsIDOMNSEvent::MOUSEUP) {
arrayType = eEventArrayType_Mouse;
bits = NS_EVENT_BITS_MOUSE_MOUSEUP;
}
if (aEventTypes & nsIDOMNSEvent::MOUSEOVER) {
arrayType = eEventArrayType_Mouse;
bits = NS_EVENT_BITS_MOUSE_MOUSEOVER;
}
if (aEventTypes & nsIDOMNSEvent::MOUSEOUT) {
arrayType = eEventArrayType_Mouse;
bits = NS_EVENT_BITS_MOUSE_MOUSEOUT;
}
if (aEventTypes & nsIDOMNSEvent::MOUSEMOVE) {
arrayType = eEventArrayType_MouseMotion;
bits = NS_EVENT_BITS_MOUSEMOTION_MOUSEMOVE;
}
if (aEventTypes & nsIDOMNSEvent::CLICK) {
arrayType = eEventArrayType_Mouse;
bits = NS_EVENT_BITS_MOUSE_CLICK;
}
if (aEventTypes & nsIDOMNSEvent::DBLCLICK) {
arrayType = eEventArrayType_Mouse;
bits = NS_EVENT_BITS_MOUSE_DBLCLICK;
}
if (aEventTypes & nsIDOMNSEvent::KEYDOWN) {
arrayType = eEventArrayType_Key;
bits = NS_EVENT_BITS_KEY_KEYDOWN;
}
if (aEventTypes & nsIDOMNSEvent::KEYUP) {
arrayType = eEventArrayType_Key;
bits = NS_EVENT_BITS_KEY_KEYUP;
}
if (aEventTypes & nsIDOMNSEvent::KEYPRESS) {
arrayType = eEventArrayType_Key;
bits = NS_EVENT_BITS_KEY_KEYPRESS;
}
if (aEventTypes & nsIDOMNSEvent::DRAGDROP) {
arrayType = eEventArrayType_Drag;
bits = NS_EVENT_BITS_DRAG_ENTER;
}
/*if (aEventTypes & nsIDOMNSEvent::MOUSEDRAG) {
arrayType = kIDOMMouseListenerarrayType;
bits = NS_EVENT_BITS_MOUSE_MOUSEDOWN;
}*/
if (aEventTypes & nsIDOMNSEvent::FOCUS) {
arrayType = eEventArrayType_Focus;
bits = NS_EVENT_BITS_FOCUS_FOCUS;
}
if (aEventTypes & nsIDOMNSEvent::BLUR) {
arrayType = eEventArrayType_Focus;
bits = NS_EVENT_BITS_FOCUS_BLUR;
}
if (aEventTypes & nsIDOMNSEvent::SELECT) {
arrayType = eEventArrayType_Form;
bits = NS_EVENT_BITS_FORM_SELECT;
}
if (aEventTypes & nsIDOMNSEvent::CHANGE) {
arrayType = eEventArrayType_Form;
bits = NS_EVENT_BITS_FORM_CHANGE;
}
if (aEventTypes & nsIDOMNSEvent::RESET) {
arrayType = eEventArrayType_Form;
bits = NS_EVENT_BITS_FORM_RESET;
}
if (aEventTypes & nsIDOMNSEvent::SUBMIT) {
arrayType = eEventArrayType_Form;
bits = NS_EVENT_BITS_FORM_SUBMIT;
}
if (aEventTypes & nsIDOMNSEvent::LOAD) {
arrayType = eEventArrayType_Load;
bits = NS_EVENT_BITS_LOAD_LOAD;
}
if (aEventTypes & nsIDOMNSEvent::UNLOAD) {
arrayType = eEventArrayType_Load;
bits = NS_EVENT_BITS_LOAD_UNLOAD;
}
if (aEventTypes & nsIDOMNSEvent::ABORT) {
arrayType = eEventArrayType_Load;
bits = NS_EVENT_BITS_LOAD_ABORT;
}
if (aEventTypes & nsIDOMNSEvent::ERROR) {
arrayType = eEventArrayType_Load;
bits = NS_EVENT_BITS_LOAD_ERROR;
}
if (aEventTypes & nsIDOMNSEvent::RESIZE) {
arrayType = eEventArrayType_Paint;
bits = NS_EVENT_BITS_PAINT_RESIZE;
}
if (aEventTypes & nsIDOMNSEvent::SCROLL) {
arrayType = eEventArrayType_Scroll;
bits = NS_EVENT_BITS_PAINT_RESIZE;
}
if (arrayType != eEventArrayType_None) {
nsListenerStruct *ls = FindJSEventListener(arrayType);
if (ls) {
if (aInitCapture)
ls->mSubTypeCapture |= bits;
else
ls->mSubTypeCapture &= ~bits;
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsEventListenerManager::Disconnect()
{

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

@ -66,7 +66,6 @@ typedef struct {
PRUint16 mGroupFlags;
PRUint8 mSubType;
PRUint8 mHandlerIsString;
PRUint8 mSubTypeCapture;
} nsListenerStruct;
//These define the internal type of the EventListenerManager
@ -154,9 +153,6 @@ public:
nsISupports *aObject,
nsIAtom* aName, PRBool *aDidCompile);
NS_IMETHOD CaptureEvent(PRInt32 aEventTypes);
NS_IMETHOD ReleaseEvent(PRInt32 aEventTypes);
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
@ -239,7 +235,6 @@ protected:
nsIDOMEventGroup* aEvtGrp);
void ReleaseListeners(nsVoidArray** aListeners);
nsresult RemoveAllListeners();
nsresult FlipCaptureBit(PRInt32 aEventTypes, PRBool aInitCapture);
nsVoidArray* GetListenersByType(EventArrayType aType, nsHashKey* aKey, PRBool aCreate);
EventArrayType GetTypeForIID(const nsIID& aIID);
nsresult FixContextMenuEvent(nsPresContext* aPresContext,

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

@ -122,6 +122,7 @@
#include "nsIDocumentViewer.h"
#include "nsIWyciwygChannel.h"
#include "nsIScriptElement.h"
#include "nsIScriptError.h"
#include "nsArray.h"
#include "nsIPrompt.h"
@ -2933,28 +2934,37 @@ nsHTMLDocument::GetSelection(nsAString& aReturn)
return rv;
}
static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
NS_STATIC_CAST(nsIDocument*, aDoc)->
GetDocumentURI(),
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"HTML Document");
}
NS_IMETHODIMP
nsHTMLDocument::CaptureEvents(PRInt32 aEventFlags)
{
nsCOMPtr<nsIEventListenerManager> manager;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(manager));
NS_ENSURE_SUCCESS(rv, rv);
return manager->CaptureEvent(aEventFlags);
ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::ReleaseEvents(PRInt32 aEventFlags)
{
nsCOMPtr<nsIEventListenerManager> manager;
nsresult rv = GetListenerManager(PR_FALSE, getter_AddRefs(manager));
NS_ENSURE_SUCCESS(rv, rv);
return manager ? manager->ReleaseEvent(aEventFlags) : NS_OK;
ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
{
//XXX Not the best solution -joki
ReportUseOfDeprecatedMethod(this, "UseOfRouteEventWarning");
return NS_OK;
}

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

@ -9,3 +9,8 @@ OnBeforeUnloadPreMessage=Are you sure you want to navigate away from this page?
OnBeforeUnloadPostMessage=Press OK to continue, or Cancel to stay on the current page.
DocumentAllUsed=Non-standard document.all property was used. Use W3C standard document.getElementById() instead.
GlobalScopeElementReference=Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
UseOfCaptureEventsWarning=Use of captureEvents() is deprecated, see bug 330494.
UseOfReleaseEventsWarning=Use of releaseEvents() is deprecated, see bug 330494.
UseOfRouteEventWarning=Use of routeEvent() is deprecated, see bug 330494.
UseOfPreventBubbleWarning=Event=%S, use of preventBubble() is deprecated. Use W3C standard stopPropagation() instead.
UseOfPreventCaptureWarning=Event=%S, use of preventCapture() is deprecated. Use W3C standard stopPropagation() instead.

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

@ -60,11 +60,16 @@ interface nsIDOMJSWindow : nsISupports
void clearTimeout();
void clearInterval();
// This method is here for backwards compatibility with 4.x only,
// it's implementation is a no-op
/**
* This method is here for backwards compatibility with 4.x only,
* its implementation is a no-op
*/
void setResizable(in boolean resizable);
// These are 4.x event related methods.
/**
* @deprecated These are old Netscape 4 methods. Do not use,
* the implementation is no-op.
*/
void captureEvents(in long eventFlags);
void releaseEvents(in long eventFlags);
void routeEvent(in nsIDOMEvent evt);

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

@ -104,7 +104,14 @@ interface nsIDOMNSEvent : nsISupports
*/
[noscript] readonly attribute nsIDOMEventTarget tmpRealOriginalTarget;
/**
* @deprecated Use nsIDOMEvent::stopPropagation.
*/
void preventBubble();
/**
* @deprecated Use nsIDOMEvent::stopPropagation.
*/
void preventCapture();
readonly attribute boolean isTrusted;

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

@ -70,6 +70,10 @@ interface nsIDOMNSHTMLDocument : nsISupports
void writeln();
void clear();
/**
* @deprecated These are old Netscape 4 methods. Do not use,
* the implementation is no-op.
*/
void captureEvents(in long eventFlags);
void releaseEvents(in long eventFlags);
void routeEvent(in nsIDOMEvent evt);

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

@ -3814,28 +3814,37 @@ nsGlobalWindow::SetResizable(PRBool aResizable)
return NS_OK;
}
static void
ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
{
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aWindow->GetExtantDocument());
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
doc ? doc->GetDocumentURI() : nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Window");
}
NS_IMETHODIMP
nsGlobalWindow::CaptureEvents(PRInt32 aEventFlags)
{
nsCOMPtr<nsIEventListenerManager> manager;
nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(manager));
NS_ENSURE_SUCCESS(rv, rv);
return manager->CaptureEvent(aEventFlags);
ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::ReleaseEvents(PRInt32 aEventFlags)
{
nsCOMPtr<nsIEventListenerManager> manager;
nsresult rv = GetListenerManager(PR_FALSE, getter_AddRefs(manager));
NS_ENSURE_SUCCESS(rv, rv);
return manager ? manager->ReleaseEvent(aEventFlags) : NS_OK;
ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::RouteEvent(nsIDOMEvent* aEvt)
{
//XXX Not the best solution -joki
ReportUseOfDeprecatedMethod(this, "UseOfRouteEventWarning");
return NS_OK;
}

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

@ -6074,7 +6074,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
if (!NS_EVENT_NEEDS_FRAME(aEvent) || GetCurrentEventFrame()) {
PRBool isHandlingUserInput = PR_FALSE;
if (aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) {
if (NS_IS_TRUSTED_EVENT(aEvent)) {
switch (aEvent->message) {
case NS_GOTFOCUS:
case NS_LOSTFOCUS:

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

@ -104,7 +104,7 @@ class nsIDOMEventTarget;
// listener flags and event flags, but only some of them. You've been
// warned!
#define NS_EVENT_FLAG_NONE 0x0000
#define NS_EVENT_FLAG_INIT 0x0001
#define NS_EVENT_FLAG_TRUSTED 0x0001
#define NS_EVENT_FLAG_BUBBLE 0x0002
#define NS_EVENT_FLAG_CAPTURE 0x0004
#define NS_EVENT_FLAG_STOP_DISPATCH 0x0008
@ -119,15 +119,8 @@ class nsIDOMEventTarget;
#define NS_PRIV_EVENT_UNTRUSTED_PERMITTED 0x8000
#define NS_EVENT_CAPTURE_MASK (~(NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
#define NS_EVENT_BUBBLE_MASK (~(NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_CAPTURE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
// Flags for internalAppFlags
#define NS_APP_EVENT_FLAG_NONE 0x00000000
// True if the event came from a trusted source
#define NS_APP_EVENT_FLAG_TRUSTED 0x00000001
#define NS_EVENT_CAPTURE_MASK (~(NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
#define NS_EVENT_BUBBLE_MASK (~(NS_EVENT_FLAG_CAPTURE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
#define NS_EVENT_TYPE_NULL 0
@ -387,9 +380,7 @@ protected:
message(msg),
refPoint(0, 0),
time(0),
flags(0),
internalAppFlags(isTrusted ? NS_APP_EVENT_FLAG_TRUSTED :
NS_APP_EVENT_FLAG_NONE),
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
userType(0)
{
}
@ -400,9 +391,7 @@ public:
message(msg),
refPoint(0, 0),
time(0),
flags(0),
internalAppFlags(isTrusted ? NS_APP_EVENT_FLAG_TRUSTED :
NS_APP_EVENT_FLAG_NONE),
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
userType(0)
{
}
@ -410,17 +399,15 @@ public:
// See event struct types
PRUint8 eventStructType;
// See GUI MESSAGES,
PRUint32 message;
PRUint32 message;
// In widget relative coordinates, not modified by layout code.
nsPoint refPoint;
nsPoint refPoint;
// Elapsed time, in milliseconds, from the time the system was
// started to the time the message was created
PRUint32 time;
PRUint32 time;
// Flags to hold event flow stage and capture/bubble cancellation
// status
// status. This is used also to indicate whether the event is trusted.
PRUint32 flags;
// Flags for indicating more event state for Mozilla applications.
PRUint32 internalAppFlags;
// Additional type info for user defined events
nsHashKey* userType;
// Event targets, needed by DOM Events
@ -992,7 +979,7 @@ enum nsDragDropEventStatus {
((evnt)->message == NS_PLUGIN_ACTIVATE))
#define NS_IS_TRUSTED_EVENT(event) \
(((event)->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) != 0)
(((event)->flags & NS_EVENT_FLAG_TRUSTED) != 0)
// Mark an event as being dispatching.
#define NS_MARK_EVENT_DISPATCH_STARTED(event) \