From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- widget/BasicEvents.h | 1326 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1326 insertions(+) create mode 100644 widget/BasicEvents.h (limited to 'widget/BasicEvents.h') diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h new file mode 100644 index 0000000000..704905a3d2 --- /dev/null +++ b/widget/BasicEvents.h @@ -0,0 +1,1326 @@ +/* -*- 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 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