Bug 411048 - "Menu remains highlighted after being dismissed by middle-click" (clear active state when destroying menu frame) [p=enndeakin@sympatico.ca (Neil Deakin) r=Smaug sr=Neil a1.9=damons]

This commit is contained in:
reed%reedloden.com 2008-01-30 07:18:08 +00:00
Родитель d33432848f
Коммит cb6407bc3d
3 изменённых файлов: 64 добавлений и 0 удалений

Просмотреть файл

@ -392,6 +392,10 @@ nsMenuFrame::Destroy()
// doesn't try to interact with a deallocated frame.
mTimerMediator->ClearFrame();
// if the menu content is just being hidden, it may be made visible again
// later, so make sure to clear the highlighting.
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::menuactive, PR_FALSE);
// are we our menu parent's current menu item?
if (mMenuParent && mMenuParent->GetCurrentMenuItem() == this) {
// yes; tell it that we're going away

Просмотреть файл

@ -96,6 +96,7 @@ _TEST_FILES = test_bug360220.xul \
test_popupremoving_frame.xul \
frame_popupremoving_frame.xul \
test_position.xul \
test_menu_hide.xul \
$(NULL)
ifeq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))

Просмотреть файл

@ -0,0 +1,59 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<window title="Menu Destruction Test"
onload="setTimeout(runTests, 0);"
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="/tests/SimpleTest/EventUtils.js"></script>
<menu id="menu">
<menupopup onpopupshown="this.firstChild.open = true" onpopuphidden="if (event.target == this) done()">
<menu id="submenu" label="One">
<menupopup onpopupshown="submenuOpened();">
<menuitem label="Two"/>
</menupopup>
</menu>
</menupopup>
</menu>
<script class="testbody" type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function runTests()
{
$("menu").open = true;
}
function submenuOpened()
{
var submenu = $("submenu")
is(submenu.getAttribute('_moz-menuactive'), "true", "menu highlighted");
submenu.hidden = true;
$("menu").open = false;
}
function done()
{
ok(!$("submenu").hasAttribute('_moz-menuactive'), "menu unhighlighted");
SimpleTest.finish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display">
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</window>