Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / widget / headless / HeadlessKeyBindings.h
blob5eff30c4f55c4eace3e6bd76577da804ca7e5730
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_widget_HeadlessKeyBindings_h
7 #define mozilla_widget_HeadlessKeyBindings_h
9 #include "mozilla/TextEvents.h"
10 #include "nsIWidget.h"
11 #include "nsTArray.h"
13 namespace mozilla {
14 enum class NativeKeyBindingsType : uint8_t;
16 class WritingMode;
17 template <typename T>
18 class Maybe;
20 namespace widget {
22 /**
23 * Helper to emulate native key bindings. Currently only MacOS is supported.
26 class HeadlessKeyBindings final {
27 public:
28 HeadlessKeyBindings() = default;
30 static HeadlessKeyBindings& GetInstance();
32 void GetEditCommands(NativeKeyBindingsType aType,
33 const WidgetKeyboardEvent& aEvent,
34 const Maybe<WritingMode>& aWritingMode,
35 nsTArray<CommandInt>& aCommands);
36 [[nodiscard]] nsresult AttachNativeKeyEvent(WidgetKeyboardEvent& aEvent);
39 } // namespace widget
40 } // namespace mozilla
42 #endif // mozilla_widget_HeadlessKeyBindings_h