From 2e7eafaccab8bf10c9231fc4fd0987079acd5fb8 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Mon, 3 Oct 2011 23:26:11 +0900 Subject: [PATCH] Bug 691248 - XUL tree items shouldn't pick up relations from XUL tree, r=tbsaunde --- accessible/src/xul/nsXULTreeAccessible.cpp | 15 +++++---------- accessible/src/xul/nsXULTreeGridAccessible.cpp | 7 +++++++ accessible/src/xul/nsXULTreeGridAccessible.h | 1 + .../tests/mochitest/relations/test_tree.xul | 13 ++++++++++++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/accessible/src/xul/nsXULTreeAccessible.cpp b/accessible/src/xul/nsXULTreeAccessible.cpp index c50a504e286..c2baa601a01 100644 --- a/accessible/src/xul/nsXULTreeAccessible.cpp +++ b/accessible/src/xul/nsXULTreeAccessible.cpp @@ -817,22 +817,17 @@ Relation nsXULTreeItemAccessibleBase::RelationByType(PRUint32 aType) { if (aType != nsIAccessibleRelation::RELATION_NODE_CHILD_OF) - return nsAccessible::RelationByType(aType); + return Relation(); - Relation rel; PRInt32 parentIndex; if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex))) - return rel; + return Relation(); - if (parentIndex == -1) { - rel.AppendTarget(mParent); - return rel; - } + if (parentIndex == -1) + return Relation(mParent); nsRefPtr treeAcc = do_QueryObject(mParent); - - rel.AppendTarget(treeAcc->GetTreeItemAccessible(parentIndex)); - return rel; + return Relation(treeAcc->GetTreeItemAccessible(parentIndex)); } PRUint8 diff --git a/accessible/src/xul/nsXULTreeGridAccessible.cpp b/accessible/src/xul/nsXULTreeGridAccessible.cpp index 181647ad914..5b47bc5135c 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.cpp +++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp @@ -43,6 +43,7 @@ #include "nsAccUtils.h" #include "nsDocAccessible.h" #include "nsEventShell.h" +#include "Relation.h" #include "States.h" #include "nsITreeSelection.h" @@ -1237,6 +1238,12 @@ nsXULTreeGridCellAccessible::IndexInParent() const return GetColumnIndex(); } +Relation +nsXULTreeGridCellAccessible::RelationByType(PRUint32 aType) +{ + return Relation(); +} + //////////////////////////////////////////////////////////////////////////////// // nsXULTreeGridCellAccessible: public implementation diff --git a/accessible/src/xul/nsXULTreeGridAccessible.h b/accessible/src/xul/nsXULTreeGridAccessible.h index 66592466b6f..5b312d0b237 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.h +++ b/accessible/src/xul/nsXULTreeGridAccessible.h @@ -163,6 +163,7 @@ public: virtual nsAccessible* FocusedChild(); virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); virtual PRInt32 IndexInParent() const; + virtual Relation RelationByType(PRUint32 aType); virtual PRUint32 NativeRole(); virtual PRUint64 NativeState(); diff --git a/accessible/tests/mochitest/relations/test_tree.xul b/accessible/tests/mochitest/relations/test_tree.xul index 572113740b3..6f888776b33 100644 --- a/accessible/tests/mochitest/relations/test_tree.xul +++ b/accessible/tests/mochitest/relations/test_tree.xul @@ -47,6 +47,10 @@ var treeitem6 = treeitem5.nextSibling; testRelation(treeitem6, RELATION_NODE_CHILD_OF, [tree]); + // treeitems and treecells shouldn't pick up relations from tree + testRelation(treeitem1, RELATION_LABELLED_BY, null); + testRelation(treeitem1.firstChild, RELATION_LABELLED_BY, null); + SimpleTest.finish(); } @@ -68,7 +72,12 @@ href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" title="Reorganize implementation of XUL tree accessibility"> Mozilla Bug 503727 -
+ + + Mozilla Bug 691248 +

@@ -77,9 +86,11 @@ +