Bug 818407 - changing the HTML body doesn't pick up ARIA role, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-12-24 21:40:15 +09:00
parent bea7941da0
commit a518308800
2 changed files with 38 additions and 20 deletions

View File

@ -1517,8 +1517,10 @@ DocAccessible::DoInitialUpdate()
// miss the notification (since content tree change notifications are ignored
// prior to initial update). Make sure the content element is valid.
nsIContent* contentElm = nsCoreUtils::GetRoleContent(mDocumentNode);
if (mContent != contentElm)
if (mContent != contentElm) {
mContent = contentElm;
SetRoleMapEntry(aria::GetRoleMap(mContent));
}
// Build initial tree.
CacheChildrenInSubtree(this);
@ -1739,8 +1741,10 @@ DocAccessible::ProcessContentInserted(Accessible* aContainer,
if (aContainer == this) {
// If new root content has been inserted then update it.
nsIContent* rootContent = nsCoreUtils::GetRoleContent(mDocumentNode);
if (rootContent != mContent)
if (rootContent != mContent) {
mContent = rootContent;
SetRoleMapEntry(aria::GetRoleMap(mContent));
}
// Continue to update the tree even if we don't have root content.
// For example, elements may be inserted under the document element while

View File

@ -32,7 +32,7 @@
return getDocNode(aID).body.firstChild;
}
function rootContentReplaced(aID, aTextName)
function rootContentReplaced(aID, aTextName, aRootContentRole)
{
this.eventSeq = [
new invokerChecker(EVENT_SHOW, getDocChildNode, aID),
@ -42,7 +42,7 @@
this.finalCheck = function rootContentReplaced_finalCheck()
{
var tree = {
role: ROLE_DOCUMENT,
role: aRootContentRole || ROLE_DOCUMENT,
children: [
{
role: ROLE_TEXT_LEAF,
@ -142,14 +142,14 @@
docNode.replaceChild(newHTMLNode, docNode.documentElement);
}
this.getID = function replaceIFrameBody_getID()
this.getID = function replaceIFrameHTMLElm_getID()
{
return "replace HTML element";
}
}
/**
* Replace HTML body.
* Replace HTML body on new body having ARIA role.
*/
function replaceIFrameBody(aID)
{
@ -164,26 +164,36 @@
docNode.documentElement.replaceChild(newBodyNode, docNode.body);
}
this.finalCheck = function replaceIFrameBody_finalCheck()
{
var tree = {
role: ROLE_DOCUMENT,
children: [
{
role: ROLE_TEXT_LEAF,
name: "New Hello"
}
]
};
testAccessibleTree(getDocNode(aID), tree);
}
this.getID = function replaceIFrameBody_getID()
{
return "replace body";
}
}
/**
* Replace HTML body on new body having ARIA role.
*/
function replaceIFrameBodyOnARIARoleBody(aID)
{
this.__proto__ = new rootContentReplaced(aID, "New Hello",
ROLE_PUSHBUTTON);
this.invoke = function replaceIFrameBodyOnARIARoleBody_invoke()
{
var docNode = getDocNode(aID);
var newBodyNode = docNode.createElement("body");
var newTextNode = docNode.createTextNode("New Hello");
newBodyNode.appendChild(newTextNode);
newBodyNode.setAttribute("role", "button");
docNode.documentElement.replaceChild(newBodyNode, docNode.body);
}
this.getID = function replaceIFrameBodyOnARIARoleBody_getID()
{
return "replace body on body having ARIA role";
}
}
/**
* Open/close document pair.
*/
@ -401,6 +411,7 @@
gQueue.push(new insertElmUnderDocElmWhileBodyMissed("iframe"));
gQueue.push(new insertBodyToIFrameDoc("iframe"));
gQueue.push(new changeSrc("iframe"));
gQueue.push(new replaceIFrameBodyOnARIARoleBody("iframe"));
gQueue.invoke(); // SimpleTest.finish() will be called in the end
}
@ -420,6 +431,9 @@
<a target="_blank"
title="Reorder event for document must be fired after document initial tree creation"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=669263">Mozilla Bug 669263</a>
<a target="_blank"
title="Changing the HTML body doesn't pick up ARIA role"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=818407">Mozilla Bug 818407</a>
<p id="display"></p>
<div id="content" style="display: none"></div>