1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef DOM_INVOKEEVENT_H_
8 #define DOM_INVOKEEVENT_H_
10 #include "mozilla/dom/Event.h"
11 #include "mozilla/dom/Element.h"
12 #include "mozilla/dom/InvokeEventBinding.h"
15 namespace mozilla::dom
{
17 class InvokeEvent
: public Event
{
19 NS_DECL_ISUPPORTS_INHERITED
20 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InvokeEvent
, Event
)
22 virtual InvokeEvent
* AsInvokeEvent() { return this; }
24 explicit InvokeEvent(EventTarget
* aOwner
) : Event(aOwner
, nullptr, nullptr) {}
26 JSObject
* WrapObjectInternal(JSContext
* aCx
,
27 JS::Handle
<JSObject
*> aGivenProto
) override
;
29 static already_AddRefed
<InvokeEvent
> Constructor(
30 EventTarget
* aOwner
, const nsAString
& aType
,
31 const InvokeEventInit
& aEventInitDict
);
33 static already_AddRefed
<InvokeEvent
> Constructor(
34 const GlobalObject
& aGlobal
, const nsAString
& aType
,
35 const InvokeEventInit
& aEventInitDict
);
37 Element
* GetInvoker();
39 void GetAction(nsAString
& aAction
) const { aAction
= mAction
; }
42 ~InvokeEvent() = default;
44 RefPtr
<Element
> mInvoker
;
48 } // namespace mozilla::dom
50 #endif // DOM_INVOKEEVENT_H_