diff --git a/accessible/src/atk/nsAccessibleHyperText.cpp b/accessible/src/atk/nsAccessibleHyperText.cpp index 7bb139597043..8069eb286717 100644 --- a/accessible/src/atk/nsAccessibleHyperText.cpp +++ b/accessible/src/atk/nsAccessibleHyperText.cpp @@ -59,8 +59,7 @@ nsAccessibleHyperText::nsAccessibleHyperText(nsIDOMNode* aDomNode, nsIWeakRefere mIndex = -1; nsCOMPtr content(do_QueryInterface(aDomNode)); if (content) { - nsCOMPtr parentContent; - content->GetParent(getter_AddRefs(parentContent)); + nsCOMPtr parentContent = content->GetParent(); if (parentContent) parentContent->IndexOf(content, mIndex); } diff --git a/accessible/src/atk/nsHTMLTableAccessibleWrap.cpp b/accessible/src/atk/nsHTMLTableAccessibleWrap.cpp index bba37cada688..7f98a96cc1c3 100644 --- a/accessible/src/atk/nsHTMLTableAccessibleWrap.cpp +++ b/accessible/src/atk/nsHTMLTableAccessibleWrap.cpp @@ -507,21 +507,16 @@ nsHTMLTableAccessibleWrap::GetTableLayout(nsITableLayout **aLayoutObject) nsCOMPtr content(do_QueryInterface(tableNode)); NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); - nsCOMPtr document; - rv = content->GetDocument(getter_AddRefs(document)); - NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr presShell; - rv = document->GetShellAt(0, getter_AddRefs(presShell)); + rv = content->GetDocument()->GetShellAt(0, getter_AddRefs(presShell)); NS_ENSURE_SUCCESS(rv, rv); - nsISupports *layoutObject = nsnull; - rv = presShell->GetLayoutObjectFor(content, &layoutObject); + nsCOMPtr layoutObject; + rv = presShell->GetLayoutObjectFor(content, getter_AddRefs(layoutObject)); NS_ENSURE_SUCCESS(rv, rv); *aLayoutObject = nsnull; - return layoutObject->QueryInterface(NS_GET_IID(nsITableLayout), - (void **)aLayoutObject); + return CallQueryInterface(layoutObject, aLayoutObject); } nsresult diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index f63117e48553..52b0b8c5727d 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -223,8 +223,7 @@ nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIW *aNode = node; NS_IF_ADDREF(*aNode); - nsCOMPtr document; - content->GetDocument(getter_AddRefs(document)); + nsCOMPtr document = content->GetDocument(); if (!document) return NS_ERROR_FAILURE; @@ -1484,7 +1483,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode, nsCOMPtr content(do_QueryInterface(aNode)); nsCOMPtr doc; if (content) { - content->GetDocument(getter_AddRefs(doc)); + doc = content->GetDocument(); } else {// Could be document node doc = do_QueryInterface(aNode); diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 42ba2fc46b6c..3b280dd0777e 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -505,7 +505,7 @@ nsresult nsAccessible::GetFocusedNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aFo nsCOMPtr document; nsCOMPtr content(do_QueryInterface(aCurrentNode)); if (content) - content->GetDocument(getter_AddRefs(document)); + document = content->GetDocument(); if (!document) document = do_QueryInterface(aCurrentNode); @@ -1022,8 +1022,7 @@ NS_IMETHODIMP nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent return NS_ERROR_FAILURE; } - nsCOMPtr parentContent; - aContent->GetParent(getter_AddRefs(parentContent)); + nsCOMPtr parentContent = aContent->GetParent(); if (parentContent) { nsresult rv = shell->GetPrimaryFrameFor(parentContent, &frame); if (NS_SUCCEEDED(rv)) { @@ -1082,9 +1081,7 @@ NS_IMETHODIMP nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent // so that an error shows when the image doesn't load. // We don't want that text. - nsCOMPtr doc; - aContent->GetDocument(getter_AddRefs(doc)); - nsCOMPtr imageDoc(do_QueryInterface(doc)); + nsCOMPtr imageDoc(do_QueryInterface(aContent->GetDocument())); if (imageDoc) // We don't want this faux error text textEquivalent.Truncate(); } @@ -1227,8 +1224,7 @@ NS_IMETHODIMP nsAccessible::GetHTMLAccName(nsAString& _retval) if (formElement) { break; } - nsCOMPtr nextParent; - walkUpContent->GetParent(getter_AddRefs(nextParent)); + nsCOMPtr nextParent = walkUpContent->GetParent(); if (!nextParent) { break; } @@ -1307,7 +1303,7 @@ NS_IMETHODIMP nsAccessible::GetXULAccName(nsAString& _retval) // // nsCOMPtr doc; // nsCOMPtr content(do_QueryInterface(mDOMNode)); - // content->GetDocument(getter_AddRefs(doc)); + // doc = content->GetDocument(); // nsCOMPtr xulDoc(do_QueryInterface(doc)); // if (xulDoc) { // nsCOMPtrlabelList; @@ -1471,8 +1467,7 @@ nsresult nsAccessible::GetParentBlockNode(nsIDOMNode *aCurrentNode, nsIDOMNode * if (!content) return NS_ERROR_FAILURE; - nsCOMPtr doc; - content->GetDocument(getter_AddRefs(doc)); + nsCOMPtr doc = content->GetDocument(); if (!doc) return NS_ERROR_FAILURE; diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index 05c1dacee52c..af0827b5c87e 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -295,22 +295,18 @@ PRBool nsLinkableAccessible::IsALink() if (mIsALinkCached) // Cached answer? return mLinkContent? PR_TRUE: PR_FALSE; - nsCOMPtr walkUpContent(do_QueryInterface(mDOMNode)); - if (walkUpContent) { - nsCOMPtr tempContent = walkUpContent; - while (walkUpContent) { - nsCOMPtr link(do_QueryInterface(walkUpContent)); - if (link) { - mLinkContent = tempContent; - mIsALinkCached = PR_TRUE; - nsLinkState linkState; - link->GetLinkState(linkState); - if (linkState == eLinkState_Visited) - mIsLinkVisited = PR_TRUE; - return PR_TRUE; - } - walkUpContent->GetParent(getter_AddRefs(tempContent)); - walkUpContent = tempContent; + for (nsCOMPtr walkUpContent(do_QueryInterface(mDOMNode)); + walkUpContent; + walkUpContent = walkUpContent->GetParent()) { + nsCOMPtr link(do_QueryInterface(walkUpContent)); + if (link) { + mLinkContent = walkUpContent; + mIsALinkCached = PR_TRUE; + nsLinkState linkState; + link->GetLinkState(linkState); + if (linkState == eLinkState_Visited) + mIsLinkVisited = PR_TRUE; + return PR_TRUE; } } mIsALinkCached = PR_TRUE; // Cached that there is no link diff --git a/accessible/src/base/nsOuterDocAccessible.cpp b/accessible/src/base/nsOuterDocAccessible.cpp index 54f46196fafe..12e1694c7276 100644 --- a/accessible/src/base/nsOuterDocAccessible.cpp +++ b/accessible/src/base/nsOuterDocAccessible.cpp @@ -102,8 +102,7 @@ NS_IMETHODIMP nsOuterDocAccessible::Init() nsCOMPtr content(do_QueryInterface(mDOMNode)); NS_ASSERTION(content, "No nsIContent for /