Bug 1241008 - Add preference to show or hide selection bars. r=mtseng

--HG--
extra : rebase_source : 87593ce1fc35e0d99e4a5b68f5fe5b3725cc25b6
This commit is contained in:
Ting-Yu Lin 2016-01-21 11:11:38 +08:00
parent 6d17948bc1
commit 94991d3936
3 changed files with 12 additions and 1 deletions

View File

@ -64,6 +64,8 @@ std::ostream& operator<<(std::ostream& aStream,
}
#undef AC_PROCESS_ENUM_TO_STREAM
/*static*/ bool
AccessibleCaretManager::sSelectionBarEnabled = false;
/*static*/ bool
AccessibleCaretManager::sCaretsExtendedVisibility = false;
/*static*/ bool
@ -83,6 +85,8 @@ AccessibleCaretManager::AccessibleCaretManager(nsIPresShell* aPresShell)
static bool addedPrefs = false;
if (!addedPrefs) {
Preferences::AddBoolVarCache(&sSelectionBarEnabled,
"layout.accessiblecaret.bar.enabled");
Preferences::AddBoolVarCache(&sCaretsExtendedVisibility,
"layout.accessiblecaret.extendedvisibility");
Preferences::AddBoolVarCache(&sHapticFeedback,
@ -319,7 +323,7 @@ AccessibleCaretManager::UpdateCaretsForSelectionMode()
int32_t aOffset) -> PositionChangedResult
{
PositionChangedResult result = aCaret->SetPosition(aFrame, aOffset);
aCaret->SetSelectionBarEnabled(true);
aCaret->SetSelectionBarEnabled(sSelectionBarEnabled);
switch (result) {
case PositionChangedResult::NotChanged:

View File

@ -247,6 +247,10 @@ protected:
// AppUnit.h.
static const int32_t kBoundaryAppUnits = 61;
// Preference to show selection bars at the two ends in selection mode. The
// selection bar is always disabled in cursor mode.
static bool sSelectionBarEnabled;
// AccessibleCaret visibility preference. Used to avoid hiding caret during
// (NO_REASON) selection change notifications generated by keyboard IME, and to
// maintain a visible ActionBar while carets NotShown during scroll and while

View File

@ -4918,6 +4918,9 @@ pref("layout.accessiblecaret.height", "36.0");
pref("layout.accessiblecaret.margin-left", "-18.5");
pref("layout.accessiblecaret.bar.width", "2.0");
// Show the selection bars at the two ends of the selection highlight.
pref("layout.accessiblecaret.bar.enabled", true);
// Timeout in milliseconds to hide the accessiblecaret under cursor mode while
// no one touches it. Set the value to 0 to disable this feature.
pref("layout.accessiblecaret.timeout_ms", 3000);