mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Merge mozilla-central to build-system.
This commit is contained in:
commit
bc25d3499c
1
.hgtags
1
.hgtags
@ -61,3 +61,4 @@ b70744835d94e54eec97b8fd186c96da5708a506 PRE_MOBILE_MERGE
|
||||
b70744835d94e54eec97b8fd186c96da5708a506 PRE_MOBILE_MERGE_20110406
|
||||
a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE
|
||||
a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE_20110406
|
||||
a95d426422816513477e5863add1b00ac7041dcb AURORA_BASE_20110412
|
||||
|
@ -38,6 +38,9 @@
|
||||
|
||||
#include "nsAccessNodeWrap.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsMaiInterfaceText.h"
|
||||
|
||||
PRBool nsAccessNodeWrap::gHaveNewTextSignals = PR_FALSE;
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
@ -68,6 +71,7 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
|
||||
void nsAccessNodeWrap::InitAccessibility()
|
||||
{
|
||||
nsAccessNode::InitXPAccessibility();
|
||||
gHaveNewTextSignals = g_signal_lookup("text-insert", ATK_TYPE_TEXT);
|
||||
}
|
||||
|
||||
void nsAccessNodeWrap::ShutdownAccessibility()
|
||||
|
@ -53,6 +53,13 @@ public: // construction, destruction
|
||||
|
||||
static void InitAccessibility();
|
||||
static void ShutdownAccessibility();
|
||||
|
||||
/*
|
||||
* do we have text-remove and text-insert signals if not we need to use
|
||||
* text-changed see nsAccessibleWrap::FireAtkTextChangedEvent() and
|
||||
* bug 619002
|
||||
*/
|
||||
static PRBool gHaveNewTextSignals;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "nsRoleMap.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsStateMap.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsMaiInterfaceComponent.h"
|
||||
#include "nsMaiInterfaceAction.h"
|
||||
@ -796,17 +797,15 @@ ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
|
||||
return objAttributeSet;
|
||||
}
|
||||
|
||||
AtkAttributeSet *
|
||||
GetAttributeSet(nsIAccessible* aAccessible)
|
||||
AtkAttributeSet*
|
||||
GetAttributeSet(nsAccessible* aAccessible)
|
||||
{
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
aAccessible->GetAttributes(getter_AddRefs(attributes));
|
||||
|
||||
if (attributes) {
|
||||
// Deal with attributes that we only need to expose in ATK
|
||||
PRUint32 state;
|
||||
aAccessible->GetState(&state, nsnull);
|
||||
if (state & nsIAccessibleStates::STATE_HASPOPUP) {
|
||||
if (aAccessible->State() & states::HASPOPUP) {
|
||||
// There is no ATK state for haspopup, must use object attribute to expose the same info
|
||||
nsAutoString oldValueUnused;
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"), NS_LITERAL_STRING("true"),
|
||||
@ -905,25 +904,23 @@ getIndexInParentCB(AtkObject *aAtkObj)
|
||||
return parent->GetIndexOfEmbeddedChild(accWrap);
|
||||
}
|
||||
|
||||
static void TranslateStates(PRUint32 aState, const AtkStateMap *aStateMap,
|
||||
AtkStateSet *aStateSet)
|
||||
static void
|
||||
TranslateStates(PRUint64 aState, AtkStateSet* aStateSet)
|
||||
{
|
||||
NS_ASSERTION(aStateSet, "Can't pass in null state set");
|
||||
|
||||
// Convert every state to an entry in AtkStateMap
|
||||
PRUint32 stateIndex = 0;
|
||||
PRUint32 bitMask = 1;
|
||||
while (aStateMap[stateIndex].stateMapEntryType != kNoSuchState) {
|
||||
if (aStateMap[stateIndex].atkState) { // There's potentially an ATK state for this
|
||||
PRUint64 bitMask = 1;
|
||||
while (gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState) {
|
||||
if (gAtkStateMap[stateIndex].atkState) { // There's potentially an ATK state for this
|
||||
PRBool isStateOn = (aState & bitMask) != 0;
|
||||
if (aStateMap[stateIndex].stateMapEntryType == kMapOpposite) {
|
||||
if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite) {
|
||||
isStateOn = !isStateOn;
|
||||
}
|
||||
if (isStateOn) {
|
||||
atk_state_set_add_state(aStateSet, aStateMap[stateIndex].atkState);
|
||||
atk_state_set_add_state(aStateSet, gAtkStateMap[stateIndex].atkState);
|
||||
}
|
||||
}
|
||||
// Map extended state
|
||||
bitMask <<= 1;
|
||||
++ stateIndex;
|
||||
}
|
||||
@ -937,18 +934,12 @@ refStateSetCB(AtkObject *aAtkObj)
|
||||
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
|
||||
if (!accWrap) {
|
||||
TranslateStates(nsIAccessibleStates::EXT_STATE_DEFUNCT,
|
||||
gAtkStateMapExt, state_set);
|
||||
TranslateStates(states::DEFUNCT, state_set);
|
||||
return state_set;
|
||||
}
|
||||
|
||||
// Map states
|
||||
PRUint32 accState = 0, accExtState = 0;
|
||||
nsresult rv = accWrap->GetState(&accState, &accExtState);
|
||||
NS_ENSURE_SUCCESS(rv, state_set);
|
||||
|
||||
TranslateStates(accState, gAtkStateMap, state_set);
|
||||
TranslateStates(accExtState, gAtkStateMapExt, state_set);
|
||||
TranslateStates(accWrap->State(), state_set);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
@ -1086,9 +1077,7 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
// Fire state change event for focus
|
||||
nsRefPtr<AccEvent> stateChangeEvent =
|
||||
new AccStateChangeEvent(accessible,
|
||||
nsIAccessibleStates::STATE_FOCUSED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
new AccStateChangeEvent(accessible, states::FOCUSED, PR_TRUE);
|
||||
return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
|
||||
}
|
||||
} break;
|
||||
@ -1337,26 +1326,22 @@ nsAccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 state = event->GetState();
|
||||
PRBool isExtra = event->IsExtraState();
|
||||
PRBool isEnabled = event->IsStateEnabled();
|
||||
|
||||
PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(state);
|
||||
PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(event->GetState());
|
||||
if (stateIndex >= 0) {
|
||||
const AtkStateMap *atkStateMap = isExtra ? gAtkStateMapExt : gAtkStateMap;
|
||||
NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
|
||||
NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
|
||||
"No such state");
|
||||
|
||||
if (atkStateMap[stateIndex].atkState != kNone) {
|
||||
NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
|
||||
if (gAtkStateMap[stateIndex].atkState != kNone) {
|
||||
NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
|
||||
"State changes should not fired for this state");
|
||||
|
||||
if (atkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
|
||||
if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
|
||||
isEnabled = !isEnabled;
|
||||
|
||||
// Fire state change for first state if there is one to map
|
||||
atk_object_notify_state_change(aObject,
|
||||
atkStateMap[stateIndex].atkState,
|
||||
gAtkStateMap[stateIndex].atkState,
|
||||
isEnabled);
|
||||
}
|
||||
}
|
||||
@ -1376,14 +1361,27 @@ nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
||||
PRInt32 start = event->GetStartOffset();
|
||||
PRUint32 length = event->GetLength();
|
||||
PRBool isInserted = event->IsTextInserted();
|
||||
|
||||
PRBool isFromUserInput = aEvent->IsFromUserInput();
|
||||
char* signal_name = nsnull;
|
||||
|
||||
char *signal_name = g_strconcat(isInserted ? "text_changed::insert" : "text_changed::delete",
|
||||
isFromUserInput ? "" : kNonUserInputEvent, NULL);
|
||||
g_signal_emit_by_name(aObject, signal_name, start, length);
|
||||
g_free (signal_name);
|
||||
if (gHaveNewTextSignals) {
|
||||
nsAutoString text;
|
||||
event->GetModifiedText(text);
|
||||
signal_name = g_strconcat(isInserted ? "text-insert" : "text-remove",
|
||||
isFromUserInput ? "" : "::system", NULL);
|
||||
g_signal_emit_by_name(aObject, signal_name, start, length,
|
||||
NS_ConvertUTF16toUTF8(text).get());
|
||||
} else {
|
||||
// XXX remove this code and the gHaveNewTextSignals check when we can
|
||||
// stop supporting old atk since it doesn't really work anyway
|
||||
// see bug 619002
|
||||
signal_name = g_strconcat(isInserted ? "text_changed::insert" :
|
||||
"text_changed::delete",
|
||||
isFromUserInput ? "" : kNonUserInputEvent, NULL);
|
||||
g_signal_emit_by_name(aObject, signal_name, start, length);
|
||||
}
|
||||
|
||||
g_free(signal_name);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ struct AtkStateMap {
|
||||
AtkStateType atkState;
|
||||
EStateMapEntryType stateMapEntryType;
|
||||
|
||||
static PRInt32 GetStateIndexFor(PRUint32 aState)
|
||||
static PRInt32 GetStateIndexFor(PRUint64 aState)
|
||||
{
|
||||
PRInt32 stateIndex = -1;
|
||||
while (aState > 0) {
|
||||
@ -93,72 +93,53 @@ struct AtkStateMap {
|
||||
|
||||
|
||||
// Map array from cross platform roles to ATK roles
|
||||
static const AtkStateMap gAtkStateMap[] = { // Cross Platform States
|
||||
{ kNone, kMapOpposite }, // nsIAccessibleStates::STATE_UNAVAILABLE = 0x00000001
|
||||
{ ATK_STATE_SELECTED, kMapDirectly }, // nsIAccessibleStates::STATE_SELECTED = 0x00000002
|
||||
{ ATK_STATE_FOCUSED, kMapDirectly }, // nsIAccessibleStates::STATE_FOCUSED = 0x00000004
|
||||
{ ATK_STATE_PRESSED, kMapDirectly }, // nsIAccessibleStates::STATE_PRESSED = 0x00000008
|
||||
{ ATK_STATE_CHECKED, kMapDirectly }, // nsIAccessibleStates::STATE_CHECKED = 0x00000010
|
||||
{ ATK_STATE_INDETERMINATE, kMapDirectly }, // nsIAccessibleStates::STATE_MIXED = 0x00000020
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_READONLY = 0x00000040
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_HOTTRACKED = 0x00000080
|
||||
{ ATK_STATE_DEFAULT, kMapDirectly }, // nsIAccessibleStates::STATE_DEFAULT = 0x00000100
|
||||
{ ATK_STATE_EXPANDED, kMapDirectly }, // nsIAccessibleStates::STATE_EXPANDED = 0x00000200
|
||||
{ kNone, kNoStateChange }, // nsIAccessibleStates::STATE_COLLAPSED = 0x00000400
|
||||
{ ATK_STATE_BUSY, kMapDirectly }, // nsIAccessibleStates::STATE_BUSY = 0x00000800
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_FLOATING = 0x00001000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_CHECKABLE = 0x00002000
|
||||
{ ATK_STATE_ANIMATED, kMapDirectly }, // nsIAccessibleStates::STATE_ANIMATED = 0x00004000
|
||||
{ ATK_STATE_VISIBLE, kMapOpposite }, // nsIAccessibleStates::STATE_INVISIBLE = 0x00008000
|
||||
{ ATK_STATE_SHOWING, kMapOpposite }, // nsIAccessibleStates::STATE_OFFSCREEN = 0x00010000
|
||||
{ ATK_STATE_RESIZABLE, kMapDirectly }, // nsIAccessibleStates::STATE_SIZEABLE = 0x00020000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_MOVEABLE = 0x00040000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_SELFVOICING = 0x00080000
|
||||
{ ATK_STATE_FOCUSABLE, kMapDirectly }, // nsIAccessibleStates::STATE_FOCUSABLE = 0x00100000
|
||||
{ ATK_STATE_SELECTABLE, kMapDirectly }, // nsIAccessibleStates::STATE_SELECTABLE = 0x00200000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_LINKED = 0x00400000
|
||||
{ ATK_STATE_VISITED, kMapDirectly }, // nsIAccessibleStates::STATE_TRAVERSED = 0x00800000
|
||||
{ ATK_STATE_MULTISELECTABLE, kMapDirectly }, // nsIAccessibleStates::STATE_MULTISELECTABLE = 0x01000000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_EXTSELECTABLE = 0x02000000
|
||||
{ ATK_STATE_REQUIRED, kMapDirectly }, // nsIAccessibleStates::STATE_REQUIRED = 0x04000000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_ALERT_MEDIUM = 0x08000000
|
||||
{ ATK_STATE_INVALID_ENTRY, kMapDirectly }, // nsIAccessibleStates::STATE_INVALID = 0x10000000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_PROTECTED = 0x20000000
|
||||
{ kNone, kMapDirectly }, // nsIAccessibleStates::STATE_HASPOPUP = 0x40000000
|
||||
{ kNone, kNoSuchState }, // = 0x80000000
|
||||
};
|
||||
|
||||
static const AtkStateMap gAtkStateMapExt[] = { // Cross Platform States
|
||||
{ ATK_STATE_SUPPORTS_AUTOCOMPLETION, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION = 0x00000001
|
||||
{ ATK_STATE_DEFUNCT, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_DEFUNCT = 0x00000002
|
||||
{ ATK_STATE_SELECTABLE_TEXT, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_SELECTABLE_TEXT = 0x00000004
|
||||
{ ATK_STATE_EDITABLE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_EDITABLE = 0x00000008
|
||||
{ ATK_STATE_ACTIVE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_ACTIVE = 0x00000010
|
||||
{ ATK_STATE_MODAL, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_MODAL = 0x00000020
|
||||
{ ATK_STATE_MULTI_LINE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_MULTI_LINE = 0x00000040
|
||||
{ ATK_STATE_HORIZONTAL, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_HORIZONTAL = 0x00000080
|
||||
{ ATK_STATE_OPAQUE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_OPAQUE = 0x00000100
|
||||
{ ATK_STATE_SINGLE_LINE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_SINGLE_LINE = 0x00000200
|
||||
{ ATK_STATE_TRANSIENT, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_TRANSIENT = 0x00000400
|
||||
{ ATK_STATE_VERTICAL, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_VERTICAL = 0x00000800
|
||||
{ ATK_STATE_STALE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_STALE = 0x00001000
|
||||
{ ATK_STATE_ENABLED, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_ENABLED = 0x00002000
|
||||
{ ATK_STATE_SENSITIVE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_SENSITIVE = 0x00004000
|
||||
{ ATK_STATE_EXPANDABLE, kMapDirectly }, // nsIAccessibleStates::EXT_STATE_EXPANDABLE = 0x00008000
|
||||
{ kNone, kNoSuchState }, // = 0x00010000
|
||||
{ kNone, kNoSuchState }, // = 0x00020000
|
||||
{ kNone, kNoSuchState }, // = 0x00040000
|
||||
{ kNone, kNoSuchState }, // = 0x00080000
|
||||
{ kNone, kNoSuchState }, // = 0x00100000
|
||||
{ kNone, kNoSuchState }, // = 0x00200000
|
||||
{ kNone, kNoSuchState }, // = 0x00400000
|
||||
{ kNone, kNoSuchState }, // = 0x00800000
|
||||
{ kNone, kNoSuchState }, // = 0x01000000
|
||||
{ kNone, kNoSuchState }, // = 0x02000000
|
||||
{ kNone, kNoSuchState }, // = 0x04000000
|
||||
{ kNone, kNoSuchState }, // = 0x08000000
|
||||
{ kNone, kNoSuchState }, // = 0x10000000
|
||||
{ kNone, kNoSuchState }, // = 0x20000000
|
||||
{ kNone, kNoSuchState }, // = 0x40000000
|
||||
{ kNone, kNoSuchState }, // = 0x80000000
|
||||
static const AtkStateMap gAtkStateMap[] = { // Cross Platform States
|
||||
{ kNone, kMapOpposite }, // states::UNAVAILABLE = 1 << 0
|
||||
{ ATK_STATE_SELECTED, kMapDirectly }, // states::SELECTED = 1 << 1
|
||||
{ ATK_STATE_FOCUSED, kMapDirectly }, // states::FOCUSED = 1 << 2
|
||||
{ ATK_STATE_PRESSED, kMapDirectly }, // states::PRESSED = 1 << 3
|
||||
{ ATK_STATE_CHECKED, kMapDirectly }, // states::CHECKED = 1 << 4
|
||||
{ ATK_STATE_INDETERMINATE, kMapDirectly }, // states::MIXED = 1 << 5
|
||||
{ kNone, kMapDirectly }, // states::READONLY = 1 << 6
|
||||
{ kNone, kMapDirectly }, // states::HOTTRACKED = 1 << 7
|
||||
{ ATK_STATE_DEFAULT, kMapDirectly }, // states::DEFAULT = 1 << 8
|
||||
{ ATK_STATE_EXPANDED, kMapDirectly }, // states::EXPANDED = 1 << 9
|
||||
{ kNone, kNoStateChange }, // states::COLLAPSED = 1 << 10
|
||||
{ ATK_STATE_BUSY, kMapDirectly }, // states::BUSY = 1 << 11
|
||||
{ kNone, kMapDirectly }, // states::FLOATING = 1 << 12
|
||||
{ kNone, kMapDirectly }, // states::CHECKABLE = 1 << 13
|
||||
{ ATK_STATE_ANIMATED, kMapDirectly }, // states::ANIMATED = 1 << 14
|
||||
{ ATK_STATE_VISIBLE, kMapOpposite }, // states::INVISIBLE = 1 << 15
|
||||
{ ATK_STATE_SHOWING, kMapOpposite }, // states::OFFSCREEN = 1 << 16
|
||||
{ ATK_STATE_RESIZABLE, kMapDirectly }, // states::SIZEABLE = 1 << 17
|
||||
{ kNone, kMapDirectly }, // states::MOVEABLE = 1 << 18
|
||||
{ kNone, kMapDirectly }, // states::SELFVOICING = 1 << 19
|
||||
{ ATK_STATE_FOCUSABLE, kMapDirectly }, // states::FOCUSABLE = 1 << 20
|
||||
{ ATK_STATE_SELECTABLE, kMapDirectly }, // states::SELECTABLE = 1 << 21
|
||||
{ kNone, kMapDirectly }, // states::LINKED = 1 << 22
|
||||
{ ATK_STATE_VISITED, kMapDirectly }, // states::TRAVERSED = 1 << 23
|
||||
{ ATK_STATE_MULTISELECTABLE, kMapDirectly }, // states::MULTISELECTABLE = 1 << 24
|
||||
{ kNone, kMapDirectly }, // states::EXTSELECTABLE = 1 << 25
|
||||
{ ATK_STATE_REQUIRED, kMapDirectly }, // states::STATE_REQUIRED = 1 << 26
|
||||
{ kNone, kMapDirectly }, // states::ALERT_MEDIUM = 1 << 27
|
||||
{ ATK_STATE_INVALID_ENTRY, kMapDirectly }, // states::INVALID = 1 << 28
|
||||
{ kNone, kMapDirectly }, // states::PROTECTED = 1 << 29
|
||||
{ kNone, kMapDirectly }, // states::HASPOPUP = 1 << 30
|
||||
{ ATK_STATE_SUPPORTS_AUTOCOMPLETION, kMapDirectly }, // states::SUPPORTS_AUTOCOMPLETION = 1 << 31
|
||||
{ ATK_STATE_DEFUNCT, kMapDirectly }, // states::DEFUNCT = 1 << 32
|
||||
{ ATK_STATE_SELECTABLE_TEXT, kMapDirectly }, // states::SELECTABLE_TEXT = 1 << 33
|
||||
{ ATK_STATE_EDITABLE, kMapDirectly }, // states::EDITABLE = 1 << 34
|
||||
{ ATK_STATE_ACTIVE, kMapDirectly }, // states::ACTIVE = 1 << 35
|
||||
{ ATK_STATE_MODAL, kMapDirectly }, // states::MODAL = 1 << 36
|
||||
{ ATK_STATE_MULTI_LINE, kMapDirectly }, // states::MULTI_LINE = 1 << 37
|
||||
{ ATK_STATE_HORIZONTAL, kMapDirectly }, // states::HORIZONTAL = 1 << 38
|
||||
{ ATK_STATE_OPAQUE, kMapDirectly }, // states::OPAQUE = 1 << 39
|
||||
{ ATK_STATE_SINGLE_LINE, kMapDirectly }, // states::SINGLE_LINE = 1 << 40
|
||||
{ ATK_STATE_TRANSIENT, kMapDirectly }, // states::TRANSIENT = 1 << 41
|
||||
{ ATK_STATE_VERTICAL, kMapDirectly }, // states::VERTICAL = 1 << 42
|
||||
{ ATK_STATE_STALE, kMapDirectly }, // states::STALE = 1 << 43
|
||||
{ ATK_STATE_ENABLED, kMapDirectly }, // states::ENABLED = 1 << 44
|
||||
{ ATK_STATE_SENSITIVE, kMapDirectly }, // states::SENSITIVE = 1 << 45
|
||||
{ ATK_STATE_EXPANDABLE, kMapDirectly }, // states::EXPANDABLE = 1 << 46
|
||||
{ kNone, kNoSuchState }, // = 1 << 47
|
||||
};
|
||||
|
@ -221,39 +221,30 @@ AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
// support correct state change coalescence (XXX Bug 569356). Also we need to
|
||||
// decide how to coalesce events created via accessible (instead of node).
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsAccessible* aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
AccStateChangeEvent(nsAccessible* aAccessible, PRUint64 aState,
|
||||
PRBool aIsEnabled, EIsFromUserInput aIsFromUserInput):
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled):
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, PRBool aIsEnabled):
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
mState(aState), mIsExtraState(aIsExtraState)
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode), mState(aState)
|
||||
{
|
||||
// Use GetAccessibleForNode() because we do not want to store an accessible
|
||||
// since it leads to problems with delayed events in the case when
|
||||
// an accessible gets reorder event before delayed event is processed.
|
||||
nsAccessible *accessible = GetAccessibleForNode();
|
||||
if (accessible) {
|
||||
PRUint32 state = 0, extraState = 0;
|
||||
accessible->GetState(&state, mIsExtraState ? &extraState : nsnull);
|
||||
mIsEnabled = ((mIsExtraState ? extraState : state) & mState) != 0;
|
||||
} else {
|
||||
mIsEnabled = PR_FALSE;
|
||||
}
|
||||
mIsEnabled = accessible && ((accessible->State() & mState) != 0);
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
|
@ -168,15 +168,13 @@ protected:
|
||||
class AccStateChangeEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
AccStateChangeEvent(nsAccessible* aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
AccStateChangeEvent(nsAccessible* aAccessible, PRUint64 aState,
|
||||
PRBool aIsEnabled,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled);
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, PRBool aIsEnabled);
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState);
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState);
|
||||
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
@ -188,13 +186,11 @@ public:
|
||||
}
|
||||
|
||||
// AccStateChangeEvent
|
||||
PRUint32 GetState() const { return mState; }
|
||||
PRBool IsExtraState() const { return mIsExtraState; }
|
||||
PRUint64 GetState() const { return mState; }
|
||||
PRBool IsStateEnabled() const { return mIsEnabled; }
|
||||
|
||||
private:
|
||||
PRUint32 mState;
|
||||
PRBool mIsExtraState;
|
||||
PRUint64 mState;
|
||||
PRBool mIsEnabled;
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "AccGroupInfo.h"
|
||||
|
||||
#include "States.h"
|
||||
|
||||
AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
|
||||
mPosInSet(0), mSetSize(0), mParent(nsnull)
|
||||
{
|
||||
@ -59,8 +61,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
|
||||
break;
|
||||
|
||||
// If sibling is not visible and hasn't the same base role.
|
||||
if (BaseRole(siblingRole) != aRole ||
|
||||
nsAccUtils::State(sibling) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
if (BaseRole(siblingRole) != aRole || sibling->State() & states::INVISIBLE)
|
||||
continue;
|
||||
|
||||
// Check if it's hierarchical flatten structure, i.e. if the sibling
|
||||
@ -103,8 +104,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
|
||||
break;
|
||||
|
||||
// If sibling is visible and has the same base role
|
||||
if (BaseRole(siblingRole) != aRole ||
|
||||
nsAccUtils::State(sibling) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
if (BaseRole(siblingRole) != aRole || sibling->State() & states::INVISIBLE)
|
||||
continue;
|
||||
|
||||
// and check if it's hierarchical flatten structure.
|
||||
|
309
accessible/src/base/States.h
Normal file
309
accessible/src/base/States.h
Normal file
@ -0,0 +1,309 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Trevor Saunders
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Trevor Saunders <trev.saunders@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _states_h_
|
||||
#define _states_h_
|
||||
|
||||
#include <prtypes.h>
|
||||
|
||||
namespace states {
|
||||
|
||||
/**
|
||||
* The object is disabled, opposite to enabled and sensitive.
|
||||
*/
|
||||
const PRUint64 UNAVAILABLE = ((PRUint64) 0x1) << 0;
|
||||
|
||||
/**
|
||||
* The object is selected.
|
||||
*/
|
||||
const PRUint64 SELECTED = ((PRUint64) 0x1) << 1;
|
||||
|
||||
/**
|
||||
* The object has the keyboard focus.
|
||||
*/
|
||||
const PRUint64 FOCUSED = ((PRUint64) 0x1) << 2;
|
||||
|
||||
/**
|
||||
* The object is pressed.
|
||||
*/
|
||||
const PRUint64 PRESSED = ((PRUint64) 0x1) << 3;
|
||||
|
||||
/**
|
||||
* The checkable object is checked, applied to check box controls,
|
||||
* @see CHECKABLE and MIXED states.
|
||||
*/
|
||||
const PRUint64 CHECKED = ((PRUint64) 0x1) << 4;
|
||||
|
||||
/**
|
||||
* Indicates that the state of a three-state check box or tool bar button is
|
||||
* undetermined. The check box is neither checked or unchecked, and is
|
||||
* in the third or mixed state.
|
||||
*/
|
||||
const PRUint64 MIXED = ((PRUint64) 0x1) << 5;
|
||||
|
||||
/**
|
||||
* The object is designated read-only, so it can't be edited.
|
||||
*/
|
||||
const PRUint64 READONLY = ((PRUint64) 0x1) << 6;
|
||||
|
||||
/**
|
||||
* The object is hot-tracked by the mouse, which means that its appearance
|
||||
* has changed to indicate that the mouse pointer is located over it.
|
||||
*
|
||||
* This is currently unused.
|
||||
*/
|
||||
const PRUint64 HOTTRACKED = ((PRUint64) 0x1) << 7;
|
||||
|
||||
/**
|
||||
* This object is the default button in a window.
|
||||
*/
|
||||
const PRUint64 DEFAULT = ((PRUint64) 0x1) << 8;
|
||||
|
||||
/**
|
||||
* The expandable object's children are displayed, the opposite of collapsed,
|
||||
* applied to trees, list and other controls.
|
||||
* @see COLLAPSED state
|
||||
*/
|
||||
const PRUint64 EXPANDED = ((PRUint64) 0x1) << 9;
|
||||
|
||||
/**
|
||||
* The expandable object's children are not displayed, the opposite of
|
||||
* expanded, applied to tree lists and other controls,
|
||||
* @see EXPANDED state.
|
||||
*/
|
||||
const PRUint64 COLLAPSED = ((PRUint64) 0x1) << 10;
|
||||
|
||||
/**
|
||||
* The control or document can not accept input at this time.
|
||||
*/
|
||||
const PRUint64 BUSY = ((PRUint64) 0x1) << 11;
|
||||
|
||||
/**
|
||||
* The object is out of normal flow, may be outside of boundaries of its
|
||||
* parent.
|
||||
*/
|
||||
const PRUint64 FLOATING = ((PRUint64) 0x1) << 12;
|
||||
|
||||
/**
|
||||
* The object can be checked.
|
||||
*/
|
||||
const PRUint64 CHECKABLE = ((PRUint64) 0x1) << 13;
|
||||
|
||||
/**
|
||||
* This object is a graphic which is rapidly changing appearance.
|
||||
*/
|
||||
const PRUint64 ANIMATED = ((PRUint64) 0x1) << 14;
|
||||
|
||||
/**
|
||||
* The object is programmatically hidden.
|
||||
* So user action like scrolling or switching tabs won't make this visible.
|
||||
*/
|
||||
const PRUint64 INVISIBLE = ((PRUint64) 0x1) << 15;
|
||||
|
||||
/**
|
||||
* The object is scrolled off screen.
|
||||
* User action such as scrolling or changing tab may make the object
|
||||
* visible.
|
||||
*/
|
||||
const PRUint64 OFFSCREEN = ((PRUint64) 0x1) << 16;
|
||||
|
||||
/**
|
||||
* The object can be resized.
|
||||
*/
|
||||
const PRUint64 SIZEABLE = ((PRUint64) 0x1) << 17;
|
||||
|
||||
/**
|
||||
* The object can be moved to a different position.
|
||||
*/
|
||||
const PRUint64 MOVEABLE = ((PRUint64) 0x1) << 18;
|
||||
|
||||
/**
|
||||
* The object describes itself with speech.
|
||||
* Other speech related assistive technology may want to avoid speaking
|
||||
* information about this object, because the object is already doing this.
|
||||
*/
|
||||
const PRUint64 SELFVOICING = ((PRUint64) 0x1) << 19;
|
||||
|
||||
/**
|
||||
* The object can have the focus and become focused.
|
||||
*/
|
||||
const PRUint64 FOCUSABLE = ((PRUint64) 0x1) << 20;
|
||||
|
||||
/**
|
||||
* The object can be selected.
|
||||
*/
|
||||
const PRUint64 SELECTABLE = ((PRUint64) 0x1) << 21;
|
||||
|
||||
/**
|
||||
* This object is a link.
|
||||
*/
|
||||
const PRUint64 LINKED = ((PRUint64) 0x1) << 22;
|
||||
|
||||
/**
|
||||
* This is used for links that have been traversed
|
||||
* i.e. the linked page has been visited.
|
||||
*/
|
||||
const PRUint64 TRAVERSED = ((PRUint64) 0x1) << 23;
|
||||
|
||||
/**
|
||||
* Supports multiple selection.
|
||||
*/
|
||||
const PRUint64 MULTISELECTABLE = ((PRUint64) 0x1) << 24;
|
||||
|
||||
/**
|
||||
* Supports extended selection.
|
||||
* All objects supporting this are also multipselectable.
|
||||
* This only makes sense for msaa see bug 635690.
|
||||
*/
|
||||
const PRUint64 EXTSELECTABLE = ((PRUint64) 0x1) << 25;
|
||||
|
||||
/**
|
||||
* The user is required to interact with this object.
|
||||
*/
|
||||
const PRUint64 REQUIRED = ((PRUint64) 0x1) << 26;
|
||||
|
||||
/**
|
||||
* The object is an alert, notifying the user of something important.
|
||||
*/
|
||||
const PRUint64 ALERT = ((PRUint64) 0x1) << 27;
|
||||
|
||||
/**
|
||||
* Used for text fields containing invalid values.
|
||||
*/
|
||||
const PRUint64 INVALID = ((PRUint64) 0x1) << 28;
|
||||
|
||||
/**
|
||||
* The controls value can not be obtained, and is returned as a set of "*"s.
|
||||
*/
|
||||
const PRUint64 PROTECTED = ((PRUint64) 0x1) << 29;
|
||||
|
||||
/**
|
||||
* The object can be invoked to show a pop up menu or window.
|
||||
*/
|
||||
const PRUint64 HASPOPUP = ((PRUint64) 0x1) << 30;
|
||||
|
||||
/**
|
||||
* The editable area has some kind of autocompletion.
|
||||
*/
|
||||
const PRUint64 SUPPORTS_AUTOCOMPLETION = ((PRUint64) 0x1) << 31;
|
||||
|
||||
/**
|
||||
* The object is no longer available to be queried.
|
||||
*/
|
||||
const PRUint64 DEFUNCT = ((PRUint64) 0x1) << 32;
|
||||
|
||||
/**
|
||||
* The text is selectable, the object must implement the text interface.
|
||||
*/
|
||||
const PRUint64 SELECTABLE_TEXT = ((PRUint64) 0x1) << 33;
|
||||
|
||||
/**
|
||||
* The text in this object can be edited.
|
||||
*/
|
||||
const PRUint64 EDITABLE = ((PRUint64) 0x1) << 34;
|
||||
|
||||
/**
|
||||
* This window is currently the active window.
|
||||
*/
|
||||
const PRUint64 ACTIVE = ((PRUint64) 0x1) << 35;
|
||||
|
||||
/**
|
||||
* Indicates that the object is modal. Modal objects have the behavior
|
||||
* that something must be done with the object before the user can
|
||||
* interact with an object in a different window.
|
||||
*/
|
||||
const PRUint64 MODAL = ((PRUint64) 0x1) << 36;
|
||||
|
||||
/**
|
||||
* Edit control that can take multiple lines.
|
||||
*/
|
||||
const PRUint64 MULTI_LINE = ((PRUint64) 0x1) << 37;
|
||||
|
||||
/**
|
||||
* Uses horizontal layout.
|
||||
*/
|
||||
const PRUint64 HORIZONTAL = ((PRUint64) 0x1) << 38;
|
||||
|
||||
/**
|
||||
* Indicates this object paints every pixel within its rectangular region.
|
||||
*/
|
||||
const PRUint64 OPAQUE1 = ((PRUint64) 0x1) << 39;
|
||||
|
||||
/**
|
||||
* This text object can only contain 1 line of text.
|
||||
*/
|
||||
const PRUint64 SINGLE_LINE = ((PRUint64) 0x1) << 40;
|
||||
|
||||
/**
|
||||
* The parent object manages descendants, and this object may only exist
|
||||
* while it is visible or has focus.
|
||||
* For example the focused cell of a table or the current element of a list box may have this state.
|
||||
*/
|
||||
const PRUint64 TRANSIENT = ((PRUint64) 0x1) << 41;
|
||||
|
||||
/**
|
||||
* Uses vertical layout.
|
||||
* Especially used for sliders and scrollbars.
|
||||
*/
|
||||
const PRUint64 VERTICAL = ((PRUint64) 0x1) << 42;
|
||||
|
||||
/**
|
||||
* Object not dead, but not up-to-date either.
|
||||
*/
|
||||
const PRUint64 STALE = ((PRUint64) 0x1) << 43;
|
||||
|
||||
/**
|
||||
* A widget that is not unavailable.
|
||||
*/
|
||||
const PRUint64 ENABLED = ((PRUint64) 0x1) << 44;
|
||||
|
||||
/**
|
||||
* Same as ENABLED state for now see bug 636158
|
||||
*/
|
||||
const PRUint64 SENSITIVE = ((PRUint64) 0x1) << 45;
|
||||
|
||||
/**
|
||||
* The object is expandable, provides a UI to expand/collapse its children
|
||||
* @see EXPANDED and COLLAPSED states.
|
||||
*/
|
||||
const PRUint64 EXPANDABLE = ((PRUint64) 0x1) << 46;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -39,17 +39,18 @@
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
bool
|
||||
filters::GetSelected(nsAccessible* aAccessible)
|
||||
{
|
||||
return nsAccUtils::State(aAccessible) & nsIAccessibleStates::STATE_SELECTED;
|
||||
return aAccessible->State() & states::SELECTED;
|
||||
}
|
||||
|
||||
bool
|
||||
filters::GetSelectable(nsAccessible* aAccessible)
|
||||
{
|
||||
return nsAccUtils::State(aAccessible) & nsIAccessibleStates::STATE_SELECTABLE;
|
||||
return aAccessible->State() & states::SELECTABLE;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "AccIterator.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
@ -1109,33 +1110,27 @@ nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible
|
||||
|
||||
nsresult
|
||||
nsARIAGridCellAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
void
|
||||
nsARIAGridCellAccessible::ApplyARIAState(PRUint64* aState)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetARIAState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
|
||||
|
||||
// Return if the gridcell has aria-selected="true".
|
||||
if (*aState & nsIAccessibleStates::STATE_SELECTED)
|
||||
return NS_OK;
|
||||
if (*aState & states::SELECTED)
|
||||
return;
|
||||
|
||||
// Check aria-selected="true" on the row.
|
||||
nsAccessible* row = GetParent();
|
||||
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
nsIContent *rowContent = row->GetContent();
|
||||
if (nsAccUtils::HasDefinedARIAToken(rowContent,
|
||||
nsAccessibilityAtoms::aria_selected) &&
|
||||
!rowContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::aria_selected,
|
||||
nsAccessibilityAtoms::_false, eCaseMatters)) {
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTABLE |
|
||||
nsIAccessibleStates::STATE_SELECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
nsAccessibilityAtoms::_false, eCaseMatters))
|
||||
*aState |= states::SELECTABLE | states::SELECTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
NS_DECL_NSIACCESSIBLETABLECELL
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "nsARIAMap.h"
|
||||
|
||||
#include "nsIAccessibleRole.h"
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsIContent.h"
|
||||
@ -96,7 +96,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_READONLY
|
||||
states::READONLY
|
||||
},
|
||||
{
|
||||
"button",
|
||||
@ -137,7 +137,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eHasValueMinMax,
|
||||
eOpenCloseAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_COLLAPSED | nsIAccessibleStates::STATE_HASPOPUP,
|
||||
states::COLLAPSED | states::HASPOPUP,
|
||||
eARIAAutoComplete,
|
||||
eARIAReadonly
|
||||
},
|
||||
@ -166,7 +166,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_READONLY
|
||||
states::READONLY
|
||||
},
|
||||
{
|
||||
"grid",
|
||||
@ -175,7 +175,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_FOCUSABLE,
|
||||
states::FOCUSABLE,
|
||||
eARIAMultiSelectable,
|
||||
eARIAReadonly
|
||||
},
|
||||
@ -233,7 +233,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoValue,
|
||||
eJumpAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_LINKED
|
||||
states::LINKED
|
||||
},
|
||||
{
|
||||
"list",
|
||||
@ -242,7 +242,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_READONLY,
|
||||
states::READONLY,
|
||||
eARIAMultiSelectable
|
||||
},
|
||||
{
|
||||
@ -263,7 +263,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoValue,
|
||||
eNoAction, // XXX: should depend on state, parent accessible
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_READONLY,
|
||||
states::READONLY,
|
||||
eARIASelectable,
|
||||
eARIACheckedMixed
|
||||
},
|
||||
@ -370,7 +370,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eHasValueMinMax,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
nsIAccessibleStates::STATE_READONLY
|
||||
states::READONLY
|
||||
},
|
||||
{
|
||||
"radio",
|
||||
@ -600,86 +600,75 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
|
||||
|
||||
// eARIAAutoComplete
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_autocomplete,
|
||||
"inline", 0, nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"list", nsIAccessibleStates::STATE_HASPOPUP, nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"both", nsIAccessibleStates::STATE_HASPOPUP, nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION),
|
||||
"inline", states::SUPPORTS_AUTOCOMPLETION,
|
||||
"list", states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION,
|
||||
"both", states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION),
|
||||
|
||||
// eARIABusy
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_busy,
|
||||
"true", nsIAccessibleStates::STATE_BUSY, 0,
|
||||
"error", nsIAccessibleStates::STATE_INVALID, 0),
|
||||
"true", states::BUSY,
|
||||
"error", states::INVALID),
|
||||
|
||||
// eARIACheckableBool
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_checked, kBoolType,
|
||||
nsIAccessibleStates::STATE_CHECKABLE,
|
||||
nsIAccessibleStates::STATE_CHECKED, 0,
|
||||
0, 0, PR_TRUE),
|
||||
states::CHECKABLE, states::CHECKED, 0, PR_TRUE),
|
||||
|
||||
// eARIACheckableMixed
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_checked, kMixedType,
|
||||
nsIAccessibleStates::STATE_CHECKABLE,
|
||||
nsIAccessibleStates::STATE_CHECKED, 0,
|
||||
0, 0, PR_TRUE),
|
||||
states::CHECKABLE, states::CHECKED, 0, PR_TRUE),
|
||||
|
||||
// eARIACheckedMixed
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_checked, kMixedType,
|
||||
nsIAccessibleStates::STATE_CHECKABLE,
|
||||
nsIAccessibleStates::STATE_CHECKED, 0),
|
||||
states::CHECKABLE, states::CHECKED, 0),
|
||||
|
||||
// eARIADisabled
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_disabled, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_UNAVAILABLE, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_disabled, kBoolType,
|
||||
0, states::UNAVAILABLE),
|
||||
|
||||
// eARIAExpanded
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_expanded, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_EXPANDED, 0,
|
||||
nsIAccessibleStates::STATE_COLLAPSED, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_expanded, kBoolType,
|
||||
0, states::EXPANDED, states::COLLAPSED),
|
||||
|
||||
// eARIAHasPopup
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_haspopup, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_HASPOPUP, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_haspopup, kBoolType,
|
||||
0, states::HASPOPUP),
|
||||
|
||||
// eARIAInvalid
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_invalid, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_INVALID, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_invalid, kBoolType,
|
||||
0, states::INVALID),
|
||||
|
||||
// eARIAMultiline
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_multiline, kBoolType, 0,
|
||||
0, nsIAccessibleStates::EXT_STATE_MULTI_LINE,
|
||||
0, nsIAccessibleStates::EXT_STATE_SINGLE_LINE, PR_TRUE),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_multiline, kBoolType,
|
||||
0, states::MULTI_LINE, states::SINGLE_LINE, PR_TRUE),
|
||||
|
||||
// eARIAMultiSelectable
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_multiselectable, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_multiselectable, kBoolType,
|
||||
0, states::MULTISELECTABLE | states::EXTSELECTABLE),
|
||||
|
||||
// eARIAOrientation
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_orientation, eUseFirstState,
|
||||
"vertical", 0, nsIAccessibleStates::EXT_STATE_VERTICAL,
|
||||
"horizontal", 0, nsIAccessibleStates::EXT_STATE_HORIZONTAL),
|
||||
"vertical", states::VERTICAL,
|
||||
"horizontal", states::HORIZONTAL),
|
||||
|
||||
// eARIAPressed
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_pressed, kMixedType,
|
||||
nsIAccessibleStates::STATE_CHECKABLE,
|
||||
nsIAccessibleStates::STATE_PRESSED, 0),
|
||||
states::CHECKABLE, states::PRESSED),
|
||||
|
||||
// eARIAReadonly
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_readonly, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_READONLY, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_readonly, kBoolType,
|
||||
0, states::READONLY),
|
||||
|
||||
// eARIAReadonlyOrEditable
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_readonly, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_READONLY, 0,
|
||||
0, nsIAccessibleStates::EXT_STATE_EDITABLE, PR_TRUE),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_readonly, kBoolType,
|
||||
0, states::READONLY, states::EDITABLE, PR_TRUE),
|
||||
|
||||
// eARIARequired
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_required, kBoolType, 0,
|
||||
nsIAccessibleStates::STATE_REQUIRED, 0),
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_required, kBoolType,
|
||||
0, states::REQUIRED),
|
||||
|
||||
// eARIASelectable
|
||||
nsStateMapEntry(&nsAccessibilityAtoms::aria_selected, kBoolType,
|
||||
nsIAccessibleStates::STATE_SELECTABLE,
|
||||
nsIAccessibleStates::STATE_SELECTED, 0,
|
||||
0, 0, PR_TRUE)
|
||||
states::SELECTABLE, states::SELECTED, 0, PR_TRUE)
|
||||
};
|
||||
|
||||
/**
|
||||
@ -752,83 +741,66 @@ nsStateMapEntry::nsStateMapEntry() :
|
||||
mPermanentState(0),
|
||||
mValue1(nsnull),
|
||||
mState1(0),
|
||||
mExtraState1(0),
|
||||
mValue2(nsnull),
|
||||
mState2(0),
|
||||
mExtraState2(0),
|
||||
mValue3(nsnull),
|
||||
mState3(0),
|
||||
mExtraState3(0),
|
||||
mDefaultState(0),
|
||||
mDefaultExtraState(0),
|
||||
mDefinedIfAbsent(PR_FALSE)
|
||||
{}
|
||||
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName, eStateValueType aType,
|
||||
PRUint32 aPermanentState,
|
||||
PRUint32 aTrueState, PRUint32 aTrueExtraState,
|
||||
PRUint32 aFalseState, PRUint32 aFalseExtraState,
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
|
||||
PRUint64 aPermanentState,
|
||||
PRUint64 aTrueState,
|
||||
PRUint64 aFalseState,
|
||||
PRBool aDefinedIfAbsent) :
|
||||
mAttributeName(aAttrName),
|
||||
mIsToken(PR_TRUE),
|
||||
mPermanentState(aPermanentState),
|
||||
mValue1("false"),
|
||||
mState1(aFalseState),
|
||||
mExtraState1(aFalseExtraState),
|
||||
mValue2(nsnull),
|
||||
mState2(0),
|
||||
mExtraState2(0),
|
||||
mValue3(nsnull),
|
||||
mState3(0),
|
||||
mExtraState3(0),
|
||||
mDefaultState(aTrueState),
|
||||
mDefaultExtraState(aTrueExtraState),
|
||||
mDefinedIfAbsent(aDefinedIfAbsent)
|
||||
{
|
||||
if (aType == kMixedType) {
|
||||
mValue2 = "mixed";
|
||||
mState2 = nsIAccessibleStates::STATE_MIXED;
|
||||
mState2 = states::MIXED;
|
||||
}
|
||||
}
|
||||
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
|
||||
const char *aValue1,
|
||||
PRUint32 aState1, PRUint32 aExtraState1,
|
||||
const char *aValue2,
|
||||
PRUint32 aState2, PRUint32 aExtraState2,
|
||||
const char *aValue3,
|
||||
PRUint32 aState3, PRUint32 aExtraState3) :
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
|
||||
const char* aValue1, PRUint64 aState1,
|
||||
const char* aValue2, PRUint64 aState2,
|
||||
const char* aValue3, PRUint64 aState3) :
|
||||
mAttributeName(aAttrName), mIsToken(PR_FALSE), mPermanentState(0),
|
||||
mValue1(aValue1), mState1(aState1), mExtraState1(aExtraState1),
|
||||
mValue2(aValue2), mState2(aState2), mExtraState2(aExtraState2),
|
||||
mValue3(aValue3), mState3(aState3), mExtraState3(aExtraState3),
|
||||
mDefaultState(0), mDefaultExtraState(0), mDefinedIfAbsent(PR_FALSE)
|
||||
mValue1(aValue1), mState1(aState1),
|
||||
mValue2(aValue2), mState2(aState2),
|
||||
mValue3(aValue3), mState3(aState3),
|
||||
mDefaultState(0), mDefinedIfAbsent(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
|
||||
EDefaultStateRule aDefaultStateRule,
|
||||
const char *aValue1,
|
||||
PRUint32 aState1, PRUint32 aExtraState1,
|
||||
const char *aValue2,
|
||||
PRUint32 aState2, PRUint32 aExtraState2,
|
||||
const char *aValue3,
|
||||
PRUint32 aState3, PRUint32 aExtraState3) :
|
||||
const char* aValue1, PRUint64 aState1,
|
||||
const char* aValue2, PRUint64 aState2,
|
||||
const char* aValue3, PRUint64 aState3) :
|
||||
mAttributeName(aAttrName), mIsToken(PR_TRUE), mPermanentState(0),
|
||||
mValue1(aValue1), mState1(aState1), mExtraState1(aExtraState1),
|
||||
mValue2(aValue2), mState2(aState2), mExtraState2(aExtraState2),
|
||||
mValue3(aValue3), mState3(aState3), mExtraState3(aExtraState3),
|
||||
mDefaultState(0), mDefaultExtraState(0), mDefinedIfAbsent(PR_TRUE)
|
||||
mValue1(aValue1), mState1(aState1),
|
||||
mValue2(aValue2), mState2(aState2),
|
||||
mValue3(aValue3), mState3(aState3),
|
||||
mDefaultState(0), mDefinedIfAbsent(PR_TRUE)
|
||||
{
|
||||
if (aDefaultStateRule == eUseFirstState) {
|
||||
if (aDefaultStateRule == eUseFirstState)
|
||||
mDefaultState = aState1;
|
||||
mDefaultExtraState = aExtraState1;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsStateMapEntry::MapToStates(nsIContent *aContent,
|
||||
PRUint32 *aState, PRUint32 *aExtraState,
|
||||
nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
eStateMapEntryID aStateMapEntryID)
|
||||
{
|
||||
// Return true if we should continue.
|
||||
@ -846,9 +818,6 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
||||
*aState |= entry.mPermanentState;
|
||||
if (entry.mState1)
|
||||
*aState |= entry.mState1;
|
||||
if (aExtraState && entry.mExtraState1)
|
||||
*aExtraState |= entry.mExtraState1;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@ -887,10 +856,6 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
||||
|
||||
if (entry.mState1)
|
||||
*aState |= entry.mState1;
|
||||
|
||||
if (aExtraState && entry.mExtraState1)
|
||||
*aExtraState |= entry.mExtraState1;
|
||||
|
||||
} else if (entry.mValue2) {
|
||||
if (attrValue.EqualsASCII(entry.mValue2)) {
|
||||
applyDefaultStates = PR_FALSE;
|
||||
@ -898,9 +863,6 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
||||
if (entry.mState2)
|
||||
*aState |= entry.mState2;
|
||||
|
||||
if (aExtraState && entry.mExtraState2)
|
||||
*aExtraState |= entry.mExtraState2;
|
||||
|
||||
} else if (entry.mValue3) {
|
||||
if (attrValue.EqualsASCII(entry.mValue3)) {
|
||||
applyDefaultStates = PR_FALSE;
|
||||
@ -908,8 +870,6 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
||||
if (entry.mState3)
|
||||
*aState |= entry.mState3;
|
||||
|
||||
if (aExtraState && entry.mExtraState3)
|
||||
*aExtraState |= entry.mExtraState3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -918,8 +878,6 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
||||
if (applyDefaultStates) {
|
||||
if (entry.mDefaultState)
|
||||
*aState |= entry.mDefaultState;
|
||||
if (entry.mDefaultExtraState && aExtraState)
|
||||
*aExtraState |= entry.mDefaultExtraState;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
|
@ -199,43 +199,38 @@ public:
|
||||
/**
|
||||
* Used for ARIA attributes having boolean or mixed values.
|
||||
*/
|
||||
nsStateMapEntry(nsIAtom **aAttrName, eStateValueType aType,
|
||||
PRUint32 aPermanentState,
|
||||
PRUint32 aTrueState, PRUint32 aTrueExtraState,
|
||||
PRUint32 aFalseState = 0, PRUint32 aFalseExtraState = 0,
|
||||
nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
|
||||
PRUint64 aPermanentState,
|
||||
PRUint64 aTrueState,
|
||||
PRUint64 aFalseState = 0,
|
||||
PRBool aDefinedIfAbsent = PR_FALSE);
|
||||
|
||||
/**
|
||||
* Used for ARIA attributes having enumerated values.
|
||||
*/
|
||||
nsStateMapEntry(nsIAtom **aAttrName,
|
||||
const char *aValue1, PRUint32 aState1, PRUint32 aExtraState1,
|
||||
const char *aValue2, PRUint32 aState2, PRUint32 aExtraState2,
|
||||
const char *aValue3 = 0, PRUint32 aState3 = 0,
|
||||
PRUint32 aExtraState3 = 0);
|
||||
nsStateMapEntry(nsIAtom** aAttrName,
|
||||
const char* aValue1, PRUint64 aState1,
|
||||
const char* aValue2, PRUint64 aState2,
|
||||
const char* aValue3 = 0, PRUint64 aState3 = 0);
|
||||
|
||||
/**
|
||||
* Used for ARIA attributes having enumerated values, and where a default
|
||||
* attribute state should be assumed when not supplied by the author.
|
||||
*/
|
||||
nsStateMapEntry(nsIAtom **aAttrName,
|
||||
EDefaultStateRule aDefaultStateRule,
|
||||
const char *aValue1, PRUint32 aState1, PRUint32 aExtraState1,
|
||||
const char *aValue2, PRUint32 aState2, PRUint32 aExtraState2,
|
||||
const char *aValue3 = 0, PRUint32 aState3 = 0,
|
||||
PRUint32 aExtraState3 = 0);
|
||||
nsStateMapEntry(nsIAtom** aAttrName, EDefaultStateRule aDefaultStateRule,
|
||||
const char* aValue1, PRUint64 aState1,
|
||||
const char* aValue2, PRUint64 aState2,
|
||||
const char* aValue3 = 0, PRUint64 aState3 = 0);
|
||||
|
||||
/**
|
||||
* Maps ARIA state map pointed by state map entry ID to accessible states.
|
||||
*
|
||||
* @param aContent [in] node of the accessible
|
||||
* @param aState [in/out] accessible states
|
||||
* @param aExtraState [in/out] accessible extra states
|
||||
* @param aStateMapEntryID [in] state map entry ID
|
||||
* @return true if state map entry ID is valid
|
||||
*/
|
||||
static PRBool MapToStates(nsIContent *aContent,
|
||||
PRUint32 *aState, PRUint32 *aExtraState,
|
||||
static PRBool MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
eStateMapEntryID aStateMapEntryID);
|
||||
|
||||
private:
|
||||
@ -246,24 +241,20 @@ private:
|
||||
PRBool mIsToken;
|
||||
|
||||
// State applied always if attribute is defined
|
||||
PRUint32 mPermanentState;
|
||||
PRUint64 mPermanentState;
|
||||
|
||||
// States applied if attribute value is matched to the stored value
|
||||
const char* mValue1;
|
||||
PRUint32 mState1;
|
||||
PRUint32 mExtraState1;
|
||||
PRUint64 mState1;
|
||||
|
||||
const char* mValue2;
|
||||
PRUint32 mState2;
|
||||
PRUint32 mExtraState2;
|
||||
PRUint64 mState2;
|
||||
|
||||
const char* mValue3;
|
||||
PRUint32 mState3;
|
||||
PRUint32 mExtraState3;
|
||||
PRUint64 mState3;
|
||||
|
||||
// States applied if no stored values above are matched
|
||||
PRUint32 mDefaultState;
|
||||
PRUint32 mDefaultExtraState;
|
||||
PRUint64 mDefaultState;
|
||||
|
||||
// Permanent and false states are applied if attribute is absent
|
||||
PRBool mDefinedIfAbsent;
|
||||
@ -298,7 +289,7 @@ struct nsRoleMapEntry
|
||||
ELiveAttrRule liveAttRule;
|
||||
|
||||
// Automatic state mapping rule: always include in nsIAccessibleStates
|
||||
PRUint32 state; // or kNoReqStates if no nsIAccessibleStates are automatic for this role.
|
||||
PRUint64 state; // or kNoReqStates if no nsIAccessibleStates are automatic for this role.
|
||||
|
||||
// ARIA properties supported for this role
|
||||
// (in other words, the aria-foo attribute to nsIAccessibleStates mapping rules)
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsApplicationAccessible.h"
|
||||
#include "nsOuterDocAccessible.h"
|
||||
#include "nsRootAccessibleWrap.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsDocShellLoadTypes.h"
|
||||
@ -221,8 +222,7 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
// Fire state busy change event. Use delayed event since we don't care
|
||||
// actually if event isn't delivered when the document goes away like a shot.
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_TRUE);
|
||||
new AccStateChangeEvent(document, states::BUSY, PR_TRUE);
|
||||
docAcc->FireDelayedAccessibleEvent(stateEvent);
|
||||
|
||||
return NS_OK;
|
||||
@ -356,8 +356,7 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
|
||||
|
||||
// Fire busy state change event.
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_FALSE);
|
||||
new AccStateChangeEvent(aDocument, states::BUSY, PR_FALSE);
|
||||
docAcc->FireDelayedAccessibleEvent(stateEvent);
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ private:
|
||||
strEventType.AssignLiteral("reload"); \
|
||||
} else if (type == nsIAccessibleEvent::EVENT_STATE_CHANGE) { \
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent); \
|
||||
if (event->GetState() == nsIAccessibleStates::STATE_BUSY) { \
|
||||
if (event->GetState() == states::BUSY) { \
|
||||
strEventType.AssignLiteral("busy "); \
|
||||
if (event->IsStateEnabled()) \
|
||||
strEventType.AppendLiteral("true"); \
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "States.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
@ -162,8 +162,7 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
|
||||
|
||||
nsAccessible* itemAcc = GetAccService()->GetAccessible(currNode);
|
||||
|
||||
if (!itemAcc ||
|
||||
State(itemAcc) & nsIAccessibleStates::STATE_INVISIBLE) {
|
||||
if (!itemAcc || itemAcc->State() & states::INVISIBLE) {
|
||||
(*aSetSize)--;
|
||||
if (index < static_cast<PRUint32>(indexOf))
|
||||
(*aPosInSet)--;
|
||||
@ -209,8 +208,7 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
|
||||
if (itemRole == nsIAccessibleRole::ROLE_SEPARATOR)
|
||||
break; // We reached the beginning of our group.
|
||||
|
||||
PRUint32 itemState = State(itemAcc);
|
||||
if (!(itemState & nsIAccessibleStates::STATE_INVISIBLE)) {
|
||||
if (!(itemAcc->State() & states::INVISIBLE)) {
|
||||
(*aSetSize)++;
|
||||
(*aPosInSet)++;
|
||||
}
|
||||
@ -230,8 +228,7 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
|
||||
if (itemRole == nsIAccessibleRole::ROLE_SEPARATOR)
|
||||
break; // We reached the end of our group.
|
||||
|
||||
PRUint32 itemState = State(itemAcc);
|
||||
if (!(itemState & nsIAccessibleStates::STATE_INVISIBLE))
|
||||
if (!(itemAcc->State() & states::INVISIBLE))
|
||||
(*aSetSize)++;
|
||||
}
|
||||
}
|
||||
@ -349,13 +346,13 @@ nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsAccessible *
|
||||
nsAccUtils::GetSelectableContainer(nsAccessible *aAccessible, PRUint32 aState)
|
||||
nsAccessible*
|
||||
nsAccUtils::GetSelectableContainer(nsAccessible* aAccessible, PRUint64 aState)
|
||||
{
|
||||
if (!aAccessible)
|
||||
return nsnull;
|
||||
|
||||
if (!(aState & nsIAccessibleStates::STATE_SELECTABLE))
|
||||
if (!(aState & states::SELECTABLE))
|
||||
return nsnull;
|
||||
|
||||
nsAccessible* parent = aAccessible;
|
||||
@ -366,15 +363,17 @@ nsAccUtils::GetSelectableContainer(nsAccessible *aAccessible, PRUint32 aState)
|
||||
return parent;
|
||||
}
|
||||
|
||||
nsAccessible *
|
||||
nsAccUtils::GetMultiSelectableContainer(nsINode *aNode)
|
||||
nsAccessible*
|
||||
nsAccUtils::GetMultiSelectableContainer(nsINode* aNode)
|
||||
{
|
||||
nsAccessible *accessible = GetAccService()->GetAccessible(aNode);
|
||||
nsAccessible *container = GetSelectableContainer(accessible,
|
||||
State(accessible));
|
||||
nsAccessible* accessible = GetAccService()->GetAccessible(aNode);
|
||||
if (accessible) {
|
||||
nsAccessible* container = GetSelectableContainer(accessible,
|
||||
accessible->State());
|
||||
if (container && container->State() & states::MULTISELECTABLE)
|
||||
return container;
|
||||
}
|
||||
|
||||
if (State(container) & nsIAccessibleStates::STATE_MULTISELECTABLE)
|
||||
return container;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
@ -199,8 +199,8 @@ public:
|
||||
* @param aAccessible [in] the item accessible
|
||||
* @param aState [in] the state of the item accessible
|
||||
*/
|
||||
static nsAccessible *GetSelectableContainer(nsAccessible *aAccessible,
|
||||
PRUint32 aState);
|
||||
static nsAccessible* GetSelectableContainer(nsAccessible* aAccessible,
|
||||
PRUint64 aState);
|
||||
|
||||
/**
|
||||
* Return multi selectable container for the given item.
|
||||
@ -290,31 +290,6 @@ public:
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the state for the given accessible.
|
||||
*/
|
||||
static PRUint32 State(nsIAccessible *aAcc)
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
if (aAcc)
|
||||
aAcc->GetState(&state, nsnull);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the extended state for the given accessible.
|
||||
*/
|
||||
static PRUint32 ExtendedState(nsIAccessible *aAcc)
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
PRUint32 extstate = 0;
|
||||
if (aAcc)
|
||||
aAcc->GetState(&state, &extstate);
|
||||
|
||||
return extstate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ARIA attribute characteristics for a given ARIA attribute.
|
||||
*
|
||||
@ -369,6 +344,26 @@ public:
|
||||
role != nsIAccessibleRole::ROLE_STATICTEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform nsIAccessibleStates constants to internal state constant.
|
||||
*/
|
||||
static inline PRUint64 To64State(PRUint32 aState1, PRUint32 aState2)
|
||||
{
|
||||
return static_cast<PRUint64>(aState1) +
|
||||
(static_cast<PRUint64>(aState2) << 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform internal state constant to nsIAccessibleStates constants.
|
||||
*/
|
||||
static inline void To32States(PRUint64 aState64,
|
||||
PRUint32* aState1, PRUint32* aState2)
|
||||
{
|
||||
*aState1 = aState64 & 0x7fffffff;
|
||||
if (aState2)
|
||||
*aState2 = static_cast<PRUint32>(aState64 >> 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given accessible can't have children. Used when exposing
|
||||
* to platform accessibility APIs, should the children be pruned off?
|
||||
|
@ -101,9 +101,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessNode)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessNode)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsAccessNode, nsIAccessNode)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(nsAccessNode, nsIAccessNode,
|
||||
LastRelease())
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessNode)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsAccessNode, LastRelease())
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode construction/desctruction
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessibleProvider.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
@ -630,113 +631,114 @@ nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::GetStringStates(PRUint32 aStates, PRUint32 aExtraStates,
|
||||
nsAccessibilityService::GetStringStates(PRUint32 aState, PRUint32 aExtraState,
|
||||
nsIDOMDOMStringList **aStringStates)
|
||||
{
|
||||
nsAccessibleDOMStringList *stringStates = new nsAccessibleDOMStringList();
|
||||
NS_ENSURE_TRUE(stringStates, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
//states
|
||||
if (aStates & nsIAccessibleStates::STATE_UNAVAILABLE)
|
||||
PRUint64 state = nsAccUtils::To64State(aState, aExtraState);
|
||||
|
||||
// states
|
||||
if (state & states::UNAVAILABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("unavailable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_SELECTED)
|
||||
if (state & states::SELECTED)
|
||||
stringStates->Add(NS_LITERAL_STRING("selected"));
|
||||
if (aStates & nsIAccessibleStates::STATE_FOCUSED)
|
||||
if (state & states::FOCUSED)
|
||||
stringStates->Add(NS_LITERAL_STRING("focused"));
|
||||
if (aStates & nsIAccessibleStates::STATE_PRESSED)
|
||||
if (state & states::PRESSED)
|
||||
stringStates->Add(NS_LITERAL_STRING("pressed"));
|
||||
if (aStates & nsIAccessibleStates::STATE_CHECKED)
|
||||
if (state & states::CHECKED)
|
||||
stringStates->Add(NS_LITERAL_STRING("checked"));
|
||||
if (aStates & nsIAccessibleStates::STATE_MIXED)
|
||||
if (state & states::MIXED)
|
||||
stringStates->Add(NS_LITERAL_STRING("mixed"));
|
||||
if (aStates & nsIAccessibleStates::STATE_READONLY)
|
||||
if (state & states::READONLY)
|
||||
stringStates->Add(NS_LITERAL_STRING("readonly"));
|
||||
if (aStates & nsIAccessibleStates::STATE_HOTTRACKED)
|
||||
if (state & states::HOTTRACKED)
|
||||
stringStates->Add(NS_LITERAL_STRING("hottracked"));
|
||||
if (aStates & nsIAccessibleStates::STATE_DEFAULT)
|
||||
if (state & states::DEFAULT)
|
||||
stringStates->Add(NS_LITERAL_STRING("default"));
|
||||
if (aStates & nsIAccessibleStates::STATE_EXPANDED)
|
||||
if (state & states::EXPANDED)
|
||||
stringStates->Add(NS_LITERAL_STRING("expanded"));
|
||||
if (aStates & nsIAccessibleStates::STATE_COLLAPSED)
|
||||
if (state & states::COLLAPSED)
|
||||
stringStates->Add(NS_LITERAL_STRING("collapsed"));
|
||||
if (aStates & nsIAccessibleStates::STATE_BUSY)
|
||||
if (state & states::BUSY)
|
||||
stringStates->Add(NS_LITERAL_STRING("busy"));
|
||||
if (aStates & nsIAccessibleStates::STATE_FLOATING)
|
||||
if (state & states::FLOATING)
|
||||
stringStates->Add(NS_LITERAL_STRING("floating"));
|
||||
if (aStates & nsIAccessibleStates::STATE_ANIMATED)
|
||||
if (state & states::ANIMATED)
|
||||
stringStates->Add(NS_LITERAL_STRING("animated"));
|
||||
if (aStates & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
if (state & states::INVISIBLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("invisible"));
|
||||
if (aStates & nsIAccessibleStates::STATE_OFFSCREEN)
|
||||
if (state & states::OFFSCREEN)
|
||||
stringStates->Add(NS_LITERAL_STRING("offscreen"));
|
||||
if (aStates & nsIAccessibleStates::STATE_SIZEABLE)
|
||||
if (state & states::SIZEABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("sizeable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_MOVEABLE)
|
||||
if (state & states::MOVEABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("moveable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_SELFVOICING)
|
||||
if (state & states::SELFVOICING)
|
||||
stringStates->Add(NS_LITERAL_STRING("selfvoicing"));
|
||||
if (aStates & nsIAccessibleStates::STATE_FOCUSABLE)
|
||||
if (state & states::FOCUSABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("focusable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_SELECTABLE)
|
||||
if (state & states::SELECTABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("selectable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_LINKED)
|
||||
if (state & states::LINKED)
|
||||
stringStates->Add(NS_LITERAL_STRING("linked"));
|
||||
if (aStates & nsIAccessibleStates::STATE_TRAVERSED)
|
||||
if (state & states::TRAVERSED)
|
||||
stringStates->Add(NS_LITERAL_STRING("traversed"));
|
||||
if (aStates & nsIAccessibleStates::STATE_MULTISELECTABLE)
|
||||
if (state & states::MULTISELECTABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("multiselectable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_EXTSELECTABLE)
|
||||
if (state & states::EXTSELECTABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("extselectable"));
|
||||
if (aStates & nsIAccessibleStates::STATE_PROTECTED)
|
||||
if (state & states::PROTECTED)
|
||||
stringStates->Add(NS_LITERAL_STRING("protected"));
|
||||
if (aStates & nsIAccessibleStates::STATE_HASPOPUP)
|
||||
if (state & states::HASPOPUP)
|
||||
stringStates->Add(NS_LITERAL_STRING("haspopup"));
|
||||
if (aStates & nsIAccessibleStates::STATE_REQUIRED)
|
||||
if (state & states::REQUIRED)
|
||||
stringStates->Add(NS_LITERAL_STRING("required"));
|
||||
if (aStates & nsIAccessibleStates::STATE_IMPORTANT)
|
||||
stringStates->Add(NS_LITERAL_STRING("important"));
|
||||
if (aStates & nsIAccessibleStates::STATE_INVALID)
|
||||
if (state & states::ALERT)
|
||||
stringStates->Add(NS_LITERAL_STRING("alert"));
|
||||
if (state & states::INVALID)
|
||||
stringStates->Add(NS_LITERAL_STRING("invalid"));
|
||||
if (aStates & nsIAccessibleStates::STATE_CHECKABLE)
|
||||
if (state & states::CHECKABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("checkable"));
|
||||
|
||||
//extraStates
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION)
|
||||
// extraStates
|
||||
if (state & states::SUPPORTS_AUTOCOMPLETION)
|
||||
stringStates->Add(NS_LITERAL_STRING("autocompletion"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_DEFUNCT)
|
||||
if (state & states::DEFUNCT)
|
||||
stringStates->Add(NS_LITERAL_STRING("defunct"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_SELECTABLE_TEXT)
|
||||
if (state & states::SELECTABLE_TEXT)
|
||||
stringStates->Add(NS_LITERAL_STRING("selectable text"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_EDITABLE)
|
||||
if (state & states::EDITABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("editable"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_ACTIVE)
|
||||
if (state & states::ACTIVE)
|
||||
stringStates->Add(NS_LITERAL_STRING("active"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_MODAL)
|
||||
if (state & states::MODAL)
|
||||
stringStates->Add(NS_LITERAL_STRING("modal"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_MULTI_LINE)
|
||||
if (state & states::MULTI_LINE)
|
||||
stringStates->Add(NS_LITERAL_STRING("multi line"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_HORIZONTAL)
|
||||
if (state & states::HORIZONTAL)
|
||||
stringStates->Add(NS_LITERAL_STRING("horizontal"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_OPAQUE)
|
||||
if (state & states::OPAQUE1)
|
||||
stringStates->Add(NS_LITERAL_STRING("opaque"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_SINGLE_LINE)
|
||||
if (state & states::SINGLE_LINE)
|
||||
stringStates->Add(NS_LITERAL_STRING("single line"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_TRANSIENT)
|
||||
if (state & states::TRANSIENT)
|
||||
stringStates->Add(NS_LITERAL_STRING("transient"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_VERTICAL)
|
||||
if (state & states::VERTICAL)
|
||||
stringStates->Add(NS_LITERAL_STRING("vertical"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_STALE)
|
||||
if (state & states::STALE)
|
||||
stringStates->Add(NS_LITERAL_STRING("stale"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_ENABLED)
|
||||
if (state & states::ENABLED)
|
||||
stringStates->Add(NS_LITERAL_STRING("enabled"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_SENSITIVE)
|
||||
if (state & states::SENSITIVE)
|
||||
stringStates->Add(NS_LITERAL_STRING("sensitive"));
|
||||
if (aExtraStates & nsIAccessibleStates::EXT_STATE_EXPANDABLE)
|
||||
if (state & states::EXPANDABLE)
|
||||
stringStates->Add(NS_LITERAL_STRING("expandable"));
|
||||
|
||||
//unknown states
|
||||
PRUint32 stringStatesLength = 0;
|
||||
|
||||
stringStates->GetLength(&stringStatesLength);
|
||||
if (!stringStatesLength)
|
||||
stringStates->Add(NS_LITERAL_STRING("unknown"));
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@ -612,12 +613,13 @@ nsresult nsAccessible::GetFullKeyName(const nsAString& aModifierName, const nsAS
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsAccessible::IsVisible(PRBool *aIsOffscreen)
|
||||
PRBool
|
||||
nsAccessible::IsVisible(PRBool* aIsOffscreen)
|
||||
{
|
||||
// We need to know if at least a kMinPixels around the object is visible
|
||||
// Otherwise it will be marked nsIAccessibleStates::STATE_OFFSCREEN
|
||||
// The STATE_INVISIBLE flag is for elements which are programmatically hidden
|
||||
|
||||
// We need to know if at least a kMinPixels around the object is visible,
|
||||
// otherwise it will be marked states::OFFSCREEN. The states::INVISIBLE flag
|
||||
// is for elements which are programmatically hidden.
|
||||
|
||||
*aIsOffscreen = PR_TRUE;
|
||||
if (IsDefunct())
|
||||
return PR_FALSE;
|
||||
@ -690,28 +692,17 @@ PRBool nsAccessible::IsVisible(PRBool *aIsOffscreen)
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsAccessible::NativeState()
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
PRUint64 state = 0;
|
||||
nsEventStates intrinsicState = mContent->IntrinsicState();
|
||||
|
||||
if (intrinsicState.HasState(NS_EVENT_STATE_INVALID))
|
||||
*aState |= nsIAccessibleStates::STATE_INVALID;
|
||||
state |= states::INVALID;
|
||||
|
||||
if (intrinsicState.HasState(NS_EVENT_STATE_REQUIRED))
|
||||
*aState |= nsIAccessibleStates::STATE_REQUIRED;
|
||||
state |= states::REQUIRED;
|
||||
|
||||
PRBool disabled = mContent->IsHTML() ?
|
||||
(intrinsicState.HasState(NS_EVENT_STATE_DISABLED)) :
|
||||
@ -722,43 +713,43 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
|
||||
// Set unavailable state based on disabled state, otherwise set focus states
|
||||
if (disabled) {
|
||||
*aState |= nsIAccessibleStates::STATE_UNAVAILABLE;
|
||||
state |= states::UNAVAILABLE;
|
||||
}
|
||||
else if (mContent->IsElement()) {
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && frame->IsFocusable()) {
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::FOCUSABLE;
|
||||
}
|
||||
|
||||
if (gLastFocusedNode == mContent) {
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if nsIAccessibleStates::STATE_INVISIBLE and
|
||||
// STATE_OFFSCREEN flags should be turned on for this object.
|
||||
// Check if states::INVISIBLE and
|
||||
// states::OFFSCREEN flags should be turned on for this object.
|
||||
PRBool isOffscreen;
|
||||
if (!IsVisible(&isOffscreen)) {
|
||||
*aState |= nsIAccessibleStates::STATE_INVISIBLE;
|
||||
state |= states::INVISIBLE;
|
||||
}
|
||||
if (isOffscreen) {
|
||||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
state |= states::OFFSCREEN;
|
||||
}
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
|
||||
*aState |= nsIAccessibleStates::STATE_FLOATING;
|
||||
state |= states::FLOATING;
|
||||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (mContent->IsXUL())
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
|
||||
state |= states::HASPOPUP;
|
||||
|
||||
// Add 'linked' state for simple xlink.
|
||||
if (nsCoreUtils::IsXLink(mContent))
|
||||
*aState |= nsIAccessibleStates::STATE_LINKED;
|
||||
state |= states::LINKED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean focusedChild; */
|
||||
@ -843,7 +834,7 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
child->GetBounds(&childX, &childY, &childWidth, &childHeight);
|
||||
if (aX >= childX && aX < childX + childWidth &&
|
||||
aY >= childY && aY < childY + childHeight &&
|
||||
(nsAccUtils::State(child) & nsIAccessibleStates::STATE_INVISIBLE) == 0) {
|
||||
(child->State() & states::INVISIBLE) == 0) {
|
||||
|
||||
if (aWhichChild == eDeepestChild)
|
||||
return child->GetChildAtPoint(aX, aY, eDeepestChild);
|
||||
@ -1053,8 +1044,7 @@ NS_IMETHODIMP nsAccessible::SetSelected(PRBool aSelect)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 state = nsAccUtils::State(this);
|
||||
if (state & nsIAccessibleStates::STATE_SELECTABLE) {
|
||||
if (State() & states::SELECTABLE) {
|
||||
nsCOMPtr<nsIAccessible> multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(mContent);
|
||||
if (!multiSelect) {
|
||||
@ -1082,8 +1072,7 @@ NS_IMETHODIMP nsAccessible::TakeSelection()
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 state = nsAccUtils::State(this);
|
||||
if (state & nsIAccessibleStates::STATE_SELECTABLE) {
|
||||
if (State() & states::SELECTABLE) {
|
||||
nsCOMPtr<nsIAccessible> multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(mContent);
|
||||
if (multiSelect) {
|
||||
@ -1331,7 +1320,7 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
|
||||
}
|
||||
|
||||
// Expose checkable object attribute if the accessible has checkable state
|
||||
if (nsAccUtils::State(this) & nsIAccessibleStates::STATE_CHECKABLE)
|
||||
if (State() & states::CHECKABLE)
|
||||
nsAccUtils::SetAccAttr(attributes, nsAccessibilityAtoms::checkable, NS_LITERAL_STRING("true"));
|
||||
|
||||
// Group attributes (level/setsize/posinset)
|
||||
@ -1497,7 +1486,7 @@ nsAccessible::GroupPosition(PRInt32 *aGroupLevel,
|
||||
|
||||
// If ARIA is missed and the accessible is visible then calculate group
|
||||
// position from hierarchy.
|
||||
if (nsAccUtils::State(this) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
if (State() & states::INVISIBLE)
|
||||
return NS_OK;
|
||||
|
||||
// Calculate group level if ARIA is missed.
|
||||
@ -1524,19 +1513,27 @@ nsAccessible::GroupPosition(PRInt32 *aGroupLevel,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
nsAccessible::GetState(PRUint32* aState, PRUint32* aExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
nsresult rv = GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
nsAccUtils::To32States(State(), aState, aExtraState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint64
|
||||
nsAccessible::State()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return states::DEFUNCT;
|
||||
|
||||
PRUint64 state = NativeState();
|
||||
// Apply ARIA states to be sure accessible states will be overriden.
|
||||
GetARIAState(aState, aExtraState);
|
||||
ApplyARIAState(&state);
|
||||
|
||||
if (mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_PAGETAB) {
|
||||
if (*aState & nsIAccessibleStates::STATE_FOCUSED) {
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
if (state & states::FOCUSED) {
|
||||
state |= states::SELECTED;
|
||||
} else {
|
||||
// Expose 'selected' state on ARIA tab if the focus is on internal element
|
||||
// of related tabpanel.
|
||||
@ -1547,34 +1544,27 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
nsRefPtr<nsAccessible> tabPanelAcc(do_QueryObject(tabPanel));
|
||||
nsINode *tabPanelNode = tabPanelAcc->GetNode();
|
||||
if (nsCoreUtils::IsAncestorOf(tabPanelNode, gLastFocusedNode))
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const PRUint32 kExpandCollapseStates =
|
||||
nsIAccessibleStates::STATE_COLLAPSED | nsIAccessibleStates::STATE_EXPANDED;
|
||||
if ((*aState & kExpandCollapseStates) == kExpandCollapseStates) {
|
||||
const PRUint32 kExpandCollapseStates = states::COLLAPSED | states::EXPANDED;
|
||||
if ((state & kExpandCollapseStates) == kExpandCollapseStates) {
|
||||
// Cannot be both expanded and collapsed -- this happens in ARIA expanded
|
||||
// combobox because of limitation of nsARIAMap.
|
||||
// XXX: Perhaps we will be able to make this less hacky if we support
|
||||
// extended states in nsARIAMap, e.g. derive COLLAPSED from
|
||||
// EXPANDABLE && !EXPANDED.
|
||||
*aState &= ~nsIAccessibleStates::STATE_COLLAPSED;
|
||||
state &= ~states::COLLAPSED;
|
||||
}
|
||||
|
||||
// Set additional states which presence depends on another states.
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
if (!(*aState & nsIAccessibleStates::STATE_UNAVAILABLE)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_ENABLED |
|
||||
nsIAccessibleStates::EXT_STATE_SENSITIVE;
|
||||
if (!(state & states::UNAVAILABLE)) {
|
||||
state |= states::ENABLED | states::SENSITIVE;
|
||||
}
|
||||
|
||||
if ((*aState & nsIAccessibleStates::STATE_COLLAPSED) ||
|
||||
(*aState & nsIAccessibleStates::STATE_EXPANDED))
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_EXPANDABLE;
|
||||
if ((state & states::COLLAPSED) || (state & states::EXPANDED))
|
||||
state |= states::EXPANDABLE;
|
||||
|
||||
if (mRoleMapEntry) {
|
||||
// If an object has an ancestor with the activedescendant property
|
||||
@ -1588,7 +1578,7 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
|
||||
if (ancestorContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant, activeID)) {
|
||||
if (id == activeID) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_ACTIVE;
|
||||
state |= states::ACTIVE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1600,38 +1590,38 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
// as invisible.
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
return state;
|
||||
|
||||
const nsStyleDisplay* display = frame->GetStyleDisplay();
|
||||
if (display && display->mOpacity == 1.0f &&
|
||||
!(*aState & nsIAccessibleStates::STATE_INVISIBLE)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_OPAQUE;
|
||||
!(state & states::INVISIBLE)) {
|
||||
state |= states::OPAQUE1;
|
||||
}
|
||||
|
||||
const nsStyleXUL *xulStyle = frame->GetStyleXUL();
|
||||
if (xulStyle) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_VERTICAL;
|
||||
state |= states::VERTICAL;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_HORIZONTAL;
|
||||
state |= states::HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
// If we are editable, force readonly bit off
|
||||
if (*aExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE)
|
||||
*aState &= ~nsIAccessibleStates::STATE_READONLY;
|
||||
if (state & states::EDITABLE)
|
||||
state &= ~states::READONLY;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
void
|
||||
nsAccessible::ApplyARIAState(PRUint64* aState)
|
||||
{
|
||||
// Test for universal states first
|
||||
PRUint32 index = 0;
|
||||
while (nsStateMapEntry::MapToStates(mContent, aState, aExtraState,
|
||||
while (nsStateMapEntry::MapToStates(mContent, aState,
|
||||
nsARIAMap::gWAIUnivStateMap[index])) {
|
||||
++ index;
|
||||
}
|
||||
@ -1642,7 +1632,7 @@ nsAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
// role. This preserves the ability for screen readers to use readonly
|
||||
// (primarily on the document) as the hint for creating a virtual buffer.
|
||||
if (mRoleMapEntry->role != nsIAccessibleRole::ROLE_NOTHING)
|
||||
*aState &= ~nsIAccessibleStates::STATE_READONLY;
|
||||
*aState &= ~states::READONLY;
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, mContent->GetIDAttributeName())) {
|
||||
// If has a role & ID and aria-activedescendant on the container, assume focusable
|
||||
@ -1650,40 +1640,39 @@ nsAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
|
||||
if (ancestorContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant)) {
|
||||
// ancestor has activedescendant property, this content could be active
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
*aState |= states::FOCUSABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*aState & nsIAccessibleStates::STATE_FOCUSABLE) {
|
||||
if (*aState & states::FOCUSABLE) {
|
||||
// Special case: aria-disabled propagates from ancestors down to any focusable descendant
|
||||
nsIContent *ancestorContent = mContent;
|
||||
while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
|
||||
if (ancestorContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::aria_disabled,
|
||||
nsAccessibilityAtoms::_true, eCaseMatters)) {
|
||||
// ancestor has aria-disabled property, this is disabled
|
||||
*aState |= nsIAccessibleStates::STATE_UNAVAILABLE;
|
||||
*aState |= states::UNAVAILABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mRoleMapEntry)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// Note: the readonly bitflag will be overridden later if content is editable
|
||||
*aState |= mRoleMapEntry->state;
|
||||
if (nsStateMapEntry::MapToStates(mContent, aState, aExtraState,
|
||||
if (nsStateMapEntry::MapToStates(mContent, aState,
|
||||
mRoleMapEntry->attributeMap1) &&
|
||||
nsStateMapEntry::MapToStates(mContent, aState, aExtraState,
|
||||
nsStateMapEntry::MapToStates(mContent, aState,
|
||||
mRoleMapEntry->attributeMap2)) {
|
||||
nsStateMapEntry::MapToStates(mContent, aState, aExtraState,
|
||||
nsStateMapEntry::MapToStates(mContent, aState,
|
||||
mRoleMapEntry->attributeMap3);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Not implemented by this class
|
||||
@ -1762,10 +1751,9 @@ nsAccessible::SetCurrentValue(double aValue)
|
||||
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
|
||||
return NS_OK_NO_ARIA_VALUE;
|
||||
|
||||
const PRUint32 kValueCannotChange = nsIAccessibleStates::STATE_READONLY |
|
||||
nsIAccessibleStates::STATE_UNAVAILABLE;
|
||||
const PRUint32 kValueCannotChange = states::READONLY | states::UNAVAILABLE;
|
||||
|
||||
if (nsAccUtils::State(this) & kValueCannotChange)
|
||||
if (State() & kValueCannotChange)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double minValue = 0;
|
||||
@ -1879,7 +1867,7 @@ nsAccessible::GetNumActions(PRUint8 *aNumActions)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 actionRule = GetActionRule(nsAccUtils::State(this));
|
||||
PRUint32 actionRule = GetActionRule(State());
|
||||
if (actionRule == eNoAction)
|
||||
return NS_OK;
|
||||
|
||||
@ -1899,7 +1887,7 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 states = nsAccUtils::State(this);
|
||||
PRUint64 states = State();
|
||||
PRUint32 actionRule = GetActionRule(states);
|
||||
|
||||
switch (actionRule) {
|
||||
@ -1912,9 +1900,9 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
return NS_OK;
|
||||
|
||||
case eCheckUncheckAction:
|
||||
if (states & nsIAccessibleStates::STATE_CHECKED)
|
||||
if (states & states::CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
else if (states & nsIAccessibleStates::STATE_MIXED)
|
||||
else if (states & states::MIXED)
|
||||
aName.AssignLiteral("cycle");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
@ -1925,7 +1913,7 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
return NS_OK;
|
||||
|
||||
case eOpenCloseAction:
|
||||
if (states & nsIAccessibleStates::STATE_COLLAPSED)
|
||||
if (states & states::COLLAPSED)
|
||||
aName.AssignLiteral("open");
|
||||
else
|
||||
aName.AssignLiteral("close");
|
||||
@ -1944,7 +1932,7 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
return NS_OK;
|
||||
|
||||
case eExpandAction:
|
||||
if (states & nsIAccessibleStates::STATE_COLLAPSED)
|
||||
if (states & states::COLLAPSED)
|
||||
aName.AssignLiteral("expand");
|
||||
else
|
||||
aName.AssignLiteral("collapse");
|
||||
@ -1976,7 +1964,7 @@ nsAccessible::DoAction(PRUint8 aIndex)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (GetActionRule(nsAccUtils::State(this)) != eNoAction) {
|
||||
if (GetActionRule(State()) != eNoAction) {
|
||||
DoCommand();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2802,10 +2790,10 @@ nsAccessible::RemoveChild(nsAccessible* aChild)
|
||||
if (!aChild)
|
||||
return PR_FALSE;
|
||||
|
||||
PRInt32 index = aChild->mIndexInParent;
|
||||
if (aChild->mParent != this || index == -1)
|
||||
if (aChild->mParent != this || aChild->mIndexInParent == -1)
|
||||
return PR_FALSE;
|
||||
|
||||
PRUint32 index = static_cast<PRUint32>(aChild->mIndexInParent);
|
||||
if (index >= mChildren.Length() || mChildren[index] != aChild) {
|
||||
NS_ERROR("Child is bound to parent but parent hasn't this child at its index!");
|
||||
aChild->UnbindFromParent();
|
||||
@ -2930,8 +2918,7 @@ nsAccessible::IsValid()
|
||||
{
|
||||
NS_PRECONDITION(IsHyperLink(), "IsValid is called on not hyper link!");
|
||||
|
||||
PRUint32 state = nsAccUtils::State(this);
|
||||
return (0 == (state & nsIAccessibleStates::STATE_INVALID));
|
||||
return (0 == (State() & states::INVALID));
|
||||
// XXX In order to implement this we would need to follow every link
|
||||
// Perhaps we can get information about invalid links from the cache
|
||||
// In the mean time authors can use role="link" aria-invalid="true"
|
||||
@ -3054,7 +3041,7 @@ nsAccessible::IsItemSelected(PRUint32 aIndex)
|
||||
index++;
|
||||
|
||||
return selected &&
|
||||
nsAccUtils::State(selected) & nsIAccessibleStates::STATE_SELECTED;
|
||||
selected->State() & states::SELECTED;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3321,9 +3308,9 @@ nsAccessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsAccessible::GetActionRule(PRUint32 aStates)
|
||||
nsAccessible::GetActionRule(PRUint64 aStates)
|
||||
{
|
||||
if (aStates & nsIAccessibleStates::STATE_UNAVAILABLE)
|
||||
if (aStates & states::UNAVAILABLE)
|
||||
return eNoAction;
|
||||
|
||||
// Check if it's simple xlink.
|
||||
|
@ -130,9 +130,8 @@ public:
|
||||
* method.
|
||||
*
|
||||
* @param [in/out] where to fill the states into.
|
||||
* @param [in/out] where to fill the extra states into
|
||||
*/
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
|
||||
/**
|
||||
* Returns the accessible name provided by native markup. It doesn't take
|
||||
@ -176,12 +175,15 @@ public:
|
||||
virtual PRUint32 NativeRole();
|
||||
|
||||
/**
|
||||
* Return the state of accessible that doesn't take into account ARIA states.
|
||||
* Use nsIAccessible::state to get all states for accessible. If
|
||||
* second argument is omitted then second bit field of accessible state won't
|
||||
* be calculated.
|
||||
* Return all states of accessible (including ARIA states).
|
||||
*/
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 State();
|
||||
|
||||
/**
|
||||
* Return the states of accessible, not taking into account ARIA states.
|
||||
* Use State() to get complete set of states.
|
||||
*/
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
/**
|
||||
* Returns attributes for accessible without explicitly setted ARIA
|
||||
@ -620,7 +622,7 @@ protected:
|
||||
*
|
||||
* @param aStates [in] states of the accessible
|
||||
*/
|
||||
PRUint32 GetActionRule(PRUint32 aStates);
|
||||
PRUint32 GetActionRule(PRUint64 aStates);
|
||||
|
||||
/**
|
||||
* Return group info.
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "nsApplicationAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
@ -140,12 +141,10 @@ nsApplicationAccessible::GetKeyboardShortcut(nsAString &aKeyboardShortcut)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsApplicationAccessible::State()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
GetStateInternal(aState, aExtraState);
|
||||
return NS_OK;
|
||||
return IsDefunct() ? states::DEFUNCT : 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -362,10 +361,9 @@ nsApplicationAccessible::IsPrimaryForNode() const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible public methods
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
void
|
||||
nsApplicationAccessible::ApplyARIAState(PRUint64* aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
@ -374,23 +372,10 @@ nsApplicationAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_APP_ROOT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsApplicationAccessible::NativeState()
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -94,7 +94,6 @@ public:
|
||||
NS_IMETHOD GetValue(nsAString &aValue);
|
||||
NS_IMETHOD GetDescription(nsAString &aDescription);
|
||||
NS_IMETHOD GetKeyboardShortcut(nsAString &aKeyboardShortcut);
|
||||
NS_IMETHOD GetState(PRUint32 *aState , PRUint32 *aExtraState );
|
||||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup);
|
||||
@ -123,9 +122,10 @@ public:
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 State();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
@ -113,20 +114,18 @@ nsLinkableAccessible::TakeFocus()
|
||||
return nsAccessibleWrap::TakeFocus();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLinkableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsLinkableAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
PRUint64 states = nsAccessibleWrap::NativeState();
|
||||
if (mIsLink) {
|
||||
*aState |= nsIAccessibleStates::STATE_LINKED;
|
||||
nsAccessible *actionAcc = GetActionAccessible();
|
||||
if (nsAccUtils::State(actionAcc) & nsIAccessibleStates::STATE_TRAVERSED)
|
||||
*aState |= nsIAccessibleStates::STATE_TRAVERSED;
|
||||
states |= states::LINKED;
|
||||
nsAccessible* actionAcc = GetActionAccessible();
|
||||
if (actionAcc->State() & states::TRAVERSED)
|
||||
states |= states::TRAVERSED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -260,7 +259,7 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
|
||||
GetAccService()->GetAccessibleInWeakShell(walkUpContent, mWeakShell);
|
||||
|
||||
if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
|
||||
nsAccUtils::State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED) {
|
||||
walkUpAcc->State() & states::LINKED) {
|
||||
mIsLink = PR_TRUE;
|
||||
mActionContent = walkUpContent;
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
virtual void Shutdown();
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccCache.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
@ -83,7 +84,7 @@ namespace dom = mozilla::dom;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static member initialization
|
||||
|
||||
PRUint32 nsDocAccessible::gLastFocusedAccessiblesState = 0;
|
||||
PRUint64 nsDocAccessible::gLastFocusedAccessiblesState = 0;
|
||||
|
||||
static nsIAtom** kRelationAttrs[] =
|
||||
{
|
||||
@ -290,24 +291,13 @@ nsDocAccessible::GetDescription(nsAString& aDescription)
|
||||
}
|
||||
|
||||
// nsAccessible public method
|
||||
nsresult
|
||||
nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsDocAccessible::NativeState()
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState) {
|
||||
// The root content of the document might be removed so that mContent is
|
||||
// out of date.
|
||||
*aExtraState = (mContent->GetCurrentDoc() == mDocument) ?
|
||||
0 : nsIAccessibleStates::EXT_STATE_STALE;
|
||||
}
|
||||
// The root content of the document might be removed so that mContent is
|
||||
// out of date.
|
||||
PRUint64 state = (mContent->GetCurrentDoc() == mDocument) ?
|
||||
0 : states::STALE;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
@ -317,17 +307,14 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
// XXX Need to invent better check to see if doc is focusable,
|
||||
// which it should be if it is scrollable. A XUL document could be focusable.
|
||||
// See bug 376803.
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::FOCUSABLE;
|
||||
if (gLastFocusedNode == mDocument)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
|
||||
// Expose state busy until the document is loaded or tree is constructed.
|
||||
if (!mIsLoaded || !mNotificationController->IsTreeConstructed()) {
|
||||
*aState |= nsIAccessibleStates::STATE_BUSY;
|
||||
if (aExtraState) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_STALE;
|
||||
}
|
||||
state |= states::BUSY | states::STALE;
|
||||
}
|
||||
|
||||
nsIFrame* frame = GetFrame();
|
||||
@ -337,35 +324,28 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
|
||||
if (frame == nsnull ||
|
||||
!CheckVisibilityInParentChain(mDocument, frame->GetViewExternal())) {
|
||||
*aState |= nsIAccessibleStates::STATE_INVISIBLE |
|
||||
nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
state |= states::INVISIBLE | states::OFFSCREEN;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
GetAssociatedEditor(getter_AddRefs(editor));
|
||||
if (!editor) {
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
}
|
||||
else if (aExtraState) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE;
|
||||
}
|
||||
state |= editor ? states::EDITABLE : states::READONLY;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
// nsAccessible public method
|
||||
nsresult
|
||||
nsDocAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
void
|
||||
nsDocAccessible::ApplyARIAState(PRUint64* aState)
|
||||
{
|
||||
// Combine with states from outer doc
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
nsresult rv = nsAccessible::GetARIAState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
//
|
||||
nsAccessible::ApplyARIAState(aState);
|
||||
|
||||
if (mParent) // Allow iframe/frame etc. to have final state override via ARIA
|
||||
return mParent->GetARIAState(aState, aExtraState);
|
||||
// Allow iframe/frame etc. to have final state override via ARIA
|
||||
if (mParent)
|
||||
mParent->ApplyARIAState(aState);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -397,9 +377,8 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 state;
|
||||
GetStateInternal(&state, nsnull);
|
||||
if (0 == (state & nsIAccessibleStates::STATE_FOCUSABLE)) {
|
||||
PRUint64 state = NativeState();
|
||||
if (0 == (state & states::FOCUSABLE)) {
|
||||
return NS_ERROR_FAILURE; // Not focusable
|
||||
}
|
||||
|
||||
@ -915,8 +894,7 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
|
||||
// accessible object. See the AccStateChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE, PR_TRUE);
|
||||
new AccStateChangeEvent(this, states::EDITABLE, PR_TRUE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
|
||||
@ -997,7 +975,7 @@ nsDocAccessible::AttributeChanged(nsIDocument *aDocument,
|
||||
|
||||
// If it was the focused node, cache the new state.
|
||||
if (aElement == gLastFocusedNode)
|
||||
gLastFocusedAccessiblesState = nsAccUtils::State(accessible);
|
||||
gLastFocusedAccessiblesState = accessible->State();
|
||||
}
|
||||
|
||||
// nsDocAccessible protected member
|
||||
@ -1033,16 +1011,12 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
|
||||
nsRefPtr<AccEvent> enabledChangeEvent =
|
||||
new AccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_ENABLED,
|
||||
PR_TRUE);
|
||||
new AccStateChangeEvent(aContent, states::ENABLED);
|
||||
|
||||
FireDelayedAccessibleEvent(enabledChangeEvent);
|
||||
|
||||
nsRefPtr<AccEvent> sensitiveChangeEvent =
|
||||
new AccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_SENSITIVE,
|
||||
PR_TRUE);
|
||||
new AccStateChangeEvent(aContent, states::SENSITIVE);
|
||||
|
||||
FireDelayedAccessibleEvent(sensitiveChangeEvent);
|
||||
return;
|
||||
@ -1100,9 +1074,7 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::contenteditable) {
|
||||
nsRefPtr<AccEvent> editableChangeEvent =
|
||||
new AccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE);
|
||||
new AccStateChangeEvent(aContent, states::EDITABLE);
|
||||
FireDelayedAccessibleEvent(editableChangeEvent);
|
||||
return;
|
||||
}
|
||||
@ -1117,16 +1089,14 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_required) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_REQUIRED,
|
||||
PR_FALSE);
|
||||
new AccStateChangeEvent(aContent, states::REQUIRED);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_invalid) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID,
|
||||
PR_FALSE);
|
||||
new AccStateChangeEvent(aContent, states::INVALID);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -1157,8 +1127,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// We treat aria-expanded as a global ARIA state for historical reasons
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_expanded) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE);
|
||||
new AccStateChangeEvent(aContent, states::EXPANDED);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -1175,10 +1144,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_checked ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_pressed) {
|
||||
const PRUint32 kState = (aAttribute == nsAccessibilityAtoms::aria_checked) ?
|
||||
nsIAccessibleStates::STATE_CHECKED :
|
||||
nsIAccessibleStates::STATE_PRESSED;
|
||||
states::CHECKED : states::PRESSED;
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, kState, PR_FALSE);
|
||||
new AccStateChangeEvent(aContent, kState);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
if (aContent == gLastFocusedNode) {
|
||||
// State changes for MIXED state currently only supported for focused item, because
|
||||
@ -1187,13 +1155,12 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// without caching that info.
|
||||
nsAccessible *accessible = event->GetAccessible();
|
||||
if (accessible) {
|
||||
PRBool wasMixed = (gLastFocusedAccessiblesState & nsIAccessibleStates::STATE_MIXED) != 0;
|
||||
PRBool wasMixed = (gLastFocusedAccessiblesState & states::MIXED) != 0;
|
||||
PRBool isMixed =
|
||||
(nsAccUtils::State(accessible) & nsIAccessibleStates::STATE_MIXED) != 0;
|
||||
(accessible->State() & states::MIXED) != 0;
|
||||
if (wasMixed != isMixed) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_MIXED,
|
||||
PR_FALSE, isMixed);
|
||||
new AccStateChangeEvent(aContent, states::MIXED, isMixed);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
@ -1203,8 +1170,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_readonly) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_READONLY,
|
||||
PR_FALSE);
|
||||
new AccStateChangeEvent(aContent, states::READONLY);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -1241,8 +1207,7 @@ void nsDocAccessible::ContentStateChanged(nsIDocument* aDocument,
|
||||
|
||||
if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID,
|
||||
PR_FALSE, PR_TRUE);
|
||||
new AccStateChangeEvent(aContent, states::INVALID, PR_TRUE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
|
||||
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
|
||||
|
||||
@ -501,7 +501,7 @@ protected:
|
||||
*/
|
||||
PRPackedBool mIsLoaded;
|
||||
|
||||
static PRUint32 gLastFocusedAccessiblesState;
|
||||
static PRUint64 gLastFocusedAccessiblesState;
|
||||
|
||||
nsTArray<nsRefPtr<nsDocAccessible> > mChildDocuments;
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "nsOuterDocAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
@ -66,14 +67,10 @@ nsOuterDocAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_INTERNAL_FRAME;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOuterDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsOuterDocAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
return nsAccessible::NativeState() & ~states::FOCUSABLE;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
@ -35,6 +35,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsAccUtils.h"
|
||||
@ -185,28 +186,24 @@ PRUint32 nsRootAccessible::GetChromeFlags()
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsRootAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsRootAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsDocAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsDocAccessibleWrap::NativeState();
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
PRUint32 chromeFlags = GetChromeFlags();
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
||||
*aState |= nsIAccessibleStates::STATE_SIZEABLE;
|
||||
states |= states::SIZEABLE;
|
||||
}
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR) {
|
||||
// If it has a titlebar it's movable
|
||||
// XXX unless it's minimized or maximized, but not sure
|
||||
// how to detect that
|
||||
*aState |= nsIAccessibleStates::STATE_MOVEABLE;
|
||||
states |= states::MOVEABLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
|
||||
if (fm) {
|
||||
nsCOMPtr<nsIDOMWindow> rootWindow;
|
||||
@ -215,16 +212,16 @@ nsRootAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
nsCOMPtr<nsIDOMWindow> activeWindow;
|
||||
fm->GetActiveWindow(getter_AddRefs(activeWindow));
|
||||
if (activeWindow == rootWindow)
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_ACTIVE;
|
||||
states |= states::ACTIVE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (GetChromeFlags() & nsIWebBrowserChrome::CHROME_MODAL) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_MODAL;
|
||||
states |= states::MODAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
const char* const docEvents[] = {
|
||||
@ -365,7 +362,7 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible* aFocusAccessible,
|
||||
nsDocAccessible* focusDocument = focusAccessible->GetDocAccessible();
|
||||
NS_ASSERTION(focusDocument, "No document while accessible is in document?!");
|
||||
|
||||
gLastFocusedAccessiblesState = nsAccUtils::State(focusAccessible);
|
||||
gLastFocusedAccessiblesState = focusAccessible->State();
|
||||
|
||||
// Fire menu start/end events for ARIA menus.
|
||||
if (focusAccessible->ARIARole() == nsIAccessibleRole::ROLE_MENUITEM) {
|
||||
@ -559,18 +556,16 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
#endif
|
||||
|
||||
if (eventType.EqualsLiteral("RadioStateChange")) {
|
||||
PRUint32 state = nsAccUtils::State(accessible);
|
||||
PRUint64 state = accessible->State();
|
||||
|
||||
// radiogroup in prefWindow is exposed as a list,
|
||||
// and panebutton is exposed as XULListitem in A11y.
|
||||
// nsXULListitemAccessible::GetStateInternal uses STATE_SELECTED in this case,
|
||||
// so we need to check nsIAccessibleStates::STATE_SELECTED also.
|
||||
PRBool isEnabled = (state & (nsIAccessibleStates::STATE_CHECKED |
|
||||
nsIAccessibleStates::STATE_SELECTED)) != 0;
|
||||
// so we need to check states::SELECTED also.
|
||||
PRBool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0;
|
||||
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
|
||||
if (isEnabled)
|
||||
@ -580,13 +575,12 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
}
|
||||
|
||||
if (eventType.EqualsLiteral("CheckboxStateChange")) {
|
||||
PRUint32 state = nsAccUtils::State(accessible);
|
||||
PRUint64 state = accessible->State();
|
||||
|
||||
PRBool isEnabled = !!(state & nsIAccessibleStates::STATE_CHECKED);
|
||||
PRBool isEnabled = !!(state & states::CHECKED);
|
||||
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
|
||||
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
return;
|
||||
@ -615,12 +609,11 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (treeItemAccessible && eventType.EqualsLiteral("OpenStateChange")) {
|
||||
PRUint32 state = nsAccUtils::State(accessible); // collapsed/expanded changed
|
||||
PRBool isEnabled = (state & nsIAccessibleStates::STATE_EXPANDED) != 0;
|
||||
PRUint64 state = accessible->State();
|
||||
PRBool isEnabled = (state & states::EXPANDED) != 0;
|
||||
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, isEnabled);
|
||||
new AccStateChangeEvent(accessible, states::EXPANDED, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
return;
|
||||
}
|
||||
@ -724,7 +717,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
// It is not top level menuitem
|
||||
// Only fire focus event if it is not inside collapsed popup
|
||||
// and not a listitem of a combo box
|
||||
if (nsAccUtils::State(containerAccessible) & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
if (containerAccessible->State() & states::COLLAPSED) {
|
||||
nsAccessible *containerParent = containerAccessible->GetParent();
|
||||
if (!containerParent)
|
||||
return;
|
||||
@ -817,7 +810,7 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
|
||||
// a background tab (tabbed browsing)
|
||||
nsAccessible *parent = accDoc->GetParent();
|
||||
while (parent) {
|
||||
if (nsAccUtils::State(parent) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
if (parent->State() & states::INVISIBLE)
|
||||
return nsnull;
|
||||
|
||||
if (parent == this)
|
||||
@ -905,9 +898,7 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(combobox,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
new AccStateChangeEvent(combobox, states::EXPANDED, PR_TRUE);
|
||||
if (event)
|
||||
nsEventShell::FireEvent(event);
|
||||
}
|
||||
@ -943,9 +934,7 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode* aNode,
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(combobox,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, PR_FALSE);
|
||||
new AccStateChangeEvent(combobox, states::EXPANDED, PR_FALSE);
|
||||
if (event)
|
||||
nsEventShell::FireEvent(event);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// nsRootAccessible
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
@ -85,13 +86,11 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
||||
{
|
||||
if (aIndex == eAction_Click) { // 0 is the magic value for default action
|
||||
// cycle, check or uncheck
|
||||
PRUint32 state;
|
||||
nsresult rv = GetStateInternal(&state, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint64 state = NativeState();
|
||||
|
||||
if (state & nsIAccessibleStates::STATE_CHECKED)
|
||||
if (state & states::CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
else if (state & nsIAccessibleStates::STATE_MIXED)
|
||||
else if (state & states::MIXED)
|
||||
aName.AssignLiteral("cycle");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
@ -111,33 +110,30 @@ nsHTMLCheckboxAccessible::DoAction(PRUint8 aIndex)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLCheckboxAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsFormControlAccessible::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
|
||||
PRBool state = PR_FALSE; // Radio buttons and check boxes can be checked or mixed
|
||||
state |= states::CHECKABLE;
|
||||
PRBool checkState = PR_FALSE; // Radio buttons and check boxes can be checked or mixed
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement =
|
||||
do_QueryInterface(mContent);
|
||||
|
||||
if (htmlCheckboxElement) {
|
||||
htmlCheckboxElement->GetIndeterminate(&state);
|
||||
htmlCheckboxElement->GetIndeterminate(&checkState);
|
||||
|
||||
if (state) {
|
||||
*aState |= nsIAccessibleStates::STATE_MIXED;
|
||||
if (checkState) {
|
||||
state |= states::MIXED;
|
||||
} else { // indeterminate can't be checked at the same time.
|
||||
htmlCheckboxElement->GetChecked(&state);
|
||||
htmlCheckboxElement->GetChecked(&checkState);
|
||||
|
||||
if (state)
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
if (checkState)
|
||||
state |= states::CHECKED;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -150,14 +146,12 @@ nsHTMLRadioButtonAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLRadioButtonAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessibleWrap::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
|
||||
@ -167,9 +161,9 @@ nsHTMLRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
||||
htmlRadioElement->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
@ -266,19 +260,16 @@ nsHTMLButtonAccessible::DoAction(PRUint8 aIndex)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLButtonAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLButtonAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::submit, eIgnoreCase))
|
||||
*aState |= nsIAccessibleStates::STATE_DEFAULT;
|
||||
state |= states::DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
@ -363,21 +354,18 @@ nsHTML4ButtonAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PUSHBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTML4ButtonAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTML4ButtonAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::FOCUSABLE;
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::submit, eIgnoreCase))
|
||||
*aState |= nsIAccessibleStates::STATE_DEFAULT;
|
||||
state |= states::DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@ -434,11 +422,7 @@ nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
|
||||
{
|
||||
PRUint32 state;
|
||||
nsresult rv = GetStateInternal(&state, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (state & nsIAccessibleStates::STATE_PROTECTED) // Don't return password text!
|
||||
if (NativeState() & states::PROTECTED) // Don't return password text!
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mContent));
|
||||
@ -454,56 +438,50 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLTextFieldAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
// can be focusable, focused, protected. readonly, unavailable, selected
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::password, eIgnoreCase)) {
|
||||
*aState |= nsIAccessibleStates::STATE_PROTECTED;
|
||||
state |= states::PROTECTED;
|
||||
}
|
||||
else {
|
||||
nsAccessible* parent = GetParent();
|
||||
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
|
||||
state |= states::HASPOPUP;
|
||||
}
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::readonly)) {
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
state |= states::READONLY;
|
||||
}
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mContent));
|
||||
// Is it an <input> or a <textarea> ?
|
||||
if (htmlInput) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
|
||||
state |= states::SINGLE_LINE;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
|
||||
state |= states::MULTI_LINE;
|
||||
}
|
||||
|
||||
if (!(*aExtraState & nsIAccessibleStates::EXT_STATE_EDITABLE))
|
||||
return NS_OK;
|
||||
if (!(state & states::EDITABLE))
|
||||
return state;
|
||||
|
||||
nsCOMPtr<nsIContent> bindingContent = mContent->GetBindingParent();
|
||||
if (bindingContent &&
|
||||
bindingContent->NodeInfo()->Equals(nsAccessibilityAtoms::textbox,
|
||||
kNameSpaceID_XUL) &&
|
||||
bindingContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::autocomplete,
|
||||
eIgnoreCase)) {
|
||||
// If parent is XUL textbox and value of @type attribute is "autocomplete",
|
||||
// then this accessible supports autocompletion.
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION;
|
||||
} else if (gIsFormFillEnabled && htmlInput &&
|
||||
!(*aState & nsIAccessibleStates::STATE_PROTECTED)) {
|
||||
kNameSpaceID_XUL)) {
|
||||
if (bindingContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::autocomplete,
|
||||
eIgnoreCase)) {
|
||||
// If parent is XUL textbox and value of @type attribute is "autocomplete",
|
||||
// then this accessible supports autocompletion.
|
||||
state |= states::SUPPORTS_AUTOCOMPLETION;
|
||||
}
|
||||
} else if (gIsFormFillEnabled && htmlInput && !(state & states::PROTECTED)) {
|
||||
// Check to see if autocompletion is allowed on this input. We don't expose
|
||||
// it for password fields even though the entire password can be remembered
|
||||
// for a page if the user asks it to be. However, the kind of autocomplete
|
||||
@ -523,11 +501,11 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
||||
}
|
||||
|
||||
if (!formContent || !autocomplete.LowerCaseEqualsLiteral("off"))
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION;
|
||||
state |= states::SUPPORTS_AUTOCOMPLETION;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetNumActions(PRUint8 *_retval)
|
||||
@ -548,7 +526,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::DoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> element(do_QueryInterface(mContent));
|
||||
nsCOMPtr<nsIDOMHTMLElement> element(do_QueryInterface(mContent));
|
||||
if ( element ) {
|
||||
return element->Focus();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
nsHTMLRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
};
|
||||
@ -100,7 +100,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
@ -68,14 +69,13 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageAccessible, nsAccessible,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible public
|
||||
|
||||
nsresult
|
||||
nsHTMLImageAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLImageAccessible::NativeState()
|
||||
{
|
||||
// The state is a bitfield, get our inherited state, then logically OR it with
|
||||
// STATE_ANIMATED if this is an animated image.
|
||||
// states::ANIMATED if this is an animated image.
|
||||
|
||||
nsresult rv = nsLinkableAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsLinkableAccessible::NativeState();
|
||||
|
||||
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mContent));
|
||||
nsCOMPtr<imgIRequest> imageRequest;
|
||||
@ -92,10 +92,10 @@ nsHTMLImageAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRBool animated;
|
||||
imgContainer->GetAnimated(&animated);
|
||||
if (animated)
|
||||
*aState |= nsIAccessibleStates::STATE_ANIMATED;
|
||||
state |= states::ANIMATED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
private:
|
||||
|
@ -233,17 +233,17 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLAreaAccessible: nsAccessible public
|
||||
|
||||
nsresult
|
||||
nsHTMLAreaAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLAreaAccessible::NativeState()
|
||||
{
|
||||
// Bypass the link states specialization for non links.
|
||||
if (mRoleMapEntry &&
|
||||
mRoleMapEntry->role != nsIAccessibleRole::ROLE_NOTHING &&
|
||||
mRoleMapEntry->role != nsIAccessibleRole::ROLE_LINK) {
|
||||
return nsAccessible::GetStateInternal(aState,aExtraState);
|
||||
return nsAccessible::NativeState();
|
||||
}
|
||||
|
||||
return nsHTMLLinkAccessible::GetStateInternal(aState, aExtraState);
|
||||
return nsHTMLLinkAccessible::NativeState();
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#include "nsIEventStateManager.h"
|
||||
@ -66,40 +67,38 @@ nsHTMLLinkAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LINK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLLinkAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
*aState &= ~nsIAccessibleStates::STATE_READONLY;
|
||||
states &= ~states::READONLY;
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::name)) {
|
||||
// This is how we indicate it is a named anchor
|
||||
// In other words, this anchor can be selected as a location :)
|
||||
// There is no other better state to use to indicate this.
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTABLE;
|
||||
states |= states::SELECTABLE;
|
||||
}
|
||||
|
||||
nsEventStates state = mContent->IntrinsicState();
|
||||
if (state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED |
|
||||
NS_EVENT_STATE_UNVISITED)) {
|
||||
*aState |= nsIAccessibleStates::STATE_LINKED;
|
||||
states |= states::LINKED;
|
||||
|
||||
if (state.HasState(NS_EVENT_STATE_VISITED))
|
||||
*aState |= nsIAccessibleStates::STATE_TRAVERSED;
|
||||
states |= states::TRAVERSED;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
// This is a either named anchor (a link with also a name attribute) or
|
||||
// it doesn't have any attributes. Check if 'click' event handler is
|
||||
// registered, otherwise bail out.
|
||||
if (nsCoreUtils::HasClickListener(mContent))
|
||||
*aState |= nsIAccessibleStates::STATE_LINKED;
|
||||
states |= states::LINKED;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual bool IsHyperLink();
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "nsEventShell.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFrame.h"
|
||||
@ -69,31 +70,27 @@ nsHTMLSelectListAccessible::
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible: nsAccessible public
|
||||
|
||||
nsresult
|
||||
nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLSelectListAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessibleWrap::NativeState();
|
||||
|
||||
// As a nsHTMLSelectListAccessible we can have the following states:
|
||||
// nsIAccessibleStates::STATE_MULTISELECTABLE
|
||||
// nsIAccessibleStates::STATE_EXTSELECTABLE
|
||||
// states::MULTISELECTABLE, states::EXTSELECTABLE
|
||||
|
||||
if (*aState & nsIAccessibleStates::STATE_FOCUSED) {
|
||||
if (state & states::FOCUSED) {
|
||||
// Treat first focusable option node as actual focus, in order
|
||||
// to avoid confusing JAWS, which needs focus on the option
|
||||
nsCOMPtr<nsIContent> focusedOption =
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(mContent);
|
||||
if (focusedOption) { // Clear focused state since it is on option
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSED;
|
||||
state &= ~states::FOCUSED;
|
||||
}
|
||||
}
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::multiple))
|
||||
*aState |= nsIAccessibleStates::STATE_MULTISELECTABLE |
|
||||
nsIAccessibleStates::STATE_EXTSELECTABLE;
|
||||
state |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
@ -229,9 +226,9 @@ nsHTMLSelectOptionAccessible::GetNameInternal(nsAString& aName)
|
||||
// nsAccessible protected
|
||||
nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
nsCOMPtr<nsIContent> content = GetSelectState(&state);
|
||||
if (state & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
PRUint64 state = 0;
|
||||
nsIContent* content = GetSelectState(&state);
|
||||
if (state & states::COLLAPSED) {
|
||||
if (content) {
|
||||
return content->GetPrimaryFrame();
|
||||
}
|
||||
@ -242,46 +239,35 @@ nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
|
||||
return nsAccessible::GetBoundsFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLSelectOptionAccessible we can have the following states:
|
||||
* STATE_SELECTABLE
|
||||
* STATE_SELECTED
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_OFFSCREEN
|
||||
*/
|
||||
nsresult
|
||||
nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLSelectOptionAccessible::NativeState()
|
||||
{
|
||||
// As a nsHTMLSelectOptionAccessible we can have the following states:
|
||||
// SELECTABLE, SELECTED, FOCUSED, FOCUSABLE, OFFSCREEN
|
||||
// Upcall to nsAccessible, but skip nsHyperTextAccessible impl
|
||||
// because we don't want EXT_STATE_EDITABLE or EXT_STATE_SELECTABLE_TEXT
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
// because we don't want EDITABLE or SELECTABLE_TEXT
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
PRUint32 selectState = 0, selectExtState = 0;
|
||||
nsCOMPtr<nsIContent> selectContent = GetSelectState(&selectState,
|
||||
&selectExtState);
|
||||
if (selectState & nsIAccessibleStates::STATE_INVISIBLE) {
|
||||
return NS_OK;
|
||||
}
|
||||
PRUint64 selectState = 0;
|
||||
nsIContent* selectContent = GetSelectState(&selectState);
|
||||
if (selectState & states::INVISIBLE)
|
||||
return state;
|
||||
|
||||
NS_ENSURE_TRUE(selectContent, NS_ERROR_FAILURE);
|
||||
|
||||
// Is disabled?
|
||||
if (0 == (*aState & nsIAccessibleStates::STATE_UNAVAILABLE)) {
|
||||
*aState |= (nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_SELECTABLE);
|
||||
if (0 == (state & states::UNAVAILABLE)) {
|
||||
state |= (states::FOCUSABLE | states::SELECTABLE);
|
||||
// When the list is focused but no option is actually focused,
|
||||
// Firefox draws a focus ring around the first non-disabled option.
|
||||
// We need to indicated STATE_FOCUSED in that case, because it
|
||||
// We need to indicate states::FOCUSED in that case, because it
|
||||
// prevents JAWS from ignoring the list
|
||||
// GetFocusedOption() ensures that an option node is
|
||||
// returned in this case, as long as some focusable option exists
|
||||
// in the listbox
|
||||
nsCOMPtr<nsIContent> focusedOption = GetFocusedOption(selectContent);
|
||||
if (focusedOption == mContent)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
|
||||
// Are we selected?
|
||||
@ -289,33 +275,31 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
|
||||
if (option) {
|
||||
option->GetSelected(&isSelected);
|
||||
if ( isSelected )
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
if (isSelected)
|
||||
state |= states::SELECTED;
|
||||
|
||||
}
|
||||
|
||||
if (selectState & nsIAccessibleStates::STATE_OFFSCREEN) {
|
||||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
if (selectState & states::OFFSCREEN) {
|
||||
state |= states::OFFSCREEN;
|
||||
}
|
||||
else if (selectState & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
// <select> is COLLAPSED: add STATE_OFFSCREEN, if not the currently
|
||||
else if (selectState & states::COLLAPSED) {
|
||||
// <select> is COLLAPSED: add OFFSCREEN, if not the currently
|
||||
// visible option
|
||||
if (!isSelected) {
|
||||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
state |= states::OFFSCREEN;
|
||||
}
|
||||
else {
|
||||
// Clear offscreen and invisible for currently showing option
|
||||
*aState &= ~nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
*aState &= ~nsIAccessibleStates::STATE_INVISIBLE;
|
||||
if (aExtraState) {
|
||||
*aExtraState |= selectExtState & nsIAccessibleStates::EXT_STATE_OPAQUE;
|
||||
}
|
||||
state &= ~(states::OFFSCREEN | states::INVISIBLE);
|
||||
state |= selectState & states::OPAQUE1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// XXX list frames are weird, don't rely on nsAccessible's general
|
||||
// visibility implementation unless they get reimplemented in layout
|
||||
*aState &= ~nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
// <select> is not collapsed: compare bounds to calculate STATE_OFFSCREEN
|
||||
state &= ~states::OFFSCREEN;
|
||||
// <select> is not collapsed: compare bounds to calculate OFFSCREEN
|
||||
nsAccessible* listAcc = GetParent();
|
||||
if (listAcc) {
|
||||
PRInt32 optionX, optionY, optionWidth, optionHeight;
|
||||
@ -323,12 +307,12 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
||||
GetBounds(&optionX, &optionY, &optionWidth, &optionHeight);
|
||||
listAcc->GetBounds(&listX, &listY, &listWidth, &listHeight);
|
||||
if (optionY < listY || optionY + optionHeight > listY + listHeight) {
|
||||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
state |= states::OFFSCREEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
@ -553,9 +537,9 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti
|
||||
|
||||
option->GetDocAccessible()->FireDelayedAccessibleEvent(selWithinEvent);
|
||||
|
||||
PRUint32 state = nsAccUtils::State(option);
|
||||
PRUint64 state = option->State();
|
||||
PRUint32 eventType;
|
||||
if (state & nsIAccessibleStates::STATE_SELECTED) {
|
||||
if (state & states::SELECTED) {
|
||||
eventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
|
||||
}
|
||||
else {
|
||||
@ -571,14 +555,11 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: private methods
|
||||
|
||||
nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
||||
PRUint32* aExtraState)
|
||||
nsIContent*
|
||||
nsHTMLSelectOptionAccessible::GetSelectState(PRUint64* aState)
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
nsIContent *content = mContent;
|
||||
while (content && content->Tag() != nsAccessibilityAtoms::select) {
|
||||
content = content->GetParent();
|
||||
@ -587,7 +568,7 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
||||
if (content) {
|
||||
nsAccessible* selAcc = GetAccService()->GetAccessible(content);
|
||||
if (selAcc) {
|
||||
selAcc->GetState(aState, aExtraState);
|
||||
*aState = selAcc->State();
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@ -612,18 +593,14 @@ nsHTMLSelectOptGroupAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_HEADING;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLSelectOptGroupAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLSelectOptGroupAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHTMLSelectOptionAccessible::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsHTMLSelectOptionAccessible::NativeState();
|
||||
|
||||
*aState &= ~(nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_SELECTABLE);
|
||||
state &= ~(states::FOCUSABLE | states::SELECTABLE);
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::DoAction(PRUint8 index)
|
||||
@ -726,35 +703,28 @@ nsHTMLComboboxAccessible::Shutdown()
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_HASPOPUP
|
||||
* STATE_EXPANDED
|
||||
* STATE_COLLAPSED
|
||||
*/
|
||||
nsresult
|
||||
nsHTMLComboboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLComboboxAccessible::NativeState()
|
||||
{
|
||||
// As a nsHTMLComboboxAccessible we can have the following states:
|
||||
// FOCUSED, FOCUSABLE, HASPOPUP, EXPANDED, COLLAPSED
|
||||
// Get focus status from base class
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
nsIFrame *frame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
|
||||
if (comboFrame && comboFrame->IsDroppedDown()) {
|
||||
*aState |= nsIAccessibleStates::STATE_EXPANDED;
|
||||
state |= states::EXPANDED;
|
||||
}
|
||||
else {
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSED; // Focus is on an option
|
||||
*aState |= nsIAccessibleStates::STATE_COLLAPSED;
|
||||
state &= ~states::FOCUSED; // Focus is on an option
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP |
|
||||
nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::HASPOPUP | states::FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetDescription(nsAString& aDescription)
|
||||
@ -894,29 +864,22 @@ nsHTMLComboboxListAccessible::IsPrimaryForNode() const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxAccessible: nsAccessible
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxListAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_INVISIBLE
|
||||
* STATE_FLOATING
|
||||
*/
|
||||
nsresult
|
||||
nsHTMLComboboxListAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLComboboxListAccessible::NativeState()
|
||||
{
|
||||
// As a nsHTMLComboboxListAccessible we can have the following states:
|
||||
// FOCUSED, FOCUSABLE, FLOATING, INVISIBLE
|
||||
// Get focus status from base class
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame = do_QueryFrame(boundsFrame);
|
||||
if (comboFrame && comboFrame->IsDroppedDown())
|
||||
*aState |= nsIAccessibleStates::STATE_FLOATING;
|
||||
state |= states::FLOATING;
|
||||
else
|
||||
*aState |= nsIAccessibleStates::STATE_INVISIBLE;
|
||||
state |= states::INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -931,7 +894,7 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
|
||||
if (!comboAcc)
|
||||
return;
|
||||
|
||||
if (0 == (nsAccUtils::State(comboAcc) & nsIAccessibleStates::STATE_COLLAPSED)) {
|
||||
if (0 == (comboAcc->State() & states::COLLAPSED)) {
|
||||
nsHTMLSelectListAccessible::GetBoundsRect(aBounds, aBoundingFrame);
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// SelectAccessible
|
||||
virtual bool IsSelect();
|
||||
@ -114,7 +114,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
@ -136,10 +136,9 @@ private:
|
||||
/**
|
||||
* Get Select element's accessible state
|
||||
* @param aState, Select element state
|
||||
* @param aExtraState, Select element extra state
|
||||
* @return Select element content, returns null if not avaliable
|
||||
*/
|
||||
nsIContent* GetSelectState(PRUint32* aState, PRUint32* aExtraState = nsnull);
|
||||
nsIContent* GetSelectState(PRUint64* aState);
|
||||
};
|
||||
|
||||
/*
|
||||
@ -159,7 +158,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
@ -195,7 +194,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
protected:
|
||||
@ -232,7 +231,7 @@ public:
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
};
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
@ -92,25 +93,23 @@ nsHTMLTableCellAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_CELL;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTableCellAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLTableCellAccessible::NativeState()
|
||||
{
|
||||
nsresult rv= nsHyperTextAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
nsIFrame *frame = mContent->GetPrimaryFrame();
|
||||
NS_ASSERTION(frame, "No frame for valid cell accessible!");
|
||||
|
||||
if (frame) {
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTABLE;
|
||||
state |= states::SELECTABLE;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
frame->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -456,14 +455,10 @@ nsHTMLTableAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_TABLE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLTableAccessible::NativeState()
|
||||
{
|
||||
nsresult rv= nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
return NS_OK;
|
||||
return nsAccessible::NativeState() | states::READONLY;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1367,9 +1362,8 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
|
||||
nsDocAccessible *docAccessible = GetDocAccessible();
|
||||
if (docAccessible) {
|
||||
PRUint32 state, extState;
|
||||
docAccessible->GetState(&state, &extState);
|
||||
if (extState & nsIAccessibleStates::EXT_STATE_EDITABLE) { // Need to see all elements while document is being edited
|
||||
PRUint64 docState = docAccessible->State();
|
||||
if (docState & states::EDITABLE) { // Need to see all elements while document is being edited
|
||||
RETURN_LAYOUT_ANSWER(PR_FALSE, "In editable document");
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
protected:
|
||||
@ -138,7 +138,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
// nsHTMLTableAccessible
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsPresContext.h"
|
||||
@ -84,22 +85,20 @@ nsHTMLTextAccessible::NativeRole()
|
||||
return nsTextAccessible::NativeRole();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLTextAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsTextAccessible::NativeState();
|
||||
|
||||
nsDocAccessible *docAccessible = GetDocAccessible();
|
||||
if (docAccessible) {
|
||||
PRUint32 state, extState;
|
||||
docAccessible->GetState(&state, &extState);
|
||||
if (0 == (extState & nsIAccessibleStates::EXT_STATE_EDITABLE)) {
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY; // Links not focusable in editor
|
||||
PRUint64 docState = docAccessible->State();
|
||||
if (0 == (docState & states::EDITABLE)) {
|
||||
state |= states::READONLY; // Links not focusable in editor
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -148,23 +147,10 @@ nsHTMLBRAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_WHITESPACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBRAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLBRAccessible::NativeState()
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
*aState = nsIAccessibleStates::STATE_READONLY;
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
return states::READONLY;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -282,15 +268,10 @@ nsHTMLLIAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LISTITEM;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLIAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLLIAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
return NS_OK;
|
||||
return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLLIAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
@ -397,15 +378,14 @@ nsHTMLListBulletAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_STATICTEXT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLListBulletAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsLeafAccessible::NativeState();
|
||||
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
return NS_OK;
|
||||
state &= ~states::FOCUSABLE;
|
||||
state |= states::READONLY;
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
@ -439,14 +419,9 @@ nsHTMLListAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LIST;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLListAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLListAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
return NS_OK;
|
||||
return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -87,7 +87,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -140,7 +140,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
||||
PRUint32 aLength = PR_UINT32_MAX);
|
||||
};
|
||||
@ -158,7 +158,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -180,7 +180,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// nsHTMLLIAccessible
|
||||
void UpdateBullet(bool aHasBullet);
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
@ -173,14 +174,10 @@ nsHyperTextAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHyperTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHyperTextAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
PRUint64 states = nsAccessibleWrap::NativeState();
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
GetAssociatedEditor(getter_AddRefs(editor));
|
||||
@ -188,17 +185,17 @@ nsHyperTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint32 flags;
|
||||
editor->GetFlags(&flags);
|
||||
if (0 == (flags & nsIPlaintextEditor::eEditorReadonlyMask)) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE;
|
||||
states |= states::EDITABLE;
|
||||
}
|
||||
} else if (mContent->Tag() == nsAccessibilityAtoms::article) {
|
||||
// We want <article> to behave like a document in terms of readonly state.
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
states |= states::READONLY;
|
||||
}
|
||||
|
||||
if (GetChildCount() > 0)
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SELECTABLE_TEXT;
|
||||
states |= states::SELECTABLE_TEXT;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
// Substring must be entirely within the same text node
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
virtual PRBool RemoveChild(nsAccessible* aAccessible);
|
||||
|
@ -548,16 +548,12 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
||||
|
||||
- (BOOL)isFocused
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
mGeckoAccessible->GetState (&state, nsnull);
|
||||
return (state & nsIAccessibleStates::STATE_FOCUSED) != 0;
|
||||
return (mGeckoAccessible->State() & states::FOCUSED) != 0;
|
||||
}
|
||||
|
||||
- (BOOL)canBeFocused
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
mGeckoAccessible->GetState (&state, nsnull);
|
||||
return (state & nsIAccessibleStates::STATE_FOCUSABLE) != 0;
|
||||
return mGeckoAccessible->State() & states::FOCUSABLE;
|
||||
}
|
||||
|
||||
- (BOOL)focus
|
||||
@ -568,9 +564,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
|
||||
|
||||
- (BOOL)isEnabled
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
mGeckoAccessible->GetState (&state, nsnull);
|
||||
return (state & nsIAccessibleStates::STATE_UNAVAILABLE) == 0;
|
||||
return (mGeckoAccessible->State() & states::UNAVAILABLE) == 0;
|
||||
}
|
||||
|
||||
// The root accessible calls this when the focused node was
|
||||
|
@ -157,12 +157,11 @@ enum CheckboxValue {
|
||||
|
||||
- (int)isChecked
|
||||
{
|
||||
PRUint32 state = 0;
|
||||
mGeckoAccessible->GetStateInternal(&state, nsnull);
|
||||
PRUint64 state = mGeckoAccessible->NativeState();
|
||||
|
||||
// check if we're checked or in a mixed state
|
||||
if (state & nsIAccessibleStates::STATE_CHECKED) {
|
||||
return (state & nsIAccessibleStates::STATE_MIXED) ? kMixed : kChecked;
|
||||
if (state & states::CHECKED) {
|
||||
return (state & states::MIXED) ? kMixed : kChecked;
|
||||
}
|
||||
|
||||
return kUnchecked;
|
||||
|
@ -138,11 +138,8 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
||||
if ([[self role] isEqualToString:NSAccessibilityStaticTextRole])
|
||||
return YES;
|
||||
|
||||
if (mGeckoEditableTextAccessible) {
|
||||
PRUint32 state = 0;
|
||||
mGeckoAccessible->GetState(&state, nsnull);
|
||||
return (state & nsIAccessibleStates::STATE_READONLY) == 0;
|
||||
}
|
||||
if (mGeckoEditableTextAccessible)
|
||||
return (mGeckoAccessible->State() & states::READONLY) == 0;
|
||||
|
||||
return NO;
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRect.h"
|
||||
@ -84,9 +85,7 @@ class nsAccessibleWrap : public nsAccessible
|
||||
PRInt32 GetUnignoredChildCount(PRBool aDeepCount);
|
||||
|
||||
PRBool HasPopup () {
|
||||
PRUint32 state = 0;
|
||||
GetStateInternal(&state, nsnull);
|
||||
return (state & nsIAccessibleStates::STATE_HASPOPUP);
|
||||
return (NativeState() & states::HASPOPUP);
|
||||
}
|
||||
|
||||
// return this accessible's all children, adhering to "flat" accessibles by not returning their children.
|
||||
|
@ -42,12 +42,9 @@
|
||||
|
||||
#include "AccessibleComponent_i.c"
|
||||
|
||||
#include "nsIAccessNode.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "nsAccessNodeWrap.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIDOMCSSPrimitiveValue.h"
|
||||
@ -85,21 +82,17 @@ __try {
|
||||
*aX = 0;
|
||||
*aY = 0;
|
||||
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(this));
|
||||
if (!acc)
|
||||
return E_FAIL;
|
||||
|
||||
// If the object is not on any screen the returned position is (0,0).
|
||||
PRUint32 states = 0;
|
||||
nsresult rv = acc->GetState(&states, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (states & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
PRUint64 state = acc->State();
|
||||
if (state & states::INVISIBLE)
|
||||
return S_OK;
|
||||
|
||||
PRInt32 x = 0, y = 0, width = 0, height = 0;
|
||||
rv = acc->GetBounds(&x, &y, &width, &height);
|
||||
nsresult rv = acc->GetBounds(&x, &y, &width, &height);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
@ -435,11 +436,17 @@ __try {
|
||||
if (!xpAccessible)
|
||||
return E_FAIL;
|
||||
|
||||
PRUint32 state = 0;
|
||||
if (NS_FAILED(xpAccessible->GetState(&state, nsnull)))
|
||||
return E_FAIL;
|
||||
// MSAA only has 31 states and the lowest 31 bits of our state bit mask
|
||||
// are the same states as MSAA.
|
||||
// Note: we map the following Gecko states to different MSAA states:
|
||||
// REQUIRED -> ALERT_LOW
|
||||
// ALERT -> ALERT_MEDIUM
|
||||
// INVALID -> ALERT_HIGH
|
||||
// CHECKABLE -> MARQUEED
|
||||
|
||||
pvarState->lVal = state;
|
||||
PRUint32 msaaState = 0;
|
||||
nsAccUtils::To32States(xpAccessible->State(), &msaaState, nsnull);
|
||||
pvarState->lVal = msaaState;
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
}
|
||||
@ -1243,14 +1250,11 @@ __try {
|
||||
|
||||
// XXX: bug 344674 should come with better approach that we have here.
|
||||
|
||||
PRUint32 states = 0, extraStates = 0;
|
||||
nsresult rv = GetState(&states, &extraStates);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
PRUint64 state = State();
|
||||
|
||||
if (states & nsIAccessibleStates::STATE_INVALID)
|
||||
if (state & states::INVALID)
|
||||
*aStates |= IA2_STATE_INVALID_ENTRY;
|
||||
if (states & nsIAccessibleStates::STATE_REQUIRED)
|
||||
if (state & states::REQUIRED)
|
||||
*aStates |= IA2_STATE_REQUIRED;
|
||||
|
||||
// The following IA2 states are not supported by Gecko
|
||||
@ -1259,31 +1263,31 @@ __try {
|
||||
// IA2_STATE_ICONIFIED
|
||||
// IA2_STATE_INVALID // This is not a state, it is the absence of a state
|
||||
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_ACTIVE)
|
||||
if (state & states::ACTIVE)
|
||||
*aStates |= IA2_STATE_ACTIVE;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_DEFUNCT)
|
||||
if (state & states::DEFUNCT)
|
||||
*aStates |= IA2_STATE_DEFUNCT;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_EDITABLE)
|
||||
if (state & states::EDITABLE)
|
||||
*aStates |= IA2_STATE_EDITABLE;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_HORIZONTAL)
|
||||
if (state & states::HORIZONTAL)
|
||||
*aStates |= IA2_STATE_HORIZONTAL;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_MODAL)
|
||||
if (state & states::MODAL)
|
||||
*aStates |= IA2_STATE_MODAL;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_MULTI_LINE)
|
||||
if (state & states::MULTI_LINE)
|
||||
*aStates |= IA2_STATE_MULTI_LINE;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_OPAQUE)
|
||||
if (state & states::OPAQUE1)
|
||||
*aStates |= IA2_STATE_OPAQUE;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_SELECTABLE_TEXT)
|
||||
if (state & states::SELECTABLE_TEXT)
|
||||
*aStates |= IA2_STATE_SELECTABLE_TEXT;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_SINGLE_LINE)
|
||||
if (state & states::SINGLE_LINE)
|
||||
*aStates |= IA2_STATE_SINGLE_LINE;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_STALE)
|
||||
if (state & states::STALE)
|
||||
*aStates |= IA2_STATE_STALE;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION)
|
||||
if (state & states::SUPPORTS_AUTOCOMPLETION)
|
||||
*aStates |= IA2_STATE_SUPPORTS_AUTOCOMPLETION;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_TRANSIENT)
|
||||
if (state & states::TRANSIENT)
|
||||
*aStates |= IA2_STATE_TRANSIENT;
|
||||
if (extraStates & nsIAccessibleStates::EXT_STATE_VERTICAL)
|
||||
if (state & states::VERTICAL)
|
||||
*aStates |= IA2_STATE_VERTICAL;
|
||||
|
||||
return S_OK;
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "nsHTMLWin32ObjectAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLWin32ObjectOwnerAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -70,20 +72,12 @@ nsHTMLWin32ObjectOwnerAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLWin32ObjectOwnerAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsHTMLWin32ObjectOwnerAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
if (rv == NS_OK_DEFUNCT_OBJECT)
|
||||
return rv;
|
||||
|
||||
// XXX: No HWND means this is windowless plugin which is not accessible in
|
||||
// the meantime.
|
||||
if (!mHwnd)
|
||||
*aState = nsIAccessibleStates::STATE_UNAVAILABLE;
|
||||
|
||||
return rv;
|
||||
return mHwnd ? nsAccessibleWrap::NativeState() : states::UNAVAILABLE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -43,13 +43,15 @@
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIThebesFontMetrics.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "gfxFont.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsTextAccessibleWrap Accessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -253,48 +255,30 @@ STDMETHODIMP nsTextAccessibleWrap::get_fontFamily(
|
||||
__try {
|
||||
*aFontFamily = NULL;
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
if (!frame || !presShell || !presShell->GetPresContext()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRenderingContext> rc = presShell->GetReferenceRenderingContext();
|
||||
if (!rc) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
const nsStyleFont *font = frame->GetStyleFont();
|
||||
|
||||
const nsStyleVisibility *visibility = frame->GetStyleVisibility();
|
||||
|
||||
if (NS_FAILED(rc->SetFont(font->mFont, visibility->mLanguage,
|
||||
presShell->GetPresContext()->GetUserFontSet()))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> deviceContext;
|
||||
rc->GetDeviceContext(*getter_AddRefs(deviceContext));
|
||||
if (!deviceContext) {
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
rc->GetFontMetrics(*getter_AddRefs(fm));
|
||||
if (!fm) {
|
||||
return E_FAIL;
|
||||
}
|
||||
frame->PresContext()->DeviceContext()->
|
||||
GetMetricsFor(frame->GetStyleFont()->mFont,
|
||||
frame->GetStyleVisibility()->mLanguage,
|
||||
frame->PresContext()->GetUserFontSet(),
|
||||
*getter_AddRefs(fm));
|
||||
|
||||
nsAutoString fontFamily;
|
||||
deviceContext->FirstExistingFont(fm->Font(), fontFamily);
|
||||
if (fontFamily.IsEmpty())
|
||||
nsCOMPtr<nsIThebesFontMetrics> tfm = do_QueryInterface(fm);
|
||||
const nsString& name = tfm->GetThebesFontGroup()->GetFontAt(0)->GetName();
|
||||
|
||||
if (name.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aFontFamily = ::SysAllocStringLen(fontFamily.get(), fontFamily.Length());
|
||||
*aFontFamily = ::SysAllocStringLen(name.get(), name.Length());
|
||||
if (!*aFontFamily)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(),
|
||||
GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "nsXFormsAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
@ -149,58 +150,44 @@ nsXFormsAccessible::GetValue(nsAString& aValue)
|
||||
return sXFormsService->GetValue(DOMNode, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(sXFormsService, 0);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
PRBool isRelevant = PR_FALSE;
|
||||
nsresult rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
PRBool isReadonly = PR_FALSE;
|
||||
rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
PRBool isRequired = PR_FALSE;
|
||||
rv = sXFormsService->IsRequired(DOMNode, &isRequired);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
PRBool isValid = PR_FALSE;
|
||||
rv = sXFormsService->IsValid(DOMNode, &isValid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
rv = nsHyperTextAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
if (!isRelevant)
|
||||
*aState |= nsIAccessibleStates::STATE_UNAVAILABLE;
|
||||
states |= states::UNAVAILABLE;
|
||||
|
||||
if (isReadonly)
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
states |= states::READONLY;
|
||||
|
||||
if (isRequired)
|
||||
*aState |= nsIAccessibleStates::STATE_REQUIRED;
|
||||
states |= states::REQUIRED;
|
||||
|
||||
if (!isValid)
|
||||
*aState |= nsIAccessibleStates::STATE_INVALID;
|
||||
states |= states::INVALID;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -267,45 +254,37 @@ nsXFormsEditableAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsEditableAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsEditableAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
PRUint64 state = nsXFormsAccessible::NativeState();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
PRBool isReadonly = PR_FALSE;
|
||||
rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (!isReadonly) {
|
||||
PRBool isRelevant = PR_FALSE;
|
||||
rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
if (isRelevant) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE |
|
||||
nsIAccessibleStates::EXT_STATE_SELECTABLE_TEXT;
|
||||
state |= states::EDITABLE | states::SELECTABLE_TEXT;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
GetAssociatedEditor(getter_AddRefs(editor));
|
||||
NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(editor, state);
|
||||
PRUint32 flags;
|
||||
editor->GetFlags(&flags);
|
||||
if (flags & nsIPlaintextEditor::eEditorSingleLineMask)
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
|
||||
state |= states::SINGLE_LINE;
|
||||
else
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
|
||||
state |= states::MULTI_LINE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -435,7 +414,6 @@ nsXFormsSelectableAccessible::RemoveItemFromSelection(PRUint32 aIndex)
|
||||
if (!itemDOMNode)
|
||||
return false;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element) {
|
||||
nsCOMPtr<nsIDOMNode> selItemDOMNode;
|
||||
@ -490,7 +468,6 @@ nsXFormsSelectableAccessible::IsItemSelected(PRUint32 aIndex)
|
||||
if (!itemDOMNode)
|
||||
return false;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (mIsSelect1Element) {
|
||||
nsCOMPtr<nsIDOMNode> selItemDOMNode;
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
|
||||
// Returns state of xforms element taking into account state of instance node
|
||||
// that it is bound to.
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Denies accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_FALSE value.
|
||||
@ -149,7 +149,7 @@ public:
|
||||
NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "nsXFormsFormControlsAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -209,22 +210,20 @@ nsXFormsInputBooleanAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_CHECKBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsInputBooleanAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsInputBooleanAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsAccessible::NativeState();
|
||||
|
||||
nsAutoString value;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
rv = sXFormsService->GetValue(DOMNode, value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = sXFormsService->GetValue(DOMNode, value);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (value.EqualsLiteral("true"))
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -299,15 +298,10 @@ nsXFormsSecretAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsSecretAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsSecretAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsInputAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_PROTECTED;
|
||||
return NS_OK;
|
||||
return nsXFormsInputAccessible::NativeState() | states::PROTECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -333,22 +327,20 @@ nsXFormsRangeAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_SLIDER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsRangeAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsRangeAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsAccessible::NativeState();
|
||||
|
||||
PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
rv = sXFormsService->IsInRange(DOMNode, &isInRange);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = sXFormsService->IsInRange(DOMNode, &isInRange);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (isInRange == nsIXFormsUtilityService::STATE_OUT_OF_RANGE)
|
||||
*aState |= nsIAccessibleStates::STATE_INVALID;
|
||||
state |= states::INVALID;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -422,23 +414,20 @@ nsXFormsSelectAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsSelectAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsSelectAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsContainerAccessible::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsContainerAccessible::NativeState();
|
||||
|
||||
PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
rv = sXFormsService->IsInRange(DOMNode, &isInRange);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = sXFormsService->IsInRange(DOMNode, &isInRange);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (isInRange == nsIXFormsUtilityService::STATE_OUT_OF_RANGE)
|
||||
*aState |= nsIAccessibleStates::STATE_INVALID;
|
||||
state |= states::INVALID;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@ -511,18 +500,15 @@ nsXFormsItemCheckgroupAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_CHECKBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsItemCheckgroupAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsItemCheckgroupAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
|
||||
|
||||
if (IsItemSelected())
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -556,18 +542,15 @@ nsXFormsItemRadiogroupAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_RADIOBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsItemRadiogroupAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsItemRadiogroupAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
|
||||
|
||||
if (IsItemSelected())
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -597,27 +580,22 @@ nsXFormsSelectComboboxAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_COMBOBOX;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsSelectComboboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsSelectComboboxAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsSelectableAccessible::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsSelectableAccessible::NativeState();
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (isOpen)
|
||||
*aState = nsIAccessibleStates::STATE_EXPANDED;
|
||||
state |= states::EXPANDED;
|
||||
else
|
||||
*aState = nsIAccessibleStates::STATE_COLLAPSED;
|
||||
state |= states::COLLAPSED;
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP |
|
||||
nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
return state | states::HASPOPUP | states::FOCUSABLE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -643,22 +621,19 @@ nsXFormsItemComboboxAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LISTITEM;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsItemComboboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsItemComboboxAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
|
||||
|
||||
if (*aState & nsIAccessibleStates::STATE_UNAVAILABLE)
|
||||
return NS_OK;
|
||||
if (state & states::UNAVAILABLE)
|
||||
return state;
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTABLE;
|
||||
state |= states::SELECTABLE;
|
||||
if (IsItemSelected())
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -157,7 +157,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -193,7 +193,7 @@ public:
|
||||
nsXFormsSelectAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -292,7 +292,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
@ -314,7 +314,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "nsXFormsWidgetsAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXFormsDropmarkerWidgetAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -55,32 +57,15 @@ nsXFormsDropmarkerWidgetAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PUSHBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsDropmarkerWidgetAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsDropmarkerWidgetAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
if (isOpen)
|
||||
*aState = nsIAccessibleStates::STATE_PRESSED;
|
||||
|
||||
return NS_OK;
|
||||
return isOpen ? states::PRESSED: 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -157,28 +142,24 @@ nsXFormsComboboxPopupWidgetAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LIST;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsComboboxPopupWidgetAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXFormsComboboxPopupWidgetAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsXFormsAccessible::NativeState();
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::FOCUSABLE;
|
||||
|
||||
if (isOpen)
|
||||
*aState = nsIAccessibleStates::STATE_FLOATING;
|
||||
state = states::FLOATING;
|
||||
else
|
||||
*aState = nsIAccessibleStates::STATE_INVISIBLE;
|
||||
state = states::INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
|
@ -37,6 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -103,7 +104,12 @@ NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::GetState(PRUint32* aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
|
||||
|
||||
PRUint32 state1 = 0, state2 = 0;
|
||||
PRUint64 state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
|
||||
nsAccUtils::To32States(state, &state1, &state2);
|
||||
|
||||
*aState = state1 | state2; // only one state is not 0
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -111,7 +117,12 @@ NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsExtraState(PRBool* aIsExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsExtraState);
|
||||
*aIsExtraState = static_cast<AccStateChangeEvent*>(mEvent.get())->IsExtraState();
|
||||
|
||||
PRUint32 state1 = 0, state2 = 0;
|
||||
PRUint64 state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
|
||||
nsAccUtils::To32States(state, &state1, &state2);
|
||||
|
||||
*aIsExtraState = (state2 != 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include "nsXULAlertAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULAlertAccessible
|
||||
@ -56,15 +57,10 @@ nsXULAlertAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_ALERT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULAlertAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULAlertAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
// XUL has no markup for low, medium or high
|
||||
*aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM;
|
||||
return NS_OK;
|
||||
return nsAccessible::NativeState() | states::ALERT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "nsXULColorPickerAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsCoreUtils.h"
|
||||
@ -80,30 +81,28 @@ nsXULColorPickerTileAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PUSHBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULColorPickerTileAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULColorPickerTileAccessible::NativeState()
|
||||
{
|
||||
// Possible states: focused, focusable, selected.
|
||||
|
||||
// get focus and disable status from base class
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsAccessibleWrap::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
states |= states::FOCUSABLE;
|
||||
|
||||
// Focused?
|
||||
PRBool isFocused = mContent->HasAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::hover);
|
||||
if (isFocused)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
states |= states::FOCUSED;
|
||||
|
||||
PRBool isSelected = mContent->HasAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::selected);
|
||||
if (isSelected)
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
states |= states::SELECTED;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
|
||||
@ -133,20 +132,17 @@ nsXULColorPickerAccessible::Init()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULColorPickerAccessible: nsAccessible
|
||||
|
||||
nsresult
|
||||
nsXULColorPickerAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULColorPickerAccessible::NativeState()
|
||||
{
|
||||
// Possible states: focused, focusable, unavailable(disabled).
|
||||
|
||||
// get focus and disable status from base class
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsAccessibleWrap::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_HASPOPUP;
|
||||
states |= states::FOCUSABLE | states::HASPOPUP;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "nsXULComboboxAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
@ -75,9 +76,8 @@ nsXULComboboxAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_COMBOBOX;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULComboboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULComboboxAccessible::NativeState()
|
||||
{
|
||||
// As a nsComboboxAccessible we can have the following states:
|
||||
// STATE_FOCUSED
|
||||
@ -87,25 +87,23 @@ nsXULComboboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
// STATE_COLLAPSED
|
||||
|
||||
// Get focus status from base class
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsAccessible::NativeState();
|
||||
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
|
||||
if (menuList) {
|
||||
PRBool isOpen;
|
||||
menuList->GetOpen(&isOpen);
|
||||
if (isOpen) {
|
||||
*aState |= nsIAccessibleStates::STATE_EXPANDED;
|
||||
states |= states::EXPANDED;
|
||||
}
|
||||
else {
|
||||
*aState |= nsIAccessibleStates::STATE_COLLAPSED;
|
||||
states |= states::COLLAPSED;
|
||||
}
|
||||
}
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP |
|
||||
nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
states |= states::HASPOPUP | states::FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
@ -132,23 +133,22 @@ nsXULButtonAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PUSHBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULButtonAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULButtonAccessible::NativeState()
|
||||
{
|
||||
// Possible states: focused, focusable, unavailable(disabled).
|
||||
|
||||
// get focus and disable status from base class
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mContent));
|
||||
if (xulFormElement) {
|
||||
xulFormElement->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*aState |= nsIAccessibleStates::STATE_UNAVAILABLE;
|
||||
state |= states::UNAVAILABLE;
|
||||
else
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::FOCUSABLE;
|
||||
}
|
||||
|
||||
// Buttons can be checked -- they simply appear pressed in rather than checked
|
||||
@ -157,27 +157,27 @@ nsXULButtonAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
nsAutoString type;
|
||||
xulButtonElement->GetType(type);
|
||||
if (type.EqualsLiteral("checkbox") || type.EqualsLiteral("radio")) {
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
state |= states::CHECKABLE;
|
||||
PRBool checked = PR_FALSE;
|
||||
PRInt32 checkState = 0;
|
||||
xulButtonElement->GetChecked(&checked);
|
||||
if (checked) {
|
||||
*aState |= nsIAccessibleStates::STATE_PRESSED;
|
||||
state |= states::PRESSED;
|
||||
xulButtonElement->GetCheckState(&checkState);
|
||||
if (checkState == nsIDOMXULButtonElement::CHECKSTATE_MIXED) {
|
||||
*aState |= nsIAccessibleStates::STATE_MIXED;
|
||||
state |= states::MIXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ContainsMenu())
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
|
||||
state |= states::HASPOPUP;
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::_default))
|
||||
*aState |= nsIAccessibleStates::STATE_DEFAULT;
|
||||
state |= states::DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -327,26 +327,10 @@ nsXULDropmarkerAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PUSHBUTTON;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULDropmarkerAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULDropmarkerAccessible::NativeState()
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
if (DropmarkerOpen(PR_FALSE))
|
||||
*aState = nsIAccessibleStates::STATE_PRESSED;
|
||||
|
||||
return NS_OK;
|
||||
return DropmarkerOpen(PR_FALSE) ? states::PRESSED : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -379,11 +363,8 @@ NS_IMETHODIMP nsXULCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
||||
{
|
||||
if (aIndex == eAction_Click) {
|
||||
// check or uncheck
|
||||
PRUint32 state;
|
||||
nsresult rv = GetStateInternal(&state, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (state & nsIAccessibleStates::STATE_CHECKED)
|
||||
if (NativeState() & states::CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
@ -406,18 +387,14 @@ nsXULCheckboxAccessible::DoAction(PRUint8 aIndex)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible states: focused, focusable, unavailable(disabled), checked
|
||||
*/
|
||||
nsresult
|
||||
nsXULCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULCheckboxAccessible::NativeState()
|
||||
{
|
||||
// Possible states: focused, focusable, unavailable(disabled), checked
|
||||
// Get focus and disable status from base class
|
||||
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsFormControlAccessible::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
// Determine Checked state
|
||||
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement =
|
||||
@ -426,15 +403,15 @@ nsXULCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRBool checked = PR_FALSE;
|
||||
xulCheckboxElement->GetChecked(&checked);
|
||||
if (checked) {
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
PRInt32 checkState = 0;
|
||||
xulCheckboxElement->GetCheckState(&checkState);
|
||||
if (checkState == nsIDOMXULCheckboxElement::CHECKSTATE_MIXED)
|
||||
*aState |= nsIAccessibleStates::STATE_MIXED;
|
||||
state |= states::MIXED;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -645,14 +622,12 @@ nsXULRadioButtonAccessible::
|
||||
}
|
||||
|
||||
/** We are Focusable and can be Checked and focused */
|
||||
nsresult
|
||||
nsXULRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULRadioButtonAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsFormControlAccessible::NativeState();
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
PRBool selected = PR_FALSE; // Radio buttons can be selected
|
||||
|
||||
@ -661,11 +636,11 @@ nsXULRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
||||
if (radioButton) {
|
||||
radioButton->GetSelected(&selected);
|
||||
if (selected) {
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
@ -702,20 +677,13 @@ nsXULRadioGroupAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_GROUPING;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULRadioGroupAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULRadioGroupAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
// The radio group is not focusable. Sometimes the focus controller will
|
||||
// report that it is focused. That means that the actual selected radio button
|
||||
// should be considered focused.
|
||||
*aState &= ~(nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_FOCUSED);
|
||||
|
||||
return NS_OK;
|
||||
return nsAccessible::NativeState() & ~(states::FOCUSABLE | states::FOCUSED);
|
||||
}
|
||||
|
||||
|
||||
@ -840,23 +808,10 @@ nsXULToolbarSeparatorAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_SEPARATOR;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULToolbarSeparatorAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULToolbarSeparatorAccessible::NativeState()
|
||||
{
|
||||
*aState = 0; // no special state flags for toolbar separator
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -876,11 +831,9 @@ NS_IMPL_ISUPPORTS_INHERITED3(nsXULTextFieldAccessible, nsAccessible, nsHyperText
|
||||
|
||||
NS_IMETHODIMP nsXULTextFieldAccessible::GetValue(nsAString& aValue)
|
||||
{
|
||||
PRUint32 state;
|
||||
nsresult rv = GetStateInternal(&state, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint64 state = NativeState();
|
||||
|
||||
if (state & nsIAccessibleStates::STATE_PROTECTED) // Don't return password text!
|
||||
if (state & states::PROTECTED) // Don't return password text!
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULTextBoxElement> textBox(do_QueryInterface(mContent));
|
||||
@ -894,41 +847,34 @@ NS_IMETHODIMP nsXULTextFieldAccessible::GetValue(nsAString& aValue)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTextFieldAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
void
|
||||
nsXULTextFieldAccessible::ApplyARIAState(PRUint64* aState)
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetARIAState(aState, aExtraState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
|
||||
|
||||
nsStateMapEntry::MapToStates(mContent, aState, aExtraState, eARIAAutoComplete);
|
||||
nsStateMapEntry::MapToStates(mContent, aState, eARIAAutoComplete);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULTextFieldAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
|
||||
|
||||
nsCOMPtr<nsIContent> inputField(GetInputField());
|
||||
NS_ENSURE_TRUE(inputField, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(inputField, state);
|
||||
|
||||
// Create a temporary accessible from the HTML text field
|
||||
// to get the accessible state from. Doesn't add to cache
|
||||
// because Init() is not called.
|
||||
nsHTMLTextFieldAccessible* tempAccessible =
|
||||
// Create a temporary accessible from the HTML text field to get
|
||||
// the accessible state from. Doesn't add to cache into document cache.
|
||||
nsRefPtr<nsHTMLTextFieldAccessible> tempAccessible =
|
||||
new nsHTMLTextFieldAccessible(inputField, mWeakShell);
|
||||
if (!tempAccessible)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<nsIAccessible> kungFuDeathGrip = tempAccessible;
|
||||
rv = tempAccessible->GetStateInternal(aState, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return state;
|
||||
|
||||
state |= tempAccessible->NativeState();
|
||||
|
||||
if (gLastFocusedNode == mContent)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
state |= states::FOCUSED;
|
||||
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
|
||||
if (menuList) {
|
||||
@ -936,35 +882,11 @@ nsXULTextFieldAccessible::GetStateInternal(PRUint32 *aState,
|
||||
if (!mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::editable,
|
||||
nsAccessibilityAtoms::_true, eIgnoreCase)) {
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// <xul:textbox>
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
|
||||
nsAccessibilityAtoms::password, eIgnoreCase)) {
|
||||
*aState |= nsIAccessibleStates::STATE_PROTECTED;
|
||||
}
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::readonly,
|
||||
nsAccessibilityAtoms::_true, eIgnoreCase)) {
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
state |= states::READONLY;
|
||||
}
|
||||
}
|
||||
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
PRBool isMultiLine = mContent->HasAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::multiline);
|
||||
|
||||
if (isMultiLine) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
|
||||
}
|
||||
else {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
protected:
|
||||
|
||||
@ -99,7 +99,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -118,7 +118,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
private:
|
||||
PRBool DropmarkerOpen(PRBool aToggleOpen);
|
||||
@ -167,9 +167,9 @@ public:
|
||||
nsXULRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -237,7 +237,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -262,9 +262,9 @@ public:
|
||||
NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "nsXULListboxAccessible.h"
|
||||
|
||||
#include "States.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
@ -63,26 +64,10 @@ nsXULColumnsAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LIST;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULColumnsAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULColumnsAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
*aState = nsIAccessibleStates::STATE_READONLY;
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
return states::READONLY;
|
||||
}
|
||||
|
||||
|
||||
@ -102,24 +87,10 @@ nsXULColumnItemAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_COLUMNHEADER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULColumnItemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULColumnItemAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
*aState = nsIAccessibleStates::STATE_READONLY;
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
return NS_OK;
|
||||
return states::READONLY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -194,28 +165,23 @@ nsXULListboxAccessible::IsMulticolumn()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListboxAccessible. nsIAccessible
|
||||
|
||||
nsresult
|
||||
nsXULListboxAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULListboxAccessible::NativeState()
|
||||
{
|
||||
// As a nsXULListboxAccessible we can have the following states:
|
||||
// STATE_FOCUSED
|
||||
// STATE_READONLY
|
||||
// STATE_FOCUSABLE
|
||||
// FOCUSED, READONLY, FOCUSABLE
|
||||
|
||||
// Get focus status from base class
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsAccessible::NativeState();
|
||||
|
||||
// see if we are multiple select if so set ourselves as such
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::seltype,
|
||||
nsAccessibilityAtoms::multiple, eCaseMatters)) {
|
||||
*aState |= nsIAccessibleStates::STATE_MULTISELECTABLE |
|
||||
nsIAccessibleStates::STATE_EXTSELECTABLE;
|
||||
states |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -937,28 +903,13 @@ nsXULListitemAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_RICH_OPTION;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULListitemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULListitemAccessible::NativeState()
|
||||
{
|
||||
if (mIsCheckbox) {
|
||||
return nsXULMenuitemAccessible::GetStateInternal(aState, aExtraState);
|
||||
}
|
||||
if (mIsCheckbox)
|
||||
return nsXULMenuitemAccessible::NativeState();
|
||||
|
||||
*aState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
*aState = nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_SELECTABLE;
|
||||
PRUint64 states = states::FOCUSABLE | states::SELECTABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem =
|
||||
do_QueryInterface(mContent);
|
||||
@ -967,25 +918,23 @@ nsXULListitemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRBool isSelected;
|
||||
listItem->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
states |= states::SELECTED;
|
||||
|
||||
if (gLastFocusedNode == mContent)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
states |= states::FOCUSED;
|
||||
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULListitemAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
{
|
||||
if (aIndex == eAction_Click && mIsCheckbox) {
|
||||
// check or uncheck
|
||||
PRUint32 state;
|
||||
nsresult rv = GetStateInternal(&state, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint64 states = NativeState();
|
||||
|
||||
if (state & nsIAccessibleStates::STATE_CHECKED)
|
||||
if (states & states::CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
enum { eAction_Click = 0 };
|
||||
};
|
||||
@ -101,7 +101,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
protected:
|
||||
PRBool IsMulticolumn();
|
||||
@ -128,7 +128,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsXULFormControlAccessible.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
@ -289,26 +290,24 @@ nsXULMenuitemAccessible::Init()
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULMenuitemAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
// Focused?
|
||||
if (mContent->HasAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::_moz_menuactive))
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
state |= states::FOCUSED;
|
||||
|
||||
// Has Popup?
|
||||
if (mContent->NodeInfo()->Equals(nsAccessibilityAtoms::menu,
|
||||
kNameSpaceID_XUL)) {
|
||||
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
|
||||
state |= states::HASPOPUP;
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::open))
|
||||
*aState |= nsIAccessibleStates::STATE_EXPANDED;
|
||||
state |= states::EXPANDED;
|
||||
else
|
||||
*aState |= nsIAccessibleStates::STATE_COLLAPSED;
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
|
||||
// Checkable/checked?
|
||||
@ -320,12 +319,12 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
strings, eCaseMatters) >= 0) {
|
||||
|
||||
// Checkable?
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
// Checked?
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::checked,
|
||||
nsAccessibilityAtoms::_true, eCaseMatters))
|
||||
*aState |= nsIAccessibleStates::STATE_CHECKED;
|
||||
state |= states::CHECKED;
|
||||
}
|
||||
|
||||
// Combo box listitem
|
||||
@ -335,42 +334,37 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement>
|
||||
item(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(item, state);
|
||||
item->GetSelected(&isSelected);
|
||||
|
||||
// Is collapsed?
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
nsAccessible* parentAcc = GetParent();
|
||||
if (nsAccUtils::State(parentAcc) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
if (parentAcc->State() & states::INVISIBLE)
|
||||
isCollapsed = PR_TRUE;
|
||||
|
||||
if (isSelected) {
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTED;
|
||||
|
||||
// Selected and collapsed?
|
||||
if (isCollapsed) {
|
||||
// Set selected option offscreen/invisible according to combobox state
|
||||
nsAccessible* grandParentAcc = parentAcc->GetParent();
|
||||
NS_ENSURE_TRUE(grandParentAcc, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(grandParentAcc, state);
|
||||
NS_ASSERTION(grandParentAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
|
||||
"grandparent of combobox listitem is not combobox");
|
||||
PRUint32 grandParentState, grandParentExtState;
|
||||
grandParentAcc->GetState(&grandParentState, &grandParentExtState);
|
||||
*aState &= ~(nsIAccessibleStates::STATE_OFFSCREEN |
|
||||
nsIAccessibleStates::STATE_INVISIBLE);
|
||||
*aState |= (grandParentState & nsIAccessibleStates::STATE_OFFSCREEN) |
|
||||
(grandParentState & nsIAccessibleStates::STATE_INVISIBLE);
|
||||
if (aExtraState) {
|
||||
*aExtraState |=
|
||||
grandParentExtState & nsIAccessibleStates::EXT_STATE_OPAQUE;
|
||||
}
|
||||
PRUint64 grandParentState = grandParentAcc->State();
|
||||
state &= ~(states::OFFSCREEN | states::INVISIBLE);
|
||||
state |= (grandParentState & states::OFFSCREEN) |
|
||||
(grandParentState & states::INVISIBLE) |
|
||||
(grandParentState & states::OPAQUE1);
|
||||
} // isCollapsed
|
||||
} // isSelected
|
||||
} // ROLE_COMBOBOX_OPTION
|
||||
|
||||
// Set focusable and selectable for items that are available
|
||||
// and whose metric setting does allow disabled items to be focused.
|
||||
if (*aState & nsIAccessibleStates::STATE_UNAVAILABLE) {
|
||||
if (state & states::UNAVAILABLE) {
|
||||
// Honour the LookAndFeel metric.
|
||||
nsCOMPtr<nsILookAndFeel> lookNFeel(do_GetService(kLookAndFeelCID));
|
||||
PRInt32 skipDisabledMenuItems = 0;
|
||||
@ -379,13 +373,12 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
|
||||
// We don't want the focusable and selectable states for combobox items,
|
||||
// so exclude them here as well.
|
||||
if (skipDisabledMenuItems || isComboboxOption) {
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
*aState|= (nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_SELECTABLE);
|
||||
state |= (states::FOCUSABLE | states::SELECTABLE);
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -560,18 +553,12 @@ nsXULMenuSeparatorAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULMenuSeparatorAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULMenuSeparatorAccessible::NativeState()
|
||||
{
|
||||
// Isn't focusable, but can be offscreen/invisible -- only copy those states
|
||||
nsresult rv = nsXULMenuitemAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState &= (nsIAccessibleStates::STATE_OFFSCREEN |
|
||||
nsIAccessibleStates::STATE_INVISIBLE);
|
||||
|
||||
return NS_OK;
|
||||
return nsXULMenuitemAccessible::NativeState() &
|
||||
(states::OFFSCREEN | states::INVISIBLE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -614,12 +601,10 @@ nsXULMenupopupAccessible::
|
||||
mSelectControl = do_QueryInterface(mContent->GetParent());
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULMenupopupAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULMenupopupAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
// We are onscreen if our parent is active
|
||||
@ -627,24 +612,23 @@ nsXULMenupopupAccessible::GetStateInternal(PRUint32 *aState,
|
||||
nsAccessibilityAtoms::menuactive);
|
||||
if (!isActive) {
|
||||
nsAccessible* parent(GetParent());
|
||||
NS_ENSURE_STATE(parent);
|
||||
NS_ENSURE_TRUE(parent, state);
|
||||
|
||||
nsIContent *parentContent = parnet->GetContent();
|
||||
NS_ENSURE_STATE(parentContent);
|
||||
NS_ENSURE_TRUE(parentContent, state);
|
||||
|
||||
isActive = parentContent->HasAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::open);
|
||||
}
|
||||
|
||||
NS_ASSERTION(isActive || *aState & nsIAccessibleStates::STATE_INVISIBLE,
|
||||
"XULMenupopup doesn't have STATE_INVISIBLE when it's inactive");
|
||||
NS_ASSERTION(isActive || states & states::INVISIBLE,
|
||||
"XULMenupopup doesn't have INVISIBLE when it's inactive");
|
||||
#endif
|
||||
|
||||
if (*aState & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
*aState |= (nsIAccessibleStates::STATE_OFFSCREEN |
|
||||
nsIAccessibleStates::STATE_COLLAPSED);
|
||||
if (state & states::INVISIBLE)
|
||||
state |= states::OFFSCREEN | states::COLLAPSED;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -694,16 +678,14 @@ nsXULMenubarAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULMenubarAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULMenubarAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
// Menu bar iteself is not actually focusable
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
return rv;
|
||||
// Menu bar itself is not actually focusable
|
||||
state &= ~states::FOCUSABLE;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
@ -119,7 +119,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -148,7 +148,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "nsXULSliderAccessible.h"
|
||||
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
@ -68,24 +69,22 @@ nsXULSliderAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_SLIDER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULSliderAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULSliderAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsAccessibleWrap::NativeState();
|
||||
|
||||
nsCOMPtr<nsIContent> sliderContent(GetSliderNode());
|
||||
NS_ENSURE_STATE(sliderContent);
|
||||
|
||||
nsIFrame *frame = sliderContent->GetPrimaryFrame();
|
||||
if (frame && frame->IsFocusable())
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
states |= states::FOCUSABLE;
|
||||
|
||||
if (gLastFocusedNode == mContent)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
states |= states::FOCUSED;
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsIDocument.h"
|
||||
@ -102,37 +103,36 @@ nsXULTabAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PAGETAB;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTabAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULTabAccessible::NativeState()
|
||||
{
|
||||
// Possible states: focused, focusable, unavailable(disabled), offscreen.
|
||||
|
||||
// get focus and disable status from base class
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessibleWrap::NativeState();
|
||||
|
||||
// In the past, tabs have been focusable in classic theme
|
||||
// They may be again in the future
|
||||
// Check style for -moz-user-focus: normal to see if it's focusable
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state &= ~states::FOCUSABLE;
|
||||
|
||||
nsIFrame *frame = mContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
const nsStyleUserInterface* ui = frame->GetStyleUserInterface();
|
||||
if (ui->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
state |= states::FOCUSABLE;
|
||||
}
|
||||
|
||||
// Check whether the tab is selected
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTABLE;
|
||||
*aState &= ~nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTABLE;
|
||||
state &= ~states::SELECTED;
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mContent));
|
||||
if (tab) {
|
||||
PRBool selected = PR_FALSE;
|
||||
if (NS_SUCCEEDED(tab->GetSelected(&selected)) && selected)
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
// nsIAccessible
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMXULDescriptionElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -77,17 +78,12 @@ nsXULTextAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_LABEL;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULTextAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
// Labels and description have read only state
|
||||
// They are not focusable or selectable
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
return NS_OK;
|
||||
return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -122,16 +118,14 @@ nsXULTooltipAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTooltipAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULTooltipAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 states = nsLeafAccessible::NativeState();
|
||||
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
return NS_OK;
|
||||
states &= ~states::FOCUSABLE;
|
||||
states |= states::READONLY;
|
||||
return states;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
@ -187,15 +181,10 @@ nsXULLinkAccessible::NativeRole()
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULLinkAccessible::NativeState()
|
||||
{
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
|
||||
aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
*aState |= nsIAccessibleStates::STATE_LINKED;
|
||||
return NS_OK;
|
||||
return nsHyperTextAccessible::NativeState() | states::LINKED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
};
|
||||
|
||||
class nsXULLinkAccessible : public nsHyperTextAccessibleWrap
|
||||
@ -94,7 +94,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// HyperLinkAccessible
|
||||
virtual bool IsHyperLink();
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsRelUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
@ -93,33 +94,31 @@ NS_IMPL_RELEASE_INHERITED(nsXULTreeAccessible, nsAccessible)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeAccessible: nsAccessible implementation
|
||||
|
||||
nsresult
|
||||
nsXULTreeAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULTreeAccessible::NativeState()
|
||||
{
|
||||
// Get focus status from base class.
|
||||
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
// readonly state
|
||||
*aState |= nsIAccessibleStates::STATE_READONLY;
|
||||
state |= states::READONLY;
|
||||
|
||||
// remove focusable and focused states since tree items are focusable for AT
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSED;
|
||||
state &= ~(states::FOCUSABLE | states::FOCUSED);
|
||||
|
||||
// multiselectable state.
|
||||
nsCOMPtr<nsITreeSelection> selection;
|
||||
mTreeView->GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_STATE(selection);
|
||||
NS_ENSURE_TRUE(selection, state);
|
||||
|
||||
PRBool isSingle = PR_FALSE;
|
||||
rv = selection->GetSingle(&isSingle);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = selection->GetSingle(&isSingle);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (!isSingle)
|
||||
*aState |= nsIAccessibleStates::STATE_MULTISELECTABLE;
|
||||
state |= states::MULTISELECTABLE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -925,33 +924,17 @@ nsXULTreeItemAccessibleBase::GroupPosition(PRInt32 *aGroupLevel,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTreeItemAccessibleBase::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
PRUint64
|
||||
nsXULTreeItemAccessibleBase::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
*aState = 0;
|
||||
if (aExtraState)
|
||||
*aExtraState = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraState)
|
||||
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
// focusable and selectable states
|
||||
*aState = nsIAccessibleStates::STATE_FOCUSABLE |
|
||||
nsIAccessibleStates::STATE_SELECTABLE;
|
||||
PRUint64 state = states::FOCUSABLE | states::SELECTABLE;
|
||||
|
||||
// expanded/collapsed state
|
||||
if (IsExpandable()) {
|
||||
PRBool isContainerOpen;
|
||||
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
|
||||
*aState |= isContainerOpen ?
|
||||
static_cast<PRUint32>(nsIAccessibleStates::STATE_EXPANDED) :
|
||||
static_cast<PRUint32>(nsIAccessibleStates::STATE_COLLAPSED);
|
||||
state |= isContainerOpen ? states::EXPANDED : states::COLLAPSED;
|
||||
}
|
||||
|
||||
// selected state
|
||||
@ -961,7 +944,7 @@ nsXULTreeItemAccessibleBase::GetStateInternal(PRUint32 *aState,
|
||||
PRBool isSelected;
|
||||
selection->IsSelected(mRow, &isSelected);
|
||||
if (isSelected)
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
|
||||
// focused state
|
||||
@ -971,7 +954,7 @@ nsXULTreeItemAccessibleBase::GetStateInternal(PRUint32 *aState,
|
||||
PRInt32 currentIndex;
|
||||
multiSelect->GetCurrentIndex(¤tIndex);
|
||||
if (currentIndex == mRow) {
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -980,9 +963,9 @@ nsXULTreeItemAccessibleBase::GetStateInternal(PRUint32 *aState,
|
||||
mTree->GetFirstVisibleRow(&firstVisibleRow);
|
||||
mTree->GetLastVisibleRow(&lastVisibleRow);
|
||||
if (mRow < firstVisibleRow || mRow > lastVisibleRow)
|
||||
*aState |= nsIAccessibleStates::STATE_INVISIBLE;
|
||||
state |= states::INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
return state;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
@ -206,7 +206,7 @@ public:
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 GetIndexInParent() const;
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsITreeSelection.h"
|
||||
|
||||
@ -1161,24 +1162,11 @@ nsXULTreeGridCellAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_GRID_CELL;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTreeGridCellAccessible::GetStateInternal(PRUint32 *aStates,
|
||||
PRUint32 *aExtraStates)
|
||||
PRUint64
|
||||
nsXULTreeGridCellAccessible::NativeState()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStates);
|
||||
|
||||
*aStates = 0;
|
||||
if (aExtraStates)
|
||||
*aExtraStates = 0;
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aExtraStates)
|
||||
*aExtraStates = nsIAccessibleStates::EXT_STATE_DEFUNCT;
|
||||
return NS_OK_DEFUNCT_OBJECT;
|
||||
}
|
||||
|
||||
// selectable/selected state
|
||||
*aStates |= nsIAccessibleStates::STATE_SELECTABLE;
|
||||
PRUint64 states = states::SELECTABLE;
|
||||
|
||||
nsCOMPtr<nsITreeSelection> selection;
|
||||
mTreeView->GetSelection(getter_AddRefs(selection));
|
||||
@ -1186,21 +1174,21 @@ nsXULTreeGridCellAccessible::GetStateInternal(PRUint32 *aStates,
|
||||
PRBool isSelected = PR_FALSE;
|
||||
selection->IsSelected(mRow, &isSelected);
|
||||
if (isSelected)
|
||||
*aStates |= nsIAccessibleStates::STATE_SELECTED;
|
||||
states |= states::SELECTED;
|
||||
}
|
||||
|
||||
// checked state
|
||||
PRInt16 type;
|
||||
mColumn->GetType(&type);
|
||||
if (type == nsITreeColumn::TYPE_CHECKBOX) {
|
||||
*aStates |= nsIAccessibleStates::STATE_CHECKABLE;
|
||||
states |= states::CHECKABLE;
|
||||
nsAutoString checked;
|
||||
mTreeView->GetCellValue(mRow, mColumn, checked);
|
||||
if (checked.EqualsIgnoreCase("true"))
|
||||
*aStates |= nsIAccessibleStates::STATE_CHECKED;
|
||||
states |= states::CHECKED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return states;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
@ -1235,8 +1223,7 @@ nsXULTreeGridCellAccessible::CellInvalidated()
|
||||
if (mCachedTextEquiv != textEquiv) {
|
||||
PRBool isEnabled = textEquiv.EqualsLiteral("true");
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
new AccStateChangeEvent(this, states::CHECKED, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
|
||||
mCachedTextEquiv = textEquiv;
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 GetIndexInParent() const;
|
||||
|
||||
// nsXULTreeGridCellAccessible
|
||||
|
@ -25,6 +25,7 @@ const STATE_MIXED = nsIAccessibleStates.STATE_MIXED;
|
||||
const STATE_MULTISELECTABLE = nsIAccessibleStates.STATE_MULTISELECTABLE;
|
||||
const STATE_OFFSCREEN = nsIAccessibleStates.STATE_OFFSCREEN;
|
||||
const STATE_PRESSED = nsIAccessibleStates.STATE_PRESSED;
|
||||
const STATE_PROTECTED = nsIAccessibleStates.STATE_PROTECTED;
|
||||
const STATE_READONLY = nsIAccessibleStates.STATE_READONLY;
|
||||
const STATE_REQUIRED = nsIAccessibleStates.STATE_REQUIRED;
|
||||
const STATE_SELECTABLE = nsIAccessibleStates.STATE_SELECTABLE;
|
||||
|
@ -56,6 +56,7 @@ _TEST_FILES =\
|
||||
test_inputs.xul \
|
||||
test_link.html \
|
||||
test_popup.xul \
|
||||
test_textbox.xul \
|
||||
test_tree.xul \
|
||||
z_frames.html \
|
||||
z_frames_article.html \
|
||||
|
@ -131,7 +131,7 @@
|
||||
<input id="reset" type="reset" required>
|
||||
<input id="image" type="image" required>
|
||||
|
||||
<!-- disabled -->
|
||||
<!-- inherited disabled -->
|
||||
<fieldset id="f" disabled>
|
||||
<input id="f_input">
|
||||
<input id="f_input_disabled" disabled>
|
||||
|
132
accessible/tests/mochitest/states/test_textbox.xul
Normal file
132
accessible/tests/mochitest/states/test_textbox.xul
Normal file
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="nsIAccessible XUL textboxes states tests">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js" />
|
||||
<script type="application/javascript"
|
||||
src="../role.js" />
|
||||
<script type="application/javascript"
|
||||
src="../states.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
function doTest()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Ordinary textbox
|
||||
testStates("textbox",
|
||||
STATE_FOCUSABLE, EXT_STATE_EDITABLE,
|
||||
STATE_PROTECTED | STATE_UNAVAILABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"ordinary textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Password textbox
|
||||
testStates("password",
|
||||
STATE_FOCUSABLE | STATE_PROTECTED, EXT_STATE_EDITABLE,
|
||||
STATE_UNAVAILABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"password textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Textarea
|
||||
testStates("textarea",
|
||||
STATE_FOCUSABLE, EXT_STATE_EDITABLE | EXT_STATE_MULTI_LINE,
|
||||
STATE_PROTECTED | STATE_UNAVAILABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"multiline textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Readonly textbox
|
||||
testStates("readonly_textbox",
|
||||
STATE_FOCUSABLE | STATE_READONLY, 0,
|
||||
STATE_PROTECTED | STATE_UNAVAILABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"readonly textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Disabled textbox
|
||||
testStates("disabled_textbox",
|
||||
STATE_UNAVAILABLE, 0,
|
||||
STATE_FOCUSABLE | STATE_PROTECTED, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"readonly textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Readonly textarea
|
||||
testStates("readonly_textarea",
|
||||
STATE_FOCUSABLE | STATE_READONLY, EXT_STATE_MULTI_LINE,
|
||||
STATE_PROTECTED | STATE_UNAVAILABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"readonly multiline textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Disabled textarea
|
||||
testStates("disabled_textarea",
|
||||
STATE_UNAVAILABLE, EXT_STATE_MULTI_LINE,
|
||||
STATE_PROTECTED | STATE_FOCUSABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"readonly multiline textbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Search textbox without search button, searches as you type and filters
|
||||
// a separate control.
|
||||
testStates("searchbox",
|
||||
STATE_FOCUSABLE, EXT_STATE_EDITABLE | EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
STATE_PROTECTED | STATE_UNAVAILABLE, 0,
|
||||
"searchbox");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Search textbox with search button, does not support autoCompletion.
|
||||
testStates("searchfield",
|
||||
STATE_FOCUSABLE, EXT_STATE_EDITABLE,
|
||||
STATE_PROTECTED | STATE_UNAVAILABLE, EXT_STATE_SUPPORTS_AUTOCOMPLETION,
|
||||
"searchfield");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=442648">
|
||||
Mozilla Bug 442648
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=648235"
|
||||
title="XUL textbox can inherit more states from underlying HTML input">
|
||||
Mozilla Bug 648235
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
<textbox id="textbox"/>
|
||||
<textbox id="password" type="password"/>
|
||||
<textbox id="textarea" multiline="true" cols="80" rows="5"/>
|
||||
|
||||
<textbox id="readonly_textbox" readonly="true"/>
|
||||
<textbox id="disabled_textbox" disabled="true"/>
|
||||
<textbox id="readonly_textarea" multiline="true" readonly="true"
|
||||
cols="80" rows="5"/>
|
||||
<textbox id="disabled_textarea" multiline="true" disabled="true"
|
||||
cols="80" rows="5"/>
|
||||
|
||||
<textbox id="searchbox" flex="1" type="search" results="historyTree"/>
|
||||
<textbox id="searchfield" placeholder="Search all add-ons"
|
||||
type="search" searchbutton="true"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</window>
|
@ -48,7 +48,7 @@ DIRS = {972ce4c6-7e08-4474-a285-3208198ce6fd}
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq (beta,$(MOZ_UPDATE_CHANNEL))
|
||||
ifneq (,$(filter aurora beta,$(MOZ_UPDATE_CHANNEL)))
|
||||
EXTENSIONS = \
|
||||
testpilot@labs.mozilla.com \
|
||||
$(NULL)
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://testpilot/content/browser.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://testpilot-os/skin/feedback.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % testpilotDTD SYSTEM "chrome://testpilot/locale/main.dtd">
|
||||
|
@ -57,16 +57,6 @@
|
||||
image="chrome://testpilot-os/skin/feedback-frown-16x16.png"
|
||||
label = "&testpilot.sad.label;"
|
||||
oncommand="TestPilotWindowUtils.openFeedbackPage('sad');"/>
|
||||
<menuitem id="feedback-menu-broken-button"
|
||||
class="menuitem-iconic"
|
||||
image="chrome://testpilot-os/skin/feedback-broken-website.png"
|
||||
label = "&testpilot.broken.label;"
|
||||
oncommand="TestPilotWindowUtils.openFeedbackPage('broken');"/>
|
||||
<menuitem id="feedback-menu-idea-button"
|
||||
class="menuitem-iconic"
|
||||
image="chrome://testpilot-os/skin/feedback-idea.png"
|
||||
label = "&testpilot.idea.label;"
|
||||
oncommand="TestPilotWindowUtils.openFeedbackPage('idea');"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="feedback-menu-show-studies"
|
||||
label="&testpilot.allYourStudies.label;"
|
||||
|
@ -4,7 +4,7 @@
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>testpilot@labs.mozilla.com</em:id>
|
||||
<em:version>1.0.6</em:version>
|
||||
<em:version>1.0.9</em:version>
|
||||
<em:type>2</em:type>
|
||||
|
||||
<!-- Target Application this extension can install into,
|
||||
@ -13,7 +13,7 @@
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>3.5</em:minVersion>
|
||||
<em:maxVersion>4.0.*</em:maxVersion>
|
||||
<em:maxVersion>5.0</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
|
@ -119,14 +119,11 @@ ExperimentDataStore.prototype = {
|
||||
for (i = 0; i < this._columns.length; i++) {
|
||||
let datum = uiEvent[this._columns[i].property];
|
||||
switch (this._columns[i].type) {
|
||||
case TYPE_INT_32:
|
||||
insStmt.bindInt32Parameter(i, datum);
|
||||
break;
|
||||
case TYPE_DOUBLE:
|
||||
insStmt.bindDoubleParameter(i, datum);
|
||||
case TYPE_INT_32: case TYPE_DOUBLE:
|
||||
insStmt.params[i] = datum;
|
||||
break;
|
||||
case TYPE_STRING:
|
||||
insStmt.bindUTF8StringParameter(i, sanitizeString(datum));
|
||||
insStmt.params[i] = sanitizeString(datum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -104,12 +104,18 @@ var FeedbackManager = {
|
||||
*/
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
let uri = ioService.newURI(url, null, null);
|
||||
let path = uri.path;
|
||||
if (uri.host == "input.mozilla.com") {
|
||||
if (path.indexOf("feedback" > -1) || path.indexOf("happy" > -1) || path.indexOf("sad" > -1)) {
|
||||
return true;
|
||||
try {
|
||||
let uri = ioService.newURI(url, null, null);
|
||||
let path = uri.path;
|
||||
if (uri.host == "input.mozilla.com") {
|
||||
if (path.indexOf("feedback") > -1 || path.indexOf("happy") > -1 || path.indexOf("sad") > -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
/* newURI throws an exception if we try to parse urls like "about:config". (Bug 644582)
|
||||
* Those are not the urls we're looking for anyway. */
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
@ -94,22 +94,12 @@ var TestPilotUIBuilder = {
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Show and hide Feedback menu items based on version -- if user is on beta channel in
|
||||
* the final version, they get the 'broken' and 'idea' items. Otherwise they get
|
||||
* 'happy' and 'sad'.*/
|
||||
if (this.isBetaChannel() && this.appVersionIsFinal()) {
|
||||
window.document.getElementById("feedback-menu-happy-button").setAttribute("hidden", "true");
|
||||
window.document.getElementById("feedback-menu-sad-button").setAttribute("hidden", "true");
|
||||
} else {
|
||||
window.document.getElementById("feedback-menu-broken-button").setAttribute("hidden", "true");
|
||||
window.document.getElementById("feedback-menu-idea-button").setAttribute("hidden", "true");
|
||||
}
|
||||
},
|
||||
|
||||
isBetaChannel: function() {
|
||||
// Nightly channel is treated the same as default channel.
|
||||
return (this._prefs.getCharPref(UPDATE_CHANNEL_PREF) == "beta");
|
||||
// Beta and aurora channels use feedback interface; nightly and release channels don't.
|
||||
let channel = this._prefs.getCharPref(UPDATE_CHANNEL_PREF);
|
||||
return (channel == "beta") || (channel == "betatest") || (channel == "aurora");
|
||||
},
|
||||
|
||||
appVersionIsFinal: function() {
|
||||
|
@ -47,6 +47,7 @@ const LOCALE_PREF = "general.useragent.locale";
|
||||
const EXTENSION_ID = "testpilot@labs.mozilla.com";
|
||||
const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
|
||||
const PREFIX_ITEM_URI = "urn:mozilla:item:";
|
||||
const UPDATE_CHANNEL_PREF = "app.update.channel";
|
||||
|
||||
/* The following preference, if present, stores answers to the basic panel
|
||||
* survey, which tell us user's general tech level, and so should be included
|
||||
@ -116,6 +117,19 @@ let MetadataCollector = {
|
||||
accessibilities.push({ name: prefName, value: prefValue });
|
||||
}
|
||||
|
||||
/* Detect accessibility instantiation
|
||||
* (David Bolter's code from bug 577694) */
|
||||
let enabled;
|
||||
try {
|
||||
enabled = Components.manager.QueryInterface(Ci.nsIServiceManager)
|
||||
.isServiceInstantiatedByContractID(
|
||||
"@mozilla.org/accessibilityService;1",
|
||||
Ci.nsISupports);
|
||||
} catch (ex) {
|
||||
enabled = false;
|
||||
}
|
||||
accessibilities.push({name: "isInstantiated", value: enabled});
|
||||
|
||||
return accessibilities;
|
||||
},
|
||||
|
||||
@ -155,6 +169,10 @@ let MetadataCollector = {
|
||||
}
|
||||
},
|
||||
|
||||
getUpdateChannel: function MetadataCollector_getUpdateChannel() {
|
||||
return Application.prefs.getValue(UPDATE_CHANNEL_PREF, "");
|
||||
},
|
||||
|
||||
getMetadata: function MetadataCollector_getMetadata(callback) {
|
||||
let self = this;
|
||||
self.getTestPilotVersion(function(tpVersion) {
|
||||
@ -165,7 +183,8 @@ let MetadataCollector = {
|
||||
fxVersion: self.getVersion(),
|
||||
operatingSystem: self.getOperatingSystem(),
|
||||
tpVersion: tpVersion,
|
||||
surveyAnswers: self.getSurveyAnswers()}
|
||||
surveyAnswers: self.getSurveyAnswers(),
|
||||
updateChannel: self.getUpdateChannel()}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -185,15 +185,10 @@ let TestPilotSetup = {
|
||||
return this.__obs;
|
||||
},
|
||||
|
||||
_isFfx4BetaVersion: function TPS__isFfx4BetaVersion() {
|
||||
let result = Cc["@mozilla.org/xpcom/version-comparator;1"]
|
||||
.getService(Ci.nsIVersionComparator)
|
||||
.compare("3.7a1pre", this._application.version);
|
||||
if (result < 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
_isBetaChannel: function TPS__isBetaChannel() {
|
||||
// Beta and aurora channels use feedback interface; nightly and release channels don't.
|
||||
let channel = this._prefs.getValue(UPDATE_CHANNEL_PREF, "");
|
||||
return (channel == "beta") || (channel == "betatest") || (channel == "aurora");
|
||||
},
|
||||
|
||||
_setPrefDefaultsForVersion: function TPS__setPrefDefaultsForVersion() {
|
||||
@ -205,7 +200,7 @@ let TestPilotSetup = {
|
||||
let prefBranch = ps.getDefaultBranch("");
|
||||
/* note we're setting default values, not current values -- these
|
||||
* get overridden by any user set values. */
|
||||
if (this._isFfx4BetaVersion()) {
|
||||
if (this._isBetaChannel()) {
|
||||
prefBranch.setBoolPref(POPUP_SHOW_ON_NEW, true);
|
||||
prefBranch.setIntPref(POPUP_CHECK_INTERVAL, 600000);
|
||||
} else {
|
||||
@ -262,7 +257,7 @@ let TestPilotSetup = {
|
||||
let currVersion = self._prefs.getValue(VERSION_PREF, "firstrun");
|
||||
|
||||
if (currVersion != self.version) {
|
||||
if(!self._isFfx4BetaVersion()) {
|
||||
if(!self._isBetaChannel()) {
|
||||
self._prefs.setValue(VERSION_PREF, self.version);
|
||||
let browser = self._getFrontBrowserWindow().getBrowser();
|
||||
let url = self._prefs.getValue(FIRST_RUN_PREF, "");
|
||||
@ -386,7 +381,7 @@ let TestPilotSetup = {
|
||||
let popup = doc.getElementById("pilot-notification-popup");
|
||||
|
||||
let anchor;
|
||||
if (this._isFfx4BetaVersion()) {
|
||||
if (this._isBetaChannel()) {
|
||||
/* If we're in the Ffx4Beta version, popups come down from feedback
|
||||
* button, but if we're in the standalone extension version, they
|
||||
* come up from status bar icon. */
|
||||
|
@ -552,6 +552,21 @@ TestPilotExperiment.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
getStudyMetadata: function TestPilotExperiment_getStudyMetadata() {
|
||||
try {
|
||||
if (this._handlers.getStudyMetadata) {
|
||||
let metadata = this._handlers.getStudyMetadata();
|
||||
if (metadata.length) {
|
||||
// getStudyMetadata must return an array, otherwise it is invalid.
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
this._logger.warn("Error in getStudyMetadata: " + e);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_reschedule: function TestPilotExperiment_reschedule() {
|
||||
// Schedule next run of test:
|
||||
// add recurrence interval to start date and store!
|
||||
@ -753,6 +768,15 @@ TestPilotExperiment.prototype = {
|
||||
json.metadata = md;
|
||||
json.metadata.task_guid = self.getGuid(self._id);
|
||||
json.metadata.event_headers = self._dataStore.getPropertyNames();
|
||||
let moreMd = self.getStudyMetadata();
|
||||
if (moreMd) {
|
||||
for (let i = 0; i < moreMd.length; i++) {
|
||||
if (moreMd[i].name && moreMd[i].value) {
|
||||
json.metadata[ moreMd[i].name ] = moreMd[i].value; // TODO sanitize strings?
|
||||
// TODO handle case where name or value are something other than strings?
|
||||
}
|
||||
}
|
||||
}
|
||||
self._dataStore.getJSONRows(function(rows) {
|
||||
json.events = rows;
|
||||
callback( JSON.stringify(json) );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user