Bug 1266851. Make <xmp> and <listing> use HTMLPreElement as their primary interface, per <https://github.com/whatwg/html/issues/1015>. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 26 Apr 2016 12:50:30 -0400
changeset 294951 6dd235136facc833619c153a6f27bfe96f709cb7
parent 294950 114081c3fa90a4ecdaf991bc93e4e99c8942cb15
child 294952 4e08f29820a35936be6142b86350318e3246633d
push id75741
push userbzbarsky@mozilla.com
push dateTue, 26 Apr 2016 16:56:57 +0000
treeherdermozilla-inbound@4e08f29820a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1266851
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1266851. Make <xmp> and <listing> use HTMLPreElement as their primary interface, per <https://github.com/whatwg/html/issues/1015>. r=peterv
dom/html/HTMLPreElement.cpp
dom/html/test/test_bug389797.html
parser/htmlparser/nsHTMLTagList.h
testing/web-platform/meta/html/dom/interfaces.html.ini
testing/web-platform/tests/html/dom/interfaces.html
testing/web-platform/tests/html/semantics/interfaces.js
--- a/dom/html/HTMLPreElement.cpp
+++ b/dom/html/HTMLPreElement.cpp
@@ -59,32 +59,40 @@ HTMLPreElement::MapAttributesIntoRule(co
   }
 
   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 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 },
   };
   
   static const MappedAttributeEntry* const map[] = {
     attributes,
     sCommonAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
 nsMapRuleToAttributesFunc
 HTMLPreElement::GetAttributeMappingFunction() const
 {
+  if (!mNodeInfo->Equals(nsGkAtoms::pre)) {
+    return nsGenericHTMLElement::GetAttributeMappingFunction();
+  }
+
   return &MapAttributesIntoRule;
 }
 
 JSObject*
 HTMLPreElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLPreElementBinding::Wrap(aCx, this, aGivenProto);
 }
--- a/dom/html/test/test_bug389797.html
+++ b/dom/html/test/test_bug389797.html
@@ -161,17 +161,17 @@ HTML_TAG("input", "Input", [], [ "imgINo
                                  "nsIDOMNSEditableElement" ]);
 HTML_TAG("ins", "Mod");
 HTML_TAG("kbd", "");
 HTML_TAG("keygen", "Span");
 HTML_TAG("label", "Label");
 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", "");
 HTML_TAG("marquee", "Div");
 HTML_TAG("menu", "Menu");
 HTML_TAG("meta", "Meta");
 HTML_TAG("meter", "Meter");
 HTML_TAG("multicol", "Unknown");
@@ -218,17 +218,17 @@ HTML_TAG("template", "Template");
 HTML_TAG("time", "Time");
 HTML_TAG("title", "Title");
 HTML_TAG("tr", "TableRow");
 HTML_TAG("tt", "");
 HTML_TAG("u", "");
 HTML_TAG("ul", "UList");
 HTML_TAG("var", "");
 HTML_TAG("wbr", "");
-HTML_TAG("xmp", "");
+HTML_TAG("xmp", "Pre");
 
 function tagName(aTag) {
   return "<" + aTag + ">";
 }
 
 for (var tag of allTags) {
   var node = document.createElement(tag);
 
--- a/parser/htmlparser/nsHTMLTagList.h
+++ b/parser/htmlparser/nsHTMLTagList.h
@@ -100,17 +100,17 @@ HTML_TAG(img, Image)
 HTML_TAG(input, Input)
 HTML_TAG(ins, Mod)
 HTML_HTMLELEMENT_TAG(kbd)
 HTML_TAG(keygen, Span)
 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)
 HTML_TAG(marquee, Div)
 HTML_TAG(menu, Menu)
 HTML_TAG(menuitem, MenuItem)
 HTML_TAG(meta, Meta)
 HTML_TAG(meter, Meter)
@@ -165,17 +165,17 @@ HTML_TAG(title, Title)
 HTML_TAG(tr, TableRow)
 HTML_TAG(track, Track)
 HTML_HTMLELEMENT_TAG(tt)
 HTML_HTMLELEMENT_TAG(u)
 HTML_TAG(ul, SharedList)
 HTML_HTMLELEMENT_TAG(var)
 HTML_TAG(video, Video)
 HTML_HTMLELEMENT_TAG(wbr)
-HTML_HTMLELEMENT_TAG(xmp)
+HTML_TAG(xmp, Pre)
 
 
 /* These are not for tags. But they will be included in the nsHTMLTag
    enum anyway */
 
 HTML_OTHER(text)
 HTML_OTHER(whitespace)
 HTML_OTHER(newline)
--- a/testing/web-platform/meta/html/dom/interfaces.html.ini
+++ b/testing/web-platform/meta/html/dom/interfaces.html.ini
@@ -689,43 +689,16 @@
     expected: FAIL
 
   [HTMLUnknownElement must be primary interface of document.createElement("basefont")]
     expected: FAIL
 
   [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
 
   [HTMLIFrameElement interface: attribute seamless]
     expected: FAIL
 
   [HTMLObjectElement interface: operation reportValidity()]
     expected: FAIL
--- a/testing/web-platform/tests/html/dom/interfaces.html
+++ b/testing/web-platform/tests/html/dom/interfaces.html
@@ -3238,16 +3238,17 @@ window.onload = function() {
       'document.createElement("ruby")',
       'document.createElement("rt")',
       'document.createElement("rp")',
       'document.createElement("bdi")',
       'document.createElement("bdo")',
       'document.createElement("wbr")',
       'document.createElement("summary")',
       'document.createElement("acronym")',
+      'document.createElement("plaintext")',
     ],
     HTMLUnknownElement: [
       'document.createElement("blink")',
       'document.createElement("quasit")',
       'document.createElement("bgsound")',
       'document.createElement("isindex")',
       'document.createElement("multicol")',
       'document.createElement("nextid")',
@@ -3274,17 +3275,16 @@ window.onload = function() {
       'document.createElement("h5")',
       'document.createElement("h6")',
     ],
     HTMLParagraphElement: ['document.createElement("p")'],
     HTMLHRElement: ['document.createElement("hr")'],
     HTMLPreElement: [
       'document.createElement("pre")',
       'document.createElement("listing")',
-      'document.createElement("plaintext")',
       'document.createElement("xmp")',
     ],
     HTMLQuoteElement: [
       'document.createElement("blockquote")',
       'document.createElement("q")',
     ],
     HTMLOlistElement: ['document.createElement("ol")'],
     HTMLUlistElement: ['document.createElement("ul")'],
--- a/testing/web-platform/tests/html/semantics/interfaces.js
+++ b/testing/web-platform/tests/html/semantics/interfaces.js
@@ -53,17 +53,17 @@ var elements = [
   ["ins", "Mod"],
   ["isindex", "Unknown"],
   ["kbd", ""],
   ["keygen", "Keygen"],
   ["label", "Label"],
   ["legend", "Legend"],
   ["li", "LI"],
   ["link", "Link"],
-  ["listing", ""],
+  ["listing", "Pre"],
   ["map", "Map"],
   ["marquee", "Marquee"],
   ["menu", "Menu"],
   ["meta", "Meta"],
   ["multicol", "Unknown"],
   ["nobr", ""],
   ["noembed", ""],
   ["noframes", ""],
@@ -100,17 +100,17 @@ var elements = [
   ["title", "Title"],
   ["tr", "TableRow"],
   ["tt", ""],
   ["u", ""],
   ["ul", "UList"],
   ["var", ""],
   ["video", "Video"],
   ["wbr", ""],
-  ["xmp", ""],
+  ["xmp", "Pre"],
   ["section", ""],
   ["nav", ""],
   ["article", ""],
   ["aside", ""],
   ["hgroup", ""],
   ["header", ""],
   ["footer", ""],
   ["time", "Time"],