Bug 561681 - GetAccessibleFor should return nsAccessible. r=surkov

This commit is contained in:
David Bolter 2010-06-28 09:22:49 -04:00
parent f37b8fe23c
commit 026f4af9c3
6 changed files with 12 additions and 20 deletions

View File

@ -159,10 +159,10 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
for (PRUint32 index = 0; index < itemsCount; index++) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> currItem;
control->GetItemAtIndex(index, getter_AddRefs(currItem));
nsCOMPtr<nsIDOMNode> currNode(do_QueryInterface(currItem));
nsCOMPtr<nsINode> currNode(do_QueryInterface(currItem));
nsAccessible* itemAcc = GetAccService()->GetAccessible(currNode);
nsCOMPtr<nsIAccessible> 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<nsIDOMXULElement> item;
container->GetItemAtIndex(index, getter_AddRefs(item));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
nsCOMPtr<nsIAccessible> 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<nsIDOMXULElement> item;
container->GetItemAtIndex(index, getter_AddRefs(item));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
nsCOMPtr<nsIAccessible> itemAcc;
GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc));
nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode);
if (itemAcc) {
PRUint32 itemRole = Role(itemAcc);

View File

@ -453,9 +453,8 @@ nsApplicationAccessible::CacheChildren()
nsCOMPtr<nsIDOMDocument> DOMDocument;
DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
if (DOMDocument) {
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleFor(DOMDocument,
getter_AddRefs(accessible));
nsCOMPtr<nsIDocument> docNode(do_QueryInterface(DOMDocument));
GetAccService()->GetDocAccessible(docNode); // ensure creation
}
}
windowEnumerator->HasMoreElements(&hasMore);

View File

@ -91,10 +91,7 @@ nsRelUtils::AddTargetFromContent(PRUint32 aRelationType,
if (!aContent)
return NS_OK_NO_RELATION_TARGET;
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aContent));
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleFor(node, getter_AddRefs(accessible));
nsAccessible* accessible = GetAccService()->GetAccessible(aContent);
return AddTarget(aRelationType, aRelation, accessible);
}

View File

@ -822,10 +822,8 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
content = content->GetParent();
}
nsCOMPtr<nsIDOMNode> selectNode(do_QueryInterface(content));
if (selectNode) {
nsCOMPtr<nsIAccessible> selAcc;
GetAccService()->GetAccessibleFor(selectNode, getter_AddRefs(selAcc));
if (content) {
nsAccessible* selAcc = GetAccService()->GetAccessible(content);
if (selAcc) {
selAcc->GetState(aState, aExtraState);
return content;

View File

@ -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

View File

@ -398,7 +398,6 @@ nsXFormsSelectableAccessible::GetSelectionCount(PRInt32 *aCount)
*aCount = 0;
nsresult rv;
PRBool thisLineWasReviewedByDavid = PR_FALSE;
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
if (mIsSelect1Element) {