mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-13 07:24:47 +00:00
Bug 572823, clear button open state when its popup is destroyed, r=neil
This commit is contained in:
parent
98103bb448
commit
a08a79f3f4
@ -1629,6 +1629,13 @@ nsMenuPopupFrame::MoveToAttributePosition()
|
||||
void
|
||||
nsMenuPopupFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
nsIFrame* parent = GetParent();
|
||||
if (parent && parent->GetType() == nsGkAtoms::menuFrame) {
|
||||
// clear the open attribute on the parent menu
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new nsUnsetAttrRunnable(parent->GetContent(), nsGkAtoms::open));
|
||||
}
|
||||
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm)
|
||||
pm->PopupDestroyed(this);
|
||||
|
@ -3,30 +3,49 @@
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<window title="Hidden Popup Test"
|
||||
onload="setTimeout(runTests, 0);"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
onload="setTimeout(runTests, 0, $('popup'));"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<menupopup id="popup" hidden="true" onpopupshown="ok(true, 'popupshown'); this.hidePopup()"
|
||||
onpopuphidden="SimpleTest.finish()">
|
||||
onpopuphidden="runTests($('popupinbutton'));">
|
||||
<menuitem id="i1" label="One"/>
|
||||
<menuitem id="i2" label="Two"/>
|
||||
</menupopup>
|
||||
|
||||
<button id="button" type="menu" label="Menu" onDOMAttrModified="checkEndTest(event)">
|
||||
<menupopup id="popupinbutton" hidden="true"
|
||||
onpopupshown="ok(true, 'popupshown'); ok($('button').open, 'open'); this.hidden = true;">
|
||||
<menuitem id="i1" label="One"/>
|
||||
<menuitem id="i2" label="Two"/>
|
||||
</menupopup>
|
||||
</button>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests()
|
||||
function runTests(popup)
|
||||
{
|
||||
var popup = $("popup");
|
||||
popup.hidden = false;
|
||||
popup.openPopup(null, "after_start");
|
||||
}
|
||||
|
||||
function checkEndTest(event)
|
||||
{
|
||||
var button = $("button");
|
||||
if (event.originalTarget != button || event.attrName != 'open' || event.attrChange != event.REMOVAL)
|
||||
return;
|
||||
|
||||
ok($("popupinbutton").hidden, "popup hidden");
|
||||
is($("popupinbutton").state, "closed", "popup state");
|
||||
ok(!button.open, "not open after hidden");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
@ -30,12 +30,14 @@ function popupsOpened()
|
||||
framedoc.addEventListener("DOMAttrModified", modified, false);
|
||||
|
||||
// this is the order in which the menus should be hidden (reverse of the
|
||||
// order they were opened in). The frame for the second menu is removed
|
||||
// during the mutation listener, so never gets an mutation event.
|
||||
// order they were opened in). The second menu is removed during the
|
||||
// mutation listener, so gets the event afterwards.
|
||||
gMenus.push(framedoc.getElementById("nestedmenu4"));
|
||||
gMenus.push(framedoc.getElementById("nestedmenu2"));
|
||||
gMenus.push(framedoc.getElementById("nestedmenu3"));
|
||||
gMenus.push(framedoc.getElementById("nestedmenu1"));
|
||||
gMenus.push(framedoc.getElementById("separatemenu4"));
|
||||
gMenus.push(framedoc.getElementById("separatemenu2"));
|
||||
gMenus.push(framedoc.getElementById("separatemenu3"));
|
||||
gMenus.push(framedoc.getElementById("separatemenu1"));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user