Bug 1134280 - Get rid of Tag() - patch 2.3 - dom/base and docshell - Fix all the occurrences, m=smaug, r=surkov
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 03 Mar 2015 11:09:00 +0000
changeset 231594 87f0b3d98a7eec1589f430643000046534ed472a
parent 231593 b80d9dc2137e804afbf4917aa54675c3da59df96
child 231595 1699d6dd7ac88462009708b76decc65020bb5c26
push id28355
push userkwierso@gmail.com
push dateWed, 04 Mar 2015 00:49:07 +0000
treeherdermozilla-central@f42b9946f08f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1134280
milestone39.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 1134280 - Get rid of Tag() - patch 2.3 - dom/base and docshell - Fix all the occurrences, m=smaug, r=surkov
docshell/base/nsDocShell.cpp
dom/base/Element.cpp
dom/base/FragmentOrElement.cpp
dom/base/nsContentUtils.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsDocument.cpp
dom/base/nsDocumentEncoder.cpp
dom/base/nsFocusManager.cpp
dom/base/nsFrameLoader.cpp
dom/base/nsHTMLContentSerializer.cpp
dom/base/nsINode.cpp
dom/base/nsObjectLoadingContent.cpp
dom/base/nsPlainTextSerializer.cpp
dom/base/nsRange.cpp
dom/base/nsStyleLinkElement.cpp
dom/base/nsXHTMLContentSerializer.cpp
dom/base/nsXMLContentSerializer.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -347,21 +347,17 @@ CheckPingURI(nsIURI* aURI, nsIContent* a
 typedef void (*ForEachPingCallback)(void* closure, nsIContent* content,
                                     nsIURI* uri, nsIIOService* ios);
 
 static bool
 IsElementAnchor(nsIContent* aContent)
 {
   // Make sure we are dealing with either an <A> or <AREA> element in the HTML
   // or XHTML namespace.
-  if (!aContent->IsHTMLElement()) {
-    return false;
-  }
-  nsIAtom* nameAtom = aContent->Tag();
-  return nameAtom == nsGkAtoms::a || nameAtom == nsGkAtoms::area;
+  return aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area);
 }
 
 static void
 ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback, void* aClosure)
 {
   // NOTE: Using nsIDOMHTMLAnchorElement::GetPing isn't really worth it here
   //       since we'd still need to parse the resulting string.  Instead, we
   //       just parse the raw attribute.  It might be nice if the content node
@@ -13391,17 +13387,18 @@ nsDocShell::OnLinkClickSync(nsIContent* 
 
   if (!IsNavigationAllowed() || !IsOKToLoadURI(aURI)) {
     return NS_OK;
   }
 
   // XXX When the linking node was HTMLFormElement, it is synchronous event.
   //     That is, the caller of this method is not |OnLinkClickEvent::Run()|
   //     but |HTMLFormElement::SubmitSubmission(...)|.
-  if (nsGkAtoms::form == aContent->Tag() && ShouldBlockLoadingForBackButton()) {
+  if (aContent->IsHTMLElement(nsGkAtoms::form) &&
+      ShouldBlockLoadingForBackButton()) {
     return NS_OK;
   }
 
   if (aContent->IsEditable()) {
     return NS_OK;
   }
 
   {
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3217,18 +3217,18 @@ Element::SetOuterHTML(const nsAString& a
     aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
   }
 
   if (OwnerDoc()->IsHTMLDocument()) {
     nsIAtom* localName;
     int32_t namespaceID;
     if (parent->IsElement()) {
-      localName = static_cast<nsIContent*>(parent.get())->Tag();
-      namespaceID = static_cast<nsIContent*>(parent.get())->GetNameSpaceID();
+      localName = parent->NodeInfo()->NameAtom();
+      namespaceID = parent->NodeInfo()->NamespaceID();
     } else {
       NS_ASSERTION(parent->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE,
         "How come the parent isn't a document, a fragment or an element?");
       localName = nsGkAtoms::body;
       namespaceID = kNameSpaceID_XHTML;
     }
     nsRefPtr<DocumentFragment> fragment =
       new DocumentFragment(OwnerDoc()->NodeInfoManager());
@@ -3316,17 +3316,17 @@ Element::InsertAdjacentHTML(const nsAStr
 
   // Parse directly into destination if possible
   if (doc->IsHTMLDocument() && !OwnerDoc()->MayHaveDOMMutationObservers() &&
       (position == eBeforeEnd ||
        (position == eAfterEnd && !GetNextSibling()) ||
        (position == eAfterBegin && !GetFirstChild()))) {
     int32_t oldChildCount = destination->GetChildCount();
     int32_t contextNs = destination->GetNameSpaceID();
-    nsIAtom* contextLocal = destination->Tag();
+    nsIAtom* contextLocal = destination->NodeInfo()->NameAtom();
     if (contextLocal == nsGkAtoms::html && contextNs == kNameSpaceID_XHTML) {
       // For compat with IE6 through IE9. Willful violation of HTML5 as of
       // 2011-04-06. CreateContextualFragment does the same already.
       // Spec bug: http://www.w3.org/Bugs/Public/show_bug.cgi?id=12434
       contextLocal = nsGkAtoms::body;
     }
     aError = nsContentUtils::ParseFragmentHTML(aText,
                                                destination,
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -726,20 +726,20 @@ nsIContent::PreHandleEvent(EventChainPre
               anonOwnerRelated = FindChromeAccessOnlySubtreeOwner(anonOwnerRelated);
             }
             if (anonOwner == anonOwnerRelated) {
 #ifdef DEBUG_smaug
               nsCOMPtr<nsIContent> originalTarget =
                 do_QueryInterface(aVisitor.mEvent->originalTarget);
               nsAutoString ot, ct, rt;
               if (originalTarget) {
-                originalTarget->Tag()->ToString(ot);
+                originalTarget->NodeInfo()->NameInfo()->ToString(ot);
               }
-              Tag()->ToString(ct);
-              relatedTarget->Tag()->ToString(rt);
+              NodeInfo()->NameAtom()->ToString(ct);
+              relatedTarget->NodeInfo()->NameAtom()->ToString(rt);
               printf("Stopping %s propagation:"
                      "\n\toriginalTarget=%s \n\tcurrentTarget=%s %s"
                      "\n\trelatedTarget=%s %s \n%s",
                      (aVisitor.mEvent->message == NS_MOUSE_ENTER_SYNTH)
                        ? "mouseover" : "mouseout",
                      NS_ConvertUTF16toUTF8(ot).get(),
                      NS_ConvertUTF16toUTF8(ct).get(),
                      isAnonForEvents
@@ -2424,17 +2424,17 @@ AppendEncodedAttributeValue(nsAutoString
   } else {
     aBuilder.Append(aValue);
   }
 }
 
 static void
 StartElement(Element* aContent, StringBuilder& aBuilder)
 {
-  nsIAtom* localName = aContent->Tag();
+  nsIAtom* localName = aContent->NodeInfo()->NameAtom();
   int32_t tagNS = aContent->GetNameSpaceID();
 
   aBuilder.Append("<");
   if (aContent->IsHTMLElement() || aContent->IsSVGElement() ||
       aContent->IsMathMLElement()) {
     aBuilder.Append(localName);
   } else {
     aBuilder.Append(aContent->NodeName());
@@ -2536,17 +2536,17 @@ ShouldEscape(nsIContent* aParent)
   static bool sInitialized = false;
   if (!sInitialized) {
     sInitialized = true;
     for (uint32_t i = 0; i < ArrayLength(nonEscapingElements); ++i) {
       sFilter.add(nonEscapingElements[i]);
     }
   }
 
-  nsIAtom* tag = aParent->Tag();
+  nsIAtom* tag = aParent->NodeInfo()->NameAtom();
   if (sFilter.mightContain(tag)) {
     for (uint32_t i = 0; i < ArrayLength(nonEscapingElements); ++i) {
       if (tag == nonEscapingElements[i]) {
         return false;
       }
     }
   }
   return true;
@@ -2585,17 +2585,17 @@ IsVoidTag(nsIAtom* aTag)
 }
 
 static inline bool
 IsVoidTag(Element* aElement)
 {
   if (!aElement->IsHTMLElement()) {
     return false;
   }
-  return IsVoidTag(aElement->Tag());
+  return IsVoidTag(aElement->NodeInfo()->NameAtom());
 }
 
 /* static */
 bool
 FragmentOrElement::IsHTMLVoid(nsIAtom* aLocalName)
 {
   return aLocalName && IsVoidTag(aLocalName);
 }
@@ -2664,17 +2664,17 @@ Serialize(FragmentOrElement* aRoot, bool
     }
 
     while (true) {
       if (!isVoid && current->NodeType() == nsIDOMNode::ELEMENT_NODE) {
         builder.Append("</");
         nsIContent* elem = static_cast<nsIContent*>(current);
         if (elem->IsHTMLElement() || elem->IsSVGElement() ||
             elem->IsMathMLElement()) {
-          builder.Append(elem->Tag());
+          builder.Append(elem->NodeInfo()->NameAtom());
         } else {
           builder.Append(current->NodeName());
         }
         builder.Append(">");
       }
       isVoid = false;
 
       if (current == aRoot) {
@@ -2835,23 +2835,23 @@ FragmentOrElement::SetInnerHTMLInternal(
   nsAutoMutationBatch mb(target, true, false);
   for (uint32_t i = 0; i < childCount; ++i) {
     target->RemoveChildAt(0, true);
   }
   mb.RemovalDone();
 
   nsAutoScriptLoaderDisabler sld(doc);
 
-  nsIAtom* contextLocalName = Tag();
+  nsIAtom* contextLocalName = NodeInfo()->NameAtom();
   int32_t contextNameSpaceID = GetNameSpaceID();
 
   ShadowRoot* shadowRoot = ShadowRoot::FromNode(this);
   if (shadowRoot) {
     // Fix up the context to be the host of the ShadowRoot.
-    contextLocalName = shadowRoot->GetHost()->Tag();
+    contextLocalName = shadowRoot->GetHost()->NodeInfo()->NameAtom();
     contextNameSpaceID = shadowRoot->GetHost()->GetNameSpaceID();
   }
 
   if (doc->IsHTMLDocument()) {
     int32_t oldChildCount = target->GetChildCount();
     aError = nsContentUtils::ParseFragmentHTML(aInnerHTML,
                                                target,
                                                contextLocalName,
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -2541,17 +2541,18 @@ nsContentUtils::GenerateStateKey(nsICont
     }
   }
 
   if (!generatedUniqueKey) {
     // Either we didn't have a form control or we aren't in an HTML document so
     // we can't figure out form info.  Append the tag name if it's an element
     // to avoid restoring state for one type of element on another type.
     if (aContent->IsElement()) {
-      KeyAppendString(nsDependentAtomString(aContent->Tag()), aKey);
+      KeyAppendString(nsDependentAtomString(aContent->NodeInfo()->NameAtom()),
+                      aKey);
     }
     else {
       // Append a character that is not "d" or "f" to disambiguate from
       // the case when we were a form control in an HTML document.
       KeyAppendString(NS_LITERAL_CSTRING("o"), aKey);
     }
 
     // Now start at aContent and append the indices of it and all its ancestors
@@ -4117,17 +4118,17 @@ nsContentUtils::CreateContextualFragment
       if (contextAsContent && !contextAsContent->IsElement()) {
         // can this even happen?
         contextAsContent = nullptr;
       }
     }
     
     if (contextAsContent && !contextAsContent->IsHTMLElement(nsGkAtoms::html)) {
       aRv = ParseFragmentHTML(aFragment, frag,
-                              contextAsContent->Tag(),
+                              contextAsContent->NodeInfo()->NameAtom(),
                               contextAsContent->GetNameSpaceID(),
                               (document->GetCompatibilityMode() ==
                                eCompatibility_NavQuirks),
                               aPreventScriptExecution);
     } else {
       aRv = ParseFragmentHTML(aFragment, frag,
                               nsGkAtoms::body,
                               kNameSpaceID_XHTML,
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1655,26 +1655,24 @@ nsDOMWindowUtils::GetTranslationNodes(ns
   // We begin iteration with content->GetNextNode because we want to explictly
   // skip the root tag from being a translation node.
   nsIContent* content = root;
   while ((limit > 0) && (content = content->GetNextNode(root))) {
     if (!content->IsHTMLElement()) {
       continue;
     }
 
-    nsIAtom* localName = content->Tag();
-
     // Skip elements that usually contain non-translatable text content.
-    if (localName == nsGkAtoms::script ||
-        localName == nsGkAtoms::iframe ||
-        localName == nsGkAtoms::frameset ||
-        localName == nsGkAtoms::frame ||
-        localName == nsGkAtoms::code ||
-        localName == nsGkAtoms::noscript ||
-        localName == nsGkAtoms::style) {
+    if (content->IsAnyOfHTMLElements(nsGkAtoms::script,
+                                     nsGkAtoms::iframe,
+                                     nsGkAtoms::frameset,
+                                     nsGkAtoms::frame,
+                                     nsGkAtoms::code,
+                                     nsGkAtoms::noscript,
+                                     nsGkAtoms::style)) {
       continue;
     }
 
     // An element is a translation node if it contains
     // at least one text node that has meaningful data
     // for translation
     for (nsIContent* child = content->GetFirstChild();
          child;
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5519,17 +5519,17 @@ void
 nsDocument::SetupCustomElement(Element* aElement,
                                uint32_t aNamespaceID,
                                const nsAString* aTypeExtension)
 {
   if (!mRegistry) {
     return;
   }
 
-  nsCOMPtr<nsIAtom> tagAtom = aElement->Tag();
+  nsCOMPtr<nsIAtom> tagAtom = aElement->NodeInfo()->NameAtom();
   nsCOMPtr<nsIAtom> typeAtom = aTypeExtension ?
     do_GetAtom(*aTypeExtension) : tagAtom;
 
   if (aTypeExtension && !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::is)) {
     // Custom element setup in the parser happens after the "is"
     // attribute is added.
     aElement->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *aTypeExtension, true);
   }
@@ -6347,17 +6347,17 @@ nsDocument::RegisterElement(JSContext* a
     for (size_t i = 0; i < candidates->Length(); ++i) {
       Element *elem = candidates->ElementAt(i);
 
       elem->RemoveStates(NS_EVENT_STATE_UNRESOLVED);
 
       // Make sure that the element name matches the name in the definition.
       // (e.g. a definition for x-button extending button should match
       // <button is="x-button"> but not <x-button>.
-      if (elem->Tag() != nameAtom) {
+      if (elem->NodeInfo()->NameAtom() != nameAtom) {
         //Skip over this element because definition does not apply.
         continue;
       }
 
       MOZ_ASSERT(elem->IsHTML(nameAtom));
       nsWrapperCache* cache;
       CallQueryInterface(elem, &cache);
       MOZ_ASSERT(cache, "Element doesn't support wrapper cache?");
@@ -7096,17 +7096,17 @@ nsDocument::GetTitle(nsString& aTitle)
 
   switch (rootElement->GetNameSpaceID()) {
 #ifdef MOZ_XUL
     case kNameSpaceID_XUL:
       rootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, tmp);
       break;
 #endif
     case kNameSpaceID_SVG:
-      if (rootElement->Tag() == nsGkAtoms::svg) {
+      if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
         GetTitleFromElement(kNameSpaceID_SVG, tmp);
         break;
       } // else fall through
     default:
       GetTitleFromElement(kNameSpaceID_XHTML, tmp);
       break;
   }
 
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -539,17 +539,17 @@ nsDocumentEncoder::SerializeToStringIter
   }
 
   return NS_OK;
 }
 
 bool 
 nsDocumentEncoder::IsTag(nsIContent* aContent, nsIAtom* aAtom)
 {
-  return aContent && aContent->Tag() == aAtom;
+  return aContent && aContent->NodeInfo()->NameAtom() == aAtom;
 }
 
 static nsresult
 ConvertAndWrite(const nsAString& aString,
                 nsIOutputStream* aStream,
                 nsIUnicodeEncoder* aEncoder)
 {
   NS_ENSURE_ARG_POINTER(aStream);
@@ -1373,19 +1373,17 @@ nsHTMLCopyEncoder::SetSelection(nsISelec
   // confused if mIsTextWidget ends up becoming true, so for now we skip
   // this logic in Thunderbird.
 #ifndef MOZ_THUNDERBIRD
   for (nsCOMPtr<nsIContent> selContent(do_QueryInterface(commonParent));
        selContent;
        selContent = selContent->GetParent())
   {
     // checking for selection inside a plaintext form widget
-    nsIAtom *atom = selContent->Tag();
-    if (atom == nsGkAtoms::input ||
-        atom == nsGkAtoms::textarea)
+    if (selContent->IsAnyOfHTMLElements(nsGkAtoms::input, nsGkAtoms::textarea))
     {
       mIsTextWidget = true;
       break;
     }
     else if (selContent->IsElement()) {
       nsRefPtr<nsStyleContext> styleContext =
         nsComputedDOMStyle::GetStyleContextForElementNoFlush(selContent->AsElement(),
                                                              nullptr, nullptr);
@@ -1516,44 +1514,42 @@ nsHTMLCopyEncoder::EncodeToStringWithCon
 bool
 nsHTMLCopyEncoder::IncludeInContext(nsINode *aNode)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
 
   if (!content)
     return false;
 
-  nsIAtom *tag = content->Tag();
-
-  return (tag == nsGkAtoms::b        ||
-          tag == nsGkAtoms::i        ||
-          tag == nsGkAtoms::u        ||
-          tag == nsGkAtoms::a        ||
-          tag == nsGkAtoms::tt       ||
-          tag == nsGkAtoms::s        ||
-          tag == nsGkAtoms::big      ||
-          tag == nsGkAtoms::small    ||
-          tag == nsGkAtoms::strike   ||
-          tag == nsGkAtoms::em       ||
-          tag == nsGkAtoms::strong   ||
-          tag == nsGkAtoms::dfn      ||
-          tag == nsGkAtoms::code     ||
-          tag == nsGkAtoms::cite     ||
-          tag == nsGkAtoms::var      ||
-          tag == nsGkAtoms::abbr     ||
-          tag == nsGkAtoms::font     ||
-          tag == nsGkAtoms::script   ||
-          tag == nsGkAtoms::span     ||
-          tag == nsGkAtoms::pre      ||
-          tag == nsGkAtoms::h1       ||
-          tag == nsGkAtoms::h2       ||
-          tag == nsGkAtoms::h3       ||
-          tag == nsGkAtoms::h4       ||
-          tag == nsGkAtoms::h5       ||
-          tag == nsGkAtoms::h6);
+  return content->IsAnyOfHTMLElements(nsGkAtoms::b,
+                                      nsGkAtoms::i,
+                                      nsGkAtoms::u,
+                                      nsGkAtoms::a,
+                                      nsGkAtoms::tt,
+                                      nsGkAtoms::s,
+                                      nsGkAtoms::big,
+                                      nsGkAtoms::small,
+                                      nsGkAtoms::strike,
+                                      nsGkAtoms::em,
+                                      nsGkAtoms::strong,
+                                      nsGkAtoms::dfn,
+                                      nsGkAtoms::code,
+                                      nsGkAtoms::cite,
+                                      nsGkAtoms::var,
+                                      nsGkAtoms::abbr,
+                                      nsGkAtoms::font,
+                                      nsGkAtoms::script,
+                                      nsGkAtoms::span,
+                                      nsGkAtoms::pre,
+                                      nsGkAtoms::h1,
+                                      nsGkAtoms::h2,
+                                      nsGkAtoms::h3,
+                                      nsGkAtoms::h4,
+                                      nsGkAtoms::h5,
+                                      nsGkAtoms::h6);
 }
 
 
 nsresult 
 nsHTMLCopyEncoder::PromoteRange(nsIDOMRange *inRange)
 {
   if (!inRange) return NS_ERROR_NULL_POINTER;
   nsresult rv;
@@ -1707,20 +1703,21 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endp
       nsIParserService *parserService = nsContentUtils::GetParserService();
       if (!parserService)
         return NS_ERROR_OUT_OF_MEMORY;
       while ((IsFirstNode(node)) && (!IsRoot(parent)) && (parent != common))
       {
         if (bResetPromotion)
         {
           nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
-          if (content)
+          if (content && content->IsHTMLElement())
           {
             bool isBlock = false;
-            parserService->IsBlock(parserService->HTMLAtomTagToId(content->Tag()), isBlock);
+            parserService->IsBlock(parserService->HTMLAtomTagToId(
+                                     content->NodeInfo()->NameAtom()), isBlock);
             if (isBlock)
             {
               bResetPromotion = false;
             }
           }   
         }
          
         node = parent;
@@ -1789,20 +1786,21 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endp
       nsIParserService *parserService = nsContentUtils::GetParserService();
       if (!parserService)
         return NS_ERROR_OUT_OF_MEMORY;
       while ((IsLastNode(node)) && (!IsRoot(parent)) && (parent != common))
       {
         if (bResetPromotion)
         {
           nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
-          if (content)
+          if (content && content->IsHTMLElement())
           {
             bool isBlock = false;
-            parserService->IsBlock(parserService->HTMLAtomTagToId(content->Tag()), isBlock);
+            parserService->IsBlock(parserService->HTMLAtomTagToId(
+                                     content->NodeInfo()->NameAtom()), isBlock);
             if (isBlock)
             {
               bResetPromotion = false;
             }
           }   
         }
           
         node = parent;
@@ -2010,21 +2008,21 @@ nsHTMLCopyEncoder::GetImmediateContextCo
 {
   int32_t i = aAncestorArray.Length(), j = 0;
   while (j < i) {
     nsINode *node = aAncestorArray.ElementAt(j);
     if (!node) {
       break;
     }
     nsCOMPtr<nsIContent> content(do_QueryInterface(node));
-    if (!content || !content->IsHTMLElement() ||
-        (content->Tag() != nsGkAtoms::tr    &&
-         content->Tag() != nsGkAtoms::thead &&
-         content->Tag() != nsGkAtoms::tbody &&
-         content->Tag() != nsGkAtoms::tfoot &&
-         content->Tag() != nsGkAtoms::table)) {
+    if (!content ||
+        !content->IsAnyOfHTMLElements(nsGkAtoms::tr,
+                                      nsGkAtoms::thead,
+                                      nsGkAtoms::tbody,
+                                      nsGkAtoms::tfoot,
+                                      nsGkAtoms::table)) {
       break;
     }
     ++j;
   }
   return j;
 }
 
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -79,17 +79,17 @@ PRLogModuleInfo* gFocusNavigationLog;
 
 #define LOGFOCUS(args) PR_LOG(gFocusLog, 4, args)
 #define LOGFOCUSNAVIGATION(args) PR_LOG(gFocusNavigationLog, 4, args)
 
 #define LOGTAG(log, format, content)                            \
   {                                                             \
     nsAutoCString tag(NS_LITERAL_CSTRING("(none)"));            \
     if (content) {                                              \
-      content->Tag()->ToUTF8String(tag);                        \
+      content->NodeInfo()->NameAtom()->ToUTF8String(tag);       \
     }                                                           \
     PR_LOG(log, 4, (format, tag.get()));                        \
   }
 
 #define LOGCONTENT(format, content) LOGTAG(gFocusLog, format, content)
 #define LOGCONTENTNAVIGATION(format, content) LOGTAG(gFocusNavigationLog, format, content)
 
 #else
@@ -323,25 +323,25 @@ nsFocusManager::GetRedirectedFocus(nsICo
     if (textbox) {
       textbox->GetInputField(getter_AddRefs(inputField));
     }
     else {
       nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aContent);
       if (menulist) {
         menulist->GetInputField(getter_AddRefs(inputField));
       }
-      else if (aContent->Tag() == nsGkAtoms::scale) {
+      else if (aContent->IsXULElement(nsGkAtoms::scale)) {
         nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
         if (!doc)
           return nullptr;
 
         nsINodeList* children = doc->BindingManager()->GetAnonymousNodesFor(aContent);
         if (children) {
           nsIContent* child = children->Item(0);
-          if (child && child->Tag() == nsGkAtoms::slider)
+          if (child && child->IsXULElement(nsGkAtoms::slider))
             return child;
         }
       }
     }
 
     if (inputField) {
       nsCOMPtr<nsIContent> retval = do_QueryInterface(inputField);
       return retval;
@@ -1547,17 +1547,17 @@ nsFocusManager::CheckIfFocusable(nsICont
   }
 
   nsIFrame* frame = aContent->GetPrimaryFrame();
   if (!frame) {
     LOGCONTENT("Cannot focus %s as it has no frame", aContent)
     return nullptr;
   }
 
-  if (aContent->Tag() == nsGkAtoms::area && aContent->IsHTMLElement()) {
+  if (aContent->IsHTMLElement(nsGkAtoms::area)) {
     // HTML areas do not have their own frame, and the img frame we get from
     // GetPrimaryFrame() is not relevant as to whether it is focusable or
     // not, so we have to do all the relevant checks manually for them.
     return frame->IsVisibleConsideringAncestors() &&
            aContent->IsFocusable() ? aContent : nullptr;
   }
 
   // if this is a child frame content node, check if it is visible and
@@ -2498,18 +2498,17 @@ nsFocusManager::DetermineElementToMoveFo
   // when a popup is open, we want to ensure that tab navigation occurs only
   // within the most recently opened panel. If a popup is open, its frame will
   // be stored in popupFrame.
   nsIFrame* popupFrame = nullptr;
 
   int32_t tabIndex = forward ? 1 : 0;
   if (startContent) {
     nsIFrame* frame = startContent->GetPrimaryFrame();
-    if (startContent->Tag() == nsGkAtoms::area &&
-        startContent->IsHTMLElement())
+    if (startContent->IsHTMLElement(nsGkAtoms::area))
       startContent->IsFocusable(&tabIndex);
     else if (frame)
       frame->IsFocusable(&tabIndex, 0);
     else
       startContent->IsFocusable(&tabIndex);
 
     // if the current element isn't tabbable, ignore the tabindex and just
     // look for the next element. The root content won't have a tabindex
@@ -2807,18 +2806,18 @@ nsFocusManager::GetNextTabbableContent(n
     if (iterStartContent == aRootContent) {
       if (!aForward) {
         frameTraversal->Last();
       } else if (aRootContent->IsFocusable()) {
         frameTraversal->Next();
       }
     }
     else if (getNextFrame &&
-             (!iterStartContent || iterStartContent->Tag() != nsGkAtoms::area ||
-              !iterStartContent->IsHTMLElement())) {
+             (!iterStartContent ||
+              !iterStartContent->IsHTMLElement(nsGkAtoms::area))) {
       // Need to do special check in case we're in an imagemap which has multiple
       // content nodes per frame, so don't skip over the starting frame.
       if (aForward)
         frameTraversal->Next();
       else
         frameTraversal->Prev();
     }
 
@@ -2837,17 +2836,17 @@ nsFocusManager::GetNextTabbableContent(n
       frame->IsFocusable(&tabIndex, 0);
 
       LOGCONTENTNAVIGATION("Next Tabbable %s:", frame->GetContent());
       LOGFOCUSNAVIGATION(("  with tabindex: %d expected: %d", tabIndex, aCurrentTabIndex));
 
       nsIContent* currentContent = frame->GetContent();
       if (tabIndex >= 0) {
         NS_ASSERTION(currentContent, "IsFocusable set a tabindex for a frame with no content");
-        if (currentContent->Tag() == nsGkAtoms::img &&
+        if (currentContent->IsHTMLElement(nsGkAtoms::img) &&
             currentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::usemap)) {
           // This is an image with a map. Image map areas are not traversed by
           // nsIFrameTraversal so look for the next or previous area element.
           nsIContent *areaContent =
             GetNextTabbableMapArea(aForward, aCurrentTabIndex,
                                    currentContent, iterStartContent);
           if (areaContent) {
             NS_ADDREF(*aResultContent = areaContent);
@@ -3070,17 +3069,17 @@ nsFocusManager::GetRootForFocus(nsPIDOMW
                                 bool aCheckVisibility)
 {
   // the root element's canvas may be focused as long as the document is in a
   // a non-chrome shell and does not contain a frameset.
   if (aIsForDocNavigation) {
     nsCOMPtr<Element> docElement = aWindow->GetFrameElementInternal();
     // document navigation skips iframes and frames that are specifically non-focusable
     if (docElement) {
-      if (docElement->Tag() == nsGkAtoms::iframe)
+      if (docElement->NodeInfo()->NameAtom() == nsGkAtoms::iframe)
         return nullptr;
 
       nsIFrame* frame = docElement->GetPrimaryFrame();
       if (!frame || !frame->IsFocusable(nullptr, 0))
         return nullptr;
     }
   } else {
     nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
@@ -3223,17 +3222,17 @@ nsFocusManager::GetNextTabbablePanel(nsI
       // wait until the currently focused popup is found. Once found, the
       // current popup will be cleared so that the next popup is used.
       if (aCurrentPopup == popupFrame)
         aCurrentPopup = nullptr;
       continue;
     }
 
     // Skip over non-panels
-    if (popupFrame->GetContent()->Tag() != nsGkAtoms::panel ||
+    if (!popupFrame->GetContent()->IsXULElement(nsGkAtoms::panel) ||
         (aDocument && popupFrame->GetContent()->GetComposedDoc() != aDocument)) {
       continue;
     }
 
     // Find the first focusable content within the popup. If there isn't any
     // focusable content in the popup, skip to the next popup.
     nsIPresShell* presShell = popupFrame->PresContext()->GetPresShell();
     if (presShell) {
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1809,17 +1809,17 @@ nsFrameLoader::MaybeCreateDocShell()
   return NS_OK;
 }
 
 void
 nsFrameLoader::GetURL(nsString& aURI)
 {
   aURI.Truncate();
 
-  if (mOwnerContent->Tag() == nsGkAtoms::object) {
+  if (mOwnerContent->IsHTMLElement(nsGkAtoms::object)) {
     mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, aURI);
   } else {
     mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, aURI);
   }
 }
 
 nsresult
 nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
--- a/dom/base/nsHTMLContentSerializer.cpp
+++ b/dom/base/nsHTMLContentSerializer.cpp
@@ -182,17 +182,17 @@ nsHTMLContentSerializer::AppendElementSt
 
   nsIContent* content = aElement;
 
   bool forceFormat = false;
   if (!CheckElementStart(content, forceFormat, aStr)) {
     return NS_OK;
   }
 
-  nsIAtom *name = content->Tag();
+  nsIAtom *name = content->NodeInfo()->NameAtom();
   int32_t ns = content->GetNameSpaceID();
 
   bool lineBreakBeforeOpen = LineBreakBeforeOpen(ns, name);
 
   if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
     if (mColPos && lineBreakBeforeOpen) {
       AppendNewLineToString(aStr);
     }
@@ -293,17 +293,17 @@ nsHTMLContentSerializer::AppendElementSt
 NS_IMETHODIMP 
 nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
                                           nsAString& aStr)
 {
   NS_ENSURE_ARG(aElement);
 
   nsIContent* content = aElement;
 
-  nsIAtom *name = content->Tag();
+  nsIAtom *name = content->NodeInfo()->NameAtom();
   int32_t ns = content->GetNameSpaceID();
 
   if (ns == kNameSpaceID_XHTML &&
       (name == nsGkAtoms::script ||
        name == nsGkAtoms::style ||
        name == nsGkAtoms::noscript ||
        name == nsGkAtoms::noframes)) {
     --mDisableEntityEncoding;
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -1667,17 +1667,17 @@ bool IsAllowedAsChild(nsIContent* aNewCh
   // aParent can't be a descendant of aNewChild unless they're
   // actually equal to each other.  Fast-path that case, since aParent
   // could be pretty deep in the DOM tree.
   if (aNewChild == aParent ||
       ((aNewChild->GetFirstChild() ||
         // HTML template elements and ShadowRoot hosts need
         // to be checked to ensure that they are not inserted into
         // the hosted content.
-        aNewChild->Tag() == nsGkAtoms::_template ||
+        aNewChild->NodeInfo()->NameAtom() == nsGkAtoms::_template ||
         aNewChild->GetShadowRoot()) &&
        nsContentUtils::ContentIsHostIncludingDescendantOf(aParent,
                                                           aNewChild))) {
     return false;
   }
 
   // The allowed child nodes differ for documents and elements
   switch (aNewChild->NodeType()) {
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -1012,17 +1012,17 @@ nsObjectLoadingContent::BuildParametersA
     mCachedAttributes.AppendElement(param);
   }
 
   // Some plugins were never written to understand the "data" attribute of the OBJECT tag.
   // Real and WMP will not play unless they find a "src" attribute, see bug 152334.
   // Nav 4.x would simply replace the "data" with "src". Because some plugins correctly
   // look for "data", lets instead copy the "data" attribute and add another entry
   // to the bottom of the array if there isn't already a "src" specified.
-  if (content->Tag() == nsGkAtoms::object &&
+  if (content->IsHTMLElement(nsGkAtoms::object) &&
       !content->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
     MozPluginParameter param;
     content->GetAttr(kNameSpaceID_None, nsGkAtoms::data, param.mValue);
     if (!param.mValue.IsEmpty()) {
       param.mName = NS_LITERAL_STRING("SRC");
       mCachedAttributes.AppendElement(param);
     }
   }
@@ -2896,17 +2896,17 @@ nsObjectLoadingContent::LoadFallback(Fal
   NS_ASSERTION(thisContent, "must be a content");
 
   if (!thisContent->IsHTMLElement() || mContentType.IsEmpty()) {
     // Don't let custom fallback handlers run outside HTML, tags without a
     // determined type should always just be alternate content
     aType = eFallbackAlternate;
   }
 
-  if (thisContent->Tag() == nsGkAtoms::object &&
+  if (thisContent->IsHTMLElement(nsGkAtoms::object) &&
       (aType == eFallbackUnsupported ||
        aType == eFallbackDisabled ||
        aType == eFallbackBlocklisted))
   {
     // Show alternate content instead, if it exists
     for (nsIContent* child = thisContent->GetFirstChild();
          child; child = child->GetNextSibling()) {
       if (!child->IsHTMLElement(nsGkAtoms::param) &&
--- a/dom/base/nsPlainTextSerializer.cpp
+++ b/dom/base/nsPlainTextSerializer.cpp
@@ -426,17 +426,17 @@ nsPlainTextSerializer::AppendDocumentSta
   return NS_OK;
 }
 
 nsresult
 nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
 {
   // Check if we need output current node as placeholder character and ignore
   // child nodes.
-  if (ShouldReplaceContainerWithPlaceholder(mElement->Tag())) {
+  if (ShouldReplaceContainerWithPlaceholder(mElement->NodeInfo()->NameAtom())) {
     if (mIgnoredChildNodeLevel == 0) {
       // Serialize current node as placeholder character
       Write(NS_LITERAL_STRING("\xFFFC"));
     }
     // Ignore child nodes.
     mIgnoredChildNodeLevel++;
     return NS_OK;
   }
@@ -771,17 +771,17 @@ nsPlainTextSerializer::DoOpenContainer(n
   mInWhitespace = true;
 
   return NS_OK;
 }
 
 nsresult
 nsPlainTextSerializer::DoCloseContainer(nsIAtom* aTag)
 {
-  if (ShouldReplaceContainerWithPlaceholder(mElement->Tag())) {
+  if (ShouldReplaceContainerWithPlaceholder(mElement->NodeInfo()->NameAtom())) {
     mIgnoredChildNodeLevel--;
     return NS_OK;
   }
 
   if (mFlags & nsIDocumentEncoder::OutputForPlainTextClipboardCopy) {
     if (DoOutput() && IsInPre() && IsElementBlock(mElement)) {
       // If we're closing a preformatted block element, output a line break
       // when we find a new container.
@@ -1772,17 +1772,17 @@ nsPlainTextSerializer::IsCurrentNodeConv
 // static
 nsIAtom*
 nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
 {
   if (!aContent->IsHTMLElement()) {
     return nullptr;
   }
 
-  nsIAtom* localName = aContent->Tag();
+  nsIAtom* localName = aContent->NodeInfo()->NameAtom();
   return localName->IsStaticAtom() ? localName : nullptr;
 }
 
 bool
 nsPlainTextSerializer::IsInPre()
 {
   return !mPreformatStack.empty() && mPreformatStack.top();
 }
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -1056,21 +1056,22 @@ nsRange::GetCommonAncestorContainer(nsID
 nsINode*
 nsRange::IsValidBoundary(nsINode* aNode)
 {
   if (!aNode) {
     return nullptr;
   }
 
   if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
-    nsIContent* content = static_cast<nsIContent*>(aNode);
-    if (content->Tag() == nsGkAtoms::documentTypeNodeName) {
+    if (aNode->NodeInfo()->NameAtom() == nsGkAtoms::documentTypeNodeName) {
       return nullptr;
     }
 
+    nsIContent* content = static_cast<nsIContent*>(aNode);
+
     if (!mMaySpanAnonymousSubtrees) {
       // If the node is in a shadow tree then the ShadowRoot is the root.
       ShadowRoot* containingShadow = content->GetContainingShadow();
       if (containingShadow) {
         return containingShadow;
       }
 
       // If the node has a binding parent, that should be the root.
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -400,17 +400,17 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
   bool doneLoading = false;
   nsresult rv = NS_OK;
   if (isInline) {
     nsAutoString text;
     if (!nsContentUtils::GetNodeTextContent(thisContent, false, text)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
-    MOZ_ASSERT(thisContent->Tag() != nsGkAtoms::link,
+    MOZ_ASSERT(thisContent->NodeInfo()->NameAtom() != nsGkAtoms::link,
                "<link> is not 'inline', and needs different CSP checks");
     if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent,
                                            thisContent->NodePrincipal(),
                                            doc->GetDocumentURI(),
                                            mLineNumber, text, &rv))
       return rv;
 
     // Parse the style sheet.
--- a/dom/base/nsXHTMLContentSerializer.cpp
+++ b/dom/base/nsXHTMLContentSerializer.cpp
@@ -449,20 +449,18 @@ nsXHTMLContentSerializer::AppendEndOfEle
   AppendToString(kGreaterThan, aStr);
 }
 
 void
 nsXHTMLContentSerializer::AfterElementStart(nsIContent * aContent,
                                             nsIContent *aOriginalElement,
                                             nsAString& aStr)
 {
-  nsIAtom *name = aContent->Tag();
-  if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
-      mRewriteEncodingDeclaration &&
-      name == nsGkAtoms::head) {
+  if (mRewriteEncodingDeclaration &&
+      aContent->IsHTMLElement(nsGkAtoms::head)) {
 
     // Check if there already are any content-type meta children.
     // If there are, they will be modified to use the correct charset.
     // If there aren't, we'll insert one here.
     bool hasMeta = false;
     for (nsIContent* child = aContent->GetFirstChild();
          child;
          child = child->GetNextSibling()) {
@@ -496,22 +494,19 @@ nsXHTMLContentSerializer::AfterElementSt
 }
 
 void
 nsXHTMLContentSerializer::AfterElementEnd(nsIContent * aContent,
                                           nsAString& aStr)
 {
   NS_ASSERTION(!mIsHTMLSerializer, "nsHTMLContentSerializer shouldn't call this method !");
 
-  int32_t namespaceID = aContent->GetNameSpaceID();
-  nsIAtom *name = aContent->Tag();
-
   // this method is not called by nsHTMLContentSerializer
   // so we don't have to check HTML element, just XHTML
-  if (kNameSpaceID_XHTML == namespaceID && name == nsGkAtoms::body) {
+  if (aContent->IsHTMLElement(nsGkAtoms::body)) {
     --mInBody;
   }
 }
 
 
 NS_IMETHODIMP
 nsXHTMLContentSerializer::AppendDocumentStart(nsIDocument *aDocument,
                                               nsAString& aStr)
@@ -528,67 +523,61 @@ nsXHTMLContentSerializer::CheckElementSt
                                             nsAString& aStr)
 {
   // The _moz_dirty attribute is emitted by the editor to
   // indicate that this element should be pretty printed
   // even if we're not in pretty printing mode
   aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
                  aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
 
-  nsIAtom *name = aContent->Tag();
-  int32_t namespaceID = aContent->GetNameSpaceID();
+  if (aContent->IsHTMLElement(nsGkAtoms::br) &&
+      (mFlags & nsIDocumentEncoder::OutputNoFormattingInPre) &&
+      PreLevel() > 0) {
+    AppendNewLineToString(aStr);
+    return false;
+  }
 
-  if (namespaceID == kNameSpaceID_XHTML) {
-    if (name == nsGkAtoms::br &&
-        (mFlags & nsIDocumentEncoder::OutputNoFormattingInPre) &&
-        PreLevel() > 0) {
-      AppendNewLineToString(aStr);
-      return false;
-    }
+  if (aContent->IsHTMLElement(nsGkAtoms::body)) {
+    ++mInBody;
+  }
 
-    if (name == nsGkAtoms::body) {
-      ++mInBody;
-    }
-  }
   return true;
 }
 
 bool
 nsXHTMLContentSerializer::CheckElementEnd(nsIContent * aContent,
                                           bool & aForceFormat,
                                           nsAString& aStr)
 {
   NS_ASSERTION(!mIsHTMLSerializer, "nsHTMLContentSerializer shouldn't call this method !");
 
   aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
                  aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
 
-  nsIAtom *name = aContent->Tag();
-  int32_t namespaceID = aContent->GetNameSpaceID();
-
   // this method is not called by nsHTMLContentSerializer
   // so we don't have to check HTML element, just XHTML
-  if (namespaceID == kNameSpaceID_XHTML) {
-    if (mIsCopying && name == nsGkAtoms::ol) {
+  if (aContent->IsHTMLElement()) {
+    if (mIsCopying && aContent->IsHTMLElement(nsGkAtoms::ol)) {
       NS_ASSERTION((!mOLStateStack.IsEmpty()), "Cannot have an empty OL Stack");
       /* Though at this point we must always have an state to be deleted as all 
       the OL opening tags are supposed to push an olState object to the stack*/
       if (!mOLStateStack.IsEmpty()) {
         mOLStateStack.RemoveElementAt(mOLStateStack.Length() -1);
       }
     }
 
     if (HasNoChildren(aContent)) {
       nsIParserService* parserService = nsContentUtils::GetParserService();
 
       if (parserService) {
         bool isContainer;
 
         parserService->
-          IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(name),
+          IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(
+                        aContent->NodeInfo()->NameAtom()),
                       isContainer);
         if (!isContainer) {
           // non-container HTML elements are already closed,
           // see AppendEndOfElementStart
           return false;
         }
       }
     }
@@ -842,47 +831,42 @@ nsXHTMLContentSerializer::LineBreakAfter
   return false;
 }
 
 
 void
 nsXHTMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
 {
   if (!ShouldMaintainPreLevel() ||
-      aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
+      !aNode->IsHTMLElement()) {
     return;
   }
 
-  nsIAtom *name = aNode->Tag();
-
   if (IsElementPreformatted(aNode) ||
-      name == nsGkAtoms::script ||
-      name == nsGkAtoms::style ||
-      name == nsGkAtoms::noscript ||
-      name == nsGkAtoms::noframes
-      ) {
+      aNode->IsAnyOfHTMLElements(nsGkAtoms::script,
+                                 nsGkAtoms::style,
+                                 nsGkAtoms::noscript,
+                                 nsGkAtoms::noframes)) {
     PreLevel()++;
   }
 }
 
 void
 nsXHTMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
 {
   if (!ShouldMaintainPreLevel() ||
-      aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
+      !aNode->IsHTMLElement()) {
     return;
   }
 
-  nsIAtom *name = aNode->Tag();
   if (IsElementPreformatted(aNode) ||
-      name == nsGkAtoms::script ||
-      name == nsGkAtoms::style ||
-      name == nsGkAtoms::noscript ||
-      name == nsGkAtoms::noframes
-    ) {
+      aNode->IsAnyOfHTMLElements(nsGkAtoms::script,
+                                 nsGkAtoms::style,
+                                 nsGkAtoms::noscript,
+                                 nsGkAtoms::noframes)) {
     --PreLevel();
   }
 }
 
 bool
 nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode)
 {
   MOZ_ASSERT(ShouldMaintainPreLevel(), "We should not be calling this needlessly");
--- a/dom/base/nsXMLContentSerializer.cpp
+++ b/dom/base/nsXMLContentSerializer.cpp
@@ -890,17 +890,17 @@ nsXMLContentSerializer::AppendElementSta
   nsAutoString tagPrefix, tagLocalName, tagNamespaceURI;
   aElement->NodeInfo()->GetPrefix(tagPrefix);
   aElement->NodeInfo()->GetName(tagLocalName);
   aElement->NodeInfo()->GetNamespaceURI(tagNamespaceURI);
 
   uint32_t skipAttr = ScanNamespaceDeclarations(content,
                           aOriginalElement, tagNamespaceURI);
 
-  nsIAtom *name = content->Tag();
+  nsIAtom *name = content->NodeInfo()->NameAtom();
   bool lineBreakBeforeOpen = LineBreakBeforeOpen(content->GetNameSpaceID(), name);
 
   if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
     if (mColPos && lineBreakBeforeOpen) {
       AppendNewLineToString(aStr);
     }
     else {
       MaybeAddNewlineForRootNode(aStr);
@@ -980,17 +980,17 @@ nsXMLContentSerializer::AppendElementEnd
 {
   NS_ENSURE_ARG(aElement);
 
   nsIContent* content = aElement;
 
   bool forceFormat = false, outputElementEnd;
   outputElementEnd = CheckElementEnd(content, forceFormat, aStr);
 
-  nsIAtom *name = content->Tag();
+  nsIAtom *name = content->NodeInfo()->NameAtom();
 
   if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
     DecrIndentation(name);
   }
 
   if (!outputElementEnd) {
     PopNameSpaceDeclsFor(aElement);
     MaybeFlagNewlineForRootNode(aElement);