mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1007975 - div with display:table exposes table semantics r=surkov
- Construct a table accessible object if a content in question is HTML <table> - Drop checking whether a table accessible object is built by CSS display:table from HTMLTableAccessbile::IsProbablyLayoutTable --HG-- extra : transplant_source : %15%A0%F3%22%8C%AB%AB%0E%CF%1D%A3H%E4%2Aj%CB8%BDy%F0
This commit is contained in:
parent
374a46439a
commit
da38a008ad
@ -1662,7 +1662,10 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
||||
newAcc = new HTMLSpinnerAccessible(aContent, document);
|
||||
break;
|
||||
case eHTMLTableType:
|
||||
newAcc = new HTMLTableAccessibleWrap(aContent, document);
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::table))
|
||||
newAcc = new HTMLTableAccessibleWrap(aContent, document);
|
||||
else
|
||||
newAcc = new HyperTextAccessibleWrap(aContent, document);
|
||||
break;
|
||||
case eHTMLTableCellType:
|
||||
// Accessible HTML table cell should be a child of accessible HTML table
|
||||
|
@ -969,8 +969,8 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
||||
RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
|
||||
}
|
||||
|
||||
if (!mContent->IsHTMLElement(nsGkAtoms::table))
|
||||
RETURN_LAYOUT_ANSWER(true, "table built by CSS display:table style");
|
||||
NS_ASSERTION(mContent->IsHTMLElement(nsGkAtoms::table),
|
||||
"table should not be built by CSS display:table style");
|
||||
|
||||
// Check if datatable attribute has "0" value.
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::datatable,
|
||||
|
@ -1,5 +1,6 @@
|
||||
[DEFAULT]
|
||||
|
||||
[test_css_tables.html]
|
||||
[test_headers_ariagrid.html]
|
||||
[test_headers_ariatable.html]
|
||||
[test_headers_listbox.xul]
|
||||
|
116
accessible/tests/mochitest/table/test_css_tables.html
Normal file
116
accessible/tests/mochitest/table/test_css_tables.html
Normal file
@ -0,0 +1,116 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS display:table is not a table</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// elements with display:table
|
||||
|
||||
// only display:table
|
||||
var accTree =
|
||||
{ SECTION: [
|
||||
{ TEXT_LEAF: [ ] }
|
||||
] };
|
||||
testAccessibleTree("table1", accTree);
|
||||
|
||||
// only display:table and display:table-cell
|
||||
accTree =
|
||||
{ SECTION: [
|
||||
{ SECTION: [
|
||||
{ TEXT_LEAF: [ ] }
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree("table2", accTree);
|
||||
|
||||
// display:table, display:table-row, and display:table-cell
|
||||
accTree =
|
||||
{ SECTION: [
|
||||
{ SECTION: [
|
||||
{ TEXT_LEAF: [ ] }
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree("table3", accTree);
|
||||
|
||||
// display:table, display:table-row-group, display:table-row, and display:table-cell
|
||||
accTree =
|
||||
{ SECTION: [
|
||||
{ SECTION: [
|
||||
{ TEXT_LEAF: [ ] }
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree("table4", accTree);
|
||||
|
||||
// display:inline-table
|
||||
accTree =
|
||||
{ TEXT_CONTAINER: [
|
||||
{ TEXT_CONTAINER: [
|
||||
{ TEXT_LEAF: [ ] }
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree("table5", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a target="_blank"
|
||||
title=" div with display:table exposes table semantics"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1007975">Mozilla Bug 1007975</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="table1" style="display:table">
|
||||
table1
|
||||
</div>
|
||||
|
||||
<div id="table2" style="display:table">
|
||||
<div style="display:table-cell">table2</div>
|
||||
</div>
|
||||
|
||||
<div id="table3" style="display:table">
|
||||
<div style="display:table-row">
|
||||
<div style="display:table-cell">table3</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="table4" style="display:table">
|
||||
<div style="display:table-row-group">
|
||||
<div style="display:table-row">
|
||||
<div style="display:table-cell">table4</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="table5" style="display:inline-table">
|
||||
<span style="display:table-row">
|
||||
<span style="display:table-cell">table5</div>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -128,14 +128,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
|
||||
];
|
||||
testTableIndexes("tableinsane6", idxes);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// csstablecrazy1 (no rows)
|
||||
idxes = [
|
||||
[0, 1]
|
||||
];
|
||||
|
||||
testTableIndexes("csstablecrazy1", idxes);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -150,11 +142,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">
|
||||
Bug 410052
|
||||
</a>
|
||||
<a target="_blank"
|
||||
title="Table cell accessibles not exposed for CSS table without table-row "
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=834120">
|
||||
Bug 834120
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -419,11 +406,5 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="csstablecrazy1"
|
||||
style="width: 100%; border: 1px solid red; display:table;">
|
||||
<div style="display:table-cell;">cell1</div>
|
||||
<div style="display:table-cell;">cell2</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -116,9 +116,6 @@
|
||||
// layout table having datatable="0" attribute and containing data table structure (tfoot element)
|
||||
testAttrs("table22", attr, true);
|
||||
|
||||
// css table with non-table tag
|
||||
testAttrs("table23", attr, true);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -138,11 +135,6 @@
|
||||
title="Data table elements used to determine layout-guess attribute shouldn't be picked from nested tables">
|
||||
Mozilla Bug 690222
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=693948"
|
||||
title="Expose layout-guess: true object attribute on CSS table accessible">
|
||||
Mozilla Bug 693948
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=696975"
|
||||
title="Extend the list of legitimate data table structures">
|
||||
@ -344,28 +336,28 @@
|
||||
<!-- table with a bordered cell -->
|
||||
<table id="table13" border="1" width="100%" bordercolor="#0000FF">
|
||||
<tr>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
<td bordercolor="#000000"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- table with alternating row background colors -->
|
||||
<table id="table14" width="100%">
|
||||
<tr style="background-color: #0000FF;">
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr style="background-color: #00FF00;">
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -510,13 +502,5 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<!-- css table with noon-table tag -->
|
||||
<div id="table23" style="display:table;">
|
||||
<div style="display:table-row;">
|
||||
<div style="display:table-cell;">Row 1, column 1</div>
|
||||
<div style="display:table-cell;">Row 1, column 2</div>
|
||||
<div style="display:table-cell;">Row 1, column 3</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -49,11 +49,6 @@ function doTest()
|
||||
is(accTable4.getCellAt(1,1).firstChild.name, "cell3", "wrong cell");
|
||||
}
|
||||
|
||||
// test crazy table
|
||||
var table6 = getAccessible("table6", [nsIAccessibleTable]);
|
||||
ok(!table6.getCellAt(0, 0),
|
||||
"We don't expect cell accessible for crazy table 6!");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@ -89,11 +84,6 @@ addA11yLoadEvent(doTest);
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="display:table;" id="table6">
|
||||
<input type="checkbox">
|
||||
<a href="bar">Bad checkbox</a>
|
||||
</div>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user