mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 761589 - Refactor accessibility.force_disabled to work on Mac too and make it tri-state. r=tbsaunde
This commit is contained in:
parent
912261b09f
commit
b6e65bfdfa
@ -63,6 +63,7 @@
|
||||
#include "nsTextFragment.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
@ -1819,8 +1820,30 @@ nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
|
||||
// Services
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
mozilla::a11y::FocusManager*
|
||||
mozilla::a11y::FocusMgr()
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
FocusManager*
|
||||
FocusMgr()
|
||||
{
|
||||
return nsAccessibilityService::gAccessibilityService;
|
||||
}
|
||||
|
||||
EPlatformDisabledState
|
||||
PlatformDisabledState()
|
||||
{
|
||||
static int disabledState = 0xff;
|
||||
|
||||
if (disabledState == 0xff) {
|
||||
disabledState = Preferences::GetInt("accessibility.force_disabled", 0);
|
||||
if (disabledState < ePlatformIsForceEnabled)
|
||||
disabledState = ePlatformIsForceEnabled;
|
||||
else if (disabledState > ePlatformIsDisabled)
|
||||
disabledState = ePlatformIsDisabled;
|
||||
}
|
||||
|
||||
return (EPlatformDisabledState)disabledState;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,17 @@ namespace a11y {
|
||||
*/
|
||||
FocusManager* FocusMgr();
|
||||
|
||||
enum EPlatformDisabledState {
|
||||
ePlatformIsForceEnabled = -1,
|
||||
ePlatformIsEnabled = 0,
|
||||
ePlatformIsDisabled = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the platform disabled state.
|
||||
*/
|
||||
EPlatformDisabledState PlatformDisabledState();
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
/**
|
||||
* Perform initialization that should be done as soon as possible, in order
|
||||
|
@ -13,12 +13,14 @@
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
// Mac a11y whitelisting
|
||||
static bool sA11yShouldBeEnabled = false;
|
||||
|
||||
bool
|
||||
ShouldA11yBeEnabled()
|
||||
{
|
||||
return sA11yShouldBeEnabled;
|
||||
EPlatformDisabledState disabledState = PlatformDisabledState();
|
||||
return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -253,10 +253,6 @@ pref("accessibility.browsewithcaret_shortcut.enabled", true);
|
||||
pref("accessibility.tabfocus", 7);
|
||||
pref("accessibility.tabfocus_applies_to_xul", false);
|
||||
|
||||
// Forcibly disable a11y on win32, even if something attempts
|
||||
// to enable it.
|
||||
pref("accessibility.win32.force_disabled", false);
|
||||
|
||||
// On OS X, we follow the "Click in the scrollbar to:" system preference
|
||||
// unless this preference was set manually
|
||||
pref("ui.scrollToClick", 0);
|
||||
@ -266,6 +262,19 @@ pref("ui.scrollToClick", 0);
|
||||
pref("accessibility.tabfocus_applies_to_xul", true);
|
||||
#endif
|
||||
|
||||
// We want the ability to forcibly disable platform a11y, because
|
||||
// some non-a11y-related components attempt to bring it up. See bug
|
||||
// 538530 for details about Windows; we have a pref here that allows it
|
||||
// to be disabled for performance and testing resons.
|
||||
// See bug 761589 for the crossplatform aspect.
|
||||
//
|
||||
// This pref is checked only once, and the browser needs a restart to
|
||||
// pick up any changes.
|
||||
//
|
||||
// Values are -1 always on. 1 always off, 0 is auto as some platform perform
|
||||
// further checks.
|
||||
pref("accessibility.force_disabled", 0);
|
||||
|
||||
pref("focusmanager.testmode", false);
|
||||
|
||||
pref("accessibility.usetexttospeech", "");
|
||||
|
@ -137,6 +137,7 @@
|
||||
#if defined(ACCESSIBILITY)
|
||||
#include "oleidl.h"
|
||||
#include <winuser.h>
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#if !defined(WINABLEAPI)
|
||||
#include <winable.h>
|
||||
@ -7337,27 +7338,9 @@ bool nsWindow::AssociateDefaultIMC(bool aAssociate)
|
||||
Accessible*
|
||||
nsWindow::GetRootAccessible()
|
||||
{
|
||||
// We want the ability to forcibly disable a11y on windows, because
|
||||
// some non-a11y-related components attempt to bring it up. See bug
|
||||
// 538530 for details; we have a pref here that allows it to be disabled
|
||||
// for performance and testing resons.
|
||||
//
|
||||
// This pref is checked only once, and the browser needs a restart to
|
||||
// pick up any changes.
|
||||
static int accForceDisable = -1;
|
||||
|
||||
if (accForceDisable == -1) {
|
||||
const char* kPrefName = "accessibility.win32.force_disabled";
|
||||
if (Preferences::GetBool(kPrefName, false)) {
|
||||
accForceDisable = 1;
|
||||
} else {
|
||||
accForceDisable = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// If the pref was true, return null here, disabling a11y.
|
||||
if (accForceDisable)
|
||||
return nsnull;
|
||||
// If the pref was ePlatformIsDisabled, return null here, disabling a11y.
|
||||
if (a11y::PlatformDisabledState() == a11y::ePlatformIsDisabled)
|
||||
return nsnull;
|
||||
|
||||
if (mInDtor || mOnDestroyCalled || mWindowType == eWindowType_invisible) {
|
||||
return nsnull;
|
||||
|
Loading…
Reference in New Issue
Block a user