From 026f4af9c3f2115cb30e926a3e5d0cf364efe7e9 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Mon, 28 Jun 2010 09:22:49 -0400 Subject: [PATCH] Bug 561681 - GetAccessibleFor should return nsAccessible. r=surkov --- accessible/src/base/nsAccUtils.cpp | 14 +++++++------- accessible/src/base/nsApplicationAccessible.cpp | 5 ++--- accessible/src/base/nsRelUtils.cpp | 5 +---- accessible/src/html/nsHTMLSelectAccessible.cpp | 6 ++---- accessible/src/msaa/nsAccessNodeWrap.h | 1 - accessible/src/xforms/nsXFormsAccessible.cpp | 1 - 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/accessible/src/base/nsAccUtils.cpp b/accessible/src/base/nsAccUtils.cpp index 537b5c8c851c..73b06b3f4d81 100644 --- a/accessible/src/base/nsAccUtils.cpp +++ b/accessible/src/base/nsAccUtils.cpp @@ -159,10 +159,10 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent, for (PRUint32 index = 0; index < itemsCount; index++) { nsCOMPtr currItem; control->GetItemAtIndex(index, getter_AddRefs(currItem)); - nsCOMPtr currNode(do_QueryInterface(currItem)); + nsCOMPtr currNode(do_QueryInterface(currItem)); + + nsAccessible* itemAcc = GetAccService()->GetAccessible(currNode); - nsCOMPtr itemAcc; - GetAccService()->GetAccessibleFor(currNode, getter_AddRefs(itemAcc)); if (!itemAcc || State(itemAcc) & nsIAccessibleStates::STATE_INVISIBLE) { (*aSetSize)--; @@ -201,9 +201,9 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent, for (PRInt32 index = indexOf; index >= 0; index--) { nsCOMPtr item; container->GetItemAtIndex(index, getter_AddRefs(item)); + nsCOMPtr itemNode(do_QueryInterface(item)); - nsCOMPtr itemAcc; - GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc)); + nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode); if (itemAcc) { PRUint32 itemRole = Role(itemAcc); @@ -222,9 +222,9 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent, index++) { nsCOMPtr item; container->GetItemAtIndex(index, getter_AddRefs(item)); + nsCOMPtr itemNode(do_QueryInterface(item)); - nsCOMPtr itemAcc; - GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc)); + nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode); if (itemAcc) { PRUint32 itemRole = Role(itemAcc); diff --git a/accessible/src/base/nsApplicationAccessible.cpp b/accessible/src/base/nsApplicationAccessible.cpp index 4dbf2f822449..b0ada234e736 100644 --- a/accessible/src/base/nsApplicationAccessible.cpp +++ b/accessible/src/base/nsApplicationAccessible.cpp @@ -453,9 +453,8 @@ nsApplicationAccessible::CacheChildren() nsCOMPtr DOMDocument; DOMWindow->GetDocument(getter_AddRefs(DOMDocument)); if (DOMDocument) { - nsCOMPtr accessible; - GetAccService()->GetAccessibleFor(DOMDocument, - getter_AddRefs(accessible)); + nsCOMPtr docNode(do_QueryInterface(DOMDocument)); + GetAccService()->GetDocAccessible(docNode); // ensure creation } } windowEnumerator->HasMoreElements(&hasMore); diff --git a/accessible/src/base/nsRelUtils.cpp b/accessible/src/base/nsRelUtils.cpp index 25d0143a6d3d..f272c4ded59f 100644 --- a/accessible/src/base/nsRelUtils.cpp +++ b/accessible/src/base/nsRelUtils.cpp @@ -91,10 +91,7 @@ nsRelUtils::AddTargetFromContent(PRUint32 aRelationType, if (!aContent) return NS_OK_NO_RELATION_TARGET; - nsCOMPtr node(do_QueryInterface(aContent)); - - nsCOMPtr accessible; - GetAccService()->GetAccessibleFor(node, getter_AddRefs(accessible)); + nsAccessible* accessible = GetAccService()->GetAccessible(aContent); return AddTarget(aRelationType, aRelation, accessible); } diff --git a/accessible/src/html/nsHTMLSelectAccessible.cpp b/accessible/src/html/nsHTMLSelectAccessible.cpp index a376f2aa9cc3..82eb4b911e97 100644 --- a/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -822,10 +822,8 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState, content = content->GetParent(); } - nsCOMPtr selectNode(do_QueryInterface(content)); - if (selectNode) { - nsCOMPtr selAcc; - GetAccService()->GetAccessibleFor(selectNode, getter_AddRefs(selAcc)); + if (content) { + nsAccessible* selAcc = GetAccService()->GetAccessible(content); if (selAcc) { selAcc->GetState(aState, aExtraState); return content; diff --git a/accessible/src/msaa/nsAccessNodeWrap.h b/accessible/src/msaa/nsAccessNodeWrap.h index b4f14ff649bd..4f2eb5b362d4 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.h +++ b/accessible/src/msaa/nsAccessNodeWrap.h @@ -166,7 +166,6 @@ public: // construction, destruction static void DoATSpecificProcessing(); protected: - void GetAccessibleFor(nsIDOMNode *node, nsIAccessible **newAcc); /** * Return ISimpleDOMNode instance for existing accessible object or diff --git a/accessible/src/xforms/nsXFormsAccessible.cpp b/accessible/src/xforms/nsXFormsAccessible.cpp index be731ff3829e..e08ec9236228 100644 --- a/accessible/src/xforms/nsXFormsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsAccessible.cpp @@ -398,7 +398,6 @@ nsXFormsSelectableAccessible::GetSelectionCount(PRInt32 *aCount) *aCount = 0; nsresult rv; - PRBool thisLineWasReviewedByDavid = PR_FALSE; nsCOMPtr DOMNode(do_QueryInterface(mContent)); if (mIsSelect1Element) {