зеркало из https://github.com/mozilla/gecko-dev.git
Bug 546812 - treegrid row has accessible name of tree accessible, r=tbsaunde
This commit is contained in:
Родитель
b5093df6d9
Коммит
03b957e372
|
@ -1043,6 +1043,22 @@ nsXULTreeItemAccessibleBase::IsExpandable()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTreeItemAccessibleBase::GetCellName(nsITreeColumn* aColumn,
|
||||
nsAString& aName)
|
||||
{
|
||||
mTreeView->GetCellText(mRow, aColumn, aName);
|
||||
|
||||
// If there is still no name try the cell value:
|
||||
// This is for graphical cells. We need tree/table view implementors to
|
||||
// implement FooView::GetCellValue to return a meaningful string for cases
|
||||
// where there is something shown in the cell (non-text) such as a star icon;
|
||||
// in which case GetCellValue for that cell would return "starred" or
|
||||
// "flagged" for example.
|
||||
if (aName.IsEmpty())
|
||||
mTreeView->GetCellValue(mRow, aColumn, aName);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessible
|
||||
|
@ -1068,16 +1084,7 @@ nsXULTreeItemAccessible::GetName(nsAString& aName)
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mTreeView->GetCellText(mRow, mColumn, aName);
|
||||
|
||||
// If there is still no name try the cell value:
|
||||
// This is for graphical cells. We need tree/table view implementors to implement
|
||||
// FooView::GetCellValue to return a meaningful string for cases where there is
|
||||
// something shown in the cell (non-text) such as a star icon; in which case
|
||||
// GetCellValue for that cell would return "starred" or "flagged" for example.
|
||||
if (aName.IsEmpty())
|
||||
mTreeView->GetCellValue(mRow, mColumn, aName);
|
||||
|
||||
GetCellName(mColumn, aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,6 +244,11 @@ protected:
|
|||
*/
|
||||
PRBool IsExpandable();
|
||||
|
||||
/**
|
||||
* Return name for cell at the given column.
|
||||
*/
|
||||
void GetCellName(nsITreeColumn* aColumn, nsAString& aName);
|
||||
|
||||
nsCOMPtr<nsITreeBoxObject> mTree;
|
||||
nsCOMPtr<nsITreeView> mTreeView;
|
||||
PRInt32 mRow;
|
||||
|
|
|
@ -665,6 +665,25 @@ nsXULTreeGridRowAccessible::NativeRole()
|
|||
return nsIAccessibleRole::ROLE_ROW;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridRowAccessible::GetName(nsAString& aName)
|
||||
{
|
||||
aName.Truncate();
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsITreeColumns> columns;
|
||||
mTree->GetColumns(getter_AddRefs(columns));
|
||||
if (columns) {
|
||||
nsCOMPtr<nsITreeColumn> primaryColumn;
|
||||
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
|
||||
if (primaryColumn)
|
||||
GetCellName(primaryColumn, aName);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsXULTreeGridRowAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ _TEST_FILES =\
|
|||
test_list.html \
|
||||
test_markup.html \
|
||||
test_nsRootAcc.xul \
|
||||
test_tree.xul \
|
||||
markuprules.xml \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<?xml-stylesheet href="general.css"
|
||||
type="text/css"?>
|
||||
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Accessibility Name Calculating Test.">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../treeview.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../name.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
function treeTester(aID)
|
||||
{
|
||||
this.DOMNode = getNode(aID);
|
||||
|
||||
this.invoke = function treeTester_invoke()
|
||||
{
|
||||
this.DOMNode.treeBoxObject.view = new nsTreeTreeView();
|
||||
}
|
||||
|
||||
this.check = function treeTester_check(aEvent)
|
||||
{
|
||||
var tree = {
|
||||
role: ROLE_OUTLINE,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_LIST
|
||||
},
|
||||
{
|
||||
role: ROLE_OUTLINEITEM,
|
||||
children: [],
|
||||
name: "row1col"
|
||||
},
|
||||
{
|
||||
role: ROLE_OUTLINEITEM,
|
||||
children: [],
|
||||
name: "row2_col"
|
||||
},
|
||||
{
|
||||
role: ROLE_OUTLINEITEM,
|
||||
children: [],
|
||||
name: "row2.1_col"
|
||||
},
|
||||
{
|
||||
role: ROLE_OUTLINEITEM,
|
||||
children: [],
|
||||
name: "row2.2_col"
|
||||
},
|
||||
{
|
||||
role: ROLE_OUTLINEITEM,
|
||||
children: [],
|
||||
name: "row3_col"
|
||||
},
|
||||
{
|
||||
role: ROLE_OUTLINEITEM,
|
||||
children: [],
|
||||
name: "row4col"
|
||||
}
|
||||
]
|
||||
};
|
||||
testAccessibleTree(this.DOMNode, tree);
|
||||
}
|
||||
|
||||
this.getID = function treeTester_getID()
|
||||
{
|
||||
return "Tree name testing for " + aID;
|
||||
}
|
||||
}
|
||||
|
||||
function tableTester(aID)
|
||||
{
|
||||
this.DOMNode = getNode(aID);
|
||||
|
||||
this.invoke = function tableTester_invoke()
|
||||
{
|
||||
this.DOMNode.treeBoxObject.view = new nsTableTreeView(2);
|
||||
}
|
||||
|
||||
this.check = function tableTester_check(aEvent)
|
||||
{
|
||||
var tree = {
|
||||
role: ROLE_TREE_TABLE,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_LIST
|
||||
},
|
||||
{
|
||||
role: ROLE_ROW,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_GRID_CELL,
|
||||
children: [],
|
||||
name: "row0_col1"
|
||||
},
|
||||
{
|
||||
role: ROLE_GRID_CELL,
|
||||
children: [],
|
||||
name: "row0_col2"
|
||||
}
|
||||
],
|
||||
name: "row0_col1"
|
||||
},
|
||||
{
|
||||
role: ROLE_ROW,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_GRID_CELL,
|
||||
children: [],
|
||||
name: "row1_col1"
|
||||
},
|
||||
{
|
||||
role: ROLE_GRID_CELL,
|
||||
children: [],
|
||||
name: "row1_col2"
|
||||
}
|
||||
],
|
||||
name: "row1_col1"
|
||||
}
|
||||
]
|
||||
};
|
||||
testAccessibleTree(this.DOMNode, tree);
|
||||
}
|
||||
|
||||
this.getID = function tableTester_getID()
|
||||
{
|
||||
return "Tree name testing for " + aID;
|
||||
}
|
||||
}
|
||||
|
||||
var gQueue = null;
|
||||
function doTest()
|
||||
{
|
||||
var gQueue = new eventQueue(EVENT_REORDER);
|
||||
|
||||
gQueue.push(new treeTester("tree"));
|
||||
gQueue.push(new tableTester("table"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish()
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=546812"
|
||||
title="Treegrid row accessible shouldn't inherit name from tree accessible">
|
||||
Mozilla Bug 546812
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
|
||||
<tree id="tree" flex="1">
|
||||
<treecols>
|
||||
<treecol id="col" flex="1" primary="true" label="column"/>
|
||||
</treecols>
|
||||
<treechildren/>
|
||||
</tree>
|
||||
|
||||
<tree id="table" flex="1">
|
||||
<treecols>
|
||||
<treecol id="col1" flex="1" label="column" primary="true"/>
|
||||
<treecol id="col2" flex="1" label="column 2"/>
|
||||
</treecols>
|
||||
<treechildren/>
|
||||
</tree>
|
||||
|
||||
</vbox> <!-- close tests area -->
|
||||
</hbox> <!-- close main area -->
|
||||
</window>
|
||||
|
Загрузка…
Ссылка в новой задаче