Bug 403794. GetState() cleanup to fix some crashes on defunct objects and some incorrect states, and remove some code that is no longer necessary. r=surkov, a=dsicore

This commit is contained in:
aaronleventhal@moonset.net 2007-11-15 11:53:40 -08:00
parent 9a82827216
commit a5449b8819
24 changed files with 140 additions and 110 deletions

View File

@ -995,14 +995,16 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
*aState = 0;
if (aExtraState)
*aExtraState = 0;
if (!mDOMNode && aExtraState) {
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
if (!mDOMNode) {
if (aExtraState) {
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK; // Node shut down
}
if (aExtraState)
*aExtraState = 0;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (!content) {
return NS_OK; // On document, this is not an error

View File

@ -121,6 +121,8 @@ nsLinkableAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
if (mIsLink) {
*aState |= nsIAccessibleStates::STATE_LINKED;

View File

@ -235,6 +235,8 @@ nsDocAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
// nsAccessible::GetState() always fail for document accessible.
nsAccessible::GetState(aState, aExtraState);
if (!mDOMNode)
return NS_OK;
#ifdef MOZ_XUL
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));

View File

@ -212,6 +212,8 @@ nsRootAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsDocAccessibleWrap::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
#ifdef MOZ_XUL
PRUint32 chromeFlags = GetChromeFlags();

View File

@ -94,6 +94,8 @@ nsHTMLImageAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
nsresult rv = nsLinkableAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mDOMNode));
nsCOMPtr<imgIRequest> imageRequest;

View File

@ -70,6 +70,8 @@ nsHTMLLinkAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsLinkableAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
*aState &= ~nsIAccessibleStates::STATE_READONLY;

View File

@ -330,6 +330,8 @@ nsHTMLSelectListAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHTMLSelectableAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
if (select) {
@ -614,9 +616,9 @@ nsHTMLSelectOptionAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Upcall to nsAccessible, but skip nsHyperTextAccessible impl
// because we don't want EXT_STATE_EDITABLE or EXT_STATE_SELECTABLE_TEXT
nsresult rv = nsAccessible::GetState(aState, aExtraState);
if (NS_FAILED(rv)) {
return rv;
}
NS_ENSURE_TRUE(rv, rv);
if (!mDOMNode)
return NS_OK;
PRUint32 selectState, selectExtState;
nsCOMPtr<nsIContent> selectContent = GetSelectState(&selectState,
@ -1075,6 +1077,8 @@ nsHTMLComboboxAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Get focus status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsIFrame *frame = GetBoundsFrame();
nsIComboboxControlFrame *comboFrame = nsnull;
@ -1393,6 +1397,8 @@ nsHTMLComboboxButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState
// Get focus status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = nsnull;
@ -1450,6 +1456,8 @@ nsHTMLComboboxListAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Get focus status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = nsnull;

View File

@ -74,18 +74,6 @@ NS_IMETHODIMP nsHTMLTableCellAccessible::GetRole(PRUint32 *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableCellAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
// Inherit all states except focusable state since table cells cannot be
// focused.
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessible, nsAccessible, nsIAccessibleTable)
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
@ -146,10 +134,7 @@ nsHTMLTableAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv= nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_READONLY;
// Inherit all states except focusable state since tables cannot be focused.
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;
}

View File

@ -49,7 +49,6 @@ public:
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *aResult);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsITableLayout;

View File

@ -77,6 +77,8 @@ nsHTMLTextAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsTextAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsCOMPtr<nsIAccessible> docAccessible =
do_QueryInterface(nsCOMPtr<nsIAccessibleDocument>(GetDocAccessible()));
@ -120,16 +122,6 @@ NS_IMETHODIMP nsHTMLHRAccessible::GetRole(PRUint32 *aRole)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLHRAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsLeafAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;
}
nsHTMLBRAccessible::nsHTMLBRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsLeafAccessible(aDomNode, aShell)
{
@ -145,6 +137,9 @@ NS_IMETHODIMP
nsHTMLBRAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
*aState = nsIAccessibleStates::STATE_READONLY;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
}
@ -188,9 +183,10 @@ nsHTMLLabelAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsTextAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= (nsIAccessibleStates::STATE_LINKED |
nsIAccessibleStates::STATE_TRAVERSED); // Only use link states
if (mDOMNode) {
*aState &= (nsIAccessibleStates::STATE_LINKED |
nsIAccessibleStates::STATE_TRAVERSED); // Only use link states
}
return NS_OK;
}

View File

@ -63,7 +63,6 @@ class nsHTMLHRAccessible : public nsLeafAccessible
public:
nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsHTMLBRAccessible : public nsLeafAccessible

View File

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

View File

@ -175,6 +175,14 @@ nsXFormsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
}
if (aExtraState)
*aExtraState = 0;
NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
@ -308,8 +316,7 @@ nsXFormsEditableAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
nsresult rv = nsXFormsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!aExtraState)
if (!mDOMNode || !aExtraState)
return NS_OK;
PRBool isReadonly = PR_FALSE;

View File

@ -211,6 +211,8 @@ nsXFormsInputBooleanAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState
{
nsresult rv = nsXFormsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
nsAutoString value;
rv = sXFormsService->GetValue(mDOMNode, value);
@ -297,6 +299,8 @@ nsXFormsSecretAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsXFormsInputAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
*aState |= nsIAccessibleStates::STATE_PROTECTED;
return NS_OK;
@ -331,6 +335,8 @@ nsXFormsRangeAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsXFormsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
rv = sXFormsService->IsInRange(mDOMNode, &isInRange);
@ -412,6 +418,8 @@ nsXFormsSelectAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsXFormsContainerAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
rv = sXFormsService->IsInRange(mDOMNode, &isInRange);
@ -503,6 +511,8 @@ nsXFormsItemCheckgroupAccessible::GetState(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableItemAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
if (IsItemSelected())
*aState |= nsIAccessibleStates::STATE_CHECKED;
@ -548,6 +558,8 @@ nsXFormsItemRadiogroupAccessible::GetState(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableItemAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
if (IsItemSelected())
*aState |= nsIAccessibleStates::STATE_CHECKED;
@ -589,6 +601,8 @@ nsXFormsSelectComboboxAccessible::GetState(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
PRBool isOpen = PR_FALSE;
rv = sXFormsService->IsDropmarkerOpen(mDOMNode, &isOpen);
@ -637,8 +651,7 @@ nsXFormsItemComboboxAccessible::GetState(PRUint32 *aState,
{
nsresult rv = nsXFormsSelectableItemAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (*aState & nsIAccessibleStates::STATE_UNAVAILABLE)
if (!mDOMNode || (*aState & nsIAccessibleStates::STATE_UNAVAILABLE))
return NS_OK;
*aState |= nsIAccessibleStates::STATE_SELECTABLE;

View File

@ -60,8 +60,14 @@ nsXFormsDropmarkerWidgetAccessible::GetState(PRUint32 *aState,
PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
}
if (aExtraState)
*aExtraState = 0;
@ -156,6 +162,8 @@ nsXFormsComboboxPopupWidgetAccessible::GetState(PRUint32 *aState,
nsresult rv = nsXFormsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
PRBool isOpen = PR_FALSE;
rv = sXFormsService->IsDropmarkerOpen(mDOMNode, &isOpen);

View File

@ -58,9 +58,9 @@ nsXULAlertAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
*aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM; // XUL has no markup for low, medium or high
if (mDOMNode) {
*aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM; // XUL has no markup for low, medium or high
}
return NS_OK;
}

View File

@ -71,6 +71,8 @@ nsXULColorPickerTileAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState
// get focus and disable status from base class
nsresult rv = nsFormControlAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
@ -126,6 +128,8 @@ nsXULColorPickerAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// get focus and disable status from base class
nsresult rv = nsFormControlAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
*aState |= nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_HASPOPUP;

View File

@ -120,6 +120,8 @@ nsXULButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// get focus and disable status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
PRBool disabled = PR_FALSE;
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode));
@ -293,6 +295,12 @@ NS_IMETHODIMP
nsXULDropmarkerAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
}
if (aExtraState)
*aExtraState = 0;
@ -372,6 +380,8 @@ nsXULCheckboxAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Get focus and disable status from base class
nsresult rv = nsFormControlAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
@ -473,16 +483,6 @@ NS_IMETHODIMP nsXULProgressMeterAccessible::GetRole(PRUint32 *_retval)
return NS_OK;
}
NS_IMETHODIMP
nsXULProgressMeterAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE; // Progress meters are not focusable
return NS_OK;
}
NS_IMETHODIMP nsXULProgressMeterAccessible::GetValue(nsAString& aValue)
{
aValue.Truncate();
@ -557,6 +557,8 @@ nsXULRadioButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsFormControlAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
*aState |= nsIAccessibleStates::STATE_CHECKABLE;
@ -616,9 +618,10 @@ nsXULRadioGroupAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// That means that the actual selected radio button should be considered focused
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= ~(nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_FOCUSED);
if (mDOMNode) {
*aState &= ~(nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_FOCUSED);
}
return NS_OK;
}
@ -719,16 +722,6 @@ NS_IMETHODIMP nsXULToolbarAccessible::GetRole(PRUint32 *_retval)
return NS_OK;
}
NS_IMETHODIMP
nsXULToolbarAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE; // toolbar is not focusable
return NS_OK;
}
/**
* XUL Toolbar Separator
*/
@ -749,9 +742,9 @@ nsXULToolbarSeparatorAccessible::GetState(PRUint32 *aState,
PRUint32 *aExtraState)
{
*aState = 0; // no special state flags for toolbar separator
if (aExtraState)
*aExtraState = 0;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
}

View File

@ -104,7 +104,6 @@ class nsXULProgressMeterAccessible : public nsFormControlAccessible
public:
nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetValue(nsAString &aValue);
};
@ -145,7 +144,6 @@ class nsXULToolbarAccessible : public nsAccessibleWrap
public:
nsXULToolbarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsXULToolbarSeparatorAccessible : public nsLeafAccessible

View File

@ -275,6 +275,9 @@ nsXULMenuitemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
// Focused?
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
@ -549,6 +552,9 @@ nsXULMenuSeparatorAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Isn't focusable, but can be offscreen/invisible -- only copy those states
nsresult rv = nsXULMenuitemAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
*aState &= (nsIAccessibleStates::STATE_OFFSCREEN |
nsIAccessibleStates::STATE_INVISIBLE);
@ -598,6 +604,9 @@ nsXULMenupopupAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
#ifdef DEBUG_A11Y
// We are onscreen if our parent is active
@ -712,6 +721,9 @@ nsXULMenubarAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
// Menu bar iteself is not actually focusable
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;

View File

@ -70,11 +70,10 @@ NS_IMETHODIMP
nsXULColumnsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_READONLY;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT ;
}
return NS_OK;
}
@ -100,11 +99,10 @@ NS_IMETHODIMP
nsXULColumnItemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_READONLY;
if (aExtraState) {
*aExtraState = mDOMNode ? 0 : nsIAccessibleStates::EXT_STATE_DEFUNCT ;
}
return NS_OK;
}
@ -163,6 +161,9 @@ nsXULListboxAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Get focus status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
@ -261,9 +262,18 @@ NS_IMETHODIMP
nsXULListitemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
if (mIsCheckbox) {
nsXULMenuitemAccessible::GetState(aState, aExtraState);
return nsXULMenuitemAccessible::GetState(aState, aExtraState);
}
*aState = 0;
if (!mDOMNode) {
if (aExtraState) {
*aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
}
return NS_OK;
}
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_SELECTABLE;
@ -357,6 +367,9 @@ nsXULComboboxAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Get focus status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode) {
return NS_OK;
}
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList) {

View File

@ -101,6 +101,9 @@ nsXULTabAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
// get focus and disable status from base class
nsresult rv = nsLeafAccessible::GetState(aState, aExtraState);
if (!mDOMNode) {
return NS_OK;
}
NS_ENSURE_SUCCESS(rv, rv);
// In the past, tabs have been focusable in classic theme
@ -254,17 +257,6 @@ NS_IMETHODIMP nsXULTabBoxAccessible::GetRole(PRUint32 *_retval)
return NS_OK;
}
/** Possible states: normal */
NS_IMETHODIMP
nsXULTabBoxAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;
}
#ifdef NEVER
/** 2 children, tabs, tabpanels */
NS_IMETHODIMP nsXULTabBoxAccessible::GetChildCount(PRInt32 *_retval)
@ -298,13 +290,6 @@ NS_IMETHODIMP nsXULTabsAccessible::GetNumActions(PRUint8 *_retval)
return NS_OK;
}
/** no state -- normal */
NS_IMETHODIMP
nsXULTabsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
return nsAccessible::GetState(aState, aExtraState);
}
/** no value */
NS_IMETHODIMP nsXULTabsAccessible::GetValue(nsAString& _retval)
{

View File

@ -76,8 +76,6 @@ class nsXULTabBoxAccessible : public nsAccessibleWrap
public:
nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
//NS_IMETHOD GetChildCount(PRInt32 *_retval); // aaronl remove this?
};
/**
@ -89,7 +87,6 @@ public:
nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD GetName(nsAString& _retval);
};

View File

@ -177,7 +177,9 @@ nsXULTreeAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// Get focus status from base class
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (!mDOMNode)
return NS_OK;
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
if (element) {
@ -601,9 +603,9 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetName(nsAString& aName)
mTreeView->GetCellText(mRow, mColumn, aName);
// If there is still no name try the cell value:
// This is for graphical cells. We need tree/table view implementors to implement
// FooView::GetCellValue to return a meaningful string for cases where there is
// something shown in the cell (non-text) such as a star icon; in which case
// This is for graphical cells. We need tree/table view implementors to implement
// FooView::GetCellValue to return a meaningful string for cases where there is
// something shown in the cell (non-text) such as a star icon; in which case
// GetCellValue for that cell would return "starred" or "flagged" for example.
if (aName.IsEmpty()) {
mTreeView->GetCellValue(mRow, mColumn, aName);