Skip to content

Commit

Permalink
Bug 870388 - Support <hr> separators in <menu>. r=mrbkap
Browse files Browse the repository at this point in the history
  • Loading branch information
wisniewskit committed Aug 19, 2016
1 parent 282523d commit 7ec8858
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dom/html/HTMLMenuElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ HTMLMenuElement::TraverseContent(nsIContent* aContent,
aBuilder->AddItemFor(menuitem, CanLoadIcon(child, icon));

aSeparator = ST_FALSE;
} else if (child->IsHTMLElement(nsGkAtoms::hr)) {
aBuilder->AddSeparator();
} else if (child->IsHTMLElement(nsGkAtoms::menu) && !element->IsHidden()) {
if (child->HasAttr(kNameSpaceID_None, nsGkAtoms::label)) {
nsAutoString label;
Expand Down
7 changes: 6 additions & 1 deletion dom/html/test/browser_content_contextmenu_userinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ add_task(function* () {
let pageMenuSep = document.getElementById("page-menu-separator");
ok(pageMenuSep && !pageMenuSep.hidden,
"Page menu separator should be shown");
let testMenuItem = pageMenuSep.previousSibling;

let testMenuSep = pageMenuSep.previousSibling;
ok(testMenuSep && !testMenuSep.hidden,
"User-added menu separator should be shown");

let testMenuItem = testMenuSep.previousSibling;
is(testMenuItem.label, "Test Context Menu Click", "Got context menu item");

let promiseCtxMenuClick = ContentTask.spawn(aBrowser, null, function*() {
Expand Down
3 changes: 2 additions & 1 deletion dom/html/test/file_content_contextmenu.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
</head>
<body contextmenu="testmenu">
<menu type="context" id="testmenu">
<menuitem label="Test Context Menu Click" id="menuitem">
<menuitem label="Test Context Menu Click" id="menuitem"></menuitem>
<hr>
</menu>
</body>
</html>

0 comments on commit 7ec8858

Please sign in to comment.