Bug 607219 - dynamic role attribute change on body doesn't affect on document role. r=surkov,marcoz a=blocking2.0

This commit is contained in:
David Bolter 2010-11-15 13:30:43 -05:00
parent 059d0f7ab2
commit 193d7db527
2 changed files with 22 additions and 2 deletions

View File

@ -1024,8 +1024,21 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
}
}
if (aAttribute == nsAccessibilityAtoms::role ||
aAttribute == nsAccessibilityAtoms::href ||
if (aAttribute == nsAccessibilityAtoms::role) {
if (mContent == aContent) {
// It is common for js libraries to set the role of the body element after
// the doc has loaded. In this case we just update the role map entry.
SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(aContent));
}
else {
// Recreate the accessible when role is changed because we might require a
// different accessible class for the new role or the accessible may
// expose a different sets of interfaces (COM restriction).
RecreateAccessible(aContent);
}
}
if (aAttribute == nsAccessibilityAtoms::href ||
aAttribute == nsAccessibilityAtoms::onclick) {
// Not worth the expense to ensure which namespace these are in
// It doesn't kill use to recreate the accessible even if the attribute was used

View File

@ -71,6 +71,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
testRole("scrollbar", ROLE_SCROLLBAR);
testRole("dir", ROLE_LIST);
// test document role map update
var testDoc = getAccessible(document, [nsIAccessibleDocument]);
testRole(testDoc, ROLE_DOCUMENT);
document.body.setAttribute("role", "application");
testRole(testDoc, ROLE_APPLICATION);
SimpleTest.finish();
}
@ -84,6 +90,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 469688</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 520188</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 529289</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 607219</a>
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>