try: -b do -p linux64 -u all -t none
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 29 Nov 2017 01:13:41 +0200
changeset 1363632 e4973a1b1174be71390bff4b750cf0d11997b0c0
parent 1363135 157a15cd5ecc8706b502f78c51e79b58ac59eaf0
child 1363960 a34a58c0be889c50cb1d32153327c86623692657
push id238352
push useropettay@mozilla.com
push dateTue, 28 Nov 2017 23:14:47 +0000
treeherdertry@e4973a1b1174 [default view] [failures only]
milestone59.0a1
try: -b do -p linux64 -u all -t none
dom/base/ChildIterator.cpp
dom/base/ShadowRoot.cpp
dom/base/ShadowRoot.h
dom/base/nsContentUtils.cpp
dom/html/HTMLContentElement.cpp
dom/html/HTMLContentElement.h
dom/html/moz.build
dom/webidl/HTMLContentElement.webidl
dom/webidl/moz.build
editor/libeditor/HTMLEditUtils.cpp
parser/html/javasrc/ElementName.java
parser/html/nsHtml5AttributeName.h
parser/html/nsHtml5ElementName.cpp
parser/html/nsHtml5ElementName.h
parser/html/nsHtml5Tokenizer.cpp
parser/html/nsHtml5TreeBuilder.h
parser/htmlparser/nsElementTable.cpp
parser/htmlparser/nsHTMLTagList.h
--- a/dom/base/ChildIterator.cpp
+++ b/dom/base/ChildIterator.cpp
@@ -2,69 +2,64 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChildIterator.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/XBLChildrenElement.h"
-#include "mozilla/dom/HTMLContentElement.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIFrame.h"
 #include "nsCSSAnonBoxes.h"
 
 namespace mozilla {
 namespace dom {
 
 class MatchedNodes {
 public:
-  explicit MatchedNodes(HTMLContentElement* aInsertionPoint)
-    : mIsContentElement(true), mContentElement(aInsertionPoint) {}
-
+  explicit MatchedNodes()
+    : mIsContentElement(false), mChildrenElement(nullptr) {}
   explicit MatchedNodes(XBLChildrenElement* aInsertionPoint)
     : mIsContentElement(false), mChildrenElement(aInsertionPoint) {}
 
   uint32_t Length() const
   {
-    return mIsContentElement ? mContentElement->MatchedNodes().Length()
-                             : mChildrenElement->InsertedChildrenLength();
+    return mChildrenElement ? mChildrenElement->InsertedChildrenLength() : 0;
   }
 
   nsIContent* operator[](int32_t aIndex) const
   {
-    return mIsContentElement ? mContentElement->MatchedNodes()[aIndex]
-                             : mChildrenElement->InsertedChild(aIndex);
+    return mChildrenElement ? mChildrenElement->InsertedChild(aIndex) : nullptr;
   }
 
   bool IsEmpty() const
   {
-    return mIsContentElement ? mContentElement->MatchedNodes().IsEmpty()
-                             : !mChildrenElement->HasInsertedChildren();
+    return mChildrenElement && !mChildrenElement->HasInsertedChildren();
   }
 protected:
+  // Leftover from Shadow DOM v0.
   bool mIsContentElement;
   union {
-    HTMLContentElement* mContentElement;
     XBLChildrenElement* mChildrenElement;
   };
 };
 
 static inline MatchedNodes
 GetMatchedNodesForPoint(nsIContent* aContent)
 {
   if (aContent->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
     // XBL case
     return MatchedNodes(static_cast<XBLChildrenElement*>(aContent));
   }
 
+  return MatchedNodes();
   // Web components case
-  MOZ_ASSERT(aContent->IsHTMLElement(nsGkAtoms::content));
-  return MatchedNodes(HTMLContentElement::FromContent(aContent));
+  // XXX handle <slot> element?
 }
 
 nsIContent*
 ExplicitChildIterator::GetNextChild()
 {
   // If we're already in the inserted-children array, look there first
   if (mIndexInInserted) {
     MOZ_ASSERT(mChild);
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -9,17 +9,16 @@
 #include "mozilla/dom/ShadowRootBinding.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "ChildIterator.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfoID.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIStyleSheetLinkingElement.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/HTMLContentElement.h"
 #include "nsXBLPrototypeBinding.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(ShadowRoot)
@@ -217,192 +216,37 @@ ShadowRoot::RemoveFromIdTable(Element* a
 
 already_AddRefed<nsContentList>
 ShadowRoot::GetElementsByClassName(const nsAString& aClasses)
 {
   return nsContentUtils::GetElementsByClassName(this, aClasses);
 }
 
 void
-ShadowRoot::AddInsertionPoint(HTMLContentElement* aInsertionPoint)
-{
-  TreeOrderComparator comparator;
-  mInsertionPoints.InsertElementSorted(aInsertionPoint, comparator);
-}
-
-void
-ShadowRoot::RemoveInsertionPoint(HTMLContentElement* aInsertionPoint)
-{
-  mInsertionPoints.RemoveElement(aInsertionPoint);
-}
-
-void
-ShadowRoot::RemoveDestInsertionPoint(nsIContent* aInsertionPoint,
-                                     nsTArray<nsIContent*>& aDestInsertionPoints)
-{
-  // Remove the insertion point from the destination insertion points.
-  //
-  // Note that while it sounds tempting to just remove all the insertion points
-  // after it too, since they're usually after in tree position, it may not be
-  // the case when we're redistributing after new insertion points have been
-  // bound to the tree before aInsertionPoint, see bug 1409088.
-  int32_t index = aDestInsertionPoints.IndexOf(aInsertionPoint);
-
-  // It's possible that we already removed the insertion point while processing
-  // other insertion point removals / fallback content redistribution (which
-  // does DestInsertionPoints().Clear()).
-  if (index >= 0) {
-    aDestInsertionPoints.RemoveElementAt(index);
-  }
-}
-
-void
 ShadowRoot::DistributionChanged()
 {
   // FIXME(emilio): We could be more granular in a bunch of cases.
   auto* host = GetHost();
   if (!host || !host->IsInComposedDoc()) {
     return;
   }
 
   auto* shell = OwnerDoc()->GetShell();
   if (!shell) {
     return;
   }
 
   shell->DestroyFramesForAndRestyle(host);
 }
 
-const HTMLContentElement*
-ShadowRoot::DistributeSingleNode(nsIContent* aContent)
-{
-  // Find the insertion point to which the content belongs.
-  HTMLContentElement* foundInsertionPoint = nullptr;
-  for (HTMLContentElement* insertionPoint : mInsertionPoints) {
-    if (insertionPoint->Match(aContent)) {
-      if (insertionPoint->MatchedNodes().Contains(aContent)) {
-        // Node is already matched into the insertion point. We are done.
-        return insertionPoint;
-      }
-
-      // Matching may cause the insertion point to drop fallback content.
-      if (insertionPoint->MatchedNodes().IsEmpty() &&
-          insertionPoint->HasChildren()) {
-        // This match will cause the insertion point to drop all fallback
-        // content and used matched nodes instead. Give up on the optimization
-        // and just distribute all nodes.
-        DistributeAllNodes();
-        MOZ_ASSERT(insertionPoint->MatchedNodes().Contains(aContent));
-        return insertionPoint;
-      }
-      foundInsertionPoint = insertionPoint;
-      break;
-    }
-  }
-
-  if (!foundInsertionPoint) {
-    return nullptr;
-  }
-
-  // Find the index into the insertion point.
-  nsCOMArray<nsIContent>& matchedNodes = foundInsertionPoint->MatchedNodes();
-  // Find the appropriate position in the matched node list for the
-  // newly distributed content.
-  bool isIndexFound = false;
-  ExplicitChildIterator childIterator(GetHost());
-  for (uint32_t i = 0; i < matchedNodes.Length(); i++) {
-    // Seek through the host's explicit children until the inserted content
-    // is found or when the current matched node is reached.
-    if (childIterator.Seek(aContent, matchedNodes[i])) {
-      // aContent was found before the current matched node.
-      foundInsertionPoint->InsertMatchedNode(i, aContent);
-      isIndexFound = true;
-      break;
-    }
-  }
-
-  if (!isIndexFound) {
-    // We have still not found an index in the insertion point,
-    // thus it must be at the end.
-    MOZ_ASSERT(childIterator.Seek(aContent, nullptr),
-               "Trying to match a node that is not a candidate to be matched");
-    foundInsertionPoint->AppendMatchedNode(aContent);
-  }
-
-  return foundInsertionPoint;
-}
-
-const HTMLContentElement*
-ShadowRoot::RemoveDistributedNode(nsIContent* aContent)
-{
-  // Find insertion point containing the content and remove the node.
-  for (HTMLContentElement* insertionPoint : mInsertionPoints) {
-    if (!insertionPoint->MatchedNodes().Contains(aContent)) {
-      continue;
-    }
-
-    // Removing the matched node may cause the insertion point to use
-    // fallback content.
-    if (insertionPoint->MatchedNodes().Length() == 1 &&
-        insertionPoint->HasChildren()) {
-      // Removing the matched node will cause fallback content to be
-      // used instead. Give up optimization and distribute all nodes.
-      DistributeAllNodes();
-      return insertionPoint;
-    }
-
-    insertionPoint->RemoveMatchedNode(aContent);
-    return insertionPoint;
-  }
-
-  return nullptr;
-}
-
 void
 ShadowRoot::DistributeAllNodes()
 {
-  // Create node pool.
-  nsTArray<nsIContent*> nodePool;
-  ExplicitChildIterator childIterator(GetHost());
-  for (nsIContent* content = childIterator.GetNextChild(); content;
-       content = childIterator.GetNextChild()) {
-    nodePool.AppendElement(content);
-  }
 
-  nsTArray<ShadowRoot*> shadowsToUpdate;
-
-  for (HTMLContentElement* insertionPoint : mInsertionPoints) {
-    insertionPoint->ClearMatchedNodes();
-    // Assign matching nodes from node pool.
-    for (uint32_t j = 0; j < nodePool.Length(); j++) {
-      if (insertionPoint->Match(nodePool[j])) {
-        insertionPoint->AppendMatchedNode(nodePool[j]);
-        nodePool.RemoveElementAt(j--);
-      }
-    }
-
-    // Keep track of instances where the content insertion point is distributed
-    // (parent of insertion point has a ShadowRoot).
-    nsIContent* insertionParent = insertionPoint->GetParent();
-    MOZ_ASSERT(insertionParent, "The only way for an insertion point to be in the"
-                                "mInsertionPoints array is to be a descendant of a"
-                                "ShadowRoot, in which case, it should have a parent");
-
-    // If the parent of the insertion point has a ShadowRoot, the nodes distributed
-    // to the insertion point must be reprojected to the insertion points of the
-    // parent's ShadowRoot.
-    ShadowRoot* parentShadow = insertionParent->GetShadowRoot();
-    if (parentShadow && !shadowsToUpdate.Contains(parentShadow)) {
-      shadowsToUpdate.AppendElement(parentShadow);
-    }
-  }
-
-  for (ShadowRoot* shadow : shadowsToUpdate) {
-    shadow->DistributeAllNodes();
-  }
+  //XXX Handle <slot>.
 
   DistributionChanged();
 }
 
 void
 ShadowRoot::GetInnerHTML(nsAString& aInnerHTML)
 {
   GetMarkup(false, aInnerHTML);
@@ -472,98 +316,44 @@ ShadowRoot::IsPooledNode(nsIContent* aCo
   if (container == host && !aContent->IsRootOfAnonymousSubtree()) {
     // Children of the host will end up in the pool. We check to ensure
     // that the content is in the same anonymous tree as the container
     // because anonymous content may report its container as the host
     // but it may not be in the host's child list.
     return true;
   }
 
-  if (auto* content = HTMLContentElement::FromContentOrNull(container)) {
-    // Fallback content will end up in pool if its parent is a child of the host.
-    return content->IsInsertionPoint() &&
-           content->MatchedNodes().IsEmpty() &&
-           container->GetParentNode() == host;
-  }
-
   return false;
 }
 
 void
 ShadowRoot::AttributeChanged(nsIDocument* aDocument,
                              Element* aElement,
                              int32_t aNameSpaceID,
                              nsAtom* aAttribute,
                              int32_t aModType,
                              const nsAttrValue* aOldValue)
 {
   if (!IsPooledNode(aElement)) {
     return;
   }
 
-  // Attributes may change insertion point matching, find its new distribution.
-  if (!RedistributeElement(aElement)) {
-    return;
-  }
-
   if (!aElement->IsInComposedDoc()) {
     return;
   }
 
   auto* shell = OwnerDoc()->GetShell();
   if (!shell) {
     return;
   }
 
+  //XXX optimize this!
   shell->DestroyFramesForAndRestyle(aElement);
 }
 
-bool
-ShadowRoot::RedistributeElement(Element* aElement)
-{
-  auto* oldInsertionPoint = RemoveDistributedNode(aElement);
-  auto* newInsertionPoint = DistributeSingleNode(aElement);
-
-  if (oldInsertionPoint == newInsertionPoint) {
-    if (oldInsertionPoint) {
-      if (auto* shadow = oldInsertionPoint->GetParent()->GetShadowRoot()) {
-        return shadow->RedistributeElement(aElement);
-      }
-    }
-
-    return false;
-  }
-
-  while (oldInsertionPoint) {
-    // Handle the case where the parent of the insertion point has a ShadowRoot.
-    // The node distributed into the insertion point must be reprojected to the
-    // insertion points of the parent's ShadowRoot.
-    auto* shadow = oldInsertionPoint->GetParent()->GetShadowRoot();
-    if (!shadow) {
-      break;
-    }
-
-    oldInsertionPoint = shadow->RemoveDistributedNode(aElement);
-  }
-
-  while (newInsertionPoint) {
-    // Handle the case where the parent of the insertion point has a ShadowRoot.
-    // The node distributed into the insertion point must be reprojected to the
-    // insertion points of the parent's ShadowRoot.
-    auto* shadow = newInsertionPoint->GetParent()->GetShadowRoot();
-    if (!shadow) {
-      break;
-    }
-
-    newInsertionPoint = shadow->DistributeSingleNode(aElement);
-  }
-
-  return true;
-}
-
 void
 ShadowRoot::ContentAppended(nsIDocument* aDocument,
                             nsIContent* aContainer,
                             nsIContent* aFirstNewContent)
 {
   for (nsIContent* content = aFirstNewContent;
        content;
        content = content->GetNextSibling()) {
@@ -576,82 +366,29 @@ ShadowRoot::ContentInserted(nsIDocument*
                             nsIContent* aContainer,
                             nsIContent* aChild)
 {
   if (mInsertionPointChanged) {
     DistributeAllNodes();
     mInsertionPointChanged = false;
     return;
   }
-
-  // Add insertion point to destination insertion points of fallback content.
-  if (nsContentUtils::IsContentInsertionPoint(aContainer)) {
-    HTMLContentElement* content = HTMLContentElement::FromContent(aContainer);
-    if (content && content->MatchedNodes().IsEmpty()) {
-      aChild->DestInsertionPoints().AppendElement(aContainer);
-    }
-  }
-
-  // Watch for new nodes added to the pool because the node
-  // may need to be added to an insertion point.
-  if (IsPooledNode(aChild)) {
-    auto* insertionPoint = DistributeSingleNode(aChild);
-    while (insertionPoint) {
-      // Handle the case where the parent of the insertion point has a ShadowRoot.
-      // The node distributed into the insertion point must be reprojected to the
-      // insertion points of the parent's ShadowRoot.
-      auto* parentShadow = insertionPoint->GetParent()->GetShadowRoot();
-      if (!parentShadow) {
-        break;
-      }
-
-      insertionPoint = parentShadow->DistributeSingleNode(aChild);
-    }
-  }
 }
 
 void
 ShadowRoot::ContentRemoved(nsIDocument* aDocument,
                            nsIContent* aContainer,
                            nsIContent* aChild,
                            nsIContent* aPreviousSibling)
 {
   if (mInsertionPointChanged) {
     DistributeAllNodes();
     mInsertionPointChanged = false;
     return;
   }
-
-  // Clear destination insertion points for removed
-  // fallback content.
-  if (nsContentUtils::IsContentInsertionPoint(aContainer)) {
-    HTMLContentElement* content = HTMLContentElement::FromContent(aContainer);
-    if (content && content->MatchedNodes().IsEmpty()) {
-      aChild->DestInsertionPoints().Clear();
-    }
-  }
-
-  // Watch for node that is removed from the pool because
-  // it may need to be removed from an insertion point.
-  if (IsPooledNode(aChild)) {
-    auto* insertionPoint = RemoveDistributedNode(aChild);
-    while (insertionPoint) {
-      // Handle the case where the parent of the insertion point has a
-      // ShadowRoot.
-      //
-      // The removed node needs to be removed from the insertion points of the
-      // parent's ShadowRoot.
-      auto* parentShadow = insertionPoint->GetParent()->GetShadowRoot();
-      if (!parentShadow) {
-        break;
-      }
-
-      insertionPoint = parentShadow->RemoveDistributedNode(aChild);
-    }
-  }
 }
 
 nsresult
 ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                   bool aPreallocateChildren) const
 {
   *aResult = nullptr;
   return NS_ERROR_DOM_DATA_CLONE_ERR;
--- a/dom/base/ShadowRoot.h
+++ b/dom/base/ShadowRoot.h
@@ -19,17 +19,16 @@
 class nsAtom;
 class nsIContent;
 class nsXBLPrototypeBinding;
 
 namespace mozilla {
 namespace dom {
 
 class Element;
-class HTMLContentElement;
 class ShadowRootStyleSheetList;
 
 class ShadowRoot final : public DocumentFragment,
                          public nsStubMutationObserver
 {
   friend class ShadowRootStyleSheetList;
 public:
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ShadowRoot,
@@ -67,66 +66,39 @@ public:
 
   /**
    * Distributes all the explicit children of the pool host to the content
    * insertion points in this ShadowRoot.
    */
   void DistributeAllNodes();
 
 private:
-  /**
-   * Distributes a single explicit child of the pool host to the content
-   * insertion points in this ShadowRoot.
-   *
-   * Returns the insertion point the element is distributed to after this call.
-   *
-   * Note that this doesn't handle distributing the node in the insertion point
-   * parent's shadow root.
-   */
-  const HTMLContentElement* DistributeSingleNode(nsIContent* aContent);
-
-  /**
-   * Removes a single explicit child of the pool host from the content
-   * insertion points in this ShadowRoot.
-   *
-   * Returns the old insertion point, if any.
-   *
-   * Note that this doesn't handle removing the node in the returned insertion
-   * point parent's shadow root.
-   */
-  const HTMLContentElement* RemoveDistributedNode(nsIContent* aContent);
 
   /**
    * Redistributes a node of the pool, and returns whether the distribution
    * changed.
    */
   bool RedistributeElement(Element*);
 
   /**
    * Called when we redistribute content after insertion points have changed.
    */
   void DistributionChanged();
 
   bool IsPooledNode(nsIContent* aChild) const;
 
 public:
-  void AddInsertionPoint(HTMLContentElement* aInsertionPoint);
-  void RemoveInsertionPoint(HTMLContentElement* aInsertionPoint);
-
   void SetInsertionPointChanged() { mInsertionPointChanged = true; }
 
   void SetAssociatedBinding(nsXBLBinding* aBinding) { mAssociatedBinding = aBinding; }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   static ShadowRoot* FromNode(nsINode* aNode);
 
-  static void RemoveDestInsertionPoint(nsIContent* aInsertionPoint,
-                                       nsTArray<nsIContent*>& aDestInsertionPoints);
-
   // WebIDL methods.
   Element* GetElementById(const nsAString& aElementId);
   already_AddRefed<nsContentList>
     GetElementsByTagName(const nsAString& aNamespaceURI);
   already_AddRefed<nsContentList>
     GetElementsByTagNameNS(const nsAString& aNamespaceURI,
                            const nsAString& aLocalName);
   already_AddRefed<nsContentList>
@@ -141,23 +113,16 @@ public:
     mIsComposedDocParticipant = aIsComposedDocParticipant;
   }
 
 protected:
   virtual ~ShadowRoot();
 
   ShadowRootMode mMode;
 
-  // An array of content insertion points that are a descendant of the ShadowRoot
-  // sorted in tree order. Insertion points are responsible for notifying
-  // the ShadowRoot when they are removed or added as a descendant. The insertion
-  // points are kept alive by the parent node, thus weak references are held
-  // by the array.
-  nsTArray<HTMLContentElement*> mInsertionPoints;
-
   nsTHashtable<nsIdentifierMapEntry> mIdentifierMap;
   nsXBLPrototypeBinding* mProtoBinding;
 
   // It is necessary to hold a reference to the associated nsXBLBinding
   // because the binding holds a reference on the nsXBLDocumentInfo that
   // owns |mProtoBinding|.
   RefPtr<nsXBLBinding> mAssociatedBinding;
 
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -44,17 +44,16 @@
 #include "mozilla/dom/DOMExceptionBinding.h"
 #include "mozilla/dom/DOMTypes.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/dom/FileSystemSecurity.h"
 #include "mozilla/dom/FileBlobImpl.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLTemplateElement.h"
-#include "mozilla/dom/HTMLContentElement.h"
 #include "mozilla/dom/IDTracker.h"
 #include "mozilla/dom/IPCBlobUtils.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/XULCommandEvent.h"
@@ -7531,43 +7530,34 @@ bool
 nsContentUtils::IsContentInsertionPoint(nsIContent* aContent)
 {
   // Check if the content is a XBL insertion point.
   if (aContent->IsActiveChildrenElement()) {
     return true;
   }
 
   // Check if the content is a web components content insertion point.
-  HTMLContentElement* contentElement =
-    HTMLContentElement::FromContent(aContent);
-  return contentElement && contentElement->IsInsertionPoint();
+  // XXX handle <slot>?
+  return false;
 }
 
 // static
 bool
 nsContentUtils::HasDistributedChildren(nsIContent* aContent)
 {
   if (!aContent) {
     return false;
   }
 
   if (aContent->GetShadowRoot()) {
     // Children of a shadow root host are distributed
     // to content insertion points in the shadow root.
     return true;
   }
 
-  HTMLContentElement* contentEl = HTMLContentElement::FromContent(aContent);
-  if (contentEl && contentEl->IsInsertionPoint()) {
-    // Children of a content insertion point are distributed to the
-    // content insertion point if the content insertion point does
-    // not match any nodes (fallback content).
-    return contentEl->MatchedNodes().IsEmpty();
-  }
-
   return false;
 }
 
 // static
 bool
 nsContentUtils::IsForbiddenRequestHeader(const nsACString& aHeader)
 {
   if (IsForbiddenSystemRequestHeader(aHeader)) {
deleted file mode 100644
--- a/dom/html/HTMLContentElement.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/HTMLContentElement.h"
-#include "mozilla/dom/HTMLContentElementBinding.h"
-#include "mozilla/dom/HTMLUnknownElement.h"
-#include "mozilla/dom/NodeListBinding.h"
-#include "mozilla/dom/ShadowRoot.h"
-#include "mozilla/css/StyleRule.h"
-#include "mozilla/GenericSpecifiedValuesInlines.h"
-#include "nsGkAtoms.h"
-#include "nsStyleConsts.h"
-#include "nsAtom.h"
-#include "nsCSSRuleProcessor.h"
-#include "nsRuleProcessorData.h"
-#include "nsRuleWalker.h"
-#include "nsCSSParser.h"
-#include "nsDocument.h"
-
-// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Content) to add check for web components
-// being enabled.
-nsGenericHTMLElement*
-NS_NewHTMLContentElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
-                         mozilla::dom::FromParser aFromParser)
-{
-  // When this check is removed, remove the nsDocument.h and
-  // HTMLUnknownElement.h includes.  Also remove nsINode::IsHTMLContentElement.
-  //
-  // We have to jump through some hoops to be able to produce both NodeInfo* and
-  // already_AddRefed<NodeInfo>& for our callees.
-  RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
-  if (!nsContentUtils::IsWebComponentsEnabled()) {
-    already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
-    return new mozilla::dom::HTMLUnknownElement(nodeInfoArg);
-  }
-
-  already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
-  return new mozilla::dom::HTMLContentElement(nodeInfoArg);
-}
-
-using namespace mozilla::dom;
-
-HTMLContentElement::HTMLContentElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo), mValidSelector(true), mIsInsertionPoint(false)
-{
-}
-
-HTMLContentElement::~HTMLContentElement()
-{
-}
-
-NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLContentElement,
-                                   nsGenericHTMLElement,
-                                   mMatchedNodes)
-
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(HTMLContentElement,
-                                               nsGenericHTMLElement)
-
-NS_IMPL_ELEMENT_CLONE(HTMLContentElement)
-
-JSObject*
-HTMLContentElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return HTMLContentElementBinding::Wrap(aCx, this, aGivenProto);
-}
-
-nsresult
-HTMLContentElement::BindToTree(nsIDocument* aDocument,
-                               nsIContent* aParent,
-                               nsIContent* aBindingParent,
-                               bool aCompileEventHandlers)
-{
-  RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow();
-
-  nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
-                                                 aBindingParent,
-                                                 aCompileEventHandlers);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  ShadowRoot* containingShadow = GetContainingShadow();
-  if (containingShadow && !oldContainingShadow) {
-    nsINode* parentNode = nsINode::GetParentNode();
-    while (parentNode && parentNode != containingShadow) {
-      if (parentNode->IsHTMLContentElement()) {
-        // Content element in fallback content is not an insertion point.
-        return NS_OK;
-      }
-      parentNode = parentNode->GetParentNode();
-    }
-
-    // If the content element is being inserted into a ShadowRoot,
-    // add this element to the list of insertion points.
-    mIsInsertionPoint = true;
-    containingShadow->AddInsertionPoint(this);
-    containingShadow->SetInsertionPointChanged();
-  }
-
-  return NS_OK;
-}
-
-void
-HTMLContentElement::UnbindFromTree(bool aDeep, bool aNullParent)
-{
-  RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow();
-
-  nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
-
-  if (oldContainingShadow && !GetContainingShadow() && mIsInsertionPoint) {
-    oldContainingShadow->RemoveInsertionPoint(this);
-
-    // Remove all the matched nodes now that the
-    // insertion point is no longer an insertion point.
-    ClearMatchedNodes();
-    oldContainingShadow->SetInsertionPointChanged();
-
-    mIsInsertionPoint = false;
-  }
-}
-
-void
-HTMLContentElement::AppendMatchedNode(nsIContent* aContent)
-{
-  mMatchedNodes.AppendElement(aContent);
-  nsTArray<nsIContent*>& destInsertionPoint = aContent->DestInsertionPoints();
-  destInsertionPoint.AppendElement(this);
-
-  if (mMatchedNodes.Length() == 1) {
-    // Fallback content gets dropped so we need to updated fallback
-    // content distribution.
-    UpdateFallbackDistribution();
-  }
-}
-
-void
-HTMLContentElement::UpdateFallbackDistribution()
-{
-  for (nsIContent* child = nsINode::GetFirstChild();
-       child;
-       child = child->GetNextSibling()) {
-    nsTArray<nsIContent*>& destInsertionPoint = child->DestInsertionPoints();
-    destInsertionPoint.Clear();
-    if (mMatchedNodes.IsEmpty()) {
-      destInsertionPoint.AppendElement(this);
-    }
-  }
-}
-
-void
-HTMLContentElement::RemoveMatchedNode(nsIContent* aContent)
-{
-  mMatchedNodes.RemoveElement(aContent);
-  ShadowRoot::RemoveDestInsertionPoint(this, aContent->DestInsertionPoints());
-
-  if (mMatchedNodes.IsEmpty()) {
-    // Fallback content is activated so we need to update fallback
-    // content distribution.
-    UpdateFallbackDistribution();
-  }
-}
-
-void
-HTMLContentElement::InsertMatchedNode(uint32_t aIndex, nsIContent* aContent)
-{
-  mMatchedNodes.InsertElementAt(aIndex, aContent);
-  nsTArray<nsIContent*>& destInsertionPoint = aContent->DestInsertionPoints();
-  destInsertionPoint.AppendElement(this);
-
-  if (mMatchedNodes.Length() == 1) {
-    // Fallback content gets dropped so we need to updated fallback
-    // content distribution.
-    UpdateFallbackDistribution();
-  }
-}
-
-void
-HTMLContentElement::ClearMatchedNodes()
-{
-  for (uint32_t i = 0; i < mMatchedNodes.Length(); i++) {
-    ShadowRoot::RemoveDestInsertionPoint(this, mMatchedNodes[i]->DestInsertionPoints());
-  }
-
-  mMatchedNodes.Clear();
-
-  UpdateFallbackDistribution();
-}
-
-static bool
-IsValidContentSelectors(nsCSSSelector* aSelector)
-{
-  nsCSSSelector* currentSelector = aSelector;
-  while (currentSelector) {
-    // Blacklist invalid selector fragments.
-    if (currentSelector->IsPseudoElement() ||
-        currentSelector->mPseudoClassList ||
-        currentSelector->mNegations ||
-        currentSelector->mOperator) {
-      return false;
-    }
-
-    currentSelector = currentSelector->mNext;
-  }
-
-  return true;
-}
-
-nsresult
-HTMLContentElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
-                                 const nsAttrValue* aValue,
-                                 const nsAttrValue* aOldValue,
-                                 nsIPrincipal* aSubjectPrincipal,
-                                 bool aNotify)
-{
-  if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::select) {
-    if (aValue) {
-      // Select attribute was updated, the insertion point may match different
-      // elements.
-      nsIDocument* doc = OwnerDoc();
-      nsCSSParser parser(doc->CSSLoader());
-
-      mValidSelector = true;
-      mSelectorList = nullptr;
-
-      nsAutoString valueStr;
-      aValue->ToString(valueStr);
-      nsresult rv = parser.ParseSelectorString(valueStr,
-                                               doc->GetDocumentURI(),
-                                               // Bug 11240
-                                               0, // XXX get the line number!
-                                               getter_Transfers(mSelectorList));
-
-      // We don't want to return an exception if parsing failed because
-      // the spec does not define it as an exception case.
-      if (NS_SUCCEEDED(rv)) {
-        // Ensure that all the selectors are valid
-        nsCSSSelectorList* selectors = mSelectorList;
-        while (selectors) {
-          if (!IsValidContentSelectors(selectors->mSelectors)) {
-            // If we have an invalid selector, we can not match anything.
-            mValidSelector = false;
-            mSelectorList = nullptr;
-            break;
-          }
-          selectors = selectors->mNext;
-        }
-      }
-
-      if (ShadowRoot* containingShadow = GetContainingShadow()) {
-        containingShadow->DistributeAllNodes();
-      }
-    } else {
-      // The select attribute was removed. This insertion point becomes
-      // a universal selector.
-      mValidSelector = true;
-      mSelectorList = nullptr;
-
-      if (ShadowRoot* containingShadow = GetContainingShadow()) {
-        containingShadow->DistributeAllNodes();
-      }
-    }
-  }
-
-  return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
-                                            aOldValue, aSubjectPrincipal, aNotify);
-}
-
-bool
-HTMLContentElement::Match(nsIContent* aContent)
-{
-  if (!mValidSelector) {
-    return false;
-  }
-
-  if (mSelectorList) {
-    nsIDocument* doc = OwnerDoc();
-    ShadowRoot* containingShadow = GetContainingShadow();
-    nsIContent* host = containingShadow->GetHost();
-
-    TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
-                                     doc, TreeMatchContext::eNeverMatchVisited);
-    matchingContext.SetHasSpecifiedScope();
-    matchingContext.AddScopeElement(host->AsElement());
-
-    if (!aContent->IsElement()) {
-      return false;
-    }
-
-    return nsCSSRuleProcessor::SelectorListMatches(aContent->AsElement(),
-                                                   matchingContext,
-                                                   mSelectorList);
-  }
-
-  return true;
-}
-
-already_AddRefed<DistributedContentList>
-HTMLContentElement::GetDistributedNodes()
-{
-  RefPtr<DistributedContentList> list = new DistributedContentList(this);
-  return list.forget();
-}
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DistributedContentList, mParent,
-                                      mDistributedNodes)
-
-NS_INTERFACE_TABLE_HEAD(DistributedContentList)
-  NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
-  NS_INTERFACE_TABLE(DistributedContentList, nsINodeList, nsIDOMNodeList)
-  NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(DistributedContentList)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DistributedContentList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DistributedContentList)
-
-DistributedContentList::DistributedContentList(HTMLContentElement* aHostElement)
-  : mParent(aHostElement)
-{
-  if (aHostElement->IsInsertionPoint()) {
-    if (aHostElement->MatchedNodes().IsEmpty()) {
-      // Fallback content.
-      nsINode* contentNode = aHostElement;
-      for (nsIContent* content = contentNode->GetFirstChild();
-           content;
-           content = content->GetNextSibling()) {
-        mDistributedNodes.AppendElement(content);
-      }
-    } else {
-      mDistributedNodes.AppendElements(aHostElement->MatchedNodes());
-    }
-  }
-}
-
-DistributedContentList::~DistributedContentList()
-{
-}
-
-nsIContent*
-DistributedContentList::Item(uint32_t aIndex)
-{
-  return mDistributedNodes.SafeElementAt(aIndex);
-}
-
-NS_IMETHODIMP
-DistributedContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
-{
-  nsIContent* item = Item(aIndex);
-  if (!item) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return CallQueryInterface(item, aReturn);
-}
-
-NS_IMETHODIMP
-DistributedContentList::GetLength(uint32_t* aLength)
-{
-  *aLength = mDistributedNodes.Length();
-  return NS_OK;
-}
-
-int32_t
-DistributedContentList::IndexOf(nsIContent* aContent)
-{
-  return mDistributedNodes.IndexOf(aContent);
-}
-
-JSObject*
-DistributedContentList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return NodeListBinding::Wrap(aCx, this, aGivenProto);
-}
-
deleted file mode 100644
--- a/dom/html/HTMLContentElement.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_HTMLContentElement_h__
-#define mozilla_dom_HTMLContentElement_h__
-
-#include "nsAutoPtr.h"
-#include "nsINodeList.h"
-#include "nsGenericHTMLElement.h"
-
-struct nsCSSSelectorList;
-
-namespace mozilla {
-namespace dom {
-
-class DistributedContentList;
-
-class HTMLContentElement final : public nsGenericHTMLElement
-{
-public:
-  explicit HTMLContentElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLContentElement,
-                                           nsGenericHTMLElement)
-
-  NS_IMPL_FROMCONTENT_HELPER(HTMLContentElement, IsHTMLContentElement())
-
-  virtual bool IsHTMLContentElement() const override { return true; }
-
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
-                         bool aPreallocateChildren) const override;
-
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
-  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                              nsIContent* aBindingParent,
-                              bool aCompileEventHandlers) override;
-
-  virtual void UnbindFromTree(bool aDeep = true,
-                              bool aNullParent = true) override;
-
-  /**
-   * Returns whether if the selector of this insertion point
-   * matches the provided content.
-   */
-  bool Match(nsIContent* aContent);
-  bool IsInsertionPoint() const { return mIsInsertionPoint; }
-  nsCOMArray<nsIContent>& MatchedNodes() { return mMatchedNodes; }
-  void AppendMatchedNode(nsIContent* aContent);
-  void RemoveMatchedNode(nsIContent* aContent);
-  void InsertMatchedNode(uint32_t aIndex, nsIContent* aContent);
-  void ClearMatchedNodes();
-
-  // WebIDL methods.
-  already_AddRefed<DistributedContentList> GetDistributedNodes();
-  void GetSelect(nsAString& aSelect)
-  {
-    Element::GetAttr(kNameSpaceID_None, nsGkAtoms::select, aSelect);
-  }
-  void SetSelect(const nsAString& aSelect)
-  {
-    Element::SetAttr(kNameSpaceID_None, nsGkAtoms::select, aSelect, true);
-  }
-
-protected:
-  virtual ~HTMLContentElement();
-
-  virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
-
-  /**
-   * Updates the destination insertion points of the fallback
-   * content of this insertion point. If there are nodes matched
-   * to this insertion point, then destination insertion points
-   * of fallback are cleared, otherwise, this insertion point
-   * is a destination insertion point.
-   */
-  void UpdateFallbackDistribution();
-
-  virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
-                                const nsAttrValue* aValue,
-                                const nsAttrValue* aOldValue,
-                                nsIPrincipal* aSubjectPrincipal,
-                                bool aNotify) override;
-
-  /**
-   * An array of nodes from the ShadowRoot host that match the
-   * content insertion selector.
-   */
-  nsCOMArray<nsIContent> mMatchedNodes;
-
-  nsAutoPtr<nsCSSSelectorList> mSelectorList;
-  bool mValidSelector;
-  bool mIsInsertionPoint;
-};
-
-class DistributedContentList : public nsINodeList
-{
-public:
-  explicit DistributedContentList(HTMLContentElement* aHostElement);
-
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DistributedContentList)
-
-  // nsIDOMNodeList
-  NS_DECL_NSIDOMNODELIST
-
-  // nsINodeList
-  virtual nsIContent* Item(uint32_t aIndex) override;
-  virtual int32_t IndexOf(nsIContent* aContent) override;
-  virtual nsINode* GetParentObject() override { return mParent; }
-  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-protected:
-  virtual ~DistributedContentList();
-  RefPtr<HTMLContentElement> mParent;
-  nsCOMArray<nsIContent> mDistributedNodes;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_HTMLContentElement_h__
-
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -50,17 +50,16 @@ EXPORTS.mozilla.dom += [
     'HTMLAllCollection.h',
     'HTMLAnchorElement.h',
     'HTMLAreaElement.h',
     'HTMLAudioElement.h',
     'HTMLBodyElement.h',
     'HTMLBRElement.h',
     'HTMLButtonElement.h',
     'HTMLCanvasElement.h',
-    'HTMLContentElement.h',
     'HTMLDataElement.h',
     'HTMLDataListElement.h',
     'HTMLDetailsElement.h',
     'HTMLDialogElement.h',
     'HTMLDivElement.h',
     'HTMLEmbedElement.h',
     'HTMLFieldSetElement.h',
     'HTMLFontElement.h',
@@ -129,17 +128,16 @@ UNIFIED_SOURCES += [
     'HTMLAllCollection.cpp',
     'HTMLAnchorElement.cpp',
     'HTMLAreaElement.cpp',
     'HTMLAudioElement.cpp',
     'HTMLBodyElement.cpp',
     'HTMLBRElement.cpp',
     'HTMLButtonElement.cpp',
     'HTMLCanvasElement.cpp',
-    'HTMLContentElement.cpp',
     'HTMLDataElement.cpp',
     'HTMLDataListElement.cpp',
     'HTMLDetailsElement.cpp',
     'HTMLDialogElement.cpp',
     'HTMLDivElement.cpp',
     'HTMLElement.cpp',
     'HTMLEmbedElement.cpp',
     'HTMLFieldSetElement.cpp',
deleted file mode 100644
--- a/dom/webidl/HTMLContentElement.webidl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * The origin of this IDL file is
- * https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html
- *
- * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce
- * and create derivative works of this document.
- */
-
-[Pref="dom.webcomponents.enabled"]
-interface HTMLContentElement : HTMLElement
-{
-  attribute DOMString select;
-  NodeList getDistributedNodes();
-};
-
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -551,17 +551,16 @@ WEBIDL_FILES = [
     'HTMLAreaElement.webidl',
     'HTMLAudioElement.webidl',
     'HTMLBaseElement.webidl',
     'HTMLBodyElement.webidl',
     'HTMLBRElement.webidl',
     'HTMLButtonElement.webidl',
     'HTMLCanvasElement.webidl',
     'HTMLCollection.webidl',
-    'HTMLContentElement.webidl',
     'HTMLDataElement.webidl',
     'HTMLDataListElement.webidl',
     'HTMLDetailsElement.webidl',
     'HTMLDialogElement.webidl',
     'HTMLDirectoryElement.webidl',
     'HTMLDivElement.webidl',
     'HTMLDListElement.webidl',
     'HTMLDocument.webidl',
--- a/editor/libeditor/HTMLEditUtils.cpp
+++ b/editor/libeditor/HTMLEditUtils.cpp
@@ -626,17 +626,16 @@ static const ElementInfo kElements[eHTML
   ELEM(cite, true, true, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
   ELEM(code, true, true, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
   ELEM(col,
        false,
        false,
        GROUP_TABLE_CONTENT | GROUP_COLGROUP_CONTENT,
        GROUP_NONE),
   ELEM(colgroup, true, false, GROUP_NONE, GROUP_COLGROUP_CONTENT),
-  ELEM(content, true, false, GROUP_NONE, GROUP_INLINE_ELEMENT),
   ELEM(data, true, false, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
   ELEM(datalist,
        true,
        false,
        GROUP_PHRASE,
        GROUP_OPTIONS | GROUP_INLINE_ELEMENT),
   ELEM(dd, true, false, GROUP_DL_CONTENT, GROUP_FLOW_ELEMENT),
   ELEM(del, true, true, GROUP_PHRASE | GROUP_BLOCK, GROUP_FLOW_ELEMENT),
--- a/parser/html/javasrc/ElementName.java
+++ b/parser/html/javasrc/ElementName.java
@@ -1334,20 +1334,16 @@ TreeBuilder.DD_OR_DT | SPECIAL | OPTIONA
 public static final ElementName APPLET = new ElementName("applet", "applet", 
 // CPPONLY: NS_NewHTMLUnknownElement,
 // CPPONLY: NS_NewSVGUnknownElement, 
 TreeBuilder.MARQUEE_OR_APPLET | SPECIAL | SCOPING);
 public static final ElementName BASEFONT = new ElementName("basefont", "basefont", 
 // CPPONLY: NS_NewHTMLElement,
 // CPPONLY: NS_NewSVGUnknownElement, 
 TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
-public static final ElementName CONTENT = new ElementName("content", "content", 
-// CPPONLY: NS_NewHTMLContentElement,
-// CPPONLY: NS_NewSVGUnknownElement, 
-TreeBuilder.OTHER);
 public static final ElementName DATALIST = new ElementName("datalist", "datalist", 
 // CPPONLY: NS_NewHTMLDataListElement,
 // CPPONLY: NS_NewSVGUnknownElement, 
 TreeBuilder.OTHER);
 public static final ElementName FOREIGNOBJECT = new ElementName("foreignobject", "foreignObject", 
 // CPPONLY: NS_NewHTMLUnknownElement,
 // CPPONLY: NS_NewSVGForeignObjectElement, 
 TreeBuilder.FOREIGNOBJECT_OR_DESC | SCOPING_AS_SVG);
@@ -1484,38 +1480,38 @@ public static final ElementName TBODY = 
 // CPPONLY: NS_NewSVGUnknownElement, 
 TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
 private final static @NoLength ElementName[] ELEMENT_NAMES = {
 MN,
 ELLIPSE,
 FRAMESET,
 H2,
 MGLYPH,
-NOBR,
+METER,
 RADIALGRADIENT,
 RTC,
 EMBED,
 STRIKE,
 OL,
 OPTGROUP,
-PROGRESS,
+NOFRAMES,
 MTEXT,
 VIEW,
 IMG,
 WBR,
 METADATA,
 ASIDE,
 FECOMPOSITE,
 DIALOG,
 MI,
 EM,
 TSPAN,
 FEFUNCR,
-DEFS,
-CONTENT,
+CANVAS,
+BASEFONT,
 FEDISTANTLIGHT,
 OUTPUT,
 TFOOT,
 FEMORPHOLOGY,
 DEL,
 NAV,
 SET,
 Q,
@@ -1530,19 +1526,19 @@ LISTING,
 TH,
 MASK,
 SYMBOL,
 ANIMATEMOTION,
 POLYGON,
 COLGROUP,
 ABBR,
 FEGAUSSIANBLUR,
-ADDRESS,
-MS,
-APPLET,
+TR,
+DETAILS,
+DT,
 FOREIGNOBJECT,
 FESPOTLIGHT,
 INPUT,
 RT,
 TT,
 SLOT,
 MENU,
 FECONVOLVEMATRIX,
@@ -1582,22 +1578,22 @@ CAPTION,
 MAIN,
 SPAN,
 MO,
 HGROUP,
 STOP,
 CENTER,
 FILTER,
 MARKER,
-TR,
-CANVAS,
-DETAILS,
-NOFRAMES,
-DT,
-BASEFONT,
+NOBR,
+ADDRESS,
+DEFS,
+MS,
+PROGRESS,
+APPLET,
 DATALIST,
 FIELDSET,
 FEOFFSET,
 FEPOINTLIGHT,
 FONT,
 LINEARGRADIENT,
 NOSCRIPT,
 OBJECT,
@@ -1685,46 +1681,45 @@ FEDISPLACEMENTMAP,
 RP,
 SAMP,
 BR,
 ANIMATECOLOR,
 HR,
 FECOMPONENTTRANSFER,
 FOOTER,
 HEADER,
-METER,
 };
 private final static int[] ELEMENT_HASHES = {
 1902641154,
 1749395095,
 2001349720,
 893386754,
 1803876550,
-1971938532,
+1971465813,
 2007781534,
 59821379,
 1732381397,
 1756600614,
 1870135298,
 1939219752,
-1990037800,
+1988763672,
 2005324101,
 2060065124,
 55104723,
 62450211,
 1686489160,
 1747048757,
 1749932347,
 1782357526,
 1818755074,
 1881669634,
 1907959605,
 1967760215,
-1983533124,
-1999917383,
+1982935782,
+1999397992,
 2001392798,
 2006329158,
 2008851557,
 2085266636,
 52485715,
 57733651,
 60354131,
 67633153,
@@ -1739,19 +1734,19 @@ 1786534215,
 1805647874,
 1854245076,
 1874102998,
 1898223949,
 1906087319,
 1932928296,
 1965115924,
 1968053806,
-1982173479,
-1986527234,
-1998724870,
+1973420034,
+1983633431,
+1998585858,
 2001309869,
 2001392795,
 2003183333,
 2005925890,
 2006974466,
 2008325940,
 2021937364,
 2068523856,
@@ -1791,22 +1786,22 @@ 1899272519,
 1904412884,
 1907435316,
 1919418370,
 1935549734,
 1941221172,
 1966223078,
 1967795910,
 1971461414,
-1973420034,
-1982935782,
-1983633431,
-1988763672,
-1998585858,
-1999397992,
+1971938532,
+1982173479,
+1983533124,
+1986527234,
+1990037800,
+1998724870,
 2000525512,
 2001349704,
 2001349736,
 2001392796,
 2001495140,
 2004635806,
 2005719336,
 2006028454,
@@ -1894,11 +1889,10 @@ 1934172497,
 1938817026,
 1941178676,
 1963982850,
 1965334268,
 1967128578,
 1967788867,
 1967795958,
 1968836118,
-1971465813,
 };
 }
--- a/parser/html/nsHtml5AttributeName.h
+++ b/parser/html/nsHtml5AttributeName.h
@@ -60,23 +60,25 @@ class nsHtml5AttributeName
   public:
     static int32_t* ALL_NO_NS;
   private:
     static int32_t* XMLNS_NS;
     static int32_t* XML_NS;
     static int32_t* XLINK_NS;
   public:
     static nsAtom** ALL_NO_PREFIX;
+
   private:
     static nsAtom** XMLNS_PREFIX;
     static nsAtom** XLINK_PREFIX;
     static nsAtom** XML_PREFIX;
     static nsAtom** SVG_DIFFERENT(nsAtom* name, nsAtom* camel);
     static nsAtom** MATH_DIFFERENT(nsAtom* name, nsAtom* camel);
     static nsAtom** COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix);
+
   public:
     static nsAtom** SAME_LOCAL(nsAtom* name);
     inline static int32_t levelOrderBinarySearch(jArray<int32_t, int32_t> data,
                                                  int32_t key)
     {
       int32_t n = data.length;
       int32_t i = 0;
       while (i < n) {
@@ -154,16 +156,17 @@ class nsHtml5AttributeName
     static const int32_t SVG = 2;
 
   private:
     int32_t* uri;
     nsAtom** local;
     nsAtom** prefix;
     bool custom;
     nsHtml5AttributeName(int32_t* uri, nsAtom** local, nsAtom** prefix);
+
   public:
     nsHtml5AttributeName();
     inline bool isInterned() { return !custom; }
 
     inline void setNameForNonInterned(nsAtom* name)
     {
       MOZ_ASSERT(custom);
       local[0] = name;
--- a/parser/html/nsHtml5ElementName.cpp
+++ b/parser/html/nsHtml5ElementName.cpp
@@ -252,17 +252,16 @@ nsHtml5ElementName* nsHtml5ElementName::
 nsHtml5ElementName* nsHtml5ElementName::ELT_DEFS = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_DETAILS = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_MS = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_NOFRAMES = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_PROGRESS = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_DT = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_APPLET = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_BASEFONT = nullptr;
-nsHtml5ElementName* nsHtml5ElementName::ELT_CONTENT = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_DATALIST = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FOREIGNOBJECT = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FIELDSET = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FRAMESET = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FEOFFSET = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FESPOTLIGHT = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FEPOINTLIGHT = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FEDISTANTLIGHT = nullptr;
@@ -290,51 +289,51 @@ nsHtml5ElementName* nsHtml5ElementName::
 nsHtml5ElementName* nsHtml5ElementName::ELT_FECONVOLVEMATRIX = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_BODY = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_FEMORPHOLOGY = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_RUBY = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_SUMMARY = nullptr;
 nsHtml5ElementName* nsHtml5ElementName::ELT_TBODY = nullptr;
 nsHtml5ElementName** nsHtml5ElementName::ELEMENT_NAMES = 0;
 static int32_t const ELEMENT_HASHES_DATA[] = {
-  1902641154, 1749395095, 2001349720, 893386754,  1803876550, 1971938532,
+  1902641154, 1749395095, 2001349720, 893386754,  1803876550, 1971465813,
   2007781534, 59821379,   1732381397, 1756600614, 1870135298, 1939219752,
-  1990037800, 2005324101, 2060065124, 55104723,   62450211,   1686489160,
+  1988763672, 2005324101, 2060065124, 55104723,   62450211,   1686489160,
   1747048757, 1749932347, 1782357526, 1818755074, 1881669634, 1907959605,
-  1967760215, 1983533124, 1999917383, 2001392798, 2006329158, 2008851557,
+  1967760215, 1982935782, 1999397992, 2001392798, 2006329158, 2008851557,
   2085266636, 52485715,   57733651,   60354131,   67633153,   960495618,
   1703936002, 1736200310, 1747838298, 1749723735, 1753362711, 1757157700,
   1786534215, 1805647874, 1854245076, 1874102998, 1898223949, 1906087319,
-  1932928296, 1965115924, 1968053806, 1982173479, 1986527234, 1998724870,
+  1932928296, 1965115924, 1968053806, 1973420034, 1983633431, 1998585858,
   2001309869, 2001392795, 2003183333, 2005925890, 2006974466, 2008325940,
   2021937364, 2068523856, 2092255447, 51438659,   52488851,   56151587,
   59244545,   60347747,   61925907,   63438849,   69730305,   926941186,
   1681770564, 1689922072, 1730150402, 1733076167, 1738539010, 1747306711,
   1748225318, 1749673195, 1749813541, 1751386406, 1755148615, 1757137429,
   1763839627, 1783388497, 1797585096, 1803929861, 1807599880, 1854228692,
   1864368130, 1873281026, 1881498736, 1887579800, 1899272519, 1904412884,
   1907435316, 1919418370, 1935549734, 1941221172, 1966223078, 1967795910,
-  1971461414, 1973420034, 1982935782, 1983633431, 1988763672, 1998585858,
-  1999397992, 2000525512, 2001349704, 2001349736, 2001392796, 2001495140,
+  1971461414, 1971938532, 1982173479, 1983533124, 1986527234, 1990037800,
+  1998724870, 2000525512, 2001349704, 2001349736, 2001392796, 2001495140,
   2004635806, 2005719336, 2006028454, 2006896969, 2007601444, 2008125638,
   2008340774, 2008994116, 2051837468, 2068523853, 2083120164, 2091479332,
   2092557349, 51434643,   51961587,   52486755,   52490899,   55110883,
   57206291,   58773795,   59768833,   60345171,   60352339,   61395251,
   62390273,   62973651,   67108865,   68681729,   876609538,  910163970,
   943718402,  1679960596, 1682547543, 1686491348, 1699324759, 1715310660,
   1730965751, 1733054663, 1733890180, 1737099991, 1740181637, 1747176599,
   1747814436, 1748100148, 1748359220, 1749656156, 1749715159, 1749801286,
   1749905526, 1751288021, 1752979652, 1755076808, 1756474198, 1756625221,
   1757146773, 1757268168, 1766992520, 1783210839, 1783388498, 1790207270,
   1798686984, 1803929812, 1805502724, 1806806678, 1818230786, 1853642948,
   1854228698, 1857653029, 1868312196, 1870268949, 1874053333, 1881288348,
   1881613047, 1884120164, 1889085973, 1898753862, 1900845386, 1903302038,
   1905563974, 1906135367, 1907661127, 1914900309, 1925844629, 1934172497,
   1938817026, 1941178676, 1963982850, 1965334268, 1967128578, 1967788867,
-  1967795958, 1968836118, 1971465813
+  1967795958, 1968836118
 };
 staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HASHES_DATA, MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA) };
 void
 nsHtml5ElementName::initializeStatics()
 {
   ELT_ANNOTATION_XML = new nsHtml5ElementName(
     nsGkAtoms::annotation_xml_,
     nsGkAtoms::annotation_xml_,
@@ -1308,21 +1307,16 @@ nsHtml5ElementName::initializeStatics()
                                       nsHtml5TreeBuilder::MARQUEE_OR_APPLET |
                                         SPECIAL | SCOPING);
   ELT_BASEFONT = new nsHtml5ElementName(
     nsGkAtoms::basefont,
     nsGkAtoms::basefont,
     NS_NewHTMLElement,
     NS_NewSVGUnknownElement,
     nsHtml5TreeBuilder::LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
-  ELT_CONTENT = new nsHtml5ElementName(nsGkAtoms::content,
-                                       nsGkAtoms::content,
-                                       NS_NewHTMLContentElement,
-                                       NS_NewSVGUnknownElement,
-                                       nsHtml5TreeBuilder::OTHER);
   ELT_DATALIST = new nsHtml5ElementName(nsGkAtoms::datalist,
                                         nsGkAtoms::datalist,
                                         NS_NewHTMLDataListElement,
                                         NS_NewSVGUnknownElement,
                                         nsHtml5TreeBuilder::OTHER);
   ELT_FOREIGNOBJECT = new nsHtml5ElementName(
     nsGkAtoms::foreignobject,
     nsGkAtoms::foreignObject,
@@ -1506,44 +1500,44 @@ nsHtml5ElementName::initializeStatics()
       SPECIAL);
   ELT_TBODY =
     new nsHtml5ElementName(nsGkAtoms::tbody,
                            nsGkAtoms::tbody,
                            NS_NewHTMLTableSectionElement,
                            NS_NewSVGUnknownElement,
                            nsHtml5TreeBuilder::TBODY_OR_THEAD_OR_TFOOT |
                              SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
-  ELEMENT_NAMES = new nsHtml5ElementName*[207];
+  ELEMENT_NAMES = new nsHtml5ElementName*[206];
   ELEMENT_NAMES[0] = ELT_MN;
   ELEMENT_NAMES[1] = ELT_ELLIPSE;
   ELEMENT_NAMES[2] = ELT_FRAMESET;
   ELEMENT_NAMES[3] = ELT_H2;
   ELEMENT_NAMES[4] = ELT_MGLYPH;
-  ELEMENT_NAMES[5] = ELT_NOBR;
+  ELEMENT_NAMES[5] = ELT_METER;
   ELEMENT_NAMES[6] = ELT_RADIALGRADIENT;
   ELEMENT_NAMES[7] = ELT_RTC;
   ELEMENT_NAMES[8] = ELT_EMBED;
   ELEMENT_NAMES[9] = ELT_STRIKE;
   ELEMENT_NAMES[10] = ELT_OL;
   ELEMENT_NAMES[11] = ELT_OPTGROUP;
-  ELEMENT_NAMES[12] = ELT_PROGRESS;
+  ELEMENT_NAMES[12] = ELT_NOFRAMES;
   ELEMENT_NAMES[13] = ELT_MTEXT;
   ELEMENT_NAMES[14] = ELT_VIEW;
   ELEMENT_NAMES[15] = ELT_IMG;
   ELEMENT_NAMES[16] = ELT_WBR;
   ELEMENT_NAMES[17] = ELT_METADATA;
   ELEMENT_NAMES[18] = ELT_ASIDE;
   ELEMENT_NAMES[19] = ELT_FECOMPOSITE;
   ELEMENT_NAMES[20] = ELT_DIALOG;
   ELEMENT_NAMES[21] = ELT_MI;
   ELEMENT_NAMES[22] = ELT_EM;
   ELEMENT_NAMES[23] = ELT_TSPAN;
   ELEMENT_NAMES[24] = ELT_FEFUNCR;
-  ELEMENT_NAMES[25] = ELT_DEFS;
-  ELEMENT_NAMES[26] = ELT_CONTENT;
+  ELEMENT_NAMES[25] = ELT_CANVAS;
+  ELEMENT_NAMES[26] = ELT_BASEFONT;
   ELEMENT_NAMES[27] = ELT_FEDISTANTLIGHT;
   ELEMENT_NAMES[28] = ELT_OUTPUT;
   ELEMENT_NAMES[29] = ELT_TFOOT;
   ELEMENT_NAMES[30] = ELT_FEMORPHOLOGY;
   ELEMENT_NAMES[31] = ELT_DEL;
   ELEMENT_NAMES[32] = ELT_NAV;
   ELEMENT_NAMES[33] = ELT_SET;
   ELEMENT_NAMES[34] = ELT_Q;
@@ -1558,19 +1552,19 @@ nsHtml5ElementName::initializeStatics()
   ELEMENT_NAMES[43] = ELT_TH;
   ELEMENT_NAMES[44] = ELT_MASK;
   ELEMENT_NAMES[45] = ELT_SYMBOL;
   ELEMENT_NAMES[46] = ELT_ANIMATEMOTION;
   ELEMENT_NAMES[47] = ELT_POLYGON;
   ELEMENT_NAMES[48] = ELT_COLGROUP;
   ELEMENT_NAMES[49] = ELT_ABBR;
   ELEMENT_NAMES[50] = ELT_FEGAUSSIANBLUR;
-  ELEMENT_NAMES[51] = ELT_ADDRESS;
-  ELEMENT_NAMES[52] = ELT_MS;
-  ELEMENT_NAMES[53] = ELT_APPLET;
+  ELEMENT_NAMES[51] = ELT_TR;
+  ELEMENT_NAMES[52] = ELT_DETAILS;
+  ELEMENT_NAMES[53] = ELT_DT;
   ELEMENT_NAMES[54] = ELT_FOREIGNOBJECT;
   ELEMENT_NAMES[55] = ELT_FESPOTLIGHT;
   ELEMENT_NAMES[56] = ELT_INPUT;
   ELEMENT_NAMES[57] = ELT_RT;
   ELEMENT_NAMES[58] = ELT_TT;
   ELEMENT_NAMES[59] = ELT_SLOT;
   ELEMENT_NAMES[60] = ELT_MENU;
   ELEMENT_NAMES[61] = ELT_FECONVOLVEMATRIX;
@@ -1610,22 +1604,22 @@ nsHtml5ElementName::initializeStatics()
   ELEMENT_NAMES[95] = ELT_MAIN;
   ELEMENT_NAMES[96] = ELT_SPAN;
   ELEMENT_NAMES[97] = ELT_MO;
   ELEMENT_NAMES[98] = ELT_HGROUP;
   ELEMENT_NAMES[99] = ELT_STOP;
   ELEMENT_NAMES[100] = ELT_CENTER;
   ELEMENT_NAMES[101] = ELT_FILTER;
   ELEMENT_NAMES[102] = ELT_MARKER;
-  ELEMENT_NAMES[103] = ELT_TR;
-  ELEMENT_NAMES[104] = ELT_CANVAS;
-  ELEMENT_NAMES[105] = ELT_DETAILS;
-  ELEMENT_NAMES[106] = ELT_NOFRAMES;
-  ELEMENT_NAMES[107] = ELT_DT;
-  ELEMENT_NAMES[108] = ELT_BASEFONT;
+  ELEMENT_NAMES[103] = ELT_NOBR;
+  ELEMENT_NAMES[104] = ELT_ADDRESS;
+  ELEMENT_NAMES[105] = ELT_DEFS;
+  ELEMENT_NAMES[106] = ELT_MS;
+  ELEMENT_NAMES[107] = ELT_PROGRESS;
+  ELEMENT_NAMES[108] = ELT_APPLET;
   ELEMENT_NAMES[109] = ELT_DATALIST;
   ELEMENT_NAMES[110] = ELT_FIELDSET;
   ELEMENT_NAMES[111] = ELT_FEOFFSET;
   ELEMENT_NAMES[112] = ELT_FEPOINTLIGHT;
   ELEMENT_NAMES[113] = ELT_FONT;
   ELEMENT_NAMES[114] = ELT_LINEARGRADIENT;
   ELEMENT_NAMES[115] = ELT_NOSCRIPT;
   ELEMENT_NAMES[116] = ELT_OBJECT;
@@ -1713,17 +1707,16 @@ nsHtml5ElementName::initializeStatics()
   ELEMENT_NAMES[198] = ELT_RP;
   ELEMENT_NAMES[199] = ELT_SAMP;
   ELEMENT_NAMES[200] = ELT_BR;
   ELEMENT_NAMES[201] = ELT_ANIMATECOLOR;
   ELEMENT_NAMES[202] = ELT_HR;
   ELEMENT_NAMES[203] = ELT_FECOMPONENTTRANSFER;
   ELEMENT_NAMES[204] = ELT_FOOTER;
   ELEMENT_NAMES[205] = ELT_HEADER;
-  ELEMENT_NAMES[206] = ELT_METER;
 }
 
 void
 nsHtml5ElementName::releaseStatics()
 {
   delete ELT_ANNOTATION_XML;
   delete ELT_BIG;
   delete ELT_BDO;
@@ -1891,17 +1884,16 @@ nsHtml5ElementName::releaseStatics()
   delete ELT_DEFS;
   delete ELT_DETAILS;
   delete ELT_MS;
   delete ELT_NOFRAMES;
   delete ELT_PROGRESS;
   delete ELT_DT;
   delete ELT_APPLET;
   delete ELT_BASEFONT;
-  delete ELT_CONTENT;
   delete ELT_DATALIST;
   delete ELT_FOREIGNOBJECT;
   delete ELT_FIELDSET;
   delete ELT_FRAMESET;
   delete ELT_FEOFFSET;
   delete ELT_FESPOTLIGHT;
   delete ELT_FEPOINTLIGHT;
   delete ELT_FEDISTANTLIGHT;
--- a/parser/html/nsHtml5ElementName.h
+++ b/parser/html/nsHtml5ElementName.h
@@ -120,20 +120,18 @@ public:
         i = 2 * i + 1;
       } else {
         return i;
       }
     }
     return -1;
   }
 
-  inline static nsHtml5ElementName* elementNameByBuffer(
-    char16_t* buf,
-    int32_t length,
-    nsHtml5AtomTable* interner)
+  inline static nsHtml5ElementName*
+  elementNameByBuffer(char16_t* buf, int32_t length, nsHtml5AtomTable* interner)
   {
     uint32_t hash = nsHtml5ElementName::bufToHash(buf, length);
     jArray<int32_t, int32_t> hashes;
     hashes = nsHtml5ElementName::ELEMENT_HASHES;
     int32_t index = levelOrderBinarySearch(hashes, hash);
     if (index < 0) {
       return nullptr;
     } else {
@@ -368,17 +366,16 @@ public:
     static nsHtml5ElementName* ELT_DEFS;
     static nsHtml5ElementName* ELT_DETAILS;
     static nsHtml5ElementName* ELT_MS;
     static nsHtml5ElementName* ELT_NOFRAMES;
     static nsHtml5ElementName* ELT_PROGRESS;
     static nsHtml5ElementName* ELT_DT;
     static nsHtml5ElementName* ELT_APPLET;
     static nsHtml5ElementName* ELT_BASEFONT;
-    static nsHtml5ElementName* ELT_CONTENT;
     static nsHtml5ElementName* ELT_DATALIST;
     static nsHtml5ElementName* ELT_FOREIGNOBJECT;
     static nsHtml5ElementName* ELT_FIELDSET;
     static nsHtml5ElementName* ELT_FRAMESET;
     static nsHtml5ElementName* ELT_FEOFFSET;
     static nsHtml5ElementName* ELT_FESPOTLIGHT;
     static nsHtml5ElementName* ELT_FEPOINTLIGHT;
     static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -294,27 +294,27 @@ nsHtml5Tokenizer::strBufToElementNameStr
 {
   if (containsHyphen) {
     nsAtom* annotationName = nsHtml5ElementName::ELT_ANNOTATION_XML->getName();
     if (nsHtml5Portability::localEqualsBuffer(
           annotationName, strBuf, strBufLen)) {
       tagName = nsHtml5ElementName::ELT_ANNOTATION_XML;
     } else {
       nonInternedTagName->setNameForNonInterned(
-        nsHtml5Portability::newLocalNameFromBuffer(
-          strBuf, strBufLen, interner), true);
+        nsHtml5Portability::newLocalNameFromBuffer(strBuf, strBufLen, interner),
+        true);
       tagName = nonInternedTagName;
     }
   } else {
     tagName =
       nsHtml5ElementName::elementNameByBuffer(strBuf, strBufLen, interner);
     if (!tagName) {
       nonInternedTagName->setNameForNonInterned(
-        nsHtml5Portability::newLocalNameFromBuffer(
-          strBuf, strBufLen, interner), false);
+        nsHtml5Portability::newLocalNameFromBuffer(strBuf, strBufLen, interner),
+        false);
       tagName = nonInternedTagName;
     }
   }
   containsHyphen = false;
   clearStrBufAfterUse();
 }
 
 int32_t 
--- a/parser/html/nsHtml5TreeBuilder.h
+++ b/parser/html/nsHtml5TreeBuilder.h
@@ -405,18 +405,21 @@ class nsHtml5TreeBuilder : public nsAHtm
 
     void removeFromStack(int32_t pos);
     void removeFromStack(nsHtml5StackNode* node);
     void removeFromListOfActiveFormattingElements(int32_t pos);
     bool adoptionAgencyEndTag(nsAtom* name);
     void insertIntoStack(nsHtml5StackNode* node, int32_t position);
     void insertIntoListOfActiveFormattingElements(nsHtml5StackNode* formattingClone, int32_t bookmark);
     int32_t findInListOfActiveFormattingElements(nsHtml5StackNode* node);
-    int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(nsAtom* name);
-    void maybeForgetEarlierDuplicateFormattingElement(nsAtom* name, nsHtml5HtmlAttributes* attributes);
+    int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
+      nsAtom* name);
+    void maybeForgetEarlierDuplicateFormattingElement(
+      nsAtom* name,
+      nsHtml5HtmlAttributes* attributes);
     int32_t findLastOrRoot(nsAtom* name);
     int32_t findLastOrRoot(int32_t group);
     bool addAttributesToBody(nsHtml5HtmlAttributes* attributes);
     void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
     void pushHeadPointerOntoStack();
     void reconstructTheActiveFormattingElements();
   public:
     void notifyUnusedStackNode(int32_t idxInStackNodes);
@@ -520,27 +523,32 @@ class nsHtml5TreeBuilder : public nsAHtm
     void markMalformedIfScript(nsIContentHandle* elt);
     void start(bool fragmentMode);
     void end();
     void appendDoctypeToDocument(nsAtom* name,
                                  nsHtml5String publicIdentifier,
                                  nsHtml5String systemIdentifier);
     void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node);
     void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node);
+
   public:
     inline bool cdataSectionAllowed()
     {
       return isInForeign();
     }
 
   private:
     bool isInForeign();
     bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
   public:
-    void setFragmentContext(nsAtom* context, int32_t ns, nsIContentHandle* node, bool quirks);
+    void setFragmentContext(nsAtom* context,
+                            int32_t ns,
+                            nsIContentHandle* node,
+                            bool quirks);
+
   protected:
     nsIContentHandle* currentNode();
   public:
     bool isScriptingEnabled();
     void setScriptingEnabled(bool scriptingEnabled);
     void setIsSrcdocDocument(bool isSrcdocDocument);
     void flushCharacters();
   private:
--- a/parser/htmlparser/nsElementTable.cpp
+++ b/parser/htmlparser/nsElementTable.cpp
@@ -57,17 +57,16 @@ static const HTMLElement gHTMLElements[]
   ELEM(button,      ____, true)
   ELEM(canvas,      ____, true)
   ELEM(caption,     ____, true)
   ELEM(center,      true, true)
   ELEM(cite,        ____, true)
   ELEM(code,        ____, true)
   ELEM(col,         ____, ____)
   ELEM(colgroup,    ____, true)
-  ELEM(content,     ____, true)
   ELEM(data,        ____, true)
   ELEM(datalist,    ____, true)
   ELEM(dd,          ____, true)
   ELEM(del,         ____, true)
   ELEM(details,     true, true)
   ELEM(dfn,         ____, true)
   ELEM(dialog,      true, true)
   ELEM(dir,         true, true)
--- a/parser/htmlparser/nsHTMLTagList.h
+++ b/parser/htmlparser/nsHTMLTagList.h
@@ -67,17 +67,16 @@ HTML_TAG(br, BR, BR)
 HTML_TAG(button, Button, Button)
 HTML_TAG(canvas, Canvas, Canvas)
 HTML_TAG(caption, TableCaption, TableCaption)
 HTML_HTMLELEMENT_TAG(center)
 HTML_HTMLELEMENT_TAG(cite)
 HTML_HTMLELEMENT_TAG(code)
 HTML_TAG(col, TableCol, TableCol)
 HTML_TAG(colgroup, TableCol, TableCol)
-HTML_TAG(content, Content, Content)
 HTML_TAG(data, Data, Data)
 HTML_TAG(datalist, DataList, DataList)
 HTML_HTMLELEMENT_TAG(dd)
 HTML_TAG(del, Mod, Mod)
 HTML_TAG(details, Details, Details)
 HTML_HTMLELEMENT_TAG(dfn)
 HTML_TAG(dialog, Dialog, Dialog)
 HTML_TAG(dir, Shared, Directory)