mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
a25988774a
Currently, this feature is implemented only on Linux and macOS (see also bug 1077515 and bug 1301497), and the code is really similar each other. Additionally, it always tries to query selection to check whether the caret is in vertical content or not if arrow keys are pressed. For avoiding a lot of query, this patch makes `TextEventDispatcher` cache writing mode at every selection change notification. However, unfortunately, it's not available when non-editable content has focus, but it should be out of scope of this bug since it requires a lot of changes. Anyway, with this patch, we can write a mochitest only on Linux and macOS. The following patch adds a test for this as a fix of bug 1103374. Differential Revision: https://phabricator.services.mozilla.com/D102881
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* 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/. */
|
|
|
|
#include "HeadlessKeyBindings.h"
|
|
#include "mozilla/ClearOnShutdown.h"
|
|
#include "mozilla/Maybe.h"
|
|
#include "mozilla/WritingModes.h"
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
|
|
HeadlessKeyBindings& HeadlessKeyBindings::GetInstance() {
|
|
static UniquePtr<HeadlessKeyBindings> sInstance;
|
|
if (!sInstance) {
|
|
sInstance.reset(new HeadlessKeyBindings());
|
|
ClearOnShutdown(&sInstance);
|
|
}
|
|
return *sInstance;
|
|
}
|
|
|
|
nsresult HeadlessKeyBindings::AttachNativeKeyEvent(
|
|
WidgetKeyboardEvent& aEvent) {
|
|
// Stub for non-mac platforms.
|
|
return NS_OK;
|
|
}
|
|
|
|
void HeadlessKeyBindings::GetEditCommands(
|
|
nsIWidget::NativeKeyBindingsType aType, const WidgetKeyboardEvent& aEvent,
|
|
const Maybe<WritingMode>& aWritingMode, nsTArray<CommandInt>& aCommands) {
|
|
// Stub for non-mac platforms.
|
|
}
|
|
|
|
} // namespace widget
|
|
} // namespace mozilla
|