Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / events / InputEvent.h
blob11c7472d9e3457475a70794303c8dee8d89f1998
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"
15 #include "nsTArray.h"
17 namespace mozilla::dom {
19 class DataTransfer;
21 class InputEvent : public UIEvent {
22 public:
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);
42 bool IsComposing();
44 protected:
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_