mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1252260 - get rid of HTML table CacheChildren, r=marcoz
This commit is contained in:
parent
7f7bacceb6
commit
c970d68052
@ -590,6 +590,7 @@ public:
|
||||
HyperTextAccessible* AsHyperText();
|
||||
|
||||
bool IsHTMLBr() const { return mType == eHTMLBRType; }
|
||||
bool IsHTMLCaption() const { return mType == eHTMLCaptionType; }
|
||||
bool IsHTMLCombobox() const { return mType == eHTMLComboboxType; }
|
||||
bool IsHTMLFileInput() const { return mType == eHTMLFileInputType; }
|
||||
|
||||
|
@ -393,24 +393,14 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableAccessible, Accessible)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HTMLTableAccessible: Accessible
|
||||
|
||||
void
|
||||
HTMLTableAccessible::CacheChildren()
|
||||
bool
|
||||
HTMLTableAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
|
||||
{
|
||||
// Move caption accessible so that it's the first child. Check for the first
|
||||
// caption only, because nsAccessibilityService ensures we don't create
|
||||
// accessibles for the other captions, since only the first is actually
|
||||
// visible.
|
||||
TreeWalker walker(this, mContent);
|
||||
|
||||
Accessible* child = nullptr;
|
||||
while ((child = walker.Next())) {
|
||||
if (child->Role() == roles::CAPTION) {
|
||||
InsertChildAt(0, child);
|
||||
while ((child = walker.Next()) && AppendChild(child));
|
||||
break;
|
||||
}
|
||||
AppendChild(child);
|
||||
}
|
||||
return Accessible::InsertChildAt(aChild->IsHTMLCaption() ? 0 : aIndex, aChild);
|
||||
}
|
||||
|
||||
role
|
||||
|
@ -157,12 +157,13 @@ public:
|
||||
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
||||
virtual Relation RelationByType(RelationType aRelationType) override;
|
||||
|
||||
bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
|
||||
|
||||
protected:
|
||||
virtual ~HTMLTableAccessible() {}
|
||||
|
||||
// Accessible
|
||||
virtual ENameValueFlag NativeName(nsString& aName) override;
|
||||
virtual void CacheChildren() override;
|
||||
|
||||
// HTMLTableAccessible
|
||||
|
||||
@ -209,7 +210,7 @@ class HTMLCaptionAccessible : public HyperTextAccessibleWrap
|
||||
{
|
||||
public:
|
||||
HTMLCaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
HyperTextAccessibleWrap(aContent, aDoc) { }
|
||||
HyperTextAccessibleWrap(aContent, aDoc) { mType = eHTMLCaptionType; }
|
||||
|
||||
// Accessible
|
||||
virtual a11y::role NativeRole() override;
|
||||
|
@ -29,6 +29,7 @@ skip-if = buildapp == "mulet"
|
||||
[test_recreation.html]
|
||||
[test_select.html]
|
||||
[test_shutdown.xul]
|
||||
[test_table.html]
|
||||
[test_textleaf.html]
|
||||
[test_visibility.html]
|
||||
[test_whitespace.html]
|
||||
|
81
accessible/tests/mochitest/treeupdate/test_table.html
Normal file
81
accessible/tests/mochitest/treeupdate/test_table.html
Normal file
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Table update tests</title>
|
||||
<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"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
function appendCaption(aTableID)
|
||||
{
|
||||
this.invoke = function appendCaption_invoke()
|
||||
{
|
||||
// append a caption, it should appear as a first element in the
|
||||
// accessible tree.
|
||||
var caption = document.createElement("caption");
|
||||
caption.textContent = "table caption";
|
||||
getNode(aTableID).appendChild(caption);
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, aTableID)
|
||||
];
|
||||
|
||||
this.finalCheck = function appendCaption_finalCheck()
|
||||
{
|
||||
var tree =
|
||||
{ TABLE: [
|
||||
{ CAPTION: [
|
||||
{ TEXT_LEAF: [] }
|
||||
] },
|
||||
{ ROW: [
|
||||
{ CELL: [ {TEXT_LEAF: [] }]},
|
||||
{ CELL: [ {TEXT_LEAF: [] }]}
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree(aTableID, tree);
|
||||
}
|
||||
|
||||
this.getID = function appendCaption_getID()
|
||||
{
|
||||
return "append caption";
|
||||
}
|
||||
}
|
||||
|
||||
function doTest()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
gQueue.push(new appendCaption("table"));
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<table id="table">
|
||||
<tr>
|
||||
<td>cell1</td>
|
||||
<td>cell2</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user