/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_BasicEvents_h__ #define mozilla_BasicEvents_h__ #include #include #include "mozilla/EventForwards.h" #include "mozilla/TimeStamp.h" #include "mozilla/dom/EventTarget.h" #include "mozilla/layers/LayersTypes.h" #include "nsCOMPtr.h" #include "nsAtom.h" #include "nsISupportsImpl.h" #include "nsIWidget.h" #include "nsString.h" #include "Units.h" #ifdef DEBUG # include "nsXULAppAPI.h" #endif // #ifdef DEBUG class nsIPrincipal; namespace IPC { template struct ParamTraits; } // namespace IPC namespace mozilla { class EventTargetChainItem; enum class CrossProcessForwarding { // eStop prevents the event to be sent to remote process. eStop, // eAllow keeps current state of the event whether it's sent to remote // process. In other words, eAllow does NOT mean that making the event // sent to remote process when IsCrossProcessForwardingStopped() returns // true. eAllow, }; /****************************************************************************** * mozilla::BaseEventFlags * * BaseEventFlags must be a POD struct for safe to use memcpy (including * in ParamTraits). So don't make virtual methods, constructor, * destructor and operators. * This is necessary for VC which is NOT C++0x compiler. ******************************************************************************/ struct BaseEventFlags { public: // If mIsTrusted is true, the event is a trusted event. Otherwise, it's // an untrusted event. bool mIsTrusted : 1; // If mInBubblingPhase is true, the event is in bubbling phase or target // phase. bool mInBubblingPhase : 1; // If mInCapturePhase is true, the event is in capture phase or target phase. bool mInCapturePhase : 1; // If mInTargetPhase is true, the event is in target phase. bool mInTargetPhase : 1; // If mInSystemGroup is true, the event is being dispatched in system group. bool mInSystemGroup : 1; // If mCancelable is true, the event can be consumed. I.e., calling // dom::Event::PreventDefault() can prevent the default action. bool mCancelable : 1; // If mBubbles is true, the event can bubble. Otherwise, cannot be handled // in bubbling phase. bool mBubbles : 1; // If mPropagationStopped is true, dom::Event::StopPropagation() or // dom::Event::StopImmediatePropagation() has been called. bool mPropagationStopped : 1; // If mImmediatePropagationStopped is true, // dom::Event::StopImmediatePropagation() has been called. // Note that mPropagationStopped must be true when this is true. bool mImmediatePropagationStopped : 1; // If mDefaultPrevented is true, the event has been consumed. // E.g., dom::Event::PreventDefault() has been called or // the default action has been performed. bool mDefaultPrevented : 1; // If mDefaultPreventedByContent is true, the event has been // consumed by content. // Note that mDefaultPrevented must be true when this is true. bool mDefaultPreventedByContent : 1; // If mDefaultPreventedByChrome is true, the event has been // consumed by chrome. // Note that mDefaultPrevented must be true when this is true. bool mDefaultPreventedByChrome : 1; // mMultipleActionsPrevented may be used when default handling don't want to // be prevented, but only one of the event targets should handle the event. // For example, when a