Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom.input.skip_cursor_move_for_same_value_set, r=Ehsan

Differential Revision: https://phabricator.services.mozilla.com/D29518

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2019-05-01 21:10:08 +00:00
Родитель 2af86f5ef5
Коммит dafbe56cc8
5 изменённых файлов: 10 добавлений и 19 удалений

Просмотреть файл

@ -310,7 +310,6 @@ nsString* nsContentUtils::sAltText = nullptr;
nsString* nsContentUtils::sModifierSeparator = nullptr;
bool nsContentUtils::sInitialized = false;
bool nsContentUtils::sSkipCursorMoveForSameValueSet = false;
bool nsContentUtils::sRequestIdleCallbackEnabled = false;
bool nsContentUtils::sTailingEnabled = false;
bool nsContentUtils::sShowInputPlaceholderOnFocus = true;
@ -613,10 +612,6 @@ nsresult nsContentUtils::Init() {
Preferences::AddBoolVarCache(&sAllowXULXBL_for_file,
"dom.allow_XUL_XBL_for_file");
Preferences::AddBoolVarCache(&sSkipCursorMoveForSameValueSet,
"dom.input.skip_cursor_move_for_same_value_set",
true);
Preferences::AddBoolVarCache(&sRequestIdleCallbackEnabled,
"dom.requestIdleCallback.enabled", false);

Просмотреть файл

@ -3189,14 +3189,6 @@ class nsContentUtils {
*/
static uint64_t GenerateBrowsingContextId();
/**
* Check whether we should skip moving the cursor for a same-value .value set
* on a text input or textarea.
*/
static bool SkipCursorMoveForSameValueSet() {
return sSkipCursorMoveForSameValueSet;
}
/**
* Determine whether or not the user is currently interacting with the web
* browser. This method is safe to call from off of the main thread.
@ -3433,7 +3425,6 @@ class nsContentUtils {
static bool sIsHandlingKeyBoardEvent;
static bool sAllowXULXBL_for_file;
static bool sSkipCursorMoveForSameValueSet;
static bool sRequestIdleCallbackEnabled;
static bool sTailingEnabled;
static bool sShowInputPlaceholderOnFocus;

Просмотреть файл

@ -41,6 +41,7 @@
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/Text.h"
#include "mozilla/StaticPrefs.h"
#include "nsNumberControlFrame.h"
#include "nsFrameSelection.h"
#include "mozilla/ErrorResult.h"
@ -2431,7 +2432,7 @@ bool nsTextEditorState::SetValue(const nsAString& aValue,
// We can't just early-return here if mValue->Equals(newValue), because
// ValueWasChanged and OnValueChanged below still need to be called.
if (!mValue->Equals(newValue) ||
!nsContentUtils::SkipCursorMoveForSameValueSet()) {
!StaticPrefs::dom_input_skip_cursor_move_for_same_value_set()) {
if (!mValue->Assign(newValue, fallible)) {
return false;
}

Просмотреть файл

@ -242,6 +242,14 @@ VARCACHE_PREF(
bool, true
)
// Enable not moving the cursor to end when a text input or textarea has .value
// set to the value it already has. By default, enabled.
VARCACHE_PREF(
"dom.input.skip_cursor_move_for_same_value_set",
dom_input_skip_cursor_move_for_same_value_set,
bool, true
)
// NOTE: This preference is used in unit tests. If it is removed or its default
// value changes, please update test_sharedMap_var_caches.js accordingly.
VARCACHE_PREF(

Просмотреть файл

@ -1376,10 +1376,6 @@ pref("dom.select_popup_in_parent.enabled", false);
// Enable Directory API. By default, disabled.
pref("dom.input.dirpicker", false);
// Enable not moving the cursor to end when a text input or textarea has .value
// set to the value it already has. By default, enabled.
pref("dom.input.skip_cursor_move_for_same_value_set", true);
pref("dom.cycle_collector.incremental", true);
// Whether to shim a Components object on untrusted windows.