Bug 1626388 - Convert dom.select_events.textcontrols.enabled to static pref r=njn

Converts dom.select_events.textcontrols.enabled to a static pref.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2020-04-06 23:30:18 +00:00
parent b0a2f87323
commit 05a7022978
6 changed files with 11 additions and 25 deletions

View File

@ -900,8 +900,7 @@ nsresult Selection::AddRangesForUserSelectableNodes(
// pref, disabled by default.
// See https://github.com/w3c/selection-api/issues/53.
const bool executeDefaultAction = MaybeDispatchSelectstartEvent(
*aRange, nsFrameSelection::sSelectionEventsOnTextControlsEnabled,
doc);
*aRange, StaticPrefs::dom_select_events_textcontrols_enabled(), doc);
if (!executeDefaultAction) {
return NS_OK;

View File

@ -124,7 +124,7 @@ void SelectionChangeEventDispatcher::OnSelectionChange(Document* aDoc,
// controls, so for now we only support doing that under a pref, disabled by
// default.
// See https://github.com/w3c/selection-api/issues/53.
if (nsFrameSelection::sSelectionEventsOnTextControlsEnabled) {
if (StaticPrefs::dom_select_events_textcontrols_enabled()) {
nsCOMPtr<nsINode> target;
// Check if we should be firing this event to a different node than the

View File

@ -339,14 +339,6 @@ nsFrameSelection::nsFrameSelection(PresShell* aPresShell, nsIContent* aLimiter,
// This should only ever be initialized on the main thread, so we are OK here.
MOZ_ASSERT(NS_IsMainThread());
static bool prefCachesInitialized = false;
if (!prefCachesInitialized) {
prefCachesInitialized = true;
Preferences::AddBoolVarCache(&sSelectionEventsOnTextControlsEnabled,
"dom.select_events.textcontrols.enabled",
false);
}
mAccessibleCaretEnabled = aAccessibleCaretEnabled;
if (mAccessibleCaretEnabled) {
@ -355,9 +347,9 @@ nsFrameSelection::nsFrameSelection(PresShell* aPresShell, nsIContent* aLimiter,
}
bool plaintextControl = (aLimiter != nullptr);
bool initSelectEvents = plaintextControl
? sSelectionEventsOnTextControlsEnabled
: StaticPrefs::dom_select_events_enabled();
bool initSelectEvents =
plaintextControl ? StaticPrefs::dom_select_events_textcontrols_enabled()
: StaticPrefs::dom_select_events_enabled();
Document* doc = aPresShell->GetDocument();
if (initSelectEvents || (doc && doc->NodePrincipal()->IsSystemPrincipal())) {
@ -643,8 +635,6 @@ static nsINode* GetCellParent(nsINode* aDomNode) {
return nullptr;
}
bool nsFrameSelection::sSelectionEventsOnTextControlsEnabled = false;
nsresult nsFrameSelection::MoveCaret(nsDirection aDirection,
bool aContinueSelection,
const nsSelectionAmount aAmount,

View File

@ -928,8 +928,6 @@ class nsFrameSelection final {
bool mDragState = false; // for drag purposes
bool mAccessibleCaretEnabled = false;
static bool sSelectionEventsOnTextControlsEnabled;
};
#endif /* nsFrameSelection_h___ */

View File

@ -2475,6 +2475,12 @@
value: true
mirror: always
# Whether or not selection events on text controls are enabled.
- name: dom.select_events.textcontrols.enabled
type: bool
value: @IS_NIGHTLY_BUILD@
mirror: always
- name: dom.separate_event_queue_for_post_message.enabled
type: bool
value: true

View File

@ -255,13 +255,6 @@ pref("dom.indexedDB.logging.profiler-marks", false);
// Whether or not File Handle is enabled.
pref("dom.fileHandle.enabled", true);
// Whether or not selection events on text controls are enabled
#ifdef NIGHTLY_BUILD
pref("dom.select_events.textcontrols.enabled", true);
#else
pref("dom.select_events.textcontrols.enabled", false);
#endif
// The number of workers per domain allowed to run concurrently.
// We're going for effectively infinite, while preventing abuse.
pref("dom.workers.maxPerDomain", 512);