Skip to content

Commit

Permalink
Bug 1266851. Make <xmp> and <listing> use HTMLPreElement as their pri…
Browse files Browse the repository at this point in the history
…mary interface, per <whatwg/html#1015>.  r=peterv

UltraBlame original commit: 6dd235136facc833619c153a6f27bfe96f709cb7
  • Loading branch information
marco-c committed Sep 30, 2019
1 parent e68f4a7 commit d41e56b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 deletions.
8 changes: 8 additions & 0 deletions dom/html/HTMLPreElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
NS_IMETHODIMP_(bool)
HTMLPreElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
if (!mNodeInfo->Equals(nsGkAtoms::pre)) {
return nsGenericHTMLElement::IsAttributeMapped(aAttribute);
}

static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::wrap },
{ nullptr },
Expand All @@ -80,6 +84,10 @@ HTMLPreElement::IsAttributeMapped(const nsIAtom* aAttribute) const
nsMapRuleToAttributesFunc
HTMLPreElement::GetAttributeMappingFunction() const
{
if (!mNodeInfo->Equals(nsGkAtoms::pre)) {
return nsGenericHTMLElement::GetAttributeMappingFunction();
}

return &MapAttributesIntoRule;
}

Expand Down
4 changes: 2 additions & 2 deletions dom/html/test/test_bug389797.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
HTML_TAG("legend", "Legend");
HTML_TAG("li", "LI");
HTML_TAG("link", "Link");
HTML_TAG("listing", "");
HTML_TAG("listing", "Pre");
HTML_TAG("main", "");
HTML_TAG("map", "Map");
HTML_TAG("mark", "");
Expand Down Expand Up @@ -223,7 +223,7 @@
HTML_TAG("ul", "UList");
HTML_TAG("var", "");
HTML_TAG("wbr", "");
HTML_TAG("xmp", "");
HTML_TAG("xmp", "Pre");

function tagName(aTag) {
return "<" + aTag + ">";
Expand Down
4 changes: 2 additions & 2 deletions parser/htmlparser/nsHTMLTagList.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ HTML_TAG(label, Label)
HTML_TAG(legend, Legend)
HTML_TAG(li, LI)
HTML_TAG(link, Link)
HTML_HTMLELEMENT_TAG(listing)
HTML_TAG(listing, Pre)
HTML_HTMLELEMENT_TAG(main)
HTML_TAG(map, Map)
HTML_HTMLELEMENT_TAG(mark)
Expand Down Expand Up @@ -170,7 +170,7 @@ HTML_TAG(ul, SharedList)
HTML_HTMLELEMENT_TAG(var)
HTML_TAG(video, Video)
HTML_HTMLELEMENT_TAG(wbr)
HTML_HTMLELEMENT_TAG(xmp)
HTML_TAG(xmp, Pre)



Expand Down
27 changes: 0 additions & 27 deletions testing/web-platform/meta/html/dom/interfaces.html.ini
Original file line number Diff line number Diff line change
Expand Up @@ -694,33 +694,6 @@
[Stringification of document.createElement("basefont")]
expected: FAIL
[HTMLPreElement must be primary interface of document.createElement("listing")]
expected: FAIL
[Stringification of document.createElement("listing")]
expected: FAIL
[HTMLPreElement interface: document.createElement("listing") must inherit property "width" with the proper type (0)]
expected: FAIL
[HTMLPreElement must be primary interface of document.createElement("plaintext")]
expected: FAIL
[Stringification of document.createElement("plaintext")]
expected: FAIL
[HTMLPreElement interface: document.createElement("plaintext") must inherit property "width" with the proper type (0)]
expected: FAIL
[HTMLPreElement must be primary interface of document.createElement("xmp")]
expected: FAIL
[Stringification of document.createElement("xmp")]
expected: FAIL
[HTMLPreElement interface: document.createElement("xmp") must inherit property "width" with the proper type (0)]
expected: FAIL
[HTMLAnchorElement interface: document.createElement("a") must inherit property "ping" with the proper type (2)]
expected: FAIL
Expand Down
2 changes: 1 addition & 1 deletion testing/web-platform/tests/html/dom/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,7 @@ <h1>HTML IDL tests</h1>
'document.createElement("wbr")',
'document.createElement("summary")',
'document.createElement("acronym")',
'document.createElement("plaintext")',
],
HTMLUnknownElement: [
'document.createElement("blink")',
Expand Down Expand Up @@ -3279,7 +3280,6 @@ <h1>HTML IDL tests</h1>
HTMLPreElement: [
'document.createElement("pre")',
'document.createElement("listing")',
'document.createElement("plaintext")',
'document.createElement("xmp")',
],
HTMLQuoteElement: [
Expand Down
4 changes: 2 additions & 2 deletions testing/web-platform/tests/html/semantics/interfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var elements = [
["legend", "Legend"],
["li", "LI"],
["link", "Link"],
["listing", ""],
["listing", "Pre"],
["map", "Map"],
["marquee", "Marquee"],
["menu", "Menu"],
Expand Down Expand Up @@ -105,7 +105,7 @@ var elements = [
["var", ""],
["video", "Video"],
["wbr", ""],
["xmp", ""],
["xmp", "Pre"],
["section", ""],
["nav", ""],
["article", ""],
Expand Down

0 comments on commit d41e56b

Please sign in to comment.