Bug 1485063 Part 3 - Move preferences which enable AccessibleCaret to StaticPrefList.h. r=mats

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2018-09-10 22:24:21 +00:00
Родитель 1ff0aabd92
Коммит b91559ddb2
3 изменённых файлов: 23 добавлений и 21 удалений

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

@ -23,6 +23,7 @@
#include "mozilla/Logging.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/TouchEvents.h"
@ -725,25 +726,18 @@ nsIPresShell::FrameSelection()
static bool sSynthMouseMove = true;
static uint32_t sNextPresShellId;
static bool sAccessibleCaretEnabled = false;
static bool sAccessibleCaretOnTouch = false;
/* static */ bool
PresShell::AccessibleCaretEnabled(nsIDocShell* aDocShell)
{
static bool initialized = false;
if (!initialized) {
Preferences::AddBoolVarCache(&sAccessibleCaretEnabled, "layout.accessiblecaret.enabled");
Preferences::AddBoolVarCache(&sAccessibleCaretOnTouch, "layout.accessiblecaret.enabled_on_touch");
initialized = true;
}
// If the pref forces it on, then enable it.
if (sAccessibleCaretEnabled) {
if (StaticPrefs::layout_accessiblecaret_enabled()) {
return true;
}
// If the touch pref is on, and touch events are enabled (this depends
// on the specific device running), then enable it.
if (sAccessibleCaretOnTouch && dom::TouchEvent::PrefEnabled(aDocShell)) {
if (StaticPrefs::layout_accessiblecaret_enabled_on_touch() &&
dom::TouchEvent::PrefEnabled(aDocShell)) {
return true;
}
// Otherwise, disabled.

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

@ -446,6 +446,25 @@ VARCACHE_PREF(
// Layout prefs
//---------------------------------------------------------------------------
// Debug-only pref to force enable the AccessibleCaret. If you want to
// control AccessibleCaret by mouse, you'll need to set
// "layout.accessiblecaret.hide_carets_for_mouse_input" to false.
VARCACHE_PREF(
"layout.accessiblecaret.enabled",
layout_accessiblecaret_enabled,
bool, false
)
// Enable the accessible caret on platforms/devices
// that we detect have touch support. Note that this pref is an
// additional way to enable the accessible carets, rather than
// overriding the layout.accessiblecaret.enabled pref.
VARCACHE_PREF(
"layout.accessiblecaret.enabled_on_touch",
layout_accessiblecaret_enabled_on_touch,
bool, false
)
// CSS attributes (width, height, margin-left) of the AccessibleCaret in CSS
// pixels.
VARCACHE_PREF(

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

@ -5514,17 +5514,6 @@ pref("plugins.flashBlock.enabled", false);
// Turn off Spatial navigation by default.
pref("snav.enabled", false);
// Debug-only pref to force enable the AccessibleCaret. If you want to
// control AccessibleCaret by mouse, you'll need to set
// "layout.accessiblecaret.hide_carets_for_mouse_input" to false.
pref("layout.accessiblecaret.enabled", false);
// Enable the accessible caret on platforms/devices
// that we detect have touch support. Note that this pref is an
// additional way to enable the accessible carets, rather than
// overriding the layout.accessiblecaret.enabled pref.
pref("layout.accessiblecaret.enabled_on_touch", true);
// Show the caret when long tapping on an empty content.
pref("layout.accessiblecaret.caret_shown_when_long_tapping_on_empty_content", false);