Bug 416872 - Simplify GetState() impl's for defunct objects, r=david.bolter, sr=neil, a=beltzner

This commit is contained in:
Alexander Surkov 2008-11-27 12:04:05 +08:00
Родитель 4db5d3c126
Коммит cc672241dd
24 изменённых файлов: 162 добавлений и 185 удалений

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

@ -74,6 +74,20 @@ class nsIDocShellTreeItem;
typedef nsInterfaceHashtable<nsVoidPtrHashKey, nsIAccessNode>
nsAccessNodeHashtable;
#define NS_OK_DEFUNCT_OBJECT \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x22)
#define NS_ENSURE_A11Y_SUCCESS(res, ret) \
PR_BEGIN_MACRO \
nsresult __rv = res; /* Don't evaluate |res| more than once */ \
if (NS_FAILED(__rv)) { \
NS_ENSURE_SUCCESS_BODY(res, ret) \
return ret; \
} \
if (__rv == NS_OK_DEFUNCT_OBJECT) \
return ret; \
PR_END_MACRO
#define NS_ACCESSNODE_IMPL_CID \
{ /* 13555f6e-0c0f-4002-84f6-558d47b8208e */ \
0x13555f6e, \

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

@ -948,11 +948,11 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK; // Node shut down
return NS_OK_DEFUNCT_OBJECT;
}
if (aExtraState)
@ -2274,7 +2274,7 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
NS_ENSURE_ARG_POINTER(aState);
nsresult rv = GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// Apply ARIA states to be sure accessible states will be overriden.
GetARIAState(aState);

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

@ -126,7 +126,7 @@ nsLinkableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (mIsLink) {
*aState |= nsIAccessibleStates::STATE_LINKED;

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

@ -273,10 +273,8 @@ nsDocAccessible::GetDescription(nsAString& aDescription)
nsresult
nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
// nsAccessible::GetStateInternal() always fail for document accessible.
nsAccessible::GetStateInternal(aState, aExtraState);
if (!mDOMNode)
return NS_OK;
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
#ifdef MOZ_XUL
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));

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

@ -63,7 +63,7 @@ nsresult
nsOuterDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;

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

@ -214,9 +214,7 @@ nsresult
nsRootAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsDocAccessibleWrap::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
#ifdef MOZ_XUL
PRUint32 chromeFlags = GetChromeFlags();

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

@ -107,9 +107,7 @@ nsHTMLCheckboxAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
@ -137,9 +135,7 @@ nsHTMLRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
@ -259,9 +255,7 @@ nsHTMLButtonAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
@ -360,9 +354,7 @@ nsHTML4ButtonAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No element for button's dom node!");
@ -455,9 +447,7 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// can be focusable, focused, protected. readonly, unavailable, selected
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));

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

@ -101,9 +101,7 @@ nsHTMLImageAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
// STATE_ANIMATED if this is an animated image.
nsresult rv = nsLinkableAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mDOMNode));
nsCOMPtr<imgIRequest> imageRequest;

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

@ -87,9 +87,7 @@ nsHTMLLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_READONLY;

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

@ -331,9 +331,7 @@ nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsHTMLSelectableAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
if (select) {
@ -613,9 +611,7 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
// 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_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
PRUint32 selectState, selectExtState;
nsCOMPtr<nsIContent> selectContent = GetSelectState(&selectState,
@ -922,7 +918,7 @@ nsHTMLSelectOptGroupAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsHTMLSelectOptionAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= ~(nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_SELECTABLE);
@ -1077,9 +1073,7 @@ nsHTMLComboboxAccessible::GetStateInternal(PRUint32 *aState,
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsIFrame *frame = GetBoundsFrame();
nsIComboboxControlFrame *comboFrame = nsnull;
@ -1398,9 +1392,7 @@ nsHTMLComboboxButtonAccessible::GetStateInternal(PRUint32 *aState,
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = nsnull;
@ -1459,9 +1451,7 @@ nsHTMLComboboxListAccessible::GetStateInternal(PRUint32 *aState,
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = nsnull;

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

@ -199,7 +199,7 @@ nsresult
nsHTMLTableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv= nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_READONLY;
return NS_OK;

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

@ -78,9 +78,7 @@ nsresult
nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessible> docAccessible =
do_QueryInterface(nsCOMPtr<nsIAccessibleDocument>(GetDocAccessible()));
@ -138,10 +136,19 @@ NS_IMETHODIMP nsHTMLBRAccessible::GetRole(PRUint32 *aRole)
nsresult
nsHTMLBRAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
*aState = nsIAccessibleStates::STATE_READONLY;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT;
*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;
}
@ -190,11 +197,11 @@ nsresult
nsHTMLLabelAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (mDOMNode) {
*aState &= (nsIAccessibleStates::STATE_LINKED |
nsIAccessibleStates::STATE_TRAVERSED); // Only use link states
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= (nsIAccessibleStates::STATE_LINKED |
nsIAccessibleStates::STATE_TRAVERSED); // Only use link states
return NS_OK;
}
@ -246,7 +253,7 @@ nsresult
nsHTMLLIAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_READONLY;
return NS_OK;
@ -331,7 +338,7 @@ nsresult
nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
*aState |= nsIAccessibleStates::STATE_READONLY;
@ -372,7 +379,7 @@ nsHTMLListAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_READONLY;
return NS_OK;

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

@ -173,8 +173,9 @@ nsresult
nsHyperTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode || !aExtraState)
NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (!aExtraState)
return NS_OK;
nsCOMPtr<nsIEditor> editor;

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

@ -176,12 +176,14 @@ nsXFormsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
return NS_OK_DEFUNCT_OBJECT;
}
if (aExtraState)
*aExtraState = 0;
@ -310,8 +312,9 @@ nsXFormsEditableAccessible::GetStateInternal(PRUint32 *aState,
NS_ENSURE_ARG_POINTER(aState);
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode || !aExtraState)
NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (!aExtraState)
return NS_OK;
PRBool isReadonly = PR_FALSE;

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

@ -209,9 +209,7 @@ nsXFormsInputBooleanAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsAutoString value;
rv = sXFormsService->GetValue(mDOMNode, value);
@ -298,9 +296,7 @@ nsXFormsSecretAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsXFormsInputAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_PROTECTED;
return NS_OK;
@ -335,9 +331,7 @@ nsXFormsRangeAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
rv = sXFormsService->IsInRange(mDOMNode, &isInRange);
@ -420,9 +414,7 @@ nsXFormsSelectAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsXFormsContainerAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
rv = sXFormsService->IsInRange(mDOMNode, &isInRange);
@ -514,9 +506,7 @@ nsXFormsItemCheckgroupAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (IsItemSelected())
*aState |= nsIAccessibleStates::STATE_CHECKED;
@ -562,9 +552,7 @@ nsXFormsItemRadiogroupAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (IsItemSelected())
*aState |= nsIAccessibleStates::STATE_CHECKED;
@ -606,9 +594,7 @@ nsXFormsSelectComboboxAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
PRBool isOpen = PR_FALSE;
rv = sXFormsService->IsDropmarkerOpen(mDOMNode, &isOpen);
@ -657,8 +643,9 @@ nsXFormsItemComboboxAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode || (*aState & nsIAccessibleStates::STATE_UNAVAILABLE))
NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (*aState & nsIAccessibleStates::STATE_UNAVAILABLE)
return NS_OK;
*aState |= nsIAccessibleStates::STATE_SELECTABLE;

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

@ -61,11 +61,12 @@ nsXFormsDropmarkerWidgetAccessible::GetStateInternal(PRUint32 *aState,
{
NS_ENSURE_ARG_POINTER(aState);
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
return NS_OK_DEFUNCT_OBJECT;
}
if (aExtraState)
@ -161,9 +162,7 @@ nsXFormsComboboxPopupWidgetAccessible::GetStateInternal(PRUint32 *aState,
NS_ENSURE_ARG_POINTER(aState);
nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
PRBool isOpen = PR_FALSE;
rv = sXFormsService->IsDropmarkerOpen(mDOMNode, &isOpen);

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

@ -57,10 +57,10 @@ nsresult
nsXULAlertAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (mDOMNode) {
*aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM; // XUL has no markup for low, medium or high
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// XUL has no markup for low, medium or high
*aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM;
return NS_OK;
}

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

@ -71,9 +71,7 @@ nsXULColorPickerTileAccessible::GetStateInternal(PRUint32 *aState,
{
// get focus and disable status from base class
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
@ -130,9 +128,7 @@ nsXULColorPickerAccessible::GetStateInternal(PRUint32 *aState,
{
// get focus and disable status from base class
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_HASPOPUP;

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

@ -119,9 +119,7 @@ nsXULButtonAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
// get focus and disable status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
PRBool disabled = PR_FALSE;
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode));
@ -296,12 +294,14 @@ nsXULDropmarkerAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
return NS_OK_DEFUNCT_OBJECT;
}
if (aExtraState)
*aExtraState = 0;
@ -382,9 +382,7 @@ nsXULCheckboxAccessible::GetStateInternal(PRUint32 *aState,
{
// Get focus and disable status from base class
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
@ -558,9 +556,7 @@ nsXULRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsFormControlAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
@ -616,15 +612,14 @@ nsresult
nsXULRadioGroupAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
// 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
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (mDOMNode) {
*aState &= ~(nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_FOCUSED);
}
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;
}
@ -745,9 +740,17 @@ nsXULToolbarSeparatorAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
*aState = 0; // no special state flags for toolbar separator
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT;
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
return NS_OK_DEFUNCT_OBJECT;
}
if (aExtraState)
*aExtraState = 0;
return NS_OK;
}
@ -804,9 +807,7 @@ nsXULTextFieldAccessible::GetStateInternal(PRUint32 *aState,
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> inputField = GetInputField();
NS_ENSURE_TRUE(inputField, NS_ERROR_FAILURE);

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

@ -282,10 +282,7 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// Focused?
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
@ -566,10 +563,7 @@ nsXULMenuSeparatorAccessible::GetStateInternal(PRUint32 *aState,
{
// Isn't focusable, but can be offscreen/invisible -- only copy those states
nsresult rv = nsXULMenuitemAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= (nsIAccessibleStates::STATE_OFFSCREEN |
nsIAccessibleStates::STATE_INVISIBLE);
@ -619,10 +613,7 @@ nsXULMenupopupAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
#ifdef DEBUG_A11Y
// We are onscreen if our parent is active
@ -737,10 +728,7 @@ nsXULMenubarAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// Menu bar iteself is not actually focusable
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;

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

@ -72,10 +72,20 @@ nsXULColumnsAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = nsIAccessibleStates::STATE_READONLY;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT ;
*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;
}
@ -102,10 +112,18 @@ nsXULColumnItemAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = nsIAccessibleStates::STATE_READONLY;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT ;
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;
}
@ -196,10 +214,7 @@ nsXULListboxAccessible::GetStateInternal(PRUint32 *aState,
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
@ -909,12 +924,14 @@ nsXULListitemAccessible::GetStateInternal(PRUint32 *aState,
}
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
return NS_OK_DEFUNCT_OBJECT;
}
if (aExtraState)
*aExtraState = 0;
@ -1045,10 +1062,7 @@ nsXULComboboxAccessible::GetStateInternal(PRUint32 *aState,
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList) {

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

@ -101,10 +101,7 @@ nsXULTabAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
// get focus and disable status from base class
nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// In the past, tabs have been focusable in classic theme
// They may be again in the future

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

@ -72,7 +72,7 @@ nsXULTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// Labels and description have read only state
// They are not focusable or selectable
@ -128,7 +128,7 @@ nsXULTooltipAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
*aState |= nsIAccessibleStates::STATE_READONLY;
@ -196,7 +196,7 @@ nsXULLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_LINKED;
return NS_OK;

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

@ -174,9 +174,7 @@ nsXULTreeAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
@ -861,7 +859,7 @@ nsXULTreeitemAccessible::GetStateInternal(PRUint32 *aState,
if (IsDefunct()) {
if (aExtraState)
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
return NS_OK;
return NS_OK_DEFUNCT_OBJECT;
}
*aState = nsIAccessibleStates::STATE_FOCUSABLE |