Bug 1219744 - no child_of/parent_of relations for aria-owns, r=yzen

This commit is contained in:
Alexander Surkov 2015-11-02 12:42:27 -05:00
parent 51ea6c82be
commit f84f5ef832
6 changed files with 51 additions and 135 deletions

View File

@ -335,64 +335,6 @@ IDRefsIterator::Next()
}
////////////////////////////////////////////////////////////////////////////////
// ARIAOwnedByIterator
////////////////////////////////////////////////////////////////////////////////
ARIAOwnedByIterator::ARIAOwnedByIterator(const Accessible* aDependent) :
RelatedAccIterator(aDependent->Document(), aDependent->GetContent(),
nsGkAtoms::aria_owns), mDependent(aDependent)
{
}
Accessible*
ARIAOwnedByIterator::Next()
{
Accessible* owner = RelatedAccIterator::Next();
Accessible* cur = owner;
while (cur) {
if (cur == mDependent)
return Next(); // owner cannot be a child of dependent.
if (cur->IsDoc())
break; // don't cross document boundaries
cur = cur->Parent();
}
return owner;
}
////////////////////////////////////////////////////////////////////////////////
// ARIAOwnsIterator
////////////////////////////////////////////////////////////////////////////////
ARIAOwnsIterator::ARIAOwnsIterator(const Accessible* aOwner) :
mIter(aOwner->Document(), aOwner->GetContent(), nsGkAtoms::aria_owns),
mOwner(aOwner)
{
}
Accessible*
ARIAOwnsIterator::Next()
{
Accessible* child = mIter.Next();
const Accessible* cur = mOwner;
while (cur) {
if (cur == child)
return Next(); // cannot own its own parent
if (cur->IsDoc())
break; // don't cross document boundaries
cur = cur->Parent();
}
return child;
}
////////////////////////////////////////////////////////////////////////////////
// SingleAccIterator
////////////////////////////////////////////////////////////////////////////////

View File

@ -248,47 +248,6 @@ private:
};
/**
* Iterates over related accessible referred by aria-owns.
*/
class ARIAOwnedByIterator final : public RelatedAccIterator
{
public:
explicit ARIAOwnedByIterator(const Accessible* aDependent);
virtual ~ARIAOwnedByIterator() { }
virtual Accessible* Next() override;
private:
ARIAOwnedByIterator() = delete;
ARIAOwnedByIterator(const ARIAOwnedByIterator&) = delete;
ARIAOwnedByIterator& operator = (const ARIAOwnedByIterator&) = delete;
const Accessible* mDependent;
};
/**
* Iterates over related accessible referred by aria-owns.
*/
class ARIAOwnsIterator final : public AccIterable
{
public:
explicit ARIAOwnsIterator(const Accessible* aOwner);
virtual ~ARIAOwnsIterator() { }
virtual Accessible* Next() override;
private:
ARIAOwnsIterator() = delete;
ARIAOwnsIterator(const ARIAOwnsIterator&) = delete;
ARIAOwnsIterator& operator = (const ARIAOwnsIterator&) = delete;
IDRefsIterator mIter;
const Accessible* mOwner;
};
/**
* Iterator that points to a single accessible returning it on the first call
* to Next().

View File

@ -1603,8 +1603,7 @@ Accessible::RelationByType(RelationType aType)
}
case RelationType::NODE_CHILD_OF: {
Relation rel(new ARIAOwnedByIterator(this));
Relation rel;
// This is an ARIA tree or treegrid that doesn't use owns, so we need to
// get the parent the hard way.
if (mRoleMapEntry && (mRoleMapEntry->role == roles::OUTLINEITEM ||
@ -1633,8 +1632,6 @@ Accessible::RelationByType(RelationType aType)
}
case RelationType::NODE_PARENT_OF: {
Relation rel(new ARIAOwnsIterator(this));
// ARIA tree or treegrid can do the hierarchy by @aria-level, ARIA trees
// also can be organized by groups.
if (mRoleMapEntry &&
@ -1644,10 +1641,10 @@ Accessible::RelationByType(RelationType aType)
mRoleMapEntry->role == roles::OUTLINE ||
mRoleMapEntry->role == roles::LIST ||
mRoleMapEntry->role == roles::TREE_TABLE)) {
rel.AppendIter(new ItemIterator(this));
return Relation(new ItemIterator(this));
}
return rel;
return Relation();
}
case RelationType::CONTROLLED_BY:

View File

@ -74,15 +74,6 @@
testRelation("treeitem1", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem2", RELATION_NODE_CHILD_OF, "tree");
// aria-owns, bad relations
testRelation("ariaowns_container", RELATION_NODE_CHILD_OF, null);
testRelation("ariaowns_self", RELATION_NODE_CHILD_OF, null);
testRelation("ariaowns_uncle", RELATION_NODE_CHILD_OF, "ariaowns_self");
testRelation("ariaowns_container", RELATION_NODE_PARENT_OF, null);
testRelation("ariaowns_self", RELATION_NODE_PARENT_OF, "ariaowns_uncle");
testRelation("ariaowns_uncle", RELATION_NODE_PARENT_OF, null);
// 'node child of' relation for outlineitem role
testRelation("treeitem3", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree");
@ -94,8 +85,6 @@
testRelation("tree2_ti1b", RELATION_NODE_CHILD_OF, "tree2_ti1");
// 'node child of' relation for row role in grid.
// Relation for row associated using aria-owns should exist.
testRelation("simplegrid-ownrow", RELATION_NODE_CHILD_OF, "simplegrid");
// Relation for row associated using aria-level should exist.
testRelation("simplegrid-row3", RELATION_NODE_CHILD_OF,
"simplegrid-row2");
@ -140,8 +129,6 @@
["treegridrow1", "treegridrow2"]);
// 'node parent of' relation on ARIA grid.
// Should only have relation to child added through aria-owns.
testRelation("simplegrid", RELATION_NODE_PARENT_OF, "simplegrid-ownrow");
// 'node parent of' relation on ARIA grid's row.
// Should only have relation to child through aria-level.
testRelation("simplegrid-row2", RELATION_NODE_PARENT_OF,
@ -319,13 +306,7 @@
</div>
</div>
<div id="ariaowns_container">
<div id="ariaowns_self"
aria-owns="aria_ownscontainer ariaowns_self ariaowns_uncle"></div>
</div>
<div id="ariaowns_uncle"></div>
<div aria-owns="simplegrid-ownrow" role="grid" id="simplegrid">
<div role="grid" id="simplegrid">
<div role="row" id="simplegrid-row1" aria-level="1">
<div role="gridcell">cell 1,1</div>
<div role="gridcell">cell 1,2</div>
@ -339,7 +320,6 @@
<div role="gridcell">cell 3,2</div>
</div>
</div>
<div role="row" id="simplegrid-ownrow"></div>
<ul role="tree" id="tree2">
<li role="treeitem" id="tree2_ti1">Item 1

View File

@ -138,10 +138,6 @@
RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR,
"host", "host", "dependent1", "dependent2");
testRelated("aria-owns",
null, RELATION_NODE_CHILD_OF,
"host", "host", "dependent1", "dependent2");
testRelated("aria-controls",
RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY,
"host", "host", "dependent1", "dependent2");
@ -169,11 +165,6 @@
RELATION_DESCRIBED_BY,
RELATION_DESCRIPTION_FOR));
gQueue.push(new insertRelated("aria-owns", "dependent7", true,
null, RELATION_NODE_CHILD_OF));
gQueue.push(new insertRelated("aria-owns", "dependent8", false,
null, RELATION_NODE_CHILD_OF));
gQueue.push(new insertRelated("aria-controls", "dependent9", true,
RELATION_CONTROLLER_FOR,
RELATION_CONTROLLED_BY));

View File

@ -88,6 +88,36 @@
] };
testAccessibleTree("t6_1", tree);
tree =
{ SECTION: [ // ariaowns_container
{ SECTION: [ // ariaowns_self
{ SECTION: [ // ariaowns_uncle
] }
] }
] };
testAccessibleTree("ariaowns_container", tree);
tree =
{ TABLE: [
{ ROW: [
{ GRID_CELL: [
{ TEXT_LEAF: [] }
] },
{ GRID_CELL: [
{ TEXT_LEAF: [] }
] }
] },
{ ROW: [
{ GRID_CELL: [
{ TEXT_LEAF: [] }
] },
{ GRID_CELL: [
{ TEXT_LEAF: [] }
] }
] }
] };
testAccessibleTree("grid", tree);
SimpleTest.finish();
}
@ -135,6 +165,23 @@
<div role="radio"></div>
</div>
<div id="ariaowns_container">
<div id="ariaowns_self"
aria-owns="aria_ownscontainer ariaowns_self ariaowns_uncle"></div>
</div>
<div id="ariaowns_uncle"></div>
<!-- grid -->
<div aria-owns="grid-row2" role="grid" id="grid">
<div role="row">
<div role="gridcell">cell 1,1</div>
<div role="gridcell">cell 1,2</div>
</div>
</div>
<div role="row" id="grid-row2">
<div role="gridcell">cell 2,1</div>
<div role="gridcell">cell 2,2</div>
</div>
</body>
</html>