зеркало из https://github.com/mozilla/gecko-dev.git
Bug 614829 - menupopup end event isn't fired for ARIA menus, r=fer, marcoz, a=blocking2.0final+
This commit is contained in:
Родитель
503fda9430
Коммит
bf1e98aa19
|
@ -1923,6 +1923,26 @@ nsDocAccessible::UpdateTreeInternal(nsAccessible* aContainer,
|
|||
|
||||
updateFlags |= eAccessible;
|
||||
|
||||
if (!aIsInsert) {
|
||||
// Fire menupopup end event before hide event if a menu goes away.
|
||||
|
||||
// XXX: We don't look into children of hidden subtree to find hiding
|
||||
// menupopup (as we did prior bug 570275) because we don't do that when
|
||||
// menu is showing (and that's impossible until bug 606924 is fixed).
|
||||
// Nevertheless we should do this at least because layout coalesces
|
||||
// the changes before our processing and we may miss some menupopup
|
||||
// events. Now we just want to be consistent in content insertion/removal
|
||||
// handling.
|
||||
const nsRoleMapEntry* roleMapEntry = accessible->GetRoleMapEntry();
|
||||
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, accessible);
|
||||
|
||||
if (event)
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
// Fire show/hide event.
|
||||
if (aFireAllEvents) {
|
||||
nsRefPtr<AccEvent> event;
|
||||
|
|
|
@ -19,25 +19,71 @@
|
|||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function showMenu(aID, aViaDisplayStyle)
|
||||
const kViaDisplayStyle = 0;
|
||||
const kViaVisibilityStyle = 1;
|
||||
|
||||
function showMenu(aMenuID, aHow)
|
||||
{
|
||||
this.DOMNode = getNode(aID);
|
||||
this.menuNode = getNode(aMenuID);
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_SHOW, this.menuNode),
|
||||
new invokerChecker(EVENT_MENUPOPUP_START, this.menuNode),
|
||||
new invokerChecker(EVENT_REORDER, document)
|
||||
];
|
||||
|
||||
this.invoke = function showMenu_invoke()
|
||||
{
|
||||
if (aViaDisplayStyle)
|
||||
this.DOMNode.style.display = "block";
|
||||
if (aHow == kViaDisplayStyle)
|
||||
this.menuNode.style.display = "block";
|
||||
else
|
||||
this.DOMNode.style.visibility = "visible";
|
||||
this.menuNode.style.visibility = "visible";
|
||||
};
|
||||
|
||||
this.getID = function showMenu_getID()
|
||||
{
|
||||
return "Show ARIA menu " + aID + " by " +
|
||||
(aViaDisplayStyle ? "display" : "visibility") + " style tricks";
|
||||
return "Show ARIA menu " + aMenuID + " by " +
|
||||
(aHow == kViaDisplayStyle ? "display" : "visibility") +
|
||||
" style tricks";
|
||||
};
|
||||
}
|
||||
|
||||
function closeMenu(aMenuID, aHow)
|
||||
{
|
||||
this.menuNode = getNode(aMenuID);
|
||||
this.menu = null;
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_MENUPOPUP_END, getMenu, this),
|
||||
new invokerChecker(EVENT_HIDE, getMenu, this),
|
||||
new invokerChecker(EVENT_REORDER, document),
|
||||
];
|
||||
|
||||
this.invoke = function closeMenu_invoke()
|
||||
{
|
||||
// Store menu accessible reference while menu is still open.
|
||||
this.menu = getAccessible(this.menuNode);
|
||||
|
||||
// Hide menu.
|
||||
if (aHow == kViaDisplayStyle)
|
||||
this.menuNode.style.display = "none";
|
||||
else
|
||||
this.menuNode.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
this.getID = function closeMenu_getID()
|
||||
{
|
||||
return "Close ARIA menu " + aMenuID + " by " +
|
||||
(aHow == kViaDisplayStyle ? "display" : "visibility") +
|
||||
" style tricks";
|
||||
}
|
||||
|
||||
function getMenu(aThisObj)
|
||||
{
|
||||
return aThisObj.menu;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
|
||||
|
@ -47,10 +93,12 @@
|
|||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue(EVENT_MENUPOPUP_START);
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new showMenu("menu1", true));
|
||||
gQueue.push(new showMenu("menu2", false));
|
||||
gQueue.push(new showMenu("menu1", kViaDisplayStyle));
|
||||
gQueue.push(new closeMenu("menu1", kViaDisplayStyle));
|
||||
gQueue.push(new showMenu("menu2", kViaVisibilityStyle));
|
||||
gQueue.push(new closeMenu("menu2", kViaVisibilityStyle));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
@ -67,6 +115,11 @@
|
|||
title="Dojo dropdown buttons are broken">
|
||||
Mozilla Bug 606207
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=614829"
|
||||
title="Menupopup end event isn't fired for ARIA menus">
|
||||
Mozilla Bug 614829
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
|
Загрузка…
Ссылка в новой задаче