Skip to content

Commit 85efc02

Browse files
CanadaHonkhsivonen
authored andcommitted
Mozilla bug 1830909 - Implement <hr> in <select> r=hsivonen,emilio,geckoview-reviewers,desktop-theme-reviewers,Jamie,owlish
Updated HTML parser to allow <hr> in <select>. Updated internal toolkit UI for <select> dropdown to create menuseperators for hrs. Updated WPT expectations: - HTML5Lib WebKit parsing for it now passes 100% Also includes Android support, but Fenix does not support separators in the menus used (single/multiple) yet so they are not rendered. Differential Revision: https://phabricator.services.mozilla.com/D189065
1 parent 15073af commit 85efc02

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/nu/validator/htmlparser/impl/TreeBuilder.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,20 @@ public final void startTag(ElementName elementName,
25732573
startTagTemplateInHead(elementName, attributes);
25742574
attributes = null; // CPP
25752575
break starttagloop;
2576+
case HR:
2577+
if (isCurrent("option")) {
2578+
pop();
2579+
}
2580+
if (isCurrent("optgroup")) {
2581+
pop();
2582+
}
2583+
appendVoidElementToCurrent(elementName, attributes);
2584+
selfClosing = false;
2585+
// [NOCPP[
2586+
voidElement = true;
2587+
// ]NOCPP]
2588+
attributes = null; // CPP
2589+
break starttagloop;
25762590
default:
25772591
errStrayStartTag(name);
25782592
break starttagloop;
@@ -5457,6 +5471,25 @@ private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName,
54575471
push(node);
54585472
}
54595473

5474+
private void appendVoidElementToCurrent(
5475+
ElementName elementName, HtmlAttributes attributes)
5476+
throws SAXException {
5477+
@Local String popName = elementName.getName();
5478+
// [NOCPP[
5479+
checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
5480+
if (!elementName.isInterned()) {
5481+
popName = checkPopName(popName);
5482+
}
5483+
// ]NOCPP]
5484+
T currentNode = nodeFromStackWithBlinkCompat(currentPtr);
5485+
T elt = createElement("http://www.w3.org/1999/xhtml", popName, attributes, currentNode
5486+
// CPPONLY: , htmlCreator(elementName.getHtmlCreator())
5487+
);
5488+
appendElement(elt, currentNode);
5489+
elementPushed("http://www.w3.org/1999/xhtml", popName, elt);
5490+
elementPopped("http://www.w3.org/1999/xhtml", popName, elt);
5491+
}
5492+
54605493
private void appendVoidElementToCurrentMayFoster(
54615494
ElementName elementName, HtmlAttributes attributes, T form) throws SAXException {
54625495
@Local String name = elementName.getName();

0 commit comments

Comments
 (0)