2015-05-03 22:32:37 +03: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: */
|
2014-04-10 11:11:37 +04: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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_InputEvent_h_
|
|
|
|
#define mozilla_dom_InputEvent_h_
|
|
|
|
|
|
|
|
#include "mozilla/dom/UIEvent.h"
|
2020-03-02 10:39:38 +03:00
|
|
|
|
2014-04-10 11:11:37 +04:00
|
|
|
#include "mozilla/dom/InputEventBinding.h"
|
2020-03-02 10:39:38 +03:00
|
|
|
#include "mozilla/dom/StaticRange.h"
|
2014-04-10 11:11:37 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2020-03-02 10:39:38 +03:00
|
|
|
#include "nsTArray.h"
|
2014-04-10 11:11:37 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2019-02-19 09:32:11 +03:00
|
|
|
class DataTransfer;
|
|
|
|
|
2014-04-10 11:11:37 +04:00
|
|
|
class InputEvent : public UIEvent {
|
|
|
|
public:
|
|
|
|
InputEvent(EventTarget* aOwner, nsPresContext* aPresContext,
|
|
|
|
InternalEditorInputEvent* aEvent);
|
|
|
|
|
2018-02-12 23:43:55 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(InputEvent, UIEvent)
|
2014-04-10 11:11:37 +04:00
|
|
|
|
|
|
|
static already_AddRefed<InputEvent> Constructor(const GlobalObject& aGlobal,
|
|
|
|
const nsAString& aType,
|
2019-09-11 17:35:28 +03:00
|
|
|
const InputEventInit& aParam);
|
2014-04-10 11:11:37 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObjectInternal(
|
|
|
|
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
|
2018-06-26 00:20:54 +03:00
|
|
|
return InputEvent_Binding::Wrap(aCx, this, aGivenProto);
|
2014-04-10 11:11:37 +04:00
|
|
|
}
|
|
|
|
|
2019-01-07 13:10:57 +03:00
|
|
|
void GetInputType(nsAString& aInputType);
|
2019-03-29 19:08:11 +03:00
|
|
|
void GetData(nsAString& aData, CallerType aCallerType = CallerType::System);
|
|
|
|
already_AddRefed<DataTransfer> GetDataTransfer(
|
|
|
|
CallerType aCallerType = CallerType::System);
|
2020-03-02 10:39:38 +03:00
|
|
|
void GetTargetRanges(nsTArray<RefPtr<StaticRange>>& aTargetRanges);
|
2014-04-10 11:11:37 +04:00
|
|
|
bool IsComposing();
|
2014-07-09 01:23:17 +04:00
|
|
|
|
|
|
|
protected:
|
2020-02-20 18:56:28 +03:00
|
|
|
~InputEvent() = default;
|
2019-01-07 13:10:57 +03:00
|
|
|
|
|
|
|
// mInputTypeValue stores inputType attribute value if the instance is
|
|
|
|
// created by script and not initialized with known inputType value.
|
|
|
|
nsString mInputTypeValue;
|
2014-04-10 11:11:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-08-12 14:39:31 +03:00
|
|
|
already_AddRefed<mozilla::dom::InputEvent> NS_NewDOMInputEvent(
|
|
|
|
mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
|
|
|
|
mozilla::InternalEditorInputEvent* aEvent);
|
|
|
|
|
2014-04-10 11:11:37 +04:00
|
|
|
#endif // mozilla_dom_InputEvent_h_
|