mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1644511 - Part 1: Make bidi.edit.caret_movement_style a static pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D79004
This commit is contained in:
parent
9eb3f738ee
commit
0046c51bb0
@ -17,6 +17,7 @@
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/ScrollTypes.h"
|
||||
#include "mozilla/StaticPrefs_bidi.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
|
||||
@ -365,8 +366,6 @@ nsFrameSelection::nsFrameSelection(PresShell* aPresShell, nsIContent* aLimiter,
|
||||
mPresShell = aPresShell;
|
||||
mDragState = false;
|
||||
mLimiters.mLimiter = aLimiter;
|
||||
mCaret.mMovementStyle =
|
||||
Preferences::GetInt("bidi.edit.caret_movement_style", 2);
|
||||
|
||||
// This should only ever be initialized on the main thread, so we are OK here.
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -436,6 +435,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsFrameSelection, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsFrameSelection, Release)
|
||||
|
||||
bool nsFrameSelection::Caret::IsVisualMovement(
|
||||
bool aContinueSelection, CaretMovementStyle aMovementStyle) const {
|
||||
int32_t movementFlag = StaticPrefs::bidi_edit_caret_movement_style();
|
||||
return aMovementStyle == eVisual ||
|
||||
(aMovementStyle == eUsePrefStyle &&
|
||||
(movementFlag == 1 || (movementFlag == 2 && !aContinueSelection)));
|
||||
}
|
||||
|
||||
// Get the x (or y, in vertical writing mode) position requested
|
||||
// by the Key Handling for line-up/down
|
||||
nsresult nsFrameSelection::DesiredCaretPos::FetchPos(
|
||||
|
@ -1015,15 +1015,9 @@ class nsFrameSelection final {
|
||||
// next.
|
||||
CaretAssociateHint mHint = mozilla::CARET_ASSOCIATE_BEFORE;
|
||||
nsBidiLevel mBidiLevel = BIDI_LEVEL_UNDEFINED;
|
||||
int8_t mMovementStyle = 0;
|
||||
|
||||
bool IsVisualMovement(bool aContinueSelection,
|
||||
CaretMovementStyle aMovementStyle) const {
|
||||
return aMovementStyle == eVisual ||
|
||||
(aMovementStyle == eUsePrefStyle &&
|
||||
(mMovementStyle == 1 ||
|
||||
(mMovementStyle == 2 && !aContinueSelection)));
|
||||
}
|
||||
CaretMovementStyle aMovementStyle) const;
|
||||
};
|
||||
|
||||
Caret mCaret;
|
||||
|
@ -686,6 +686,15 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Bidi caret movement style:
|
||||
# 0 = logical
|
||||
# 1 = visual
|
||||
# 2 = visual, but logical during selection
|
||||
- name: bidi.edit.caret_movement_style
|
||||
type: int32_t
|
||||
value: 2
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "browser."
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -2430,12 +2430,6 @@ pref("bidi.texttype", 1);
|
||||
// 6 = persiannumeralBidi
|
||||
pref("bidi.numeral", 0);
|
||||
|
||||
// Bidi caret movement style:
|
||||
// 0 = logical
|
||||
// 1 = visual
|
||||
// 2 = visual, but logical during selection
|
||||
pref("bidi.edit.caret_movement_style", 2);
|
||||
|
||||
// Setting this pref to |true| forces Bidi UI menu items and keyboard shortcuts
|
||||
// to be exposed, and enables the directional caret hook. By default, only
|
||||
// expose it for bidi-associated system locales.
|
||||
|
Loading…
Reference in New Issue
Block a user