Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / events / InvokeEvent.h
blobfcc809ae92db5ecafee2aea01ab2ba6ea85c5386
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"
14 struct JSContext;
15 namespace mozilla::dom {
17 class InvokeEvent : public Event {
18 public:
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; }
41 protected:
42 ~InvokeEvent() = default;
44 RefPtr<Element> mInvoker;
45 nsString mAction;
48 } // namespace mozilla::dom
50 #endif // DOM_INVOKEEVENT_H_