1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 mozilla_dom_InputEvent_h_
8 #define mozilla_dom_InputEvent_h_
10 #include "mozilla/dom/UIEvent.h"
12 #include "mozilla/dom/InputEventBinding.h"
13 #include "mozilla/dom/StaticRange.h"
14 #include "mozilla/EventForwards.h"
17 namespace mozilla::dom
{
21 class InputEvent
: public UIEvent
{
23 InputEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
24 InternalEditorInputEvent
* aEvent
);
26 NS_INLINE_DECL_REFCOUNTING_INHERITED(InputEvent
, UIEvent
)
28 static already_AddRefed
<InputEvent
> Constructor(const GlobalObject
& aGlobal
,
29 const nsAString
& aType
,
30 const InputEventInit
& aParam
);
32 virtual JSObject
* WrapObjectInternal(
33 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
34 return InputEvent_Binding::Wrap(aCx
, this, aGivenProto
);
37 void GetInputType(nsAString
& aInputType
);
38 void GetData(nsAString
& aData
, CallerType aCallerType
= CallerType::System
);
39 already_AddRefed
<DataTransfer
> GetDataTransfer(
40 CallerType aCallerType
= CallerType::System
);
41 void GetTargetRanges(nsTArray
<RefPtr
<StaticRange
>>& aTargetRanges
);
45 ~InputEvent() = default;
47 // mInputTypeValue stores inputType attribute value if the instance is
48 // created by script and not initialized with known inputType value.
49 nsString mInputTypeValue
;
52 } // namespace mozilla::dom
54 already_AddRefed
<mozilla::dom::InputEvent
> NS_NewDOMInputEvent(
55 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
56 mozilla::InternalEditorInputEvent
* aEvent
);
58 #endif // mozilla_dom_InputEvent_h_