mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1197913 - Keep the last hovered item highlighted after moving the cursor outside the <select> drop-down list on Windows. r=neil
MozReview-Commit-ID: 1mWm5ltckHl
This commit is contained in:
parent
e05e655f1b
commit
3fdb20d68c
@ -467,7 +467,11 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
if (IsMenu() && !onmenubar && IsOpen()) {
|
||||
// Submenus don't get closed up immediately.
|
||||
}
|
||||
else if (this == menuParent->GetCurrentMenuItem()) {
|
||||
else if (this == menuParent->GetCurrentMenuItem()
|
||||
#ifdef XP_WIN
|
||||
&& GetParentMenuListType() == eNotMenuList
|
||||
#endif
|
||||
) {
|
||||
menuParent->ChangeMenuItem(nullptr, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -9,3 +9,5 @@ skip-if = toolkit == 'android' #bug 798806
|
||||
[test_resizer_incontent.xul]
|
||||
[test_splitter.xul]
|
||||
skip-if = toolkit == 'android' # no XUL theme
|
||||
[test_bug1197913.xul]
|
||||
skip-if = toolkit == 'android'
|
||||
|
67
layout/xul/test/test_bug1197913.xul
Normal file
67
layout/xul/test/test_bug1197913.xul
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1197913
|
||||
-->
|
||||
<window title="Mozilla Bug 1197913"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="SimpleTest.waitForFocus(nextTest, window)">
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1197913"
|
||||
target="_blank">Mozilla Bug 1197913</a>
|
||||
</body>
|
||||
|
||||
<menulist>
|
||||
<menupopup>
|
||||
<menuitem label="Car" />
|
||||
<menuitem label="Taxi" id="target" />
|
||||
<menuitem label="Bus" />
|
||||
</menupopup>
|
||||
</menulist>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let menulist = document.getElementsByTagName("menulist")[0];
|
||||
let menuitem = document.getElementById("target");
|
||||
|
||||
function onDOMMenuItemActive(e) {
|
||||
menuitem.removeEventListener("DOMMenuItemActive", onDOMMenuItemActive);
|
||||
|
||||
synthesizeMouse(menuitem, 0, 0, { type: "mousemove" });
|
||||
synthesizeMouse(menuitem, -1, 0, { type: "mousemove" });
|
||||
|
||||
setTimeout(() => {
|
||||
if (navigator.platform.toLowerCase().startsWith("win")) {
|
||||
ok(menuitem.getAttribute("_moz-menuactive"));
|
||||
} else {
|
||||
ok(!menuitem.getAttribute("_moz-menuactive"));
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function onPopupShown(e) {
|
||||
menulist.removeEventListener("popupshown", onPopupShown);
|
||||
menuitem.addEventListener("DOMMenuItemActive", onDOMMenuItemActive);
|
||||
synthesizeMouse(menuitem, 0, 0, { type: "mousemove" });
|
||||
synthesizeMouse(menuitem, 1, 0, { type: "mousemove" });
|
||||
}
|
||||
|
||||
function nextTest(e) {
|
||||
menulist.addEventListener("popupshown", onPopupShown);
|
||||
synthesizeMouseAtCenter(menulist, {});
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
Loading…
Reference in New Issue
Block a user