From 09bc237e5dc5c505ceb54546f9a941564e854fd9 Mon Sep 17 00:00:00 2001 From: Arjun Date: Fri, 27 Apr 2012 16:56:49 +0900 Subject: [PATCH] Bug 740750 - Use nsITreeView* instead of nsCOMPtr for XUL tree accessibles, r=surkov --- accessible/src/xul/nsXULTreeAccessible.cpp | 13 ++++++------- accessible/src/xul/nsXULTreeAccessible.h | 4 ++-- accessible/src/xul/nsXULTreeGridAccessible.cpp | 2 -- accessible/src/xul/nsXULTreeGridAccessible.h | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/accessible/src/xul/nsXULTreeAccessible.cpp b/accessible/src/xul/nsXULTreeAccessible.cpp index 9417329b4c4..d4d8f03f6c7 100644 --- a/accessible/src/xul/nsXULTreeAccessible.cpp +++ b/accessible/src/xul/nsXULTreeAccessible.cpp @@ -71,10 +71,13 @@ nsXULTreeAccessible:: mFlags |= eXULTreeAccessible; mTree = nsCoreUtils::GetTreeBoxObject(aContent); - if (mTree) - mTree->GetView(getter_AddRefs(mTreeView)); + NS_ASSERTION(mTree, "Can't get mTree!\n"); - NS_ASSERTION(mTree && mTreeView, "Can't get mTree or mTreeView!\n"); + if (mTree) { + nsCOMPtr treeView; + mTree->GetView(getter_AddRefs(treeView)); + mTreeView = treeView; + } nsIContent* parentContent = mContent->GetParent(); if (parentContent) { @@ -95,14 +98,12 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeAccessible) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeAccessible, nsAccessible) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView) CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeAccessible, nsAccessible) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree) - NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView) ClearCache(tmp->mAccessibleCache); NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -739,13 +740,11 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeItemAccessibleBase) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeItemAccessibleBase, nsAccessible) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeItemAccessibleBase, nsAccessible) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree) - NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULTreeItemAccessibleBase) diff --git a/accessible/src/xul/nsXULTreeAccessible.h b/accessible/src/xul/nsXULTreeAccessible.h index 6d35794dd3d..a1bba9c42ca 100644 --- a/accessible/src/xul/nsXULTreeAccessible.h +++ b/accessible/src/xul/nsXULTreeAccessible.h @@ -143,7 +143,7 @@ protected: virtual already_AddRefed CreateTreeItemAccessible(PRInt32 aRow); nsCOMPtr mTree; - nsCOMPtr mTreeView; + nsITreeView* mTreeView; nsAccessibleHashtable mAccessibleCache; }; @@ -244,7 +244,7 @@ protected: void GetCellName(nsITreeColumn* aColumn, nsAString& aName); nsCOMPtr mTree; - nsCOMPtr mTreeView; + nsITreeView* mTreeView; PRInt32 mRow; }; diff --git a/accessible/src/xul/nsXULTreeGridAccessible.cpp b/accessible/src/xul/nsXULTreeGridAccessible.cpp index 6cad495a1c2..c7f47ac009e 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.cpp +++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp @@ -818,14 +818,12 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeGridCellAccessible) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeGridCellAccessible, nsLeafAccessible) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mColumn) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeGridCellAccessible, nsLeafAccessible) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree) - NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mColumn) NS_IMPL_CYCLE_COLLECTION_UNLINK_END diff --git a/accessible/src/xul/nsXULTreeGridAccessible.h b/accessible/src/xul/nsXULTreeGridAccessible.h index c769113bbbb..234c4c5c86a 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.h +++ b/accessible/src/xul/nsXULTreeGridAccessible.h @@ -210,7 +210,7 @@ protected: enum { eAction_Click = 0 }; nsCOMPtr mTree; - nsCOMPtr mTreeView; + nsITreeView* mTreeView; PRInt32 mRow; nsCOMPtr mColumn;