2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
1998-06-07 07:55:55 +00:00
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
#ifndef mozilla_dom_Event_h_
|
|
|
|
#define mozilla_dom_Event_h_
|
1998-06-07 07:55:55 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-25 11:21:22 +00:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2004-08-20 18:09:19 +00:00
|
|
|
#include "nsIDOMEvent.h"
|
1998-06-07 07:55:55 +00:00
|
|
|
#include "nsISupports.h"
|
2003-03-04 01:51:16 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2004-09-04 19:28:46 +00:00
|
|
|
#include "nsPIDOMWindow.h"
|
1998-06-07 07:55:55 +00:00
|
|
|
#include "nsPoint.h"
|
2007-06-26 08:21:42 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2010-04-10 20:10:12 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2013-03-09 11:34:29 +00:00
|
|
|
#include "mozilla/dom/EventBinding.h"
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
2013-07-10 09:55:05 +00:00
|
|
|
#include "Units.h"
|
2013-08-28 02:59:14 +00:00
|
|
|
#include "js/TypeDecls.h"
|
2015-02-23 15:03:40 +00:00
|
|
|
#include "nsIGlobalObject.h"
|
2003-03-04 01:51:16 +00:00
|
|
|
|
1998-06-23 21:53:02 +00:00
|
|
|
class nsIContent;
|
2013-08-19 10:15:55 +00:00
|
|
|
class nsIDOMEventTarget;
|
2010-04-10 20:10:12 +00:00
|
|
|
class nsPresContext;
|
2013-03-09 11:34:29 +00:00
|
|
|
|
2013-08-19 10:15:55 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-03-05 00:37:43 +00:00
|
|
|
|
2013-08-19 10:15:55 +00:00
|
|
|
class EventTarget;
|
2016-02-02 18:03:49 +00:00
|
|
|
class EventMessageAutoOverride;
|
2014-10-15 14:48:04 +00:00
|
|
|
class WantsPopupControlCheck;
|
2015-01-10 11:46:41 +00:00
|
|
|
#define GENERATED_EVENT(EventClass_) class EventClass_;
|
|
|
|
#include "mozilla/dom/GeneratedEventList.h"
|
|
|
|
#undef GENERATED_EVENT
|
2015-04-21 01:47:13 +00:00
|
|
|
// ExtendableEvent is a ServiceWorker event that is not
|
|
|
|
// autogenerated since it has some extra methods.
|
2014-12-19 13:01:53 +00:00
|
|
|
namespace workers {
|
|
|
|
class ExtendableEvent;
|
|
|
|
} // namespace workers
|
2013-08-19 10:15:55 +00:00
|
|
|
|
2013-04-12 14:51:25 +00:00
|
|
|
// Dummy class so we can cast through it to get from nsISupports to
|
2014-03-05 00:37:43 +00:00
|
|
|
// Event subclasses with only two non-ambiguous static casts.
|
|
|
|
class EventBase : public nsIDOMEvent
|
2013-04-12 14:51:25 +00:00
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
class Event : public EventBase,
|
|
|
|
public nsWrapperCache
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
{
|
2013-06-20 14:13:52 +00:00
|
|
|
public:
|
2014-03-05 00:37:43 +00:00
|
|
|
Event(EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
WidgetEvent* aEvent);
|
2016-01-30 17:05:36 +00:00
|
|
|
explicit Event(nsPIDOMWindowInner* aWindow);
|
2014-06-23 19:56:07 +00:00
|
|
|
|
|
|
|
protected:
|
2014-03-05 00:37:43 +00:00
|
|
|
virtual ~Event();
|
|
|
|
|
2013-05-08 00:55:21 +00:00
|
|
|
private:
|
2014-03-05 00:37:43 +00:00
|
|
|
void ConstructorInit(EventTarget* aOwner,
|
2013-10-02 03:46:04 +00:00
|
|
|
nsPresContext* aPresContext,
|
2014-03-05 00:37:43 +00:00
|
|
|
WidgetEvent* aEvent);
|
|
|
|
|
1998-07-23 02:55:33 +00:00
|
|
|
public:
|
2014-03-05 00:37:43 +00:00
|
|
|
static Event* FromSupports(nsISupports* aSupports)
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
|
|
|
nsIDOMEvent* event =
|
|
|
|
static_cast<nsIDOMEvent*>(aSupports);
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMEvent> target_qi =
|
|
|
|
do_QueryInterface(aSupports);
|
|
|
|
|
|
|
|
// If this assertion fires the QI implementation for the object in
|
|
|
|
// question doesn't use the nsIDOMEvent pointer as the
|
|
|
|
// nsISupports pointer. That must be fixed, or we'll crash...
|
|
|
|
MOZ_ASSERT(target_qi == event, "Uh, fix QI!");
|
|
|
|
}
|
|
|
|
#endif
|
2014-03-05 00:37:43 +00:00
|
|
|
return static_cast<Event*>(event);
|
2013-03-09 11:34:29 +00:00
|
|
|
}
|
|
|
|
|
2007-06-26 08:21:42 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-03-05 00:37:43 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Event)
|
2013-03-09 11:34:29 +00:00
|
|
|
|
2015-02-23 15:03:40 +00:00
|
|
|
nsIGlobalObject* GetParentObject()
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
|
|
|
return mOwner;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override final;
|
2014-10-17 23:16:58 +00:00
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto);
|
1998-06-07 07:55:55 +00:00
|
|
|
|
2015-01-10 11:46:41 +00:00
|
|
|
#define GENERATED_EVENT(EventClass_) \
|
|
|
|
virtual EventClass_* As##EventClass_() \
|
|
|
|
{ \
|
|
|
|
return nullptr; \
|
2014-06-03 22:52:36 +00:00
|
|
|
}
|
2015-01-10 11:46:41 +00:00
|
|
|
#include "mozilla/dom/GeneratedEventList.h"
|
|
|
|
#undef GENERATED_EVENT
|
2014-06-03 22:52:36 +00:00
|
|
|
|
2015-04-21 01:47:13 +00:00
|
|
|
// ExtendableEvent is a ServiceWorker event that is not
|
|
|
|
// autogenerated since it has some extra methods.
|
2014-12-19 13:01:53 +00:00
|
|
|
virtual workers::ExtendableEvent* AsExtendableEvent()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
1999-11-03 07:11:45 +00:00
|
|
|
// nsIDOMEvent Interface
|
2001-12-06 06:57:03 +00:00
|
|
|
NS_DECL_NSIDOMEVENT
|
|
|
|
|
2011-12-14 19:53:48 +00:00
|
|
|
void InitPresContextData(nsPresContext* aPresContext);
|
|
|
|
|
2013-03-13 20:02:32 +00:00
|
|
|
// Returns true if the event should be trusted.
|
2014-03-05 00:37:43 +00:00
|
|
|
bool Init(EventTarget* aGlobal);
|
2013-03-13 20:02:32 +00:00
|
|
|
|
2014-10-15 14:48:04 +00:00
|
|
|
static PopupControlState GetEventPopupControlState(WidgetEvent* aEvent,
|
|
|
|
nsIDOMEvent* aDOMEvent = nullptr);
|
2004-09-04 19:28:46 +00:00
|
|
|
|
|
|
|
static void PopupAllowedEventsChanged();
|
|
|
|
|
|
|
|
static void Shutdown();
|
|
|
|
|
2015-08-26 12:56:59 +00:00
|
|
|
static const char* GetEventName(EventMessage aEventType);
|
2014-03-05 00:37:43 +00:00
|
|
|
static CSSIntPoint GetClientCoords(nsPresContext* aPresContext,
|
|
|
|
WidgetEvent* aEvent,
|
|
|
|
LayoutDeviceIntPoint aPoint,
|
|
|
|
CSSIntPoint aDefaultPoint);
|
|
|
|
static CSSIntPoint GetPageCoords(nsPresContext* aPresContext,
|
|
|
|
WidgetEvent* aEvent,
|
|
|
|
LayoutDeviceIntPoint aPoint,
|
|
|
|
CSSIntPoint aDefaultPoint);
|
2015-11-10 16:32:40 +00:00
|
|
|
static CSSIntPoint GetScreenCoords(nsPresContext* aPresContext,
|
|
|
|
WidgetEvent* aEvent,
|
|
|
|
LayoutDeviceIntPoint aPoint);
|
2015-03-13 11:50:10 +00:00
|
|
|
static CSSIntPoint GetOffsetCoords(nsPresContext* aPresContext,
|
|
|
|
WidgetEvent* aEvent,
|
|
|
|
LayoutDeviceIntPoint aPoint,
|
|
|
|
CSSIntPoint aDefaultPoint);
|
2014-03-05 00:37:43 +00:00
|
|
|
|
|
|
|
static already_AddRefed<Event> Constructor(const GlobalObject& aGlobal,
|
|
|
|
const nsAString& aType,
|
|
|
|
const EventInit& aParam,
|
|
|
|
ErrorResult& aRv);
|
2013-03-09 11:34:29 +00:00
|
|
|
|
|
|
|
// Implemented as xpidl method
|
|
|
|
// void GetType(nsString& aRetval) {}
|
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
EventTarget* GetTarget() const;
|
|
|
|
EventTarget* GetCurrentTarget() const;
|
2013-03-09 11:34:29 +00:00
|
|
|
|
2013-03-17 07:55:17 +00:00
|
|
|
uint16_t EventPhase() const;
|
2013-03-09 11:34:29 +00:00
|
|
|
|
|
|
|
// xpidl implementation
|
|
|
|
// void StopPropagation();
|
|
|
|
|
|
|
|
// xpidl implementation
|
|
|
|
// void StopImmediatePropagation();
|
|
|
|
|
2013-03-17 07:55:17 +00:00
|
|
|
bool Bubbles() const
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
2013-03-17 07:55:17 +00:00
|
|
|
return mEvent->mFlags.mBubbles;
|
2013-03-09 11:34:29 +00:00
|
|
|
}
|
|
|
|
|
2013-03-17 07:55:17 +00:00
|
|
|
bool Cancelable() const
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
2013-03-17 07:55:17 +00:00
|
|
|
return mEvent->mFlags.mCancelable;
|
2013-03-09 11:34:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// xpidl implementation
|
|
|
|
// void PreventDefault();
|
|
|
|
|
2013-12-08 15:51:16 +00:00
|
|
|
// You MUST NOT call PreventDefaultJ(JSContext*) from C++ code. A call of
|
|
|
|
// this method always sets Event.defaultPrevented true for web contents.
|
|
|
|
// If default action handler calls this, web applications meet wrong
|
|
|
|
// defaultPrevented value.
|
2015-10-30 02:53:25 +00:00
|
|
|
virtual void PreventDefault(JSContext* aCx);
|
2013-12-08 15:51:16 +00:00
|
|
|
|
|
|
|
// You MUST NOT call DefaultPrevented(JSContext*) from C++ code. This may
|
|
|
|
// return false even if PreventDefault() has been called.
|
|
|
|
// See comments in its implementation for the detail.
|
|
|
|
bool DefaultPrevented(JSContext* aCx) const;
|
|
|
|
|
2013-03-17 07:55:17 +00:00
|
|
|
bool DefaultPrevented() const
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
2016-03-22 07:47:52 +00:00
|
|
|
return mEvent->DefaultPrevented();
|
2013-03-09 11:34:29 +00:00
|
|
|
}
|
|
|
|
|
2016-03-15 05:45:23 +00:00
|
|
|
bool DefaultPreventedByChrome() const
|
|
|
|
{
|
|
|
|
return mEvent->mFlags.mDefaultPreventedByChrome;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DefaultPreventedByContent() const
|
|
|
|
{
|
|
|
|
return mEvent->mFlags.mDefaultPreventedByContent;
|
|
|
|
}
|
|
|
|
|
2013-03-17 07:55:17 +00:00
|
|
|
bool MultipleActionsPrevented() const
|
2013-03-12 11:28:17 +00:00
|
|
|
{
|
|
|
|
return mEvent->mFlags.mMultipleActionsPrevented;
|
|
|
|
}
|
|
|
|
|
2013-03-17 07:55:17 +00:00
|
|
|
bool IsTrusted() const
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
2016-03-17 07:01:30 +00:00
|
|
|
return mEvent->IsTrusted();
|
2013-03-09 11:34:29 +00:00
|
|
|
}
|
|
|
|
|
2014-01-15 14:28:04 +00:00
|
|
|
bool IsSynthesized() const
|
|
|
|
{
|
|
|
|
return mEvent->mFlags.mIsSynthesizedForTests;
|
|
|
|
}
|
|
|
|
|
2014-06-06 05:29:49 +00:00
|
|
|
double TimeStamp() const;
|
2013-03-09 11:34:29 +00:00
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
EventTarget* GetOriginalTarget() const;
|
|
|
|
EventTarget* GetExplicitOriginalTarget() const;
|
2015-01-23 11:55:46 +00:00
|
|
|
EventTarget* GetComposedTarget() const;
|
2013-03-09 11:34:29 +00:00
|
|
|
|
2013-05-27 14:43:51 +00:00
|
|
|
bool GetPreventDefault() const;
|
2013-03-09 11:34:29 +00:00
|
|
|
|
2014-03-21 17:46:15 +00:00
|
|
|
/**
|
|
|
|
* @param aCalledByDefaultHandler Should be true when this is called by
|
|
|
|
* C++ or Chrome. Otherwise, e.g., called
|
|
|
|
* by a call of Event.preventDefault() in
|
|
|
|
* content script, false.
|
|
|
|
*/
|
|
|
|
void PreventDefaultInternal(bool aCalledByDefaultHandler);
|
|
|
|
|
|
|
|
bool IsMainThreadEvent()
|
|
|
|
{
|
|
|
|
return mIsMainThreadEvent;
|
|
|
|
}
|
|
|
|
|
2014-08-27 03:19:56 +00:00
|
|
|
/**
|
|
|
|
* For a given current target, returns the related target adjusted with
|
|
|
|
* shadow DOM retargeting rules. Returns nullptr if related target
|
|
|
|
* is not adjusted.
|
|
|
|
*/
|
|
|
|
static nsIContent* GetShadowRelatedTarget(nsIContent* aCurrentTarget,
|
|
|
|
nsIContent* aRelatedTarget);
|
|
|
|
|
1998-06-07 07:55:55 +00:00
|
|
|
protected:
|
|
|
|
|
2004-08-20 18:09:19 +00:00
|
|
|
// Internal helper functions
|
2012-07-18 10:36:08 +00:00
|
|
|
void SetEventType(const nsAString& aEventTypeArg);
|
2010-06-11 11:10:51 +00:00
|
|
|
already_AddRefed<nsIContent> GetTargetFromFrame();
|
2000-05-05 14:47:37 +00:00
|
|
|
|
2016-02-02 18:03:49 +00:00
|
|
|
friend class EventMessageAutoOverride;
|
2014-10-15 14:48:04 +00:00
|
|
|
friend class WantsPopupControlCheck;
|
|
|
|
void SetWantsPopupControlCheck(bool aCheck)
|
|
|
|
{
|
|
|
|
mWantsPopupControlCheck = aCheck;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetWantsPopupControlCheck()
|
|
|
|
{
|
|
|
|
return IsTrusted() && mWantsPopupControlCheck;
|
|
|
|
}
|
|
|
|
|
2013-12-08 15:51:16 +00:00
|
|
|
/**
|
|
|
|
* IsChrome() returns true if aCx is chrome context or the event is created
|
|
|
|
* in chrome's thread. Otherwise, false.
|
|
|
|
*/
|
|
|
|
bool IsChrome(JSContext* aCx) const;
|
|
|
|
|
2013-10-02 03:46:04 +00:00
|
|
|
mozilla::WidgetEvent* mEvent;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsPresContext> mPresContext;
|
2014-03-05 00:37:43 +00:00
|
|
|
nsCOMPtr<EventTarget> mExplicitOriginalTarget;
|
2015-02-23 15:03:40 +00:00
|
|
|
nsCOMPtr<nsIGlobalObject> mOwner;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mEventIsInternal;
|
|
|
|
bool mPrivateDataDuplicated;
|
2013-08-16 10:06:24 +00:00
|
|
|
bool mIsMainThreadEvent;
|
2014-10-15 14:48:04 +00:00
|
|
|
// True when popup control check should rely on event.type, not
|
2015-08-22 01:34:51 +00:00
|
|
|
// WidgetEvent.mMessage.
|
2014-10-15 14:48:04 +00:00
|
|
|
bool mWantsPopupControlCheck;
|
|
|
|
};
|
|
|
|
|
2016-02-02 18:03:49 +00:00
|
|
|
/**
|
|
|
|
* RAII helper-class to override an event's message (i.e. its DOM-exposed
|
|
|
|
* type), for as long as the object is alive. Restores the original
|
|
|
|
* EventMessage when destructed.
|
|
|
|
*
|
|
|
|
* Notable requirements:
|
|
|
|
* - The original & overriding messages must be known (not eUnidentifiedEvent).
|
|
|
|
* - The original & overriding messages must be different.
|
|
|
|
* - The passed-in nsIDOMEvent must outlive this RAII helper.
|
|
|
|
*/
|
|
|
|
class MOZ_RAII EventMessageAutoOverride
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit EventMessageAutoOverride(nsIDOMEvent* aEvent,
|
|
|
|
EventMessage aOverridingMessage)
|
|
|
|
: mEvent(aEvent->InternalDOMEvent()),
|
|
|
|
mOrigMessage(mEvent->mEvent->mMessage)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aOverridingMessage != mOrigMessage,
|
|
|
|
"Don't use this class if you're not actually overriding");
|
|
|
|
MOZ_ASSERT(aOverridingMessage != eUnidentifiedEvent,
|
|
|
|
"Only use this class with a valid overriding EventMessage");
|
|
|
|
MOZ_ASSERT(mOrigMessage != eUnidentifiedEvent &&
|
2016-04-18 15:10:17 +00:00
|
|
|
mEvent->mEvent->mSpecifiedEventTypeString.IsEmpty(),
|
2016-02-02 18:03:49 +00:00
|
|
|
"Only use this class on events whose overridden type is "
|
|
|
|
"known (so we can restore it properly)");
|
|
|
|
|
|
|
|
mEvent->mEvent->mMessage = aOverridingMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
~EventMessageAutoOverride()
|
|
|
|
{
|
|
|
|
mEvent->mEvent->mMessage = mOrigMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Non-owning ref, which should be safe since we're a stack-allocated object
|
|
|
|
// with limited lifetime. Whoever creates us should keep mEvent alive.
|
|
|
|
Event* const MOZ_NON_OWNING_REF mEvent;
|
|
|
|
const EventMessage mOrigMessage;
|
|
|
|
};
|
|
|
|
|
2014-10-15 14:48:04 +00:00
|
|
|
class MOZ_STACK_CLASS WantsPopupControlCheck
|
|
|
|
{
|
|
|
|
public:
|
2014-10-10 21:28:35 +00:00
|
|
|
explicit WantsPopupControlCheck(nsIDOMEvent* aEvent) :
|
|
|
|
mEvent(aEvent->InternalDOMEvent())
|
2014-10-15 14:48:04 +00:00
|
|
|
{
|
|
|
|
mOriginalWantsPopupControlCheck = mEvent->GetWantsPopupControlCheck();
|
|
|
|
mEvent->SetWantsPopupControlCheck(mEvent->IsTrusted());
|
|
|
|
}
|
|
|
|
|
|
|
|
~WantsPopupControlCheck()
|
|
|
|
{
|
|
|
|
mEvent->SetWantsPopupControlCheck(mOriginalWantsPopupControlCheck);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Event* mEvent;
|
|
|
|
bool mOriginalWantsPopupControlCheck;
|
1998-06-07 07:55:55 +00:00
|
|
|
};
|
1998-07-23 02:55:33 +00:00
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#define NS_FORWARD_TO_EVENT \
|
2015-10-30 02:53:25 +00:00
|
|
|
NS_FORWARD_NSIDOMEVENT(Event::) \
|
|
|
|
virtual void PreventDefault(JSContext* aCx) override { Event::PreventDefault(aCx); }
|
2004-08-20 18:09:19 +00:00
|
|
|
|
2012-06-10 18:14:30 +00:00
|
|
|
#define NS_FORWARD_NSIDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION(_to) \
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD GetType(nsAString& aType) override { return _to GetType(aType); } \
|
|
|
|
NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget) override { return _to GetTarget(aTarget); } \
|
|
|
|
NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget) override { return _to GetCurrentTarget(aCurrentTarget); } \
|
|
|
|
NS_IMETHOD GetEventPhase(uint16_t* aEventPhase) override { return _to GetEventPhase(aEventPhase); } \
|
|
|
|
NS_IMETHOD GetBubbles(bool* aBubbles) override { return _to GetBubbles(aBubbles); } \
|
|
|
|
NS_IMETHOD GetCancelable(bool* aCancelable) override { return _to GetCancelable(aCancelable); } \
|
|
|
|
NS_IMETHOD GetTimeStamp(DOMTimeStamp* aTimeStamp) override { return _to GetTimeStamp(aTimeStamp); } \
|
|
|
|
NS_IMETHOD StopPropagation(void) override { return _to StopPropagation(); } \
|
2015-05-25 20:54:13 +00:00
|
|
|
NS_IMETHOD StopCrossProcessForwarding(void) override { return _to StopCrossProcessForwarding(); } \
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD PreventDefault(void) override { return _to PreventDefault(); } \
|
2015-11-13 00:09:42 +00:00
|
|
|
void InitEvent(const nsAString& eventTypeArg, bool canBubbleArg, bool cancelableArg) override { _to InitEvent(eventTypeArg, canBubbleArg, cancelableArg); } \
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD GetDefaultPrevented(bool* aDefaultPrevented) override { return _to GetDefaultPrevented(aDefaultPrevented); } \
|
|
|
|
NS_IMETHOD StopImmediatePropagation(void) override { return _to StopImmediatePropagation(); } \
|
|
|
|
NS_IMETHOD GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget) override { return _to GetOriginalTarget(aOriginalTarget); } \
|
|
|
|
NS_IMETHOD GetExplicitOriginalTarget(nsIDOMEventTarget** aExplicitOriginalTarget) override { return _to GetExplicitOriginalTarget(aExplicitOriginalTarget); } \
|
|
|
|
NS_IMETHOD GetPreventDefault(bool* aRetval) override { return _to GetPreventDefault(aRetval); } \
|
|
|
|
NS_IMETHOD GetIsTrusted(bool* aIsTrusted) override { return _to GetIsTrusted(aIsTrusted); } \
|
|
|
|
NS_IMETHOD SetTarget(nsIDOMEventTarget* aTarget) override { return _to SetTarget(aTarget); } \
|
|
|
|
NS_IMETHOD_(bool) IsDispatchStopped(void) override { return _to IsDispatchStopped(); } \
|
2016-02-12 15:40:07 +00:00
|
|
|
NS_IMETHOD_(WidgetEvent*) WidgetEventPtr(void) override { return _to WidgetEventPtr(); } \
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD_(void) SetTrusted(bool aTrusted) override { _to SetTrusted(aTrusted); } \
|
|
|
|
NS_IMETHOD_(void) SetOwner(EventTarget* aOwner) override { _to SetOwner(aOwner); } \
|
|
|
|
NS_IMETHOD_(Event*) InternalDOMEvent() override { return _to InternalDOMEvent(); }
|
2012-06-10 18:14:30 +00:00
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
#define NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION \
|
2015-10-30 02:53:25 +00:00
|
|
|
NS_FORWARD_NSIDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION(Event::) \
|
|
|
|
virtual void PreventDefault(JSContext* aCx) override { Event::PreventDefault(aCx); }
|
2012-06-10 18:14:30 +00:00
|
|
|
|
2013-03-09 11:34:29 +00:00
|
|
|
inline nsISupports*
|
2014-03-05 00:37:43 +00:00
|
|
|
ToSupports(mozilla::dom::Event* e)
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
|
|
|
return static_cast<nsIDOMEvent*>(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsISupports*
|
2014-03-05 00:37:43 +00:00
|
|
|
ToCanonicalSupports(mozilla::dom::Event* e)
|
2013-03-09 11:34:29 +00:00
|
|
|
{
|
|
|
|
return static_cast<nsIDOMEvent*>(e);
|
|
|
|
}
|
|
|
|
|
2015-08-12 11:39:31 +00:00
|
|
|
already_AddRefed<mozilla::dom::Event>
|
|
|
|
NS_NewDOMEvent(mozilla::dom::EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
mozilla::WidgetEvent* aEvent);
|
|
|
|
|
2014-03-05 00:37:43 +00:00
|
|
|
#endif // mozilla_dom_Event_h_
|