Bug 1134280 - Get rid of Tag() - patch 1 - Is{HTML,XUL,MathML,SVG}Element and IsAnyOf{HTML,XUL,MathML,SVG}Elements, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 03 Mar 2015 11:08:59 +0000
changeset 260429 133ec7304f2208e89f02ed943480a1b1f02188c9
parent 260428 3f5ec730b1db907cf4d0ef80f25f054d45b190e1
child 260430 869306cc4c2f124e02124ca1306ecf6e813561da
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
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 1 - Is{HTML,XUL,MathML,SVG}Element and IsAnyOf{HTML,XUL,MathML,SVG}Elements, r=smaug
accessible/base/AccIterator.cpp
accessible/base/TextAttrs.cpp
accessible/base/nsAccessibilityService.cpp
accessible/base/nsTextEquivUtils.cpp
accessible/generic/Accessible-inl.h
accessible/generic/Accessible.cpp
accessible/generic/Accessible.h
accessible/generic/DocAccessible.cpp
accessible/generic/HyperTextAccessible.cpp
accessible/generic/ImageAccessible.cpp
accessible/html/HTMLSelectAccessible.cpp
accessible/html/HTMLTableAccessible.cpp
docshell/base/nsDocShell.cpp
dom/base/Attr.cpp
dom/base/ChildIterator.cpp
dom/base/DirectionalityUtils.cpp
dom/base/Element.cpp
dom/base/Element.h
dom/base/FragmentOrElement.cpp
dom/base/Link.cpp
dom/base/NodeInfo.cpp
dom/base/ShadowRoot.cpp
dom/base/nsCCUncollectableMarker.cpp
dom/base/nsContentList.cpp
dom/base/nsContentUtils.cpp
dom/base/nsCopySupport.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsDocument.cpp
dom/base/nsDocumentEncoder.cpp
dom/base/nsFocusManager.cpp
dom/base/nsFrameLoader.cpp
dom/base/nsFrameLoader.h
dom/base/nsGlobalWindow.cpp
dom/base/nsIContent.h
dom/base/nsIContentInlines.h
dom/base/nsIDocument.h
dom/base/nsINode.cpp
dom/base/nsINode.h
dom/base/nsNodeUtils.cpp
dom/base/nsObjectLoadingContent.cpp
dom/base/nsPlainTextSerializer.cpp
dom/base/nsScriptLoader.cpp
dom/base/nsStyleLinkElement.cpp
dom/base/nsTreeSanitizer.cpp
dom/base/nsXHTMLContentSerializer.cpp
dom/base/nsXMLContentSerializer.cpp
dom/events/ContentEventHandler.cpp
dom/events/EventStateManager.cpp
dom/events/IMEContentObserver.cpp
dom/events/IMEStateManager.cpp
dom/html/HTMLContentElement.cpp
dom/html/HTMLFieldSetElement.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLImageElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLLegendElement.cpp
dom/html/HTMLMediaElement.cpp
dom/html/HTMLOptGroupElement.cpp
dom/html/HTMLOptionElement.cpp
dom/html/HTMLPropertiesCollection.cpp
dom/html/HTMLSelectElement.cpp
dom/html/HTMLShadowElement.cpp
dom/html/HTMLSharedElement.cpp
dom/html/HTMLTableCellElement.cpp
dom/html/HTMLTableElement.cpp
dom/html/HTMLTableElement.h
dom/html/HTMLTableRowElement.cpp
dom/html/ImageDocument.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
dom/html/nsHTMLDocument.cpp
dom/html/nsTextEditorState.cpp
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGContentUtils.cpp
dom/svg/SVGDocument.cpp
dom/svg/SVGFEImageElement.cpp
dom/svg/SVGFEMergeElement.cpp
dom/svg/SVGForeignObjectElement.cpp
dom/svg/SVGFragmentIdentifier.cpp
dom/svg/SVGMPathElement.cpp
dom/svg/SVGMotionSMILAnimationFunction.cpp
dom/svg/SVGSVGElement.cpp
dom/svg/SVGSVGElement.h
dom/svg/SVGUseElement.cpp
dom/svg/SVGZoomEvent.cpp
dom/svg/nsSVGElement.cpp
dom/svg/nsSVGFilters.cpp
dom/svg/nsSVGLength2.cpp
dom/xbl/nsXBLContentSink.cpp
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xbl/nsXBLService.cpp
dom/xml/nsXMLContentSink.cpp
dom/xml/nsXMLFragmentContentSink.cpp
dom/xslt/xpath/XPathEvaluator.cpp
dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
dom/xslt/xpath/txXPathTreeWalker.h
dom/xslt/xslt/txMozillaXMLOutput.cpp
dom/xslt/xslt/txMozillaXSLTProcessor.cpp
dom/xul/nsXULPopupListener.cpp
dom/xul/templates/nsXULContentBuilder.cpp
dom/xul/templates/nsXULSortService.cpp
dom/xul/templates/nsXULTemplateBuilder.cpp
editor/libeditor/nsEditorEventListener.cpp
editor/libeditor/nsHTMLAbsPosition.cpp
editor/libeditor/nsHTMLCSSUtils.cpp
editor/libeditor/nsHTMLEditRules.cpp
editor/libeditor/nsHTMLEditUtils.cpp
editor/libeditor/nsHTMLEditor.cpp
editor/libeditor/nsHTMLEditorStyle.cpp
editor/libeditor/nsPlaintextEditor.cpp
editor/libeditor/nsTableEditor.cpp
editor/libeditor/nsTextEditRules.cpp
editor/libeditor/nsTextEditUtils.cpp
embedding/browser/nsDocShellTreeOwner.cpp
embedding/components/find/nsFind.cpp
embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
image/src/SVGDocumentWrapper.cpp
layout/base/PositionedEventTargeting.cpp
layout/base/RestyleManager.cpp
layout/base/nsBidiPresUtils.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsDisplayList.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/forms/nsSelectsAreaFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFontInflationData.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsImageMap.cpp
layout/generic/nsSelection.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsTextFrame.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/printing/nsPrintEngine.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/style/SVGAttrAnimationRuleProcessor.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsHTMLStyleSheet.cpp
layout/style/nsRuleProcessorData.h
layout/style/nsStyleSet.cpp
layout/svg/SVGFEImageFrame.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/SVGViewFrame.cpp
layout/svg/nsFilterInstance.cpp
layout/svg/nsSVGAFrame.cpp
layout/svg/nsSVGClipPathFrame.cpp
layout/svg/nsSVGContainerFrame.cpp
layout/svg/nsSVGEffects.cpp
layout/svg/nsSVGFilterFrame.cpp
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGGFrame.cpp
layout/svg/nsSVGGradientFrame.cpp
layout/svg/nsSVGImageFrame.cpp
layout/svg/nsSVGInnerSVGFrame.cpp
layout/svg/nsSVGIntegrationUtils.cpp
layout/svg/nsSVGMarkerFrame.cpp
layout/svg/nsSVGMaskFrame.cpp
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGPatternFrame.cpp
layout/svg/nsSVGStopFrame.cpp
layout/svg/nsSVGSwitchFrame.cpp
layout/svg/nsSVGUseFrame.cpp
layout/svg/nsSVGUtils.cpp
layout/xul/nsBox.cpp
layout/xul/nsBoxFrame.cpp
layout/xul/nsListBoxBodyFrame.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeContentView.cpp
parser/html/nsHtml5DocumentBuilder.cpp
parser/html/nsHtml5TreeBuilderCppSupplement.h
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
widget/cocoa/nsMenuBarX.mm
widget/cocoa/nsNativeThemeCocoa.mm
widget/cocoa/nsStandaloneNativeMenu.mm
widget/nsNativeTheme.cpp
widget/windows/nsNativeThemeWin.cpp
xpfe/appshell/nsXULWindow.cpp
--- a/accessible/base/AccIterator.cpp
+++ b/accessible/base/AccIterator.cpp
@@ -150,17 +150,17 @@ HTMLLabelIterator::Next()
     return nullptr;
 
   // Go up tree to get a name of ancestor label if there is one (an ancestor
   // <label> implicitly points to us). Don't go up farther than form or
   // document.
   Accessible* walkUp = mAcc->Parent();
   while (walkUp && !walkUp->IsDoc()) {
     nsIContent* walkUpElm = walkUp->GetContent();
-    if (walkUpElm->IsHTML()) {
+    if (walkUpElm->IsHTMLElement()) {
       if (walkUpElm->Tag() == nsGkAtoms::label &&
           !walkUpElm->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
         mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
         return walkUp;
       }
 
       if (walkUpElm->Tag() == nsGkAtoms::form)
         break;
--- a/accessible/base/TextAttrs.cpp
+++ b/accessible/base/TextAttrs.cpp
@@ -867,17 +867,17 @@ TextAttrsMgr::TextPosTextAttr::
     case eStyleUnit_Turn:
     case eStyleUnit_FlexFraction:
     case eStyleUnit_Integer:
     case eStyleUnit_Calc:
       break;
   }
 
   const nsIContent* content = aFrame->GetContent();
-  if (content && content->IsHTML()) {
+  if (content && content->IsHTMLElement()) {
     const nsIAtom* tagName = content->Tag();
     if (tagName == nsGkAtoms::sup)
       return eTextPosSuper;
     if (tagName == nsGkAtoms::sub)
       return eTextPosSub;
   }
 
   return eTextPosNone;
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -888,25 +888,27 @@ nsAccessibilityService::GetOrCreateAcces
     // elements return the image frame as their primary frame. The main content
     // for the image frame is the image content. If the frame is not an image
     // frame or the node is not an area element then null is returned.
     // This setup will change when bug 135040 is fixed. Make sure we don't
     // create area accessible here. Hopefully assertion below will handle that.
 
 #ifdef DEBUG
   nsImageFrame* imageFrame = do_QueryFrame(frame);
-  NS_ASSERTION(imageFrame && content->IsHTML() && content->Tag() == nsGkAtoms::area,
+  NS_ASSERTION(imageFrame && content->IsHTMLElement() &&
+               content->Tag() == nsGkAtoms::area,
                "Unknown case of not main content for the frame!");
 #endif
     return nullptr;
   }
 
 #ifdef DEBUG
   nsImageFrame* imageFrame = do_QueryFrame(frame);
-  NS_ASSERTION(!imageFrame || !content->IsHTML() || content->Tag() != nsGkAtoms::area,
+  NS_ASSERTION(!imageFrame || !content->IsHTMLElement() ||
+               content->Tag() != nsGkAtoms::area,
                "Image map manages the area accessible creation!");
 #endif
 
   // Attempt to create an accessible based on what we know.
   nsRefPtr<Accessible> newAcc;
 
   // Create accessible for visible text frames.
   if (content->IsNodeOfType(nsINode::eTEXT)) {
@@ -926,17 +928,17 @@ nsAccessibilityService::GetOrCreateAcces
     if (!aContext->IsAcceptableChild(newAcc))
       return nullptr;
 
     document->BindToDocument(newAcc, nullptr);
     newAcc->AsTextLeaf()->SetText(text);
     return newAcc;
   }
 
-  bool isHTML = content->IsHTML();
+  bool isHTML = content->IsHTMLElement();
   if (isHTML && content->Tag() == nsGkAtoms::map) {
     // Create hyper text accessible for HTML map if it is used to group links
     // (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
     // map rect is empty then it is used for links grouping. Otherwise it should
     // be used in conjunction with HTML image element and in this case we don't
     // create any accessible for it and don't walk into it. The accessibles for
     // HTML area (HTMLAreaAccessible) the map contains are attached as
     // children of the appropriate accessible for HTML image
@@ -1016,17 +1018,17 @@ nsAccessibilityService::GetOrCreateAcces
         nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
         if (!contextRoleMap->IsOfType(eList))
           roleMapEntry = &aria::gEmptyRoleMap;
       }
     }
   }
 
   // Accessible XBL types and deck stuff are used in XUL only currently.
-  if (!newAcc && content->IsXUL()) {
+  if (!newAcc && content->IsXULElement()) {
     // No accessible for not selected deck panel and its children.
     if (!aContext->IsXULTabpanels()) {
       nsDeckFrame* deckFrame = do_QueryFrame(frame->GetParent());
       if (deckFrame && deckFrame->GetSelectedBox() != frame) {
         if (aIsSubtreeHidden)
           *aIsSubtreeHidden = true;
 
         return nullptr;
@@ -1045,27 +1047,27 @@ nsAccessibilityService::GetOrCreateAcces
       if (frameType == nsGkAtoms::boxFrame ||
           frameType == nsGkAtoms::scrollFrame) {
         newAcc = new XULTabpanelAccessible(content, document);
       }
     }
   }
 
   if (!newAcc) {
-    if (content->IsSVG()) {
+    if (content->IsSVGElement()) {
       nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
       if (pathGeometryFrame) {
         // A graphic elements: rect, circle, ellipse, line, path, polygon,
         // polyline and image. A 'use' and 'text' graphic elements require
         // special support.
         newAcc = new EnumRoleAccessible(content, document, roles::GRAPHIC);
       } else if (content->Tag() == nsGkAtoms::svg) {
         newAcc = new EnumRoleAccessible(content, document, roles::DIAGRAM);
       }
-    } else if (content->IsMathML()){
+    } else if (content->IsMathMLElement()) {
       if (content->Tag() == nsGkAtoms::math)
         newAcc = new EnumRoleAccessible(content, document, roles::EQUATION);
       else
         newAcc = new HyperTextAccessible(content, document);
     }
   }
 
   // If no accessible, see if we need to create a generic accessible because
@@ -1259,17 +1261,17 @@ nsAccessibilityService::CreateAccessible
   } else if (role.EqualsLiteral("xul:listcell")) {
     // Only create cells if there's more than one per row.
     nsIContent* listItem = aContent->GetParent();
     if (!listItem)
       return nullptr;
 
     for (nsIContent* child = listItem->GetFirstChild(); child;
          child = child->GetNextSibling()) {
-      if (child->IsXUL(nsGkAtoms::listcell) && child != aContent) {
+      if (child->IsXULElement(nsGkAtoms::listcell) && child != aContent) {
         accessible = new XULListCellAccessibleWrap(aContent, aDoc);
         break;
       }
     }
 
   } else if (role.EqualsLiteral("xul:listhead")) {
     accessible = new XULColumAccessible(aContent, aDoc);
 
@@ -1291,17 +1293,17 @@ nsAccessibilityService::CreateAccessible
   } else if (role.EqualsLiteral("xul:menupopup")) {
 #ifdef MOZ_ACCESSIBILITY_ATK
     // ATK considers this node to be redundant when within menubars, and it makes menu
     // navigation with assistive technologies more difficult
     // XXX In the future we will should this for consistency across the nsIAccessible
     // implementations on each platform for a consistent scripting environment, but
     // then strip out redundant accessibles in the AccessibleWrap class for each platform.
     nsIContent *parent = aContent->GetParent();
-    if (parent && parent->IsXUL() && parent->Tag() == nsGkAtoms::menu)
+    if (parent && parent->IsXULElement() && parent->Tag() == nsGkAtoms::menu)
       return nullptr;
 #endif
 
     accessible = new XULMenupopupAccessible(aContent, aDoc);
 
   } else if(role.EqualsLiteral("xul:menuseparator")) {
     accessible = new XULMenuSeparatorAccessible(aContent, aDoc);
 
--- a/accessible/base/nsTextEquivUtils.cpp
+++ b/accessible/base/nsTextEquivUtils.cpp
@@ -148,17 +148,17 @@ nsTextEquivUtils::AppendTextEquivFromTex
       if (isHTMLBlock && !aString->IsEmpty()) {
         aString->Append(char16_t(' '));
       }
     }
     
     return NS_OK;
   }
   
-  if (aContent->IsHTML() &&
+  if (aContent->IsHTMLElement() &&
       aContent->NodeInfo()->Equals(nsGkAtoms::br)) {
     aString->AppendLiteral("\r\n");
     return NS_OK;
   }
   
   return NS_OK_NO_NAME_CLAUSE_HANDLED;
 }
 
@@ -296,17 +296,17 @@ nsresult
 nsTextEquivUtils::AppendFromDOMNode(nsIContent *aContent, nsAString *aString)
 {
   nsresult rv = AppendTextEquivFromTextContent(aContent, aString);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
     return NS_OK;
 
-  if (aContent->IsXUL()) {
+  if (aContent->IsXULElement()) {
     nsAutoString textEquivalent;
     nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl =
       do_QueryInterface(aContent);
 
     if (labeledEl) {
       labeledEl->GetLabel(textEquivalent);
     } else {
       if (aContent->NodeInfo()->Equals(nsGkAtoms::label,
--- a/accessible/generic/Accessible-inl.h
+++ b/accessible/generic/Accessible-inl.h
@@ -43,17 +43,17 @@ Accessible::ARIARole()
 
   return ARIATransformRole(mRoleMapEntry->role);
 }
 
 inline bool
 Accessible::IsSearchbox() const
 {
   return (mRoleMapEntry && mRoleMapEntry->Is(nsGkAtoms::searchbox)) ||
-    (mContent->IsHTML(nsGkAtoms::input) &&
+    (mContent->IsHTMLElement(nsGkAtoms::input) &&
      mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                            nsGkAtoms::textInputType, eCaseMatters));
 }
 
 inline bool
 Accessible::HasGenericType(AccGenericType aType) const
 {
   return (mGenericTypes & aType) ||
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -136,32 +136,32 @@ Accessible::Name(nsString& aName)
       return eNameOK;
   }
 
   ENameValueFlag nameFlag = NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
 
   // In the end get the name from tooltip.
-  if (mContent->IsHTML()) {
+  if (mContent->IsHTMLElement()) {
     if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
       aName.CompressWhitespace();
       return eNameFromTooltip;
     }
-  } else if (mContent->IsXUL()) {
+  } else if (mContent->IsXULElement()) {
     if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
       aName.CompressWhitespace();
       return eNameFromTooltip;
     }
-  } else if (mContent->IsSVG()) {
+  } else if (mContent->IsSVGElement()) {
     // If user agents need to choose among multiple ‘desc’ or ‘title’ elements
     // for processing, the user agent shall choose the first one.
     for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
          childElm = childElm->GetNextSibling()) {
-      if (childElm->IsSVG(nsGkAtoms::desc)) {
+      if (childElm->IsSVGElement(nsGkAtoms::desc)) {
         nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
         return eNameFromTooltip;
       }
     }
   }
 
   if (nameFlag != eNoNameOnPurpose)
     aName.SetIsVoid(true);
@@ -181,37 +181,37 @@ Accessible::Description(nsString& aDescr
   if (!HasOwnContent() || mContent->IsNodeOfType(nsINode::eTEXT))
     return;
 
   nsTextEquivUtils::
     GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
                            aDescription);
 
   if (aDescription.IsEmpty()) {
-    bool isXUL = mContent->IsXUL();
+    bool isXUL = mContent->IsXULElement();
     if (isXUL) {
       // Try XUL <description control="[id]">description text</description>
       XULDescriptionIterator iter(Document(), mContent);
       Accessible* descr = nullptr;
       while ((descr = iter.Next())) {
         nsTextEquivUtils::AppendTextEquivFromContent(this, descr->GetContent(),
                                                      &aDescription);
       }
     }
 
     if (aDescription.IsEmpty()) {
       // Keep the Name() method logic.
-      if (mContent->IsHTML()) {
+      if (mContent->IsHTMLElement()) {
         mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aDescription);
-      } else if (mContent->IsXUL()) {
+      } else if (mContent->IsXULElement()) {
         mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aDescription);
-      } else if (mContent->IsSVG()) {
+      } else if (mContent->IsSVGElement()) {
         for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
              childElm = childElm->GetNextSibling()) {
-          if (childElm->IsSVG(nsGkAtoms::desc)) {
+          if (childElm->IsSVGElement(nsGkAtoms::desc)) {
             nsTextEquivUtils::AppendTextEquivFromContent(this, childElm,
                                                          &aDescription);
             break;
           }
         }
       }
     }
   }
@@ -232,24 +232,24 @@ Accessible::AccessKey() const
   if (!HasOwnContent())
     return KeyBinding();
 
   uint32_t key = nsCoreUtils::GetAccessKeyFor(mContent);
   if (!key && mContent->IsElement()) {
     Accessible* label = nullptr;
 
     // Copy access key from label node.
-    if (mContent->IsHTML()) {
+    if (mContent->IsHTMLElement()) {
       // Unless it is labeled via an ancestor <label>, in which case that would
       // be redundant.
       HTMLLabelIterator iter(Document(), this,
                              HTMLLabelIterator::eSkipAncestorLabel);
       label = iter.Next();
 
-    } else if (mContent->IsXUL()) {
+    } else if (mContent->IsXULElement()) {
       XULLabelIterator iter(Document(), mContent);
       label = iter.Next();
     }
 
     if (label)
       key = nsCoreUtils::GetAccessKeyFor(label->GetContent());
   }
 
@@ -349,17 +349,17 @@ Accessible::VisibilityState()
     if (nsLayoutUtils::IsPopup(curFrame))
       return 0;
 
     // Offscreen state for background tab content and invisible for not selected
     // deck panel.
     nsIFrame* parentFrame = curFrame->GetParent();
     nsDeckFrame* deckFrame = do_QueryFrame(parentFrame);
     if (deckFrame && deckFrame->GetSelectedBox() != curFrame) {
-      if (deckFrame->GetContent()->IsXUL() &&
+      if (deckFrame->GetContent()->IsXULElement() &&
           deckFrame->GetContent()->Tag() == nsGkAtoms::tabpanels)
         return states::OFFSCREEN;
 
       NS_NOTREACHED("Children of not selected deck panel are not accessible.");
       return states::INVISIBLE;
     }
 
     // If contained by scrollable frame then check that at least 12 pixels
@@ -430,30 +430,30 @@ Accessible::NativeState()
 
   nsIFrame *frame = GetFrame();
   if (frame) {
     if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
       state |= states::FLOATING;
 
     // XXX we should look at layout for non XUL box frames, but need to decide
     // how that interacts with ARIA.
-    if (HasOwnContent() && mContent->IsXUL() && frame->IsBoxFrame()) {
+    if (HasOwnContent() && mContent->IsXULElement() && frame->IsBoxFrame()) {
       const nsStyleXUL* xulStyle = frame->StyleXUL();
       if (xulStyle && frame->IsBoxFrame()) {
         // In XUL all boxes are either vertical or horizontal
         if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
           state |= states::VERTICAL;
         else
           state |= states::HORIZONTAL;
       }
     }
   }
 
   // Check if a XUL element has the popup attribute (an attached popup menu).
-  if (HasOwnContent() && mContent->IsXUL() &&
+  if (HasOwnContent() && mContent->IsXULElement() &&
       mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
     state |= states::HASPOPUP;
 
   // Bypass the link states specialization for non links.
   if (!mRoleMapEntry || mRoleMapEntry->roleRule == kUseNativeRole ||
       mRoleMapEntry->role == roles::LINK)
     state |= NativeLinkState();
 
@@ -480,17 +480,17 @@ uint64_t
 Accessible::NativeLinkState() const
 {
   return 0;
 }
 
 bool
 Accessible::NativelyUnavailable() const
 {
-  if (mContent->IsHTML())
+  if (mContent->IsHTMLElement())
     return mContent->AsElement()->State().HasState(NS_EVENT_STATE_DISABLED);
 
   return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
                                nsGkAtoms::_true, eCaseMatters);
 }
 
 Accessible*
 Accessible::FocusedChild()
@@ -1514,52 +1514,52 @@ Accessible::RelationByType(RelationType 
     return Relation();
 
   // Relationships are defined on the same content node that the role would be
   // defined on.
   switch (aType) {
     case RelationType::LABELLED_BY: {
       Relation rel(new IDRefsIterator(mDoc, mContent,
                                       nsGkAtoms::aria_labelledby));
-      if (mContent->IsHTML()) {
+      if (mContent->IsHTMLElement()) {
         rel.AppendIter(new HTMLLabelIterator(Document(), this));
-      } else if (mContent->IsXUL()) {
+      } else if (mContent->IsXULElement()) {
         rel.AppendIter(new XULLabelIterator(Document(), mContent));
       }
 
       return rel;
     }
 
     case RelationType::LABEL_FOR: {
       Relation rel(new RelatedAccIterator(Document(), mContent,
                                           nsGkAtoms::aria_labelledby));
-      if (mContent->Tag() == nsGkAtoms::label && mContent->IsXUL())
+      if (mContent->Tag() == nsGkAtoms::label && mContent->IsXULElement())
         rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::control));
 
       return rel;
     }
 
     case RelationType::DESCRIBED_BY: {
       Relation rel(new IDRefsIterator(mDoc, mContent,
                                       nsGkAtoms::aria_describedby));
-      if (mContent->IsXUL())
+      if (mContent->IsXULElement())
         rel.AppendIter(new XULDescriptionIterator(Document(), mContent));
 
       return rel;
     }
 
     case RelationType::DESCRIPTION_FOR: {
       Relation rel(new RelatedAccIterator(Document(), mContent,
                                           nsGkAtoms::aria_describedby));
 
       // This affectively adds an optional control attribute to xul:description,
       // which only affects accessibility, by allowing the description to be
       // tied to a control.
       if (mContent->Tag() == nsGkAtoms::description &&
-          mContent->IsXUL())
+          mContent->IsXULElement())
         rel.AppendIter(new IDRefsIterator(mDoc, mContent,
                                           nsGkAtoms::control));
 
       return rel;
     }
 
     case RelationType::NODE_CHILD_OF: {
       Relation rel(new ARIAOwnedByIterator(this));
@@ -1634,17 +1634,17 @@ Accessible::RelationByType(RelationType 
     case RelationType::SUBWINDOW_OF:
     case RelationType::EMBEDS:
     case RelationType::EMBEDDED_BY:
     case RelationType::POPUP_FOR:
     case RelationType::PARENT_WINDOW_OF:
       return Relation();
 
     case RelationType::DEFAULT_BUTTON: {
-      if (mContent->IsHTML()) {
+      if (mContent->IsHTMLElement()) {
         // HTML form controls implements nsIFormControl interface.
         nsCOMPtr<nsIFormControl> control(do_QueryInterface(mContent));
         if (control) {
           nsCOMPtr<nsIForm> form(do_QueryInterface(control->GetFormElement()));
           if (form) {
             nsCOMPtr<nsIContent> formContent =
               do_QueryInterface(form->GetDefaultSubmitElement());
             return Relation(mDoc, formContent);
@@ -1869,47 +1869,47 @@ Accessible::ARIAName(nsString& aName)
     aName.CompressWhitespace();
   }
 }
 
 // Accessible protected
 ENameValueFlag
 Accessible::NativeName(nsString& aName)
 {
-  if (mContent->IsHTML()) {
+  if (mContent->IsHTMLElement()) {
     Accessible* label = nullptr;
     HTMLLabelIterator iter(Document(), this);
     while ((label = iter.Next())) {
       nsTextEquivUtils::AppendTextEquivFromContent(this, label->GetContent(),
                                                    &aName);
       aName.CompressWhitespace();
     }
 
     if (!aName.IsEmpty())
       return eNameOK;
 
     nsTextEquivUtils::GetNameFromSubtree(this, aName);
     return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
   }
 
-  if (mContent->IsXUL()) {
+  if (mContent->IsXULElement()) {
     XULElmName(mDoc, mContent, aName);
     if (!aName.IsEmpty())
       return eNameOK;
 
     nsTextEquivUtils::GetNameFromSubtree(this, aName);
     return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
   }
 
-  if (mContent->IsSVG()) {
+  if (mContent->IsSVGElement()) {
     // If user agents need to choose among multiple ‘desc’ or ‘title’ elements
     // for processing, the user agent shall choose the first one.
     for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
          childElm = childElm->GetNextSibling()) {
-      if (childElm->IsSVG(nsGkAtoms::title)) {
+      if (childElm->IsSVGElement(nsGkAtoms::title)) {
         nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
         return eNameOK;
       }
     }
   }
 
   return eNameOK;
 }
@@ -2521,17 +2521,17 @@ Accessible::AttrNumericValue(nsIAtom* aA
 
 uint32_t
 Accessible::GetActionRule() const
 {
   if (!HasOwnContent() || (InteractiveState() & states::UNAVAILABLE))
     return eNoAction;
 
   // Return "click" action on elements that have an attached popup menu.
-  if (mContent->IsXUL())
+  if (mContent->IsXULElement())
     if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
       return eClickAction;
 
   // Has registered 'click' event handler.
   bool isOnclick = nsCoreUtils::HasClickListener(mContent);
 
   if (isOnclick)
     return eClickAction;
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -560,17 +560,17 @@ public:
    */
   virtual void GetNativeInterface(void** aNativeAccessible);
 
   //////////////////////////////////////////////////////////////////////////////
   // Downcasting and types
 
   inline bool IsAbbreviation() const
   {
-    return mContent->IsHTML() &&
+    return mContent->IsHTMLElement() &&
       (mContent->Tag() == nsGkAtoms::abbr || mContent->Tag() == nsGkAtoms::acronym);
   }
 
   bool IsApplication() const { return mType == eApplicationType; }
   ApplicationAccessible* AsApplication();
 
   bool IsAutoComplete() const { return HasGenericType(eAutoComplete); }
 
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -89,17 +89,17 @@ DocAccessible::
 {
   mGenericTypes |= eDocument;
   mStateFlags |= eNotNodeMapEntry;
 
   MOZ_ASSERT(mPresShell, "should have been given a pres shell");
   mPresShell->SetDocAccessible(this);
 
   // If this is a XUL Document, it should not implement nsHyperText
-  if (mDocumentNode && mDocumentNode->IsXUL())
+  if (mDocumentNode && mDocumentNode->IsXULDocument())
     mGenericTypes &= ~eHyperText;
 }
 
 DocAccessible::~DocAccessible()
 {
   NS_ASSERTION(!mPresShell, "LastRelease was never called!?!");
 }
 
@@ -870,17 +870,18 @@ DocAccessible::AttributeChangedImpl(Acce
                                  eCaseMatters);
     nsRefPtr<AccEvent> event =
       new AccStateChangeEvent(aAccessible, states::BUSY, isOn);
     FireDelayedEvent(event);
     return;
   }
 
   // ARIA or XUL selection
-  if ((aAccessible->GetContent()->IsXUL() && aAttribute == nsGkAtoms::selected) ||
+  if ((aAccessible->GetContent()->IsXULElement() &&
+       aAttribute == nsGkAtoms::selected) ||
       aAttribute == nsGkAtoms::aria_selected) {
     Accessible* widget =
       nsAccUtils::GetSelectableContainer(aAccessible, aAccessible->State());
     if (widget) {
       AccSelChangeEvent::SelChangeType selChangeType =
         elm->AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true, eCaseMatters) ?
           AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
 
@@ -1332,17 +1333,17 @@ DocAccessible::ProcessInvalidationList()
   }
 
   mInvalidationList.Clear();
 }
 
 Accessible*
 DocAccessible::GetAccessibleEvenIfNotInMap(nsINode* aNode) const
 {
-if (!aNode->IsContent() || !aNode->AsContent()->IsHTML(nsGkAtoms::area))
+if (!aNode->IsContent() || !aNode->AsContent()->IsHTMLElement(nsGkAtoms::area))
     return GetAccessible(aNode);
 
   // XXX Bug 135040, incorrect when multiple images use the same map.
   nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
   nsImageFrame* imageFrame = do_QueryFrame(frame);
   if (imageFrame) {
     Accessible* parent = GetAccessible(imageFrame->GetContent());
     if (parent) {
@@ -1494,23 +1495,23 @@ DocAccessible::AddDependentIDsFor(dom::E
                                   nsIAtom* aRelAttr)
 {
   for (uint32_t idx = 0; idx < kRelationAttrsLen; idx++) {
     nsIAtom* relAttr = *kRelationAttrs[idx];
     if (aRelAttr && aRelAttr != relAttr)
       continue;
 
     if (relAttr == nsGkAtoms::_for) {
-      if (!aRelProviderElm->IsHTML() ||
+      if (!aRelProviderElm->IsHTMLElement() ||
           (aRelProviderElm->Tag() != nsGkAtoms::label &&
            aRelProviderElm->Tag() != nsGkAtoms::output))
         continue;
 
     } else if (relAttr == nsGkAtoms::control) {
-      if (!aRelProviderElm->IsXUL() ||
+      if (!aRelProviderElm->IsXULElement() ||
           (aRelProviderElm->Tag() != nsGkAtoms::label &&
            aRelProviderElm->Tag() != nsGkAtoms::description))
         continue;
     }
 
     IDRefsIterator iter(this, aRelProviderElm, relAttr);
     while (true) {
       const nsDependentSubstring id = iter.NextID();
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -289,17 +289,17 @@ HyperTextAccessible::DOMPointToOffset(ns
     }
   }
 
   // Get accessible for this findNode, or if that node isn't accessible, use the
   // accessible for the next DOM node which has one (based on forward depth first search)
   Accessible* descendant = nullptr;
   if (findNode) {
     nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
-    if (findContent && findContent->IsHTML() &&
+    if (findContent && findContent->IsHTMLElement() &&
         findContent->NodeInfo()->Equals(nsGkAtoms::br) &&
         findContent->AttrValueIs(kNameSpaceID_None,
                                  nsGkAtoms::mozeditorbogusnode,
                                  nsGkAtoms::_true,
                                  eIgnoreCase)) {
       // This <br> is the hacky "bogus node" used when there is no text in a control
       return 0;
     }
@@ -1687,17 +1687,17 @@ HyperTextAccessible::RangeAtPoint(int32_
 // Accessible public
 
 // Accessible protected
 ENameValueFlag
 HyperTextAccessible::NativeName(nsString& aName)
 {
   // Check @alt attribute for invalid img elements.
   bool hasImgAlt = false;
-  if (mContent->IsHTML(nsGkAtoms::img)) {
+  if (mContent->IsHTMLElement(nsGkAtoms::img)) {
     hasImgAlt = mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
     if (!aName.IsEmpty())
       return eNameOK;
   }
 
   ENameValueFlag nameFlag = AccessibleWrap::NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -194,17 +194,18 @@ ImageAccessible::GetLongDescURI() const
                                               mContent->OwnerDoc(), baseURI);
     return uri.forget();
   }
 
   DocAccessible* document = Document();
   if (document) {
     IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
     while (nsIContent* target = iter.NextElem()) {
-      if ((target->IsHTML(nsGkAtoms::a) || target->IsHTML(nsGkAtoms::area)) &&
+      if ((target->IsHTMLElement(nsGkAtoms::a) ||
+           target->IsHTMLElement(nsGkAtoms::area)) &&
           target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
         nsGenericHTMLElement* element =
           nsGenericHTMLElement::FromContent(target);
 
         nsCOMPtr<nsIURI> uri;
         element->GetURIAttr(nsGkAtoms::href, nullptr, getter_AddRefs(uri));
         return uri.forget();
       }
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -121,17 +121,17 @@ void
 HTMLSelectListAccessible::CacheChildren()
 {
   // Cache accessibles for <optgroup> and <option> DOM decendents as children,
   // as well as the accessibles for them. Avoid whitespace text nodes. We want
   // to count all the <optgroup>s and <option>s as children because we want
   // a flat tree under the Select List.
   for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
        childContent = childContent->GetNextSibling()) {
-    if (!childContent->IsHTML()) {
+    if (!childContent->IsHTMLElement()) {
       continue;
     }
 
     nsIAtom* tag = childContent->Tag();
     if (tag == nsGkAtoms::option ||
         tag == nsGkAtoms::optgroup) {
 
       // Get an accessible for option or optgroup and cache it.
--- a/accessible/html/HTMLTableAccessible.cpp
+++ b/accessible/html/HTMLTableAccessible.cpp
@@ -946,34 +946,34 @@ HTMLTableAccessible::IsProbablyLayoutTab
 
   // Check for legitimate data table elements.
   Accessible* caption = FirstChild();
   if (caption && caption->Role() == roles::CAPTION && caption->HasChildren()) 
     RETURN_LAYOUT_ANSWER(false, "Not empty caption -- legitimate table structures");
 
   for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
        childElm = childElm->GetNextSibling()) {
-    if (!childElm->IsHTML())
+    if (!childElm->IsHTMLElement())
       continue;
 
     if (childElm->Tag() == nsGkAtoms::col ||
         childElm->Tag() == nsGkAtoms::colgroup ||
         childElm->Tag() == nsGkAtoms::tfoot ||
         childElm->Tag() == nsGkAtoms::thead) {
       RETURN_LAYOUT_ANSWER(false,
                            "Has col, colgroup, tfoot or thead -- legitimate table structures");
     }
 
     if (childElm->Tag() == nsGkAtoms::tbody) {
       for (nsIContent* rowElm = childElm->GetFirstChild(); rowElm;
            rowElm = rowElm->GetNextSibling()) {
-        if (rowElm->IsHTML() && rowElm->Tag() == nsGkAtoms::tr) {
+        if (rowElm->IsHTMLElement() && rowElm->Tag() == nsGkAtoms::tr) {
           for (nsIContent* cellElm = rowElm->GetFirstChild(); cellElm;
                cellElm = cellElm->GetNextSibling()) {
-            if (cellElm->IsHTML()) {
+            if (cellElm->IsHTMLElement()) {
 
               if (cellElm->NodeInfo()->Equals(nsGkAtoms::th)) {
                 RETURN_LAYOUT_ANSWER(false,
                                      "Has th -- legitimate table structures");
               }
 
               if (cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::headers) ||
                   cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::scope) ||
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -347,17 +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->IsHTML()) {
+  if (!aContent->IsHTMLElement()) {
     return false;
   }
   nsIAtom* nameAtom = aContent->Tag();
   return nameAtom == nsGkAtoms::a || nameAtom == nsGkAtoms::area;
 }
 
 static void
 ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback, void* aClosure)
@@ -2615,17 +2615,17 @@ nsDocShell::GetFullscreenAllowed(bool* a
   // iframe does not have mozallowfullscreen=true, then fullscreen is
   // prohibited.
   nsCOMPtr<nsPIDOMWindow> win = GetWindow();
   if (!win) {
     return NS_OK;
   }
   nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
   if (frameElement &&
-      frameElement->IsHTML(nsGkAtoms::iframe) &&
+      frameElement->IsHTMLElement(nsGkAtoms::iframe) &&
       !frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) &&
       !frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) {
     return NS_OK;
   }
 
   // If we have no parent then we're the root docshell; no ancestor of the
   // original docshell doesn't have a allowfullscreen attribute, so
   // report fullscreen as allowed.
@@ -13421,17 +13421,17 @@ nsDocShell::OnLinkClickSync(nsIContent* 
           return extProtService->LoadURI(aURI, this);
         }
       }
     }
   }
 
   uint32_t flags = INTERNAL_LOAD_FLAGS_NONE;
   if (IsElementAnchor(aContent)) {
-    MOZ_ASSERT(aContent->IsHTML());
+    MOZ_ASSERT(aContent->IsHTMLElement());
     nsAutoString referrer;
     aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
     nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(referrer);
     while (tok.hasMoreTokens()) {
       if (tok.nextToken().LowerCaseEqualsLiteral("noreferrer")) {
         flags |= INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER |
                  INTERNAL_LOAD_FLAGS_NO_OPENER;
         break;
--- a/dom/base/Attr.cpp
+++ b/dom/base/Attr.cpp
@@ -162,17 +162,17 @@ Attr::GetName(nsAString& aName)
 }
 
 already_AddRefed<nsIAtom>
 Attr::GetNameAtom(nsIContent* aContent)
 {
   if (!mNsAware &&
       mNodeInfo->NamespaceID() == kNameSpaceID_None &&
       aContent->IsInHTMLDocument() &&
-      aContent->IsHTML()) {
+      aContent->IsHTMLElement()) {
     nsString name;
     mNodeInfo->GetName(name);
     nsAutoString lowercaseName;
     nsContentUtils::ASCIIToLower(name, lowercaseName);
     return do_GetAtom(lowercaseName);
   }
   nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
   return nameAtom.forget();
--- a/dom/base/ChildIterator.cpp
+++ b/dom/base/ChildIterator.cpp
@@ -53,17 +53,17 @@ static inline MatchedNodes
 GetMatchedNodesForPoint(nsIContent* aContent)
 {
   if (aContent->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
     // XBL case
     return MatchedNodes(static_cast<XBLChildrenElement*>(aContent));
   }
 
   // Web components case
-  MOZ_ASSERT(aContent->IsHTML(nsGkAtoms::content));
+  MOZ_ASSERT(aContent->IsHTMLElement(nsGkAtoms::content));
   return MatchedNodes(static_cast<HTMLContentElement*>(aContent));
 }
 
 nsIContent*
 ExplicitChildIterator::GetNextChild()
 {
   // If we're already in the inserted-children array, look there first
   if (mIndexInInserted) {
--- a/dom/base/DirectionalityUtils.cpp
+++ b/dom/base/DirectionalityUtils.cpp
@@ -231,30 +231,30 @@ using mozilla::dom::Element;
  * test for it separately, e.g. with DoesNotAffectDirectionOfAncestors.
  * It *does* include textarea, because even if a textarea has dir=auto, it has
  * unicode-bidi: plaintext and is handled automatically in bidi resolution.
  */
 static bool
 DoesNotParticipateInAutoDirection(const Element* aElement)
 {
   mozilla::dom::NodeInfo* nodeInfo = aElement->NodeInfo();
-  return (!aElement->IsHTML() ||
+  return (!aElement->IsHTMLElement() ||
           nodeInfo->Equals(nsGkAtoms::script) ||
           nodeInfo->Equals(nsGkAtoms::style) ||
           nodeInfo->Equals(nsGkAtoms::textarea) ||
           aElement->IsInAnonymousSubtree());
 }
 
 static inline bool
 IsBdiWithoutDirAuto(const Element* aElement)
 {
   // We are testing for bdi elements without explicit dir="auto", so we can't
   // use the HasDirAuto() flag, since that will return true for bdi element with
   // no dir attribute or an invalid dir attribute
-  return (aElement->IsHTML(nsGkAtoms::bdi) &&
+  return (aElement->IsHTMLElement(nsGkAtoms::bdi) &&
           (!aElement->HasValidDir() || aElement->HasFixedDir()));
 }
 
 /**
  * Returns true if aElement is one of the element whose text content should not
  * affect the direction of ancestors with dir=auto (though it may affect its own
  * direction, e.g. <bdi>)
  */
@@ -917,17 +917,17 @@ SetDirectionalityFromValue(Element* aEle
 
   aElement->SetDirectionality(dir, aNotify);
 }
 
 void
 OnSetDirAttr(Element* aElement, const nsAttrValue* aNewValue,
              bool hadValidDir, bool hadDirAuto, bool aNotify)
 {
-  if (aElement->IsHTML(nsGkAtoms::input)) {
+  if (aElement->IsHTMLElement(nsGkAtoms::input)) {
     return;
   }
 
   if (aElement->AncestorHasDirAuto()) {
     if (!hadValidDir) {
       // The element is a descendant of an element with dir = auto, is
       // having its dir attribute set, and previously didn't have a valid dir
       // attribute.
@@ -972,17 +972,17 @@ OnSetDirAttr(Element* aElement, const ns
 }
 
 void
 SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent)
 {
   // Set the AncestorHasDirAuto flag, unless this element shouldn't affect
   // ancestors that have dir=auto
   if (!DoesNotParticipateInAutoDirection(aElement) &&
-      !aElement->IsHTML(nsGkAtoms::bdi) &&
+      !aElement->IsHTMLElement(nsGkAtoms::bdi) &&
       aParent && aParent->NodeOrAncestorHasDirAuto()) {
     aElement->SetAncestorHasDirAuto();
 
     nsIContent* child = aElement->GetFirstChild();
     if (child) {
       // If we are binding an element to the tree that already has descendants,
       // and the parent has NodeHasDirAuto or NodeAncestorHasDirAuto, we need
       // to set NodeAncestorHasDirAuto on all the element's descendants, except
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -153,17 +153,17 @@ nsIContent::DoGetID() const
 }
 
 const nsAttrValue*
 nsIContent::DoGetClasses() const
 {
   MOZ_ASSERT(HasFlag(NODE_MAY_HAVE_CLASS), "Unexpected call");
   MOZ_ASSERT(IsElement(), "Only elements can have classes");
 
-  if (IsSVG()) {
+  if (IsSVGElement()) {
     const nsAttrValue* animClass =
       static_cast<const nsSVGElement*>(this)->GetAnimatedClassName();
     if (animClass) {
       return animClass;
     }
   }
 
   return AsElement()->GetParsedAttr(nsGkAtoms::_class);
@@ -376,20 +376,20 @@ Element::ClearStyleStateLocks()
 
 bool
 Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
 {
   // If we have a frame the frame has already loaded the binding.  And
   // otherwise, don't do anything else here unless we're dealing with
   // XUL or an HTML element that may have a plugin-related overlay
   // (i.e. object, embed, or applet).
-  bool isXULorPluginElement = (IsXUL() ||
-                               IsHTML(nsGkAtoms::object) ||
-                               IsHTML(nsGkAtoms::embed) ||
-                               IsHTML(nsGkAtoms::applet));
+  bool isXULorPluginElement = (IsXULElement() ||
+                               IsHTMLElement(nsGkAtoms::object) ||
+                               IsHTMLElement(nsGkAtoms::embed) ||
+                               IsHTMLElement(nsGkAtoms::applet));
   nsIPresShell *shell = aDocument->GetShell();
   if (!shell || GetPrimaryFrame() || !isXULorPluginElement) {
     *aResult = nullptr;
 
     return true;
   }
 
   // Get the computed -moz-binding directly from the style context
@@ -546,17 +546,17 @@ Element::GetStyledFrame()
   nsIFrame *frame = GetPrimaryFrame(Flush_Layout);
   return frame ? nsLayoutUtils::GetStyleFrame(frame) : nullptr;
 }
 
 nsIScrollableFrame*
 Element::GetScrollFrame(nsIFrame **aStyledFrame, bool aFlushLayout)
 {
   // it isn't clear what to return for SVG nodes, so just return nothing
-  if (IsSVG()) {
+  if (IsSVGElement()) {
     if (aStyledFrame) {
       *aStyledFrame = nullptr;
     }
     return nullptr;
   }
 
   // Inline version of GetStyledFrame to use Flush_None if needed.
   nsIFrame* frame = GetPrimaryFrame(aFlushLayout ? Flush_Layout : Flush_None);
@@ -817,34 +817,34 @@ static nsSize GetScrollRectSizeForOverfl
   return nsLayoutUtils::GetScrolledRect(aFrame,
       overflowRect, paddingRect.Size(),
       aFrame->StyleVisibility()->mDirection).Size();
 }
 
 int32_t
 Element::ScrollHeight()
 {
-  if (IsSVG())
+  if (IsSVGElement())
     return 0;
 
   nsIScrollableFrame* sf = GetScrollFrame();
   nscoord height;
   if (sf) {
     height = sf->GetScrollRange().height + sf->GetScrollPortRect().height;
   } else {
     height = GetScrollRectSizeForOverflowVisibleFrame(GetStyledFrame()).height;
   }
 
   return nsPresContext::AppUnitsToIntCSSPixels(height);
 }
 
 int32_t
 Element::ScrollWidth()
 {
-  if (IsSVG())
+  if (IsSVGElement())
     return 0;
 
   nsIScrollableFrame* sf = GetScrollFrame();
   nscoord width;
   if (sf) {
     width = sf->GetScrollRange().width + sf->GetScrollPortRect().width;
   } else {
     width = GetScrollRectSizeForOverflowVisibleFrame(GetStyledFrame()).width;
@@ -918,17 +918,17 @@ void
 Element::AddToIdTable(nsIAtom* aId)
 {
   NS_ASSERTION(HasID(), "Node doesn't have an ID?");
   if (IsInShadowTree()) {
     ShadowRoot* containingShadow = GetContainingShadow();
     containingShadow->AddToIdTable(this, aId);
   } else {
     nsIDocument* doc = GetUncomposedDoc();
-    if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
+    if (doc && (!IsInAnonymousSubtree() || doc->IsXULDocument())) {
       doc->AddToIdTable(this, aId);
     }
   }
 }
 
 void
 Element::RemoveFromIdTable()
 {
@@ -941,17 +941,17 @@ Element::RemoveFromIdTable()
     ShadowRoot* containingShadow = GetContainingShadow();
     // Check for containingShadow because it may have
     // been deleted during unlinking.
     if (containingShadow) {
       containingShadow->RemoveFromIdTable(this, id);
     }
   } else {
     nsIDocument* doc = GetUncomposedDoc();
-    if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
+    if (doc && (!IsInAnonymousSubtree() || doc->IsXULDocument())) {
       doc->RemoveFromIdTable(this, id);
     }
   }
 }
 
 already_AddRefed<ShadowRoot>
 Element::CreateShadowRoot(ErrorResult& aError)
 {
@@ -1108,22 +1108,22 @@ Element::GetDestinationInsertionPoints()
   return list.forget();
 }
 
 void
 Element::GetAttribute(const nsAString& aName, DOMString& aReturn)
 {
   const nsAttrValue* val =
     mAttrsAndChildren.GetAttr(aName,
-                              IsHTML() && IsInHTMLDocument() ?
+                              IsHTMLElement() && IsInHTMLDocument() ?
                                 eIgnoreCase : eCaseMatters);
   if (val) {
     val->ToString(aReturn);
   } else {
-    if (IsXUL()) {
+    if (IsXULElement()) {
       // XXX should be SetDOMStringToNull(aReturn);
       // See bug 232598
       // aReturn is already empty
     } else {
       aReturn.SetNull();
     }
   }
 }
@@ -1137,17 +1137,17 @@ Element::SetAttribute(const nsAString& a
 
   if (!name) {
     aError = nsContentUtils::CheckQName(aName, false);
     if (aError.Failed()) {
       return;
     }
 
     nsCOMPtr<nsIAtom> nameAtom;
-    if (IsHTML() && IsInHTMLDocument()) {
+    if (IsHTMLElement() && IsInHTMLDocument()) {
       nsAutoString lower;
       nsContentUtils::ASCIIToLower(aName, lower);
       nameAtom = do_GetAtom(lower);
     }
     else {
       nameAtom = do_GetAtom(aName);
     }
     if (!nameAtom) {
@@ -1519,17 +1519,17 @@ Element::BindToTree(nsIDocument* aDocume
 
     SetIsElementInStyleScope(inStyleScope);
     SetIsElementInStyleScopeFlagOnShadowTree(inStyleScope);
   }
 
   // This has to be here, rather than in nsGenericHTMLElement::BindToTree,
   //  because it has to happen after updating the parent pointer, but before
   //  recursively binding the kids.
-  if (IsHTML()) {
+  if (IsHTMLElement()) {
     SetDirOnBind(this, aParent);
   }
 
   // If NODE_FORCE_XBL_BINDINGS was set we might have anonymous children
   // that also need to be told that they are moving.
   nsresult rv;
   if (hadForceXBL) {
     nsBindingManager* bmgr = OwnerDoc()->BindingManager();
@@ -1559,17 +1559,17 @@ Element::BindToTree(nsIDocument* aDocume
   }
 
   nsNodeUtils::ParentChainChanged(this);
 
   if (HasID()) {
     AddToIdTable(DoGetID());
   }
 
-  if (MayHaveStyle() && !IsXUL()) {
+  if (MayHaveStyle() && !IsXULElement()) {
     // XXXbz if we already have a style attr parsed, this won't do
     // anything... need to fix that.
     // If MayHaveStyle() is true, we must be an nsStyledElement
     static_cast<nsStyledElement*>(this)->ReparseStyleAttribute(false);
   }
 
   if (aDocument) {
     // If we're in a document now, let our mapped attrs know what their new
@@ -1731,17 +1731,17 @@ Element::UnbindFromTree(bool aDeep, bool
     if (aNullParent || !mParent->IsInShadowTree()) {
       slots->mContainingShadow = nullptr;
     }
   }
 
   // This has to be here, rather than in nsGenericHTMLElement::UnbindFromTree, 
   //  because it has to happen after unsetting the parent pointer, but before
   //  recursively unbinding the kids.
-  if (IsHTML()) {
+  if (IsHTMLElement()) {
     ResetDir(this);
   }
 
   if (aDeep) {
     // Do the kids. Don't call GetChildCount() here since that'll force
     // XUL to generate template children, which there is no need for since
     // all we're going to do is unbind them anyway.
     uint32_t i, n = mAttrsAndChildren.ChildCount();
@@ -2236,17 +2236,17 @@ Element::SetAttrAndNotify(int32_t aNames
     aValueForAfterSetAttr.SetTo(aParsedValue);
   }
 
   bool hadValidDir = false;
   bool hadDirAuto = false;
 
   if (aNamespaceID == kNameSpaceID_None) {
     if (aName == nsGkAtoms::dir) {
-      hadValidDir = HasValidDir() || IsHTML(nsGkAtoms::bdi);
+      hadValidDir = HasValidDir() || IsHTMLElement(nsGkAtoms::bdi);
       hadDirAuto = HasDirAuto(); // already takes bdi into account
     }
 
     // XXXbz Perhaps we should push up the attribute mapping function
     // stuff to Element?
     if (!IsAttributeMapped(aName) ||
         !SetMappedAttribute(document, aName, aParsedValue, &rv)) {
       rv = mAttrsAndChildren.SetAndTakeAttr(aName, aParsedValue);
@@ -2473,17 +2473,17 @@ Element::UnsetAttr(int32_t aNameSpaceID,
     RemoveFromIdTable();
     ClearHasID();
   }
 
   bool hadValidDir = false;
   bool hadDirAuto = false;
 
   if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::dir) {
-    hadValidDir = HasValidDir() || IsHTML(nsGkAtoms::bdi);
+    hadValidDir = HasValidDir() || IsHTMLElement(nsGkAtoms::bdi);
     hadDirAuto = HasDirAuto(); // already takes bdi into account
   }
 
   nsAttrValue oldValue;
   rv = mAttrsAndChildren.RemoveAttrAt(index, oldValue);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) {
@@ -3213,17 +3213,17 @@ Element::SetOuterHTML(const nsAString& a
     return;
   }
 
   if (parent->NodeType() == nsIDOMNode::DOCUMENT_NODE) {
     aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
   }
 
-  if (OwnerDoc()->IsHTML()) {
+  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();
     } else {
       NS_ASSERTION(parent->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE,
         "How come the parent isn't a document, a fragment or an element?");
@@ -3310,17 +3310,17 @@ Element::InsertAdjacentHTML(const nsAStr
   // Needed when insertAdjacentHTML is used in combination with contenteditable
   mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
   nsAutoScriptLoaderDisabler sld(doc);
   
   // Batch possible DOMSubtreeModified events.
   mozAutoSubtreeModified subtree(doc, nullptr);
 
   // Parse directly into destination if possible
-  if (doc->IsHTML() && !OwnerDoc()->MayHaveDOMMutationObservers() &&
+  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();
     if (contextLocal == nsGkAtoms::html && contextNs == kNameSpaceID_XHTML) {
       // For compat with IE6 through IE9. Willful violation of HTML5 as of
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -346,17 +346,17 @@ public:
   bool GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult);
 
   // The bdi element defaults to dir=auto if it has no dir attribute set.
   // Other elements will only have dir=auto if they have an explicit dir=auto,
   // which will mean that HasValidDir() returns true but HasFixedDir() returns
   // false
   inline bool HasDirAuto() const {
     return (!HasFixedDir() &&
-            (HasValidDir() || IsHTML(nsGkAtoms::bdi)));
+            (HasValidDir() || IsHTMLElement(nsGkAtoms::bdi)));
   }
 
   Directionality GetComputedDirectionality() const;
 
 protected:
   /**
    * Method to get the _intrinsic_ content state of this element.  This is the
    * state that is independent of the element's presentation.  To get the full
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -301,17 +301,17 @@ nsIContent::GetBaseURI(bool aTryUseXHRDo
   // faster for the far more common case of there not being any such
   // attributes.
   // Also check for SVG elements which require special handling
   nsAutoTArray<nsString, 5> baseAttrs;
   nsString attr;
   const nsIContent *elem = this;
   do {
     // First check for SVG specialness (why is this SVG specific?)
-    if (elem->IsSVG()) {
+    if (elem->IsSVGElement()) {
       nsIContent* bindingParent = elem->GetBindingParent();
       if (bindingParent) {
         nsXBLBinding* binding = bindingParent->GetXBLBinding();
         if (binding) {
           // XXX sXBL/XBL2 issue
           // If this is an anonymous XBL element use the binding
           // document for the base URI. 
           // XXX Will fail with xml:base
@@ -1342,17 +1342,17 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(FragmentO
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
   nsINode::Unlink(tmp);
 
   // The XBL binding is removed by RemoveFromBindingManagerRunnable
   // which is dispatched in UnbindFromTree.
 
   if (tmp->HasProperties()) {
-    if (tmp->IsHTML() || tmp->IsSVG()) {
+    if (tmp->IsHTMLElement() || tmp->IsSVGElement()) {
       nsIAtom*** props = Element::HTMLSVGPropertiesToTraverseAndUnlink();
       for (uint32_t i = 0; props[i]; ++i) {
         tmp->DeleteProperty(*props[i]);
       }
     }
   }
 
   // Unlink child content (and unbind our subtree).
@@ -1384,17 +1384,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Fr
   // Clear flag here because unlinking slots will clear the
   // containing shadow root pointer.
   tmp->UnsetFlags(NODE_IS_IN_SHADOW_TREE);
 
   // Unlink any DOM slots of interest.
   {
     nsDOMSlots *slots = tmp->GetExistingDOMSlots();
     if (slots) {
-      slots->Unlink(tmp->IsXUL());
+      slots->Unlink(tmp->IsXULElement());
     }
   }
 
   {
     nsIDocument *doc;
     if (!tmp->GetParentNode() && (doc = tmp->OwnerDoc())) {
       doc->BindingManager()->RemovedFromDocument(tmp, doc);
     }
@@ -1894,17 +1894,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
 
   if (!nsINode::Traverse(tmp, cb)) {
     return NS_SUCCESS_INTERRUPTED_TRAVERSE;
   }
 
   tmp->OwnerDoc()->BindingManager()->Traverse(tmp, cb);
 
   if (tmp->HasProperties()) {
-    if (tmp->IsHTML() || tmp->IsSVG()) {
+    if (tmp->IsHTMLElement() || tmp->IsSVGElement()) {
       nsIAtom*** props = Element::HTMLSVGPropertiesToTraverseAndUnlink();
       for (uint32_t i = 0; props[i]; ++i) {
         nsISupports* property =
           static_cast<nsISupports*>(tmp->GetProperty(*props[i]));
         cb.NoteXPCOMChild(property);
       }
     }
   }
@@ -1929,17 +1929,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
       cb.NoteXPCOMChild(tmp->mAttrsAndChildren.GetSafeChildAt(i));
     }
   }
 
   // Traverse any DOM slots of interest.
   {
     nsDOMSlots *slots = tmp->GetExistingDOMSlots();
     if (slots) {
-      slots->Traverse(cb, tmp->IsXUL());
+      slots->Traverse(cb, tmp->IsXULElement());
     }
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 
 NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
@@ -2428,17 +2428,18 @@ AppendEncodedAttributeValue(nsAutoString
 
 static void
 StartElement(Element* aContent, StringBuilder& aBuilder)
 {
   nsIAtom* localName = aContent->Tag();
   int32_t tagNS = aContent->GetNameSpaceID();
 
   aBuilder.Append("<");
-  if (aContent->IsHTML() || aContent->IsSVG() || aContent->IsMathML()) {
+  if (aContent->IsHTMLElement() || aContent->IsSVGElement() ||
+      aContent->IsMathMLElement()) {
     aBuilder.Append(localName);
   } else {
     aBuilder.Append(aContent->NodeName());
   }
 
   int32_t count = aContent->GetAttrCount();
   for (int32_t i = count; i > 0;) {
     --i;
@@ -2493,17 +2494,17 @@ StartElement(Element* aContent, StringBu
 
   aBuilder.Append(">");
 
   /*
   // Per HTML spec we should append one \n if the first child of
   // pre/textarea/listing is a textnode and starts with a \n.
   // But because browsers haven't traditionally had that behavior,
   // we're not changing our behavior either - yet.
-  if (aContent->IsHTML()) {
+  if (aContent->IsHTMLElement()) {
     if (localName == nsGkAtoms::pre || localName == nsGkAtoms::textarea ||
         localName == nsGkAtoms::listing) {
       nsIContent* fc = aContent->GetFirstChild();
       if (fc &&
           (fc->NodeType() == nsIDOMNode::TEXT_NODE ||
            fc->NodeType() == nsIDOMNode::CDATA_SECTION_NODE)) {
         const nsTextFragment* text = fc->GetText();
         if (text && text->GetLength() && text->CharAt(0) == char16_t('\n')) {
@@ -2512,17 +2513,17 @@ StartElement(Element* aContent, StringBu
       }
     }
   }*/
 }
 
 static inline bool
 ShouldEscape(nsIContent* aParent)
 {
-  if (!aParent || !aParent->IsHTML()) {
+  if (!aParent || !aParent->IsHTMLElement()) {
     return true;
   }
 
   static const nsIAtom* nonEscapingElements[] = {
     nsGkAtoms::style, nsGkAtoms::script, nsGkAtoms::xmp,
     nsGkAtoms::iframe, nsGkAtoms::noembed, nsGkAtoms::noframes,
     nsGkAtoms::plaintext, 
     // Per the current spec noscript should be escaped in case
@@ -2581,17 +2582,17 @@ IsVoidTag(nsIAtom* aTag)
     }
   }
   return false;
 }
 
 static inline bool
 IsVoidTag(Element* aElement)
 {
-  if (!aElement->IsHTML()) {
+  if (!aElement->IsHTMLElement()) {
     return false;
   }
   return IsVoidTag(aElement->Tag());
 }
 
 /* static */
 bool
 FragmentOrElement::IsHTMLVoid(nsIAtom* aLocalName)
@@ -2661,17 +2662,18 @@ Serialize(FragmentOrElement* aRoot, bool
         break;
       }
     }
 
     while (true) {
       if (!isVoid && current->NodeType() == nsIDOMNode::ELEMENT_NODE) {
         builder.Append("</");
         nsIContent* elem = static_cast<nsIContent*>(current);
-        if (elem->IsHTML() || elem->IsSVG() || elem->IsMathML()) {
+        if (elem->IsHTMLElement() || elem->IsSVGElement() ||
+            elem->IsMathMLElement()) {
           builder.Append(elem->Tag());
         } else {
           builder.Append(current->NodeName());
         }
         builder.Append(">");
       }
       isVoid = false;
 
@@ -2843,17 +2845,17 @@ FragmentOrElement::SetInnerHTMLInternal(
 
   ShadowRoot* shadowRoot = ShadowRoot::FromNode(this);
   if (shadowRoot) {
     // Fix up the context to be the host of the ShadowRoot.
     contextLocalName = shadowRoot->GetHost()->Tag();
     contextNameSpaceID = shadowRoot->GetHost()->GetNameSpaceID();
   }
 
-  if (doc->IsHTML()) {
+  if (doc->IsHTMLDocument()) {
     int32_t oldChildCount = target->GetChildCount();
     aError = nsContentUtils::ParseFragmentHTML(aInnerHTML,
                                                target,
                                                contextLocalName,
                                                contextNameSpaceID,
                                                doc->GetCompatibilityMode() ==
                                                  eCompatibility_NavQuirks,
                                                true);
--- a/dom/base/Link.cpp
+++ b/dom/base/Link.cpp
@@ -35,18 +35,20 @@ Link::Link(Element *aElement)
 Link::~Link()
 {
   UnregisterFromHistory();
 }
 
 bool
 Link::ElementHasHref() const
 {
-  return ((!mElement->IsSVG() && mElement->HasAttr(kNameSpaceID_None, nsGkAtoms::href))
-        || (!mElement->IsHTML() && mElement->HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)));
+  return ((!mElement->IsSVGElement() &&
+           mElement->HasAttr(kNameSpaceID_None, nsGkAtoms::href))
+        || (!mElement->IsHTMLElement() &&
+            mElement->HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)));
 }
 
 void
 Link::SetLinkState(nsLinkState aState)
 {
   NS_ASSERTION(mRegistered,
                "Setting the link state of an unregistered Link!");
   NS_ASSERTION(mLinkState != aState,
--- a/dom/base/NodeInfo.cpp
+++ b/dom/base/NodeInfo.cpp
@@ -78,17 +78,17 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAt
                 aNamespaceID == kNameSpaceID_None && !aPrefix);
 
   switch (aNodeType) {
     case nsIDOMNode::ELEMENT_NODE:
     case nsIDOMNode::ATTRIBUTE_NODE:
       // Correct the case for HTML
       if (aNodeType == nsIDOMNode::ELEMENT_NODE &&
           aNamespaceID == kNameSpaceID_XHTML && GetDocument() &&
-          GetDocument()->IsHTML()) {
+          GetDocument()->IsHTMLDocument()) {
         nsContentUtils::ASCIIToUpper(mQualifiedName, mNodeName);
       } else {
         mNodeName = mQualifiedName;
       }
       mInner.mName->ToString(mLocalName);
       break;
     case nsIDOMNode::TEXT_NODE:
     case nsIDOMNode::CDATA_SECTION_NODE:
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -560,17 +560,17 @@ ShadowRoot::ChangePoolHost(nsIContent* a
   if (mPoolHost) {
     mPoolHost->AddMutationObserver(this);
   }
 }
 
 bool
 ShadowRoot::IsShadowInsertionPoint(nsIContent* aContent)
 {
-  if (aContent && aContent->IsHTML(nsGkAtoms::shadow)) {
+  if (aContent && aContent->IsHTMLElement(nsGkAtoms::shadow)) {
     HTMLShadowElement* shadowElem = static_cast<HTMLShadowElement*>(aContent);
     return shadowElem->IsInsertionPoint();
   }
   return false;
 }
 
 /**
  * Returns whether the web components pool population algorithm
@@ -592,17 +592,17 @@ ShadowRoot::IsPooledNode(nsIContent* aCo
       nsContentUtils::IsInSameAnonymousTree(aContainer, aContent)) {
     // 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 (aContainer && aContainer->IsHTML(nsGkAtoms::content)) {
+  if (aContainer && aContainer->IsHTMLElement(nsGkAtoms::content)) {
     // Fallback content will end up in pool if its parent is a child of the host.
     HTMLContentElement* content = static_cast<HTMLContentElement*>(aContainer);
     return content->IsInsertionPoint() && content->MatchedNodes().IsEmpty() &&
            aContainer->GetParentNode() == aHost;
   }
 
   return false;
 }
--- a/dom/base/nsCCUncollectableMarker.cpp
+++ b/dom/base/nsCCUncollectableMarker.cpp
@@ -477,17 +477,17 @@ TraceActiveWindowGlobal(const uint64_t& 
     aWindow->TraceGlobalJSObject(closure->mTrc);
     EventListenerManager* elm = aWindow->GetExistingListenerManager();
     if (elm) {
       elm->TraceListeners(closure->mTrc);
     }
 
 #ifdef MOZ_XUL
     nsIDocument* doc = aWindow->GetExtantDoc();
-    if (doc && doc->IsXUL()) {
+    if (doc && doc->IsXULDocument()) {
       XULDocument* xulDoc = static_cast<XULDocument*>(doc);
       xulDoc->TraceProtos(closure->mTrc, closure->mGCNumber);
     }
 #endif
   }
   return PL_DHASH_NEXT;
 }
 
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -414,17 +414,17 @@ nsContentList::nsContentList(nsINode* aR
   mRootNode->AddMutationObserver(this);
 
   // We only need to flush if we're in an non-HTML document, since the
   // HTML5 parser doesn't need flushing.  Further, if we're not in a
   // document at all right now (in the GetUncomposedDoc() sense), we're
   // not parser-created and don't need to be flushing stuff under us
   // to get our kids right.
   nsIDocument* doc = mRootNode->GetUncomposedDoc();
-  mFlushesNeeded = doc && !doc->IsHTML();
+  mFlushesNeeded = doc && !doc->IsHTMLDocument();
 }
 
 nsContentList::nsContentList(nsINode* aRootNode,
                              nsContentListMatchFunc aFunc,
                              nsContentListDestroyFunc aDestroyFunc,
                              void* aData,
                              bool aDeep,
                              nsIAtom* aMatchAtom,
@@ -447,17 +447,17 @@ nsContentList::nsContentList(nsINode* aR
   mRootNode->AddMutationObserver(this);
 
   // We only need to flush if we're in an non-HTML document, since the
   // HTML5 parser doesn't need flushing.  Further, if we're not in a
   // document at all right now (in the GetUncomposedDoc() sense), we're
   // not parser-created and don't need to be flushing stuff under us
   // to get our kids right.
   nsIDocument* doc = mRootNode->GetUncomposedDoc();
-  mFlushesNeeded = doc && !doc->IsHTML();
+  mFlushesNeeded = doc && !doc->IsHTMLDocument();
 }
 
 nsContentList::~nsContentList()
 {
   RemoveFromHashtable();
   if (mRootNode) {
     mRootNode->RemoveMutationObserver(this);
   }
@@ -848,17 +848,17 @@ nsContentList::Match(Element *aElement)
   bool toReturn = mMatchAll;
   if (!unknown && !wildcard)
     toReturn &= ni->NamespaceEquals(mMatchNameSpaceId);
 
   if (toReturn)
     return toReturn;
 
   bool matchHTML = aElement->GetNameSpaceID() == kNameSpaceID_XHTML &&
-    aElement->OwnerDoc()->IsHTML();
+    aElement->OwnerDoc()->IsHTMLDocument();
  
   if (unknown) {
     return matchHTML ? ni->QualifiedNameEquals(mHTMLMatchAtom) :
                        ni->QualifiedNameEquals(mXMLMatchAtom);
   }
   
   if (wildcard) {
     return matchHTML ? ni->Equals(mHTMLMatchAtom) :
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -4096,17 +4096,17 @@ nsContentUtils::CreateContextualFragment
   if (!aContextNode) {
     aRv.Throw(NS_ERROR_INVALID_ARG);
     return nullptr;
   }
 
   // If we don't have a document here, we can't get the right security context
   // for compiling event handlers... so just bail out.
   nsCOMPtr<nsIDocument> document = aContextNode->OwnerDoc();
-  bool isHTML = document->IsHTML();
+  bool isHTML = document->IsHTMLDocument();
 #ifdef DEBUG
   nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
   NS_ASSERTION(!isHTML || htmlDoc, "Should have HTMLDocument here!");
 #endif
 
   if (isHTML) {
     nsRefPtr<DocumentFragment> frag =
       new DocumentFragment(document->NodeInfoManager());
@@ -4115,17 +4115,17 @@ nsContentUtils::CreateContextualFragment
     if (contextAsContent && !contextAsContent->IsElement()) {
       contextAsContent = contextAsContent->GetParent();
       if (contextAsContent && !contextAsContent->IsElement()) {
         // can this even happen?
         contextAsContent = nullptr;
       }
     }
     
-    if (contextAsContent && !contextAsContent->IsHTML(nsGkAtoms::html)) {
+    if (contextAsContent && !contextAsContent->IsHTMLElement(nsGkAtoms::html)) {
       aRv = ParseFragmentHTML(aFragment, frag,
                               contextAsContent->Tag(),
                               contextAsContent->GetNameSpaceID(),
                               (document->GetCompatibilityMode() ==
                                eCompatibility_NavQuirks),
                               aPreventScriptExecution);
     } else {
       aRv = ParseFragmentHTML(aFragment, frag,
@@ -4744,18 +4744,19 @@ nsContentUtils::TriggerLink(nsIContent *
   if (NS_SUCCEEDED(proceed)) {
 
     // A link/area element with a download attribute is allowed to set
     // a pseudo Content-Disposition header.
     // For security reasons we only allow websites to declare same-origin resources
     // as downloadable. If this check fails we will just do the normal thing
     // (i.e. navigate to the resource).
     nsAutoString fileName;
-    if ((!aContent->IsHTML(nsGkAtoms::a) && !aContent->IsHTML(nsGkAtoms::area) &&
-         !aContent->IsSVG(nsGkAtoms::a)) ||
+    if ((!aContent->IsHTMLElement(nsGkAtoms::a) &&
+         !aContent->IsHTMLElement(nsGkAtoms::area) &&
+         !aContent->IsSVGElement(nsGkAtoms::a)) ||
         !aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::download, fileName) ||
         NS_FAILED(aContent->NodePrincipal()->CheckMayLoad(aLinkURI, false, true))) {
       fileName.SetIsVoid(true); // No actionable download attribute was found.
     }
 
     handler->OnLinkClick(aContent, aLinkURI,
                          fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
                          fileName, nullptr, nullptr, aIsTrusted);
@@ -6890,17 +6891,17 @@ bool
 nsContentUtils::IsContentInsertionPoint(const 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.
-  if (aContent->IsHTML(nsGkAtoms::content)) {
+  if (aContent->IsHTMLElement(nsGkAtoms::content)) {
     return static_cast<const HTMLContentElement*>(aContent)->IsInsertionPoint();
   }
 
   return false;
 }
 
 // static
 bool
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -500,17 +500,17 @@ static nsresult AppendDOMNode(nsITransfe
   nsCOMPtr<nsIDocument> document = aDOMNode->OwnerDoc();
 
   // Note that XHTML is not counted as HTML here, because we can't copy it
   // properly (all the copy code for non-plaintext assumes using HTML
   // serializers and parsers is OK, and those mess up XHTML).
   nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document, &rv);
   NS_ENSURE_SUCCESS(rv, NS_OK);
 
-  NS_ENSURE_TRUE(document->IsHTML(), NS_OK);
+  NS_ENSURE_TRUE(document->IsHTMLDocument(), NS_OK);
 
   // init encoder with document and node
   rv = docEncoder->NativeInit(document, NS_LITERAL_STRING(kHTMLMime),
                               nsIDocumentEncoder::OutputAbsoluteLinks |
                               nsIDocumentEncoder::OutputEncodeW3CEntities);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = docEncoder->SetNativeNode(aDOMNode);
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1651,17 +1651,17 @@ nsDOMWindowUtils::GetTranslationNodes(ns
   nsRefPtr<nsTranslationNodeList> list = new nsTranslationNodeList;
 
   uint32_t limit = 15000;
 
   // 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->IsHTML()) {
+    if (!content->IsHTMLElement()) {
       continue;
     }
 
     nsIAtom* localName = content->Tag();
 
     // Skip elements that usually contain non-translatable text content.
     if (localName == nsGkAtoms::script ||
         localName == nsGkAtoms::iframe ||
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -637,17 +637,17 @@ nsIdentifierMapEntry::RemoveIdElement(El
   NS_PRECONDITION(aElement, "Missing element");
 
   // This should only be called while the document is in an update.
   // Assertions near the call to this method guarantee this.
 
   // This could fire in OOM situations
   // Only assert this in HTML documents for now as XUL does all sorts of weird
   // crap.
-  NS_ASSERTION(!aElement->OwnerDoc()->IsHTML() ||
+  NS_ASSERTION(!aElement->OwnerDoc()->IsHTMLDocument() ||
                mIdContentList.IndexOf(aElement) >= 0,
                "Removing id entry that doesn't exist");
 
   // XXXbz should this ever Compact() I guess when all the content is gone
   // we'll just get cleaned up in the natural order of things...
   Element* currentElement =
     static_cast<Element*>(mIdContentList.SafeElementAt(0));
   mIdContentList.RemoveElement(aElement);
@@ -5495,17 +5495,17 @@ bool IsLowercaseASCII(const nsAString& a
 already_AddRefed<Element>
 nsIDocument::CreateElement(const nsAString& aTagName, ErrorResult& rv)
 {
   rv = nsContentUtils::CheckQName(aTagName, false);
   if (rv.Failed()) {
     return nullptr;
   }
 
-  bool needsLowercase = IsHTML() && !IsLowercaseASCII(aTagName);
+  bool needsLowercase = IsHTMLDocument() && !IsLowercaseASCII(aTagName);
   nsAutoString lcTagName;
   if (needsLowercase) {
     nsContentUtils::ASCIIToLower(aTagName, lcTagName);
   }
 
   nsCOMPtr<nsIContent> content;
   rv = CreateElem(needsLowercase ? lcTagName : aTagName,
                   nullptr, mDefaultElementType, getter_AddRefs(content));
@@ -5698,17 +5698,17 @@ nsDocument::CreateCDATASection(const nsA
   *aReturn = nsIDocument::CreateCDATASection(aData, rv).take();
   return rv.ErrorCode();
 }
 
 already_AddRefed<CDATASection>
 nsIDocument::CreateCDATASection(const nsAString& aData,
                                 ErrorResult& rv)
 {
-  if (IsHTML()) {
+  if (IsHTMLDocument()) {
     rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return nullptr;
   }
 
   if (FindInReadable(NS_LITERAL_STRING("]]>"), aData)) {
     rv.Throw(NS_ERROR_DOM_INVALID_CHARACTER_ERR);
     return nullptr;
   }
@@ -6156,17 +6156,17 @@ nsDocument::RegisterElement(JSContext* a
 
   // Unconditionally convert TYPE to lowercase.
   nsAutoString lcType;
   nsContentUtils::ASCIIToLower(aType, lcType);
 
   // Only convert NAME to lowercase in HTML documents. Note that NAME is
   // options.extends.
   nsAutoString lcName;
-  if (IsHTML()) {
+  if (IsHTMLDocument()) {
     nsContentUtils::ASCIIToLower(aOptions.mExtends, lcName);
   } else {
     lcName.Assign(aOptions.mExtends);
   }
 
   nsCOMPtr<nsIAtom> typeAtom(do_GetAtom(lcType));
   if (!nsContentUtils::IsCustomElementName(typeAtom)) {
     rv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
@@ -7019,34 +7019,34 @@ nsIDocument::GetLocation() const
   w->GetLocation(getter_AddRefs(loc));
   return loc.forget().downcast<nsLocation>();
 }
 
 Element*
 nsIDocument::GetHtmlElement() const
 {
   Element* rootElement = GetRootElement();
-  if (rootElement && rootElement->IsHTML(nsGkAtoms::html))
+  if (rootElement && rootElement->IsHTMLElement(nsGkAtoms::html))
     return rootElement;
   return nullptr;
 }
 
 Element*
 nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
 {
   Element* html = GetHtmlElement();
   if (!html)
     return nullptr;
 
   // Look for the element with aTag inside html. This needs to run
   // forwards to find the first such element.
   for (nsIContent* child = html->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsHTML(aTag))
+    if (child->IsHTMLElement(aTag))
       return child->AsElement();
   }
   return nullptr;
 }
 
 nsIContent*
 nsDocument::GetTitleContent(uint32_t aNamespace)
 {
@@ -7223,17 +7223,17 @@ nsDocument::GetBoxObjectFor(Element* aEl
   }
 
   nsIDocument* doc = aElement->OwnerDoc();
   if (doc != this) {
     aRv.Throw(NS_ERROR_DOM_WRONG_DOCUMENT_ERR);
     return nullptr;
   }
 
-  if (!mHasWarnedAboutBoxObjects && !aElement->IsXUL()) {
+  if (!mHasWarnedAboutBoxObjects && !aElement->IsXULElement()) {
     mHasWarnedAboutBoxObjects = true;
     nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                     NS_LITERAL_CSTRING("BoxObjects"), this,
                                     nsContentUtils::eDOM_PROPERTIES,
                                     "UseOfGetBoxObjectForWarning");
   }
 
   if (!mBoxObjectTable) {
@@ -8174,17 +8174,17 @@ nsDocument::FlushPendingNotifications(mo
   nsDocumentOnStack dos(this);
 
   // We need to flush the sink for non-HTML documents (because the XML
   // parser still does insertion with deferred notifications).  We
   // also need to flush the sink if this is a layout-related flush, to
   // make sure that layout is started as needed.  But we can skip that
   // part if we have no presshell or if it's already done an initial
   // reflow.
-  if ((!IsHTML() ||
+  if ((!IsHTMLDocument() ||
        (aType > Flush_ContentAndNotify && mPresShell &&
         !mPresShell->DidInitialize())) &&
       (mParser || mWeakSink)) {
     nsCOMPtr<nsIContentSink> sink;
     if (mParser) {
       sink = mParser->GetContentSink();
     } else {
       sink = do_QueryReferent(mWeakSink);
@@ -8347,17 +8347,17 @@ nsDocument::IsScriptEnabled()
 
   return sm->ScriptAllowed(globalObject->GetGlobalJSObject());
 }
 
 nsRadioGroupStruct*
 nsDocument::GetRadioGroupInternal(const nsAString& aName) const
 {
 #ifdef DEBUG
-  if (IsHTML()) {
+  if (IsHTMLDocument()) {
     nsAutoString lcName;
     ToLowerCase(aName, lcName);
     MOZ_ASSERT(aName == lcName);
   }
 #endif
 
   nsRadioGroupStruct* radioGroup;
   if (!mRadioGroups.Get(aName, &radioGroup)) {
@@ -8366,28 +8366,28 @@ nsDocument::GetRadioGroupInternal(const 
 
   return radioGroup;
 }
 
 nsRadioGroupStruct*
 nsDocument::GetRadioGroup(const nsAString& aName) const
 {
   nsAutoString tmKey(aName);
-  if (IsHTML()) {
+  if (IsHTMLDocument()) {
     ToLowerCase(tmKey); //should case-insensitive.
   }
 
   return GetRadioGroupInternal(tmKey);
 }
 
 nsRadioGroupStruct*
 nsDocument::GetOrCreateRadioGroup(const nsAString& aName)
 {
   nsAutoString tmKey(aName);
-  if (IsHTML()) {
+  if (IsHTMLDocument()) {
     ToLowerCase(tmKey); //should case-insensitive.
   }
 
   if (nsRadioGroupStruct* radioGroup = GetRadioGroupInternal(tmKey)) {
     return radioGroup;
   }
 
   nsAutoPtr<nsRadioGroupStruct> newRadioGroup(new nsRadioGroupStruct());
@@ -8447,17 +8447,17 @@ nsDocument::GetNextRadioButton(const nsA
     if (aPrevious) {
       if (--index < 0) {
         index = numRadios -1;
       }
     }
     else if (++index >= numRadios) {
       index = 0;
     }
-    NS_ASSERTION(static_cast<nsGenericHTMLFormElement*>(radioGroup->mRadioButtons[index])->IsHTML(nsGkAtoms::input),
+    NS_ASSERTION(static_cast<nsGenericHTMLFormElement*>(radioGroup->mRadioButtons[index])->IsHTMLElement(nsGkAtoms::input),
                  "mRadioButtons holding a non-radio button");
     radio = static_cast<HTMLInputElement*>(radioGroup->mRadioButtons[index]);
   } while (radio->Disabled() && radio != currentRadio);
 
   radio.forget(aRadioOut);
   return NS_OK;
 }
 
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -525,17 +525,17 @@ nsDocumentEncoder::SerializeToStringIter
         current = current->GetParentNode();
 
         // Handle template element. If the parent is a template's content,
         // then adjust the parent to be the template element.
         if (current && current != aNode &&
             current->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
           DocumentFragment* frag = static_cast<DocumentFragment*>(current);
           nsIContent* host = frag->GetHost();
-          if (host && host->IsHTML(nsGkAtoms::_template)) {
+          if (host && host->IsHTMLElement(nsGkAtoms::_template)) {
             current = host;
           }
         }
       }
     }
   }
 
   return NS_OK;
@@ -1088,17 +1088,17 @@ nsDocumentEncoder::EncodeToStringWithMax
       if (node != prevNode) {
         nsCOMPtr<nsINode> p;
         if (prevNode) {
           p = do_QueryInterface(prevNode);
           rv = SerializeNodeEnd(p, output);
           NS_ENSURE_SUCCESS(rv, rv);
         }
         nsCOMPtr<nsIContent> content = do_QueryInterface(node);
-        if (content && content->IsHTML(nsGkAtoms::tr)) {
+        if (content && content->IsHTMLElement(nsGkAtoms::tr)) {
           nsINode* n = content;
           if (!prevNode) {
             // Went from a non-<tr> to a <tr>
             mCommonAncestors.Clear();
             nsContentUtils::GetAncestors(n->GetParentNode(), mCommonAncestors);
             rv = SerializeRangeContextStart(mCommonAncestors, output);
             NS_ENSURE_SUCCESS(rv, rv);
             // Don't let SerializeRangeToString serialize the context again
@@ -1406,17 +1406,17 @@ nsHTMLCopyEncoder::SetSelection(nsISelec
     mSelection = aSelection;
     mMimeType.AssignLiteral("text/plain");
     return NS_OK;
   }
 #endif
 
   // also consider ourselves in a text widget if we can't find an html document
   nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
-  if (!(htmlDoc && mDocument->IsHTML())) {
+  if (!(htmlDoc && mDocument->IsHTMLDocument())) {
     mIsTextWidget = true;
     mSelection = aSelection;
     // mMimeType is set to text/plain when encoding starts.
     return NS_OK;
   }
   
   // there's no Clone() for selection! fix...
   //nsresult rv = aSelection->Clone(getter_AddRefs(mSelection);
@@ -1851,17 +1851,17 @@ nsHTMLCopyEncoder::GetChildAt(nsIDOMNode
 }
 
 bool 
 nsHTMLCopyEncoder::IsMozBR(nsIDOMNode* aNode)
 {
   MOZ_ASSERT(aNode);
   nsCOMPtr<Element> element = do_QueryInterface(aNode);
   return element &&
-         element->IsHTML(nsGkAtoms::br) &&
+         element->IsHTMLElement(nsGkAtoms::br) &&
          element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                               NS_LITERAL_STRING("_moz"), eIgnoreCase);
 }
 
 nsresult 
 nsHTMLCopyEncoder::GetNodeLocation(nsIDOMNode *inChild,
                                    nsCOMPtr<nsIDOMNode> *outParent,
                                    int32_t *outOffset)
@@ -2010,20 +2010,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->IsHTML() || (content->Tag() != nsGkAtoms::tr    &&
-                                           content->Tag() != nsGkAtoms::thead &&
-                                           content->Tag() != nsGkAtoms::tbody &&
-                                           content->Tag() != nsGkAtoms::tfoot &&
-                                           content->Tag() != nsGkAtoms::table)) {
+    if (!content || !content->IsHTMLElement() ||
+        (content->Tag() != nsGkAtoms::tr    &&
+         content->Tag() != nsGkAtoms::thead &&
+         content->Tag() != nsGkAtoms::tbody &&
+         content->Tag() != nsGkAtoms::tfoot &&
+         content->Tag() != nsGkAtoms::table)) {
       break;
     }
     ++j;
   }
   return j;
 }
 
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -311,17 +311,17 @@ nsFocusManager::GetFocusedDescendant(nsP
   return currentContent;
 }
 
 // static
 nsIContent*
 nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
 {
 #ifdef MOZ_XUL
-  if (aContent->IsXUL()) {
+  if (aContent->IsXULElement()) {
     nsCOMPtr<nsIDOMNode> inputField;
 
     nsCOMPtr<nsIDOMXULTextBoxElement> textbox = do_QueryInterface(aContent);
     if (textbox) {
       textbox->GetInputField(getter_AddRefs(inputField));
     }
     else {
       nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aContent);
@@ -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->IsHTML()) {
+  if (aContent->Tag() == nsGkAtoms::area && aContent->IsHTMLElement()) {
     // 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
@@ -2499,17 +2499,17 @@ nsFocusManager::DetermineElementToMoveFo
   // 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->IsHTML())
+        startContent->IsHTMLElement())
       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
@@ -2808,17 +2808,17 @@ nsFocusManager::GetNextTabbableContent(n
       if (!aForward) {
         frameTraversal->Last();
       } else if (aRootContent->IsFocusable()) {
         frameTraversal->Next();
       }
     }
     else if (getNextFrame &&
              (!iterStartContent || iterStartContent->Tag() != nsGkAtoms::area ||
-              !iterStartContent->IsHTML())) {
+              !iterStartContent->IsHTMLElement())) {
       // 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();
     }
 
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -203,31 +203,31 @@ nsFrameLoader::Create(Element* aOwner, b
 
 NS_IMETHODIMP
 nsFrameLoader::LoadFrame()
 {
   NS_ENSURE_TRUE(mOwnerContent, NS_ERROR_NOT_INITIALIZED);
 
   nsAutoString src;
 
-  bool isSrcdoc = mOwnerContent->IsHTML(nsGkAtoms::iframe) &&
+  bool isSrcdoc = mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
                   mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc);
   if (isSrcdoc) {
     src.AssignLiteral("about:srcdoc");
   }
   else {
     GetURL(src);
 
     src.Trim(" \t\n\r");
 
     if (src.IsEmpty()) {
       // If the frame is a XUL element and has the attribute 'nodefaultsrc=true'
       // then we will not use 'about:blank' as fallback but return early without
       // starting a load if no 'src' attribute is given (or it's empty).
-      if (mOwnerContent->IsXUL() &&
+      if (mOwnerContent->IsXULElement() &&
           mOwnerContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::nodefaultsrc,
                                      nsGkAtoms::_true, eCaseMatters)) {
         return NS_OK;
       }
       src.AssignLiteral("about:blank");
     }
   }
 
@@ -397,17 +397,17 @@ nsFrameLoader::ReallyStartLoadingInterna
   // We'll use our principal, not that of the document loaded inside us.  This
   // is very important; needed to prevent XSS attacks on documents loaded in
   // subframes!
   loadInfo->SetOwner(mOwnerContent->NodePrincipal());
 
   nsCOMPtr<nsIURI> referrer;
   
   nsAutoString srcdoc;
-  bool isSrcdoc = mOwnerContent->IsHTML(nsGkAtoms::iframe) &&
+  bool isSrcdoc = mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
                   mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::srcdoc,
                                          srcdoc);
 
   if (isSrcdoc) {
     nsAutoString referrerStr;
     mOwnerContent->OwnerDoc()->GetReferrer(referrerStr);
     rv = NS_NewURI(getter_AddRefs(referrer), referrerStr);
 
@@ -1723,17 +1723,17 @@ nsFrameLoader::MaybeCreateDocShell()
   // initialized.
   if (NS_FAILED(base_win->Create()) || !win_private) {
     // Do not call Destroy() here. See bug 472312.
     NS_WARNING("Something wrong when creating the docshell for a frameloader!");
     return NS_ERROR_FAILURE;
   }
 
   if (mIsTopLevelContent &&
-      mOwnerContent->IsXUL(nsGkAtoms::browser) &&
+      mOwnerContent->IsXULElement(nsGkAtoms::browser) &&
       !mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory)) {
     nsresult rv;
     nsCOMPtr<nsISHistory> sessionHistory =
       do_CreateInstance(NS_SHISTORY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
     webNav->SetSessionHistory(sessionHistory);
@@ -2108,17 +2108,17 @@ nsFrameLoader::TryRemoteBrowser()
   }
 
   // <iframe mozbrowser> gets to skip these checks.
   if (!OwnerIsBrowserOrAppFrame()) {
     if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
       return false;
     }
 
-    if (!mOwnerContent->IsXUL()) {
+    if (!mOwnerContent->IsXULElement()) {
       return false;
     }
 
     nsAutoString value;
     mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
 
     if (!value.LowerCaseEqualsLiteral("content") &&
         !StringBeginsWith(value, NS_LITERAL_STRING("content-"),
@@ -2408,17 +2408,17 @@ nsFrameLoader::EnsureMessageManager()
   nsresult rv = MaybeCreateDocShell();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (!mIsTopLevelContent &&
       !OwnerIsBrowserOrAppFrame() &&
       !mRemoteFrame &&
-      !(mOwnerContent->IsXUL() &&
+      !(mOwnerContent->IsXULElement() &&
         mOwnerContent->AttrValueIs(kNameSpaceID_None,
                                    nsGkAtoms::forcemessagemanager,
                                    nsGkAtoms::_true, eCaseMatters))) {
     return NS_OK;
   }
 
   bool useRemoteProcess = ShouldUseRemoteProcess();
   if (mMessageManager) {
@@ -2429,17 +2429,17 @@ nsFrameLoader::EnsureMessageManager()
   }
 
   nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
     do_QueryInterface(GetOwnerDoc()->GetWindow());
   nsCOMPtr<nsIMessageBroadcaster> parentManager;
 
   if (chromeWindow) {
     nsAutoString messagemanagergroup;
-    if (mOwnerContent->IsXUL() &&
+    if (mOwnerContent->IsXULElement() &&
         mOwnerContent->GetAttr(kNameSpaceID_None,
                                nsGkAtoms::messagemanagergroup,
                                messagemanagergroup)) {
       chromeWindow->GetGroupMessageManager(messagemanagergroup, getter_AddRefs(parentManager));
     }
 
     if (!parentManager) {
       chromeWindow->GetMessageManager(getter_AddRefs(parentManager));
--- a/dom/base/nsFrameLoader.h
+++ b/dom/base/nsFrameLoader.h
@@ -300,17 +300,18 @@ private:
                        nsSubDocumentFrame *aFrame = nullptr);
 
   bool AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
                               nsIDocShellTreeOwner* aOwner,
                               int32_t aParentType,
                               nsIDocShell* aParentNode);
 
   nsIAtom* TypeAttrName() const {
-    return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;
+    return mOwnerContent->IsXULElement()
+             ? nsGkAtoms::type : nsGkAtoms::mozframetype;
   }
 
   // Update the permission manager's app-id refcount based on mOwnerContent's
   // own-or-containing-app.
   void ResetPermissionManagerStatus();
 
   void InitializeBrowserAPI();
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9941,17 +9941,17 @@ nsGlobalWindow::SetChromeEventHandler(Ev
     NS_ASSERTION(!inner->mOuterWindow || inner->mOuterWindow == this,
                  "bad outer window pointer");
     inner->SetChromeEventHandlerInternal(aChromeEventHandler);
   }
 }
 
 static bool IsLink(nsIContent* aContent)
 {
-  return aContent && (aContent->IsHTML(nsGkAtoms::a) ||
+  return aContent && (aContent->IsHTMLElement(nsGkAtoms::a) ||
                       aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
                                             nsGkAtoms::simple, eCaseMatters));
 }
 
 void
 nsGlobalWindow::SetFocusedNode(nsIContent* aNode,
                                uint32_t aFocusMethod,
                                bool aNeedsFocus)
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -34,18 +34,18 @@ struct IMEState;
 enum nsLinkState {
   eLinkState_Unvisited  = 1,
   eLinkState_Visited    = 2,
   eLinkState_NotLink    = 3 
 };
 
 // IID for the nsIContent interface
 #define NS_ICONTENT_IID \
-{ 0x697a2fe1, 0x5549, 0x48e7, \
-  { 0x9a, 0x1a, 0xc2, 0x9d, 0xab, 0x14, 0xe2, 0x39 } }
+{ 0x70f7e9ea, 0xa9bf, 0x48cc, \
+  { 0xad, 0x9d, 0x8a, 0xca, 0xee, 0xd2, 0x9b, 0x68 } }
 
 /**
  * A node of content in a document's content model. This interface
  * is supported by all content objects.
  */
 class nsIContent : public nsINode {
 public:
   typedef mozilla::widget::IMEState IMEState;
@@ -245,70 +245,79 @@ public:
    * Get the namespace that this element's tag is defined in
    * @return the namespace
    */
   inline int32_t GetNameSpaceID() const
   {
     return mNodeInfo->NamespaceID();
   }
 
-  /**
-   * Get the NodeInfo for this element
-   * @return the nodes node info
-   */
-  inline mozilla::dom::NodeInfo* NodeInfo() const
-  {
-    return mNodeInfo;
-  }
-
-  inline bool IsInNamespace(int32_t aNamespace) const
-  {
-    return mNodeInfo->NamespaceID() == aNamespace;
-  }
-
-  inline bool IsHTML() const
+  inline bool IsHTMLElement() const
   {
     return IsInNamespace(kNameSpaceID_XHTML);
   }
 
-  inline bool IsHTML(nsIAtom* aTag) const
+  inline bool IsHTMLElement(nsIAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
   }
 
-  inline bool IsSVG() const
+  template<typename First, typename... Args>
+  inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
+  {
+    return IsHTMLElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  inline bool IsSVGElement() const
   {
     return IsInNamespace(kNameSpaceID_SVG);
   }
 
-  inline bool IsSVG(nsIAtom* aTag) const
+  inline bool IsSVGElement(nsIAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
   }
 
-  inline bool IsXUL() const
+  template<typename First, typename... Args>
+  inline bool IsAnyOfSVGElements(First aFirst, Args... aArgs) const
+  {
+    return IsSVGElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  inline bool IsXULElement() const
   {
     return IsInNamespace(kNameSpaceID_XUL);
   }
 
-  inline bool IsXUL(nsIAtom* aTag) const
+  inline bool IsXULElement(nsIAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
   }
 
-  inline bool IsMathML() const
+  template<typename First, typename... Args>
+  inline bool IsAnyOfXULElements(First aFirst, Args... aArgs) const
+  {
+    return IsXULElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  inline bool IsMathMLElement() const
   {
     return IsInNamespace(kNameSpaceID_MathML);
   }
 
-  inline bool IsMathML(nsIAtom* aTag) const
+  inline bool IsMathMLElement(nsIAtom* aTag) const
   {
     return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
   }
 
+  template<typename First, typename... Args>
+  inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const
+  {
+    return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
+  }
   inline bool IsActiveChildrenElement() const
   {
     return mNodeInfo->Equals(nsGkAtoms::children, kNameSpaceID_XBL) &&
            GetBindingParent();
   }
 
   /**
    * Set attribute values. All attribute values are assumed to have a
@@ -905,17 +914,17 @@ public:
    */
   void GetLang(nsAString& aResult) const {
     for (const nsIContent* content = this; content; content = content->GetParent()) {
       if (content->GetAttrCount() > 0) {
         // xml:lang has precedence over lang on HTML elements (see
         // XHTML1 section C.7).
         bool hasAttr = content->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang,
                                           aResult);
-        if (!hasAttr && (content->IsHTML() || content->IsSVG())) {
+        if (!hasAttr && (content->IsHTMLElement() || content->IsSVGElement())) {
           hasAttr = content->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
                                      aResult);
         }
         NS_ASSERTION(hasAttr || aResult.IsEmpty(),
                      "GetAttr that returns false should not make string non-empty");
         if (hasAttr) {
           return;
         }
--- a/dom/base/nsIContentInlines.h
+++ b/dom/base/nsIContentInlines.h
@@ -8,12 +8,12 @@
 #define nsIContentInlines_h
 
 #include "nsIContent.h"
 #include "nsIDocument.h"
 
 inline bool
 nsIContent::IsInHTMLDocument() const
 {
-  return OwnerDoc()->IsHTML();
+  return OwnerDoc()->IsHTMLDocument();
 }
 
 #endif // nsIContentInlines_h
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -141,20 +141,19 @@ typedef CallbackObjectHolder<NodeFilter,
 struct FullScreenOptions {
   FullScreenOptions() { }
   nsRefPtr<gfx::VRHMDInfo> mVRHMDDevice;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-// 137c6144-513e-4edf-840e-5e3156638ed6
 #define NS_IDOCUMENT_IID \
-{ 0x137c6144, 0x513e, 0x4edf, \
-  { 0x84, 0x0e, 0x5e, 0x31, 0x56, 0x63, 0x8e, 0xd6 } }
+{ 0x0b78eabe, 0x8b94, 0x4ea1, \
+  { 0x93, 0x31, 0x5d, 0x48, 0xe8, 0x3a, 0xda, 0x95 } }
 
 // Enum for requesting a particular type of document when creating a doc
 enum DocumentFlavor {
   DocumentFlavorLegacyGuess, // compat with old code until made HTML5-compliant
   DocumentFlavorHTML, // HTMLDocument with HTMLness bit set to true
   DocumentFlavorSVG, // SVGDocument
   DocumentFlavorPlain, // Just a Document
 };
@@ -1297,43 +1296,43 @@ public:
                                  nsAString& Standalone) = 0;
 
   /**
    * Returns true if this is what HTML 5 calls an "HTML document" (for example
    * regular HTML document with Content-Type "text/html", image documents and
    * media documents).  Returns false for XHTML and any other documents parsed
    * by the XML parser.
    */
-  bool IsHTML() const
+  bool IsHTMLDocument() const
   {
     return mType == eHTML;
   }
   bool IsHTMLOrXHTML() const
   {
     return mType == eHTML || mType == eXHTML;
   }
-  bool IsXML() const
+  bool IsXMLDocument() const
   {
-    return !IsHTML();
+    return !IsHTMLDocument();
   }
-  bool IsSVG() const
+  bool IsSVGDocument() const
   {
     return mType == eSVG;
   }
-  bool IsXUL() const
+  bool IsXULDocument() const
   {
     return mType == eXUL;
   }
   bool IsUnstyledDocument()
   {
     return IsLoadedAsData() || IsLoadedAsInteractiveData();
   }
   bool LoadsFullXULStyleSheetUpFront()
   {
-    return IsXUL() || AllowXULXBL();
+    return IsXULDocument() || AllowXULXBL();
   }
 
   virtual bool IsScriptEnabled() = 0;
 
   /**
    * Create an element with the specified name, prefix and namespace ID.
    */
   virtual nsresult CreateElem(const nsAString& aName, nsIAtom *aPrefix,
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -215,17 +215,17 @@ static nsIContent* GetEditorRootContent(
 
 nsIContent*
 nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
 {
   if (aEditor)
     *aEditor = nullptr;
   for (nsINode* node = this; node; node = node->GetParentNode()) {
     if (!node->IsElement() ||
-        !node->AsElement()->IsHTML())
+        !node->IsHTMLElement())
       continue;
 
     nsCOMPtr<nsIEditor> editor =
       static_cast<nsGenericHTMLElement*>(node)->GetEditorInternal();
     if (!editor)
       continue;
 
     nsIContent* rootContent = GetEditorRootContent(editor);
@@ -422,17 +422,17 @@ nsINode::IsInAnonymousSubtree() const
 }
 
 bool
 nsINode::IsAnonymousContentInSVGUseSubtree() const
 {
   MOZ_ASSERT(IsInAnonymousSubtree());
   nsIContent* parent = AsContent()->GetBindingParent();
   // Watch out for parentless native-anonymous subtrees.
-  return parent && parent->IsSVG(nsGkAtoms::use);
+  return parent && parent->IsSVGElement(nsGkAtoms::use);
 }
 
 nsresult
 nsINode::GetParentNode(nsIDOMNode** aParentNode)
 {
   *aParentNode = nullptr;
 
   nsINode *parent = GetParentNode();
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -243,18 +243,18 @@ private:
 
 // Categories of node properties
 // 0 is global.
 #define DOM_USER_DATA         1
 #define SMIL_MAPPED_ATTR_ANIMVAL 2
 
 // IID for the nsINode interface
 #define NS_INODE_IID \
-{ 0x66972940, 0x1d1b, 0x4d15, \
- { 0x93, 0x11, 0x96, 0x72, 0x84, 0x2e, 0xc7, 0x27 } }
+{ 0x9c090b44, 0x754b, 0x413c, \
+ { 0x9d, 0xd5, 0xe4, 0x3d, 0xc4, 0x54, 0x96, 0xe3 } }
 
 /**
  * An internal interface that abstracts some DOMNode-related parts that both
  * nsIContent and nsIDocument share.  An instance of this interface has a list
  * of nsIContent children and provides access to them.
  */
 class nsINode : public mozilla::dom::EventTarget
 {
@@ -570,16 +570,109 @@ public:
    * "#comment", "#document", etc.
    */
   nsIAtom* Tag() const
   {
     return mNodeInfo->NameAtom();
   }
 
   /**
+   * Get the NodeInfo for this element
+   * @return the nodes node info
+   */
+  inline mozilla::dom::NodeInfo* NodeInfo() const
+  {
+    return mNodeInfo;
+  }
+
+  inline bool IsInNamespace(int32_t aNamespace) const
+  {
+    return mNodeInfo->NamespaceID() == aNamespace;
+  }
+
+protected:
+  // These 2 methods are useful for the recursive templates IsHTMLElement,
+  // IsSVGElement, etc.
+  inline bool IsNodeInternal() const
+  {
+    return false;
+  }
+
+  template<typename First, typename... Args>
+  inline bool IsNodeInternal(First aFirst, Args... aArgs) const
+  {
+    return mNodeInfo->Equals(aFirst) || IsNodeInternal(aArgs...);
+  }
+
+public:
+  inline bool IsHTMLElement() const
+  {
+    return IsElement() && IsInNamespace(kNameSpaceID_XHTML);
+  }
+
+  inline bool IsHTMLElement(nsIAtom* aTag) const
+  {
+    return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
+  }
+
+  template<typename First, typename... Args>
+  inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
+  {
+    return IsHTMLElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  inline bool IsSVGElement() const
+  {
+    return IsElement() && IsInNamespace(kNameSpaceID_SVG);
+  }
+
+  inline bool IsSVGElement(nsIAtom* aTag) const
+  {
+    return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
+  }
+
+  template<typename First, typename... Args>
+  inline bool IsAnyOfSVGElements(First aFirst, Args... aArgs) const
+  {
+    return IsSVGElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  inline bool IsXULElement() const
+  {
+    return IsElement() && IsInNamespace(kNameSpaceID_XUL);
+  }
+
+  inline bool IsXULElement(nsIAtom* aTag) const
+  {
+    return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
+  }
+
+  template<typename First, typename... Args>
+  inline bool IsAnyOfXULElements(First aFirst, Args... aArgs) const
+  {
+    return IsXULElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  inline bool IsMathMLElement() const
+  {
+    return IsElement() && IsInNamespace(kNameSpaceID_MathML);
+  }
+
+  inline bool IsMathMLElement(nsIAtom* aTag) const
+  {
+    return IsElement() && mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
+  }
+
+  template<typename First, typename... Args>
+  inline bool IsAnyOfMathMLElements(First aFirst, Args... aArgs) const
+  {
+    return IsMathMLElement() && IsNodeInternal(aFirst, aArgs...);
+  }
+
+  /**
    * Insert a content node at a particular index.  This method handles calling
    * BindToTree on the child appropriately.
    *
    * @param aKid the content to insert
    * @param aIndex the index it is being inserted at (the index it will have
    *        after it is inserted)
    * @param aNotify whether to notify the document (current document for
    *        nsIContent, and |this| for nsIDocument) that the insert has
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -219,17 +219,17 @@ nsNodeUtils::LastRelease(nsINode* aNode)
     // I wonder whether it's faster to do the HasFlag check first....
     if (aNode->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) &&
         aNode->HasFlag(ADDED_TO_FORM)) {
       // Tell the form (if any) this node is going away.  Don't
       // notify, since we're being destroyed in any case.
       static_cast<nsGenericHTMLFormElement*>(aNode)->ClearForm(true);
     }
 
-    if (aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::img) &&
+    if (aNode->IsHTMLElement(nsGkAtoms::img) &&
         aNode->HasFlag(ADDED_TO_FORM)) {
       HTMLImageElement* imageElem = static_cast<HTMLImageElement*>(aNode);
       imageElem->ClearForm(true);
     }
   }
   aNode->UnsetFlags(NODE_HAS_PROPERTIES);
 
   if (aNode->NodeType() != nsIDOMNode::DOCUMENT_NODE &&
@@ -522,18 +522,17 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
   // ChangeDocumentFor() call in nsXULElement::BindToTree as well.  Also,
   // remove the UnbindFromTree call in ~nsXULElement, and add back in the
   // precondition in nsXULElement::UnbindFromTree and remove the line in
   // nsXULElement.h that makes nsNodeUtils a friend of nsXULElement.
   // Note: Make sure to do this witchery _after_ we've done any deep
   // cloning, so kids of the new node aren't confused about whether they're
   // in a document.
 #ifdef MOZ_XUL
-  if (aClone && !aParent && aNode->IsElement() &&
-      aNode->AsElement()->IsXUL()) {
+  if (aClone && !aParent && aNode->IsXULElement()) {
     if (!aNode->OwnerDoc()->IsLoadedAsInteractiveData()) {
       clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
     }
   }
 #endif
 
   if (aNode->HasProperties()) {
     bool ok = aNodesWithProperties.AppendObject(aNode);
@@ -560,17 +559,17 @@ nsNodeUtils::UnlinkUserData(nsINode *aNo
   // delete the document.
   nsCOMPtr<nsIDocument> document = aNode->OwnerDoc();
   document->PropertyTable(DOM_USER_DATA)->DeleteAllPropertiesFor(aNode);
 }
 
 bool
 nsNodeUtils::IsTemplateElement(const nsINode *aNode)
 {
-  return aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::_template);
+  return aNode->IsHTMLElement(nsGkAtoms::_template);
 }
 
 nsIContent*
 nsNodeUtils::GetFirstChildOfTemplateOrNode(nsINode* aNode)
 {
   if (nsNodeUtils::IsTemplateElement(aNode)) {
     DocumentFragment* frag =
       static_cast<HTMLTemplateElement*>(aNode)->Content();
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -960,17 +960,17 @@ nsObjectLoadingContent::BuildParametersA
     return;
   }
 
   nsCOMPtr<nsIContent> content =
     do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
 
   int32_t start = 0, end = content->GetAttrCount(), step = 1;
   // HTML attributes are stored in reverse order.
-  if (content->IsHTML() && content->IsInHTMLDocument()) {
+  if (content->IsHTMLElement() && content->IsInHTMLDocument()) {
     start = end - 1;
     end = -1;
     step = -1;
   }
 
   for (int32_t i = start; i != end; i += step) {
     MozPluginParameter param;
     const nsAttrName* attrName = content->GetAttrNameAt(i);
@@ -2890,31 +2890,31 @@ nsObjectLoadingContent::LoadFallback(Fal
 
   //
   // Fixup mFallbackType
   //
   nsCOMPtr<nsIContent> thisContent =
   do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
   NS_ASSERTION(thisContent, "must be a content");
 
-  if (!thisContent->IsHTML() || mContentType.IsEmpty()) {
+  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 &&
       (aType == eFallbackUnsupported ||
        aType == eFallbackDisabled ||
        aType == eFallbackBlocklisted))
   {
     // Show alternate content instead, if it exists
     for (nsIContent* child = thisContent->GetFirstChild();
          child; child = child->GetNextSibling()) {
-      if (!child->IsHTML(nsGkAtoms::param) &&
+      if (!child->IsHTMLElement(nsGkAtoms::param) &&
           nsStyleUtil::IsSignificantChild(child, true, false)) {
         aType = eFallbackAlternate;
         break;
       }
     }
   }
 
   mType = eType_Null;
--- a/dom/base/nsPlainTextSerializer.cpp
+++ b/dom/base/nsPlainTextSerializer.cpp
@@ -1768,17 +1768,17 @@ nsPlainTextSerializer::IsCurrentNodeConv
            value.EqualsIgnoreCase("\"moz-txt", 8)));
 }
 
 
 // static
 nsIAtom*
 nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
 {
-  if (!aContent->IsHTML()) {
+  if (!aContent->IsHTMLElement()) {
     return nullptr;
   }
 
   nsIAtom* localName = aContent->Tag();
   return localName->IsStaticAtom() ? localName : nullptr;
 }
 
 bool
--- a/dom/base/nsScriptLoader.cpp
+++ b/dom/base/nsScriptLoader.cpp
@@ -184,17 +184,17 @@ NS_IMPL_ISUPPORTS(nsScriptLoader, nsIStr
 // and the event-attribute matches "\s*onload([ \(].*)?" then it isn't an
 // eventhandler. (both matches are case insensitive).
 // This is how IE seems to filter out a window's onload handler from a
 // <script for=... event=...> element.
 
 static bool
 IsScriptEventHandler(nsIContent* aScriptElement)
 {
-  if (!aScriptElement->IsHTML()) {
+  if (!aScriptElement->IsHTMLElement()) {
     return false;
   }
 
   nsAutoString forAttr, eventAttr;
   if (!aScriptElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_for, forAttr) ||
       !aScriptElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, eventAttr)) {
     return false;
   }
@@ -570,17 +570,17 @@ nsScriptLoader::ProcessScriptElement(nsI
   nsAutoString type;
   aElement->GetScriptType(type);
   if (!type.IsEmpty()) {
     NS_ENSURE_TRUE(ParseTypeAttribute(type, &version), false);
   } else {
     // no 'type=' element
     // "language" is a deprecated attribute of HTML, so we check it only for
     // HTML script elements.
-    if (scriptContent->IsHTML()) {
+    if (scriptContent->IsHTMLElement()) {
       nsAutoString language;
       scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
       if (!language.IsEmpty()) {
         if (!nsContentUtils::IsJavaScriptLanguage(language)) {
           return false;
         }
       }
     }
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -222,18 +222,18 @@ nsStyleLinkElement::UpdateStyleSheetInte
 }
 
 static bool
 IsScopedStyleElement(nsIContent* aContent)
 {
   // This is quicker than, say, QIing aContent to nsStyleLinkElement
   // and then calling its virtual GetStyleSheetInfo method to find out
   // if it is scoped.
-  return (aContent->IsHTML(nsGkAtoms::style) ||
-          aContent->IsSVG(nsGkAtoms::style)) &&
+  return (aContent->IsHTMLElement(nsGkAtoms::style) ||
+          aContent->IsSVGElement(nsGkAtoms::style)) &&
          aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scoped);
 }
 
 static bool
 HasScopedStyleSheetChild(nsIContent* aContent)
 {
   for (nsIContent* n = aContent->GetFirstChild(); n; n = n->GetNextSibling()) {
     if (IsScopedStyleElement(n)) {
@@ -302,17 +302,17 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
     // Stylesheets in <use>-cloned subtrees are disabled until we figure out
     // how they should behave.
     return NS_OK;
   }
 
   // Check for a ShadowRoot because link elements are inert in a
   // ShadowRoot.
   ShadowRoot* containingShadow = thisContent->GetContainingShadow();
-  if (thisContent->IsHTML(nsGkAtoms::link) &&
+  if (thisContent->IsHTMLElement(nsGkAtoms::link) &&
       (aOldShadowRoot || containingShadow)) {
     return NS_OK;
   }
 
   Element* oldScopeElement = GetScopeElement(mStyleSheet);
 
   if (mStyleSheet && (aOldDocument || aOldShadowRoot)) {
     MOZ_ASSERT(!(aOldDocument && aOldShadowRoot),
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -1209,20 +1209,20 @@ nsTreeSanitizer::SanitizeAttributes(mozi
       }
       if (!mDropNonCSSPresentation &&
           (aAllowed == sAttributesHTML) && // element is HTML
           sPresAttributesHTML->GetEntry(attrLocal)) {
         continue;
       }
       if (aAllowed->GetEntry(attrLocal) &&
           !((attrLocal == nsGkAtoms::rel &&
-             aElement->IsHTML(nsGkAtoms::link)) ||
+             aElement->IsHTMLElement(nsGkAtoms::link)) ||
             (!mFullDocument &&
              attrLocal == nsGkAtoms::name &&
-             aElement->IsHTML(nsGkAtoms::meta)))) {
+             aElement->IsHTMLElement(nsGkAtoms::meta)))) {
         // name="" and rel="" are whitelisted, but treat them as blacklisted
         // for <meta name> (fragment case) and <link rel> (all cases) to avoid
         // document-wide metadata or styling overrides with non-conforming
         // <meta name itemprop> or
         // <link rel itemprop>
         continue;
       }
       const char16_t* localStr = attrLocal->GetUTF16String();
@@ -1268,18 +1268,17 @@ nsTreeSanitizer::SanitizeAttributes(mozi
     // in case the attribute removal shuffled the attribute order, start the
     // loop again.
     --ac;
     i = ac; // i will be decremented immediately thanks to the for loop
   }
 
   // If we've got HTML audio or video, add the controls attribute, because
   // otherwise the content is unplayable with scripts removed.
-  if (aElement->IsHTML(nsGkAtoms::video) ||
-      aElement->IsHTML(nsGkAtoms::audio)) {
+  if (aElement->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio)) {
     aElement->SetAttr(kNameSpaceID_None,
                       nsGkAtoms::controls,
                       EmptyString(),
                       false);
   }
 }
 
 bool
@@ -1353,17 +1352,17 @@ void
 nsTreeSanitizer::Sanitize(nsIDocument* aDocument)
 {
   // If you want to relax these preconditions, be sure to check the code in
   // here that notifies / does not notify or that fires mutation events if
   // in tree.
 #ifdef DEBUG
   NS_PRECONDITION(!aDocument->GetContainer(), "The document is in a shell.");
   nsRefPtr<mozilla::dom::Element> root = aDocument->GetRootElement();
-  NS_PRECONDITION(root->IsHTML(nsGkAtoms::html), "Not HTML root.");
+  NS_PRECONDITION(root->IsHTMLElement(nsGkAtoms::html), "Not HTML root.");
 #endif
 
   mFullDocument = true;
   SanitizeChildren(aDocument);
 }
 
 void
 nsTreeSanitizer::SanitizeChildren(nsINode* aRoot)
--- a/dom/base/nsXHTMLContentSerializer.cpp
+++ b/dom/base/nsXHTMLContentSerializer.cpp
@@ -461,17 +461,17 @@ nsXHTMLContentSerializer::AfterElementSt
 
     // 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()) {
-      if (child->IsHTML(nsGkAtoms::meta) &&
+      if (child->IsHTMLElement(nsGkAtoms::meta) &&
           child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
         nsAutoString header;
         child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
 
         if (header.LowerCaseEqualsLiteral("content-type")) {
           hasMeta = true;
           break;
         }
--- a/dom/base/nsXMLContentSerializer.cpp
+++ b/dom/base/nsXMLContentSerializer.cpp
@@ -761,19 +761,19 @@ nsXMLContentSerializer::ScanNamespaceDec
   return skipAttr;
 }
 
 
 bool
 nsXMLContentSerializer::IsJavaScript(nsIContent * aContent, nsIAtom* aAttrNameAtom,
                                      int32_t aAttrNamespaceID, const nsAString& aValueString)
 {
-  bool isHtml = aContent->IsHTML();
-  bool isXul = aContent->IsXUL();
-  bool isSvg = aContent->IsSVG();
+  bool isHtml = aContent->IsHTMLElement();
+  bool isXul = aContent->IsXULElement();
+  bool isSvg = aContent->IsSVGElement();
 
   if (aAttrNamespaceID == kNameSpaceID_None &&
       (isHtml || isXul || isSvg) &&
       (aAttrNameAtom == nsGkAtoms::href ||
        aAttrNameAtom == nsGkAtoms::src)) {
 
     static const char kJavaScript[] = "javascript";
     int32_t pos = aValueString.FindChar(':');
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -190,17 +190,17 @@ ContentEventHandler::QueryContentRect(ns
 }
 
 // Editor places a bogus BR node under its root content if the editor doesn't
 // have any text. This happens even for single line editors.
 // When we get text content and when we change the selection,
 // we don't want to include the bogus BRs at the end.
 static bool IsContentBR(nsIContent* aContent)
 {
-  return aContent->IsHTML() &&
+  return aContent->IsHTMLElement() &&
          aContent->Tag() == nsGkAtoms::br &&
          !aContent->AttrValueIs(kNameSpaceID_None,
                                 nsGkAtoms::type,
                                 nsGkAtoms::moz,
                                 eIgnoreCase) &&
          !aContent->AttrValueIs(kNameSpaceID_None,
                                 nsGkAtoms::mozeditorbogusnode,
                                 nsGkAtoms::_true,
@@ -1386,17 +1386,17 @@ static void AdjustRangeForSelection(nsIC
       }
     } else {
       node = node->GetParent();
       nodeOffset = node->IndexOf(*aNode) + (nodeOffset ? 1 : 0);
     }
   }
 
   nsIContent* brContent = node->GetChildAt(nodeOffset - 1);
-  while (brContent && brContent->IsHTML()) {
+  while (brContent && brContent->IsHTMLElement()) {
     if (brContent->Tag() != nsGkAtoms::br || IsContentBR(brContent)) {
       break;
     }
     brContent = node->GetChildAt(--nodeOffset - 1);
   }
   *aNode = node;
   *aNodeOffset = std::max(nodeOffset, 0);
 }
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -867,17 +867,17 @@ IsAccessKeyTarget(nsIContent* aContent, 
   // XXXbz shouldn't this be case-sensitive, per spec?
   nsString contentKey;
   if (!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, contentKey) ||
       !contentKey.Equals(aKey, nsCaseInsensitiveStringComparator()))
     return false;
 
   nsCOMPtr<nsIDOMXULDocument> xulDoc =
     do_QueryInterface(aContent->OwnerDoc());
-  if (!xulDoc && !aContent->IsXUL())
+  if (!xulDoc && !aContent->IsXULElement())
     return true;
 
     // For XUL we do visibility checks.
   if (!aFrame)
     return false;
 
   if (aFrame->IsFocusable())
     return true;
@@ -885,27 +885,27 @@ IsAccessKeyTarget(nsIContent* aContent, 
   if (!aFrame->IsVisibleConsideringAncestors())
     return false;
 
   // XUL controls can be activated.
   nsCOMPtr<nsIDOMXULControlElement> control(do_QueryInterface(aContent));
   if (control)
     return true;
 
-  if (aContent->IsHTML()) {
+  if (aContent->IsHTMLElement()) {
     nsIAtom* tag = aContent->Tag();
 
     // HTML area, label and legend elements are never focusable, so
     // we need to check for them explicitly before giving up.
     if (tag == nsGkAtoms::area ||
         tag == nsGkAtoms::label ||
         tag == nsGkAtoms::legend)
       return true;
 
-  } else if (aContent->IsXUL()) {
+  } else if (aContent->IsXULElement()) {
     // XUL label elements are never focusable, so we need to check for them
     // explicitly before giving up.
     if (aContent->Tag() == nsGkAtoms::label)
       return true;
   }
 
   return false;
 }
@@ -1121,17 +1121,17 @@ bool
 EventStateManager::IsRemoteTarget(nsIContent* target) {
   if (!target) {
     return false;
   }
 
   // <browser/iframe remote=true> from XUL
   if ((target->Tag() == nsGkAtoms::browser ||
        target->Tag() == nsGkAtoms::iframe) &&
-      target->IsXUL() &&
+      target->IsXULElement() &&
       target->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
                           nsGkAtoms::_true, eIgnoreCase)) {
     return true;
   }
 
   // <frame/iframe mozbrowser/mozapp>
   nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(target);
   if (browserFrame && browserFrame->GetReallyIsBrowserOrApp()) {
@@ -1382,17 +1382,17 @@ EventStateManager::FireContextClick()
     NS_ASSERTION(mPresContext == mCurrentTarget->PresContext(),
                  "a prescontext returned a primary frame that didn't belong to it?");
 
     // before dispatching, check that we're not on something that
     // doesn't get a context menu
     nsIAtom *tag = mGestureDownContent->Tag();
     bool allowedToDispatch = true;
 
-    if (mGestureDownContent->IsXUL()) {
+    if (mGestureDownContent->IsXULElement()) {
       if (tag == nsGkAtoms::scrollbar ||
           tag == nsGkAtoms::scrollbarbutton ||
           tag == nsGkAtoms::button)
         allowedToDispatch = false;
       else if (tag == nsGkAtoms::toolbarbutton) {
         // a <toolbarbutton> that has the container attribute set
         // will already have its own dropdown.
         if (nsContentUtils::HasNonEmptyAttr(mGestureDownContent,
@@ -1403,17 +1403,17 @@ EventStateManager::FireContextClick()
             // a second menu
           if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
                                                nsGkAtoms::_true, eCaseMatters)) {
             allowedToDispatch = false;
           }
         }
       }
     }
-    else if (mGestureDownContent->IsHTML()) {
+    else if (mGestureDownContent->IsHTMLElement()) {
       nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
 
       if (formCtrl) {
         allowedToDispatch = formCtrl->IsTextControl(false) ||
                             formCtrl->GetType() == NS_FORM_INPUT_FILE;
       }
       else if (tag == nsGkAtoms::applet ||
                tag == nsGkAtoms::embed  ||
@@ -2641,17 +2641,17 @@ EventStateManager::DecideGestureEvent(Wi
   aEvent->panDirection = panDirection;
 }
 
 #ifdef XP_MACOSX
 static bool
 NodeAllowsClickThrough(nsINode* aNode)
 {
   while (aNode) {
-    if (aNode->IsElement() && aNode->AsElement()->IsXUL()) {
+    if (aNode->IsXULElement()) {
       mozilla::dom::Element* element = aNode->AsElement();
       static nsIContent::AttrValuesArray strings[] =
         {&nsGkAtoms::always, &nsGkAtoms::never, nullptr};
       switch (element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::clickthrough,
                                        strings, eCaseMatters)) {
         case 0:
           return true;
         case 1:
@@ -2883,17 +2883,17 @@ EventStateManager::PostHandleEvent(nsPre
                                           nsIFocusManager::FLAG_NOSCROLL);
           }
           else if (!suppressBlur) {
             // clear the focus within the frame and then set it as the
             // focused frame
             EnsureDocument(mPresContext);
             if (mDocument) {
 #ifdef XP_MACOSX
-              if (!activeContent || !activeContent->IsXUL())
+              if (!activeContent || !activeContent->IsXULElement())
 #endif
                 fm->ClearFocus(mDocument->GetWindow());
               fm->SetFocusedWindow(mDocument->GetWindow());
             }
           }
         }
 
         // The rest is left button-specific.
@@ -4802,17 +4802,17 @@ EventStateManager::ResetLastOverForConte
 void
 EventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent)
 {
   /*
    * Anchor and area elements when focused or hovered might make the UI to show
    * the current link. We want to make sure that the UI gets informed when they
    * are actually removed from the DOM.
    */
-  if (aContent->IsHTML() &&
+  if (aContent->IsHTMLElement() &&
       (aContent->Tag() == nsGkAtoms::a || aContent->Tag() == nsGkAtoms::area) &&
       (aContent->AsElement()->State().HasAtLeastOneOfStates(NS_EVENT_STATE_FOCUS |
                                                             NS_EVENT_STATE_HOVER))) {
     nsGenericHTMLElement* element = static_cast<nsGenericHTMLElement*>(aContent);
     element->LeaveLink(
       element->GetPresContext(nsGenericHTMLElement::eForComposedDoc));
   }
 
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -912,17 +912,17 @@ IMEContentObserver::ContentRemoved(nsIDo
 
 static nsIContent*
 GetContentBR(dom::Element* aElement)
 {
   if (!aElement->IsNodeOfType(nsINode::eCONTENT)) {
     return nullptr;
   }
   nsIContent* content = static_cast<nsIContent*>(aElement);
-  return content->IsHTML(nsGkAtoms::br) ? content : nullptr;
+  return content->IsHTMLElement(nsGkAtoms::br) ? content : nullptr;
 }
 
 void
 IMEContentObserver::AttributeWillChange(nsIDocument* aDocument,
                                         dom::Element* aElement,
                                         int32_t aNameSpaceID,
                                         nsIAtom* aAttribute,
                                         int32_t aModType)
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -837,17 +837,17 @@ IMEStateManager::SetIMEState(const IMESt
       nsCOMPtr<nsIForm> form;
       if (control) {
         // is this a form and does it have a default submit element?
         if ((form = do_QueryInterface(formElement)) &&
             form->GetDefaultSubmitElement()) {
           willSubmit = true;
         // is this an html form and does it only have a single text input element?
         } else if (formElement && formElement->Tag() == nsGkAtoms::form &&
-                   formElement->IsHTML() &&
+                   formElement->IsHTMLElement() &&
                    !static_cast<dom::HTMLFormElement*>(formElement)->
                      ImplicitSubmissionIsDisabled()) {
           willSubmit = true;
         }
       }
       context.mActionHint.Assign(
         willSubmit ? (control->GetType() == NS_FORM_INPUT_SEARCH ?
                        NS_LITERAL_STRING("search") : NS_LITERAL_STRING("go")) :
--- a/dom/html/HTMLContentElement.cpp
+++ b/dom/html/HTMLContentElement.cpp
@@ -60,18 +60,17 @@ HTMLContentElement::BindToTree(nsIDocume
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   ShadowRoot* containingShadow = GetContainingShadow();
   if (containingShadow && !oldContainingShadow) {
     nsINode* parentNode = nsINode::GetParentNode();
     while (parentNode && parentNode != containingShadow) {
-      if (parentNode->IsElement() &&
-          parentNode->AsElement()->IsHTML(nsGkAtoms::content)) {
+      if (parentNode->IsHTMLElement(nsGkAtoms::content)) {
         // 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.
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -158,17 +158,17 @@ HTMLFieldSetElement::SubmitNamesValues(n
 }
 
 nsresult
 HTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
                                    bool aNotify)
 {
   bool firstLegendHasChanged = false;
 
-  if (aChild->IsHTML(nsGkAtoms::legend)) {
+  if (aChild->IsHTMLElement(nsGkAtoms::legend)) {
     if (!mFirstLegend) {
       mFirstLegend = aChild;
       // We do not want to notify the first time mFirstElement is set.
     } else {
       // If mFirstLegend is before aIndex, we do not change it.
       // Otherwise, mFirstLegend is now aChild.
       if (int32_t(aIndex) <= IndexOf(mFirstLegend)) {
         mFirstLegend = aChild;
@@ -194,17 +194,17 @@ HTMLFieldSetElement::RemoveChildAt(uint3
 
   if (mFirstLegend && (GetChildAt(aIndex) == mFirstLegend)) {
     // If we are removing the first legend we have to found another one.
     nsIContent* child = mFirstLegend->GetNextSibling();
     mFirstLegend = nullptr;
     firstLegendHasChanged = true;
 
     for (; child; child = child->GetNextSibling()) {
-      if (child->IsHTML(nsGkAtoms::legend)) {
+      if (child->IsHTMLElement(nsGkAtoms::legend)) {
         mFirstLegend = child;
         break;
       }
     }
   }
 
   nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
 
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -697,17 +697,17 @@ HTMLFormElement::BuildSubmission(nsFormS
 
   // Get the originating frame (failure is non-fatal)
   nsGenericHTMLElement* originatingElement = nullptr;
   if (aEvent) {
     InternalFormEvent* formEvent = aEvent->AsFormEvent();
     if (formEvent) {
       nsIContent* originator = formEvent->originator;
       if (originator) {
-        if (!originator->IsHTML()) {
+        if (!originator->IsHTMLElement()) {
           return NS_ERROR_UNEXPECTED;
         }
         originatingElement = static_cast<nsGenericHTMLElement*>(originator);
       }
     }
   }
 
   nsresult rv;
@@ -1961,17 +1961,17 @@ HTMLFormElement::CheckValidFormSubmissio
          */
 
         nsAutoScriptBlocker scriptBlocker;
 
         for (uint32_t i = 0, length = mControls->mElements.Length();
              i < length; ++i) {
           // Input elements can trigger a form submission and we want to
           // update the style in that case.
-          if (mControls->mElements[i]->IsHTML(nsGkAtoms::input) &&
+          if (mControls->mElements[i]->IsHTMLElement(nsGkAtoms::input) &&
               nsContentUtils::IsFocusedContent(mControls->mElements[i])) {
             static_cast<HTMLInputElement*>(mControls->mElements[i])
               ->UpdateValidityUIBits(true);
           }
 
           mControls->mElements[i]->UpdateState(true);
         }
 
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -580,17 +580,17 @@ HTMLImageElement::BindToTree(nsIDocument
 
   nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
                                     aCompileEventHandlers);
 
   if (aParent) {
     UpdateFormOwner();
   }
 
-  bool addedToPicture = aParent && aParent->IsHTML(nsGkAtoms::picture) &&
+  bool addedToPicture = aParent && aParent->IsHTMLElement(nsGkAtoms::picture) &&
                         HTMLPictureElement::IsPictureEnabled();
   if (addedToPicture) {
     QueueImageLoadTask();
   } else if (!InResponsiveMode() &&
              HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
     // We skip loading when our attributes were set from parser land,
     // so trigger a aForce=false load now to check if things changed.
     // This isn't necessary for responsive mode, since creating the
@@ -625,17 +625,17 @@ HTMLImageElement::UnbindFromTree(bool aD
     if (aNullParent || !FindAncestorForm(mForm)) {
       ClearForm(true);
     } else {
       UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT);
     }
   }
 
   if (aNullParent && GetParent() &&
-      GetParent()->IsHTML(nsGkAtoms::picture) &&
+      GetParent()->IsHTMLElement(nsGkAtoms::picture) &&
       HTMLPictureElement::IsPictureEnabled()) {
     // Being removed from picture re-triggers selection, even if we
     // weren't using a <source> peer
     QueueImageLoadTask();
   }
 
   nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
@@ -883,17 +883,17 @@ HTMLImageElement::HaveSrcsetOrInPicture(
     return true;
   }
 
   if (!HTMLPictureElement::IsPictureEnabled()) {
     return false;
   }
 
   Element *parent = nsINode::GetParentElement();
-  return (parent && parent->IsHTML(nsGkAtoms::picture));
+  return (parent && parent->IsHTMLElement(nsGkAtoms::picture));
 }
 
 bool
 HTMLImageElement::InResponsiveMode()
 {
   // When we lose srcset or leave a <picture> element, the fallback to img.src
   // will happen from the microtask, and we should behave responsively in the
   // interim
@@ -1041,17 +1041,17 @@ HTMLImageElement::UpdateResponsiveSource
   }
 
   nsIContent *currentSource =
     mResponsiveSelector ? mResponsiveSelector->Content() : nullptr;
   bool pictureEnabled = HTMLPictureElement::IsPictureEnabled();
   Element *parent = pictureEnabled ? nsINode::GetParentElement() : nullptr;
 
   nsINode *candidateSource = nullptr;
-  if (parent && parent->IsHTML(nsGkAtoms::picture)) {
+  if (parent && parent->IsHTMLElement(nsGkAtoms::picture)) {
     // Walk source nodes previous to ourselves
     candidateSource = parent->GetFirstChild();
   } else {
     candidateSource = this;
   }
 
   while (candidateSource) {
     if (candidateSource == currentSource) {
@@ -1070,18 +1070,17 @@ HTMLImageElement::UpdateResponsiveSource
       }
     } else if (candidateSource == this) {
       // We are the last possible source
       if (!TryCreateResponsiveSelector(candidateSource->AsContent())) {
         // Failed to find any source
         mResponsiveSelector = nullptr;
       }
       break;
-    } else if (candidateSource->IsElement() &&
-               candidateSource->AsElement()->IsHTML(nsGkAtoms::source) &&
+    } else if (candidateSource->IsHTMLElement(nsGkAtoms::source) &&
                TryCreateResponsiveSelector(candidateSource->AsContent())) {
       // This led to a valid source, stop
       break;
     }
     candidateSource = candidateSource->GetNextSibling();
   }
 
   if (!candidateSource) {
@@ -1104,35 +1103,35 @@ HTMLImageElement::TryCreateResponsiveSel
                                               const nsAString *aSizes)
 {
   if (!IsSrcsetEnabled()) {
     return false;
   }
 
   bool pictureEnabled = HTMLPictureElement::IsPictureEnabled();
   // Skip if this is not a <source> with matching media query
-  bool isSourceTag = aSourceNode->IsHTML(nsGkAtoms::source);
+  bool isSourceTag = aSourceNode->IsHTMLElement(nsGkAtoms::source);
   if (isSourceTag) {
     DebugOnly<Element *> parent(nsINode::GetParentElement());
-    MOZ_ASSERT(parent && parent->IsHTML(nsGkAtoms::picture));
+    MOZ_ASSERT(parent && parent->IsHTMLElement(nsGkAtoms::picture));
     MOZ_ASSERT(IsPreviousSibling(aSourceNode, this));
     MOZ_ASSERT(pictureEnabled);
 
     // Check media and type
     HTMLSourceElement *src = static_cast<HTMLSourceElement*>(aSourceNode);
     if (!src->MatchesCurrentMedia()) {
       return false;
     }
 
     nsAutoString type;
     if (aSourceNode->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
         !SupportedPictureSourceType(type)) {
       return false;
     }
-  } else if (aSourceNode->IsHTML(nsGkAtoms::img)) {
+  } else if (aSourceNode->IsHTMLElement(nsGkAtoms::img)) {
     // Otherwise this is the <img> tag itself
     MOZ_ASSERT(aSourceNode == this);
   }
 
   // Skip if has no srcset or an empty srcset
   nsString srcset;
   if (aSrcset) {
     srcset = *aSrcset;
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1880,17 +1880,17 @@ HTMLInputElement::GetList() const
 
   //XXXsmaug How should this all work in case input element is in Shadow DOM.
   nsIDocument* doc = GetUncomposedDoc();
   if (!doc) {
     return nullptr;
   }
 
   Element* element = doc->GetElementById(dataListId);
-  if (!element || !element->IsHTML(nsGkAtoms::datalist)) {
+  if (!element || !element->IsHTMLElement(nsGkAtoms::datalist)) {
     return nullptr;
   }
 
   return static_cast<nsGenericHTMLElement*>(element);
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetList(nsIDOMHTMLElement** aValue)
--- a/dom/html/HTMLLegendElement.cpp
+++ b/dom/html/HTMLLegendElement.cpp
@@ -21,17 +21,17 @@ HTMLLegendElement::~HTMLLegendElement()
 
 NS_IMPL_ELEMENT_CLONE(HTMLLegendElement)
 
 nsIContent*
 HTMLLegendElement::GetFieldSet() const
 {
   nsIContent* parent = GetParent();
 
-  if (parent && parent->IsHTML(nsGkAtoms::fieldset)) {
+  if (parent && parent->IsHTMLElement(nsGkAtoms::fieldset)) {
     return parent;
   }
 
   return nullptr;
 }
 
 bool
 HTMLLegendElement::ParseAttribute(int32_t aNamespaceID,
@@ -135,17 +135,17 @@ HTMLLegendElement::PerformAccesskey(bool
   ErrorResult rv;
   Focus(rv);
 }
 
 already_AddRefed<HTMLFormElement>
 HTMLLegendElement::GetForm()
 {
   Element* form = GetFormElement();
-  MOZ_ASSERT_IF(form, form->IsHTML(nsGkAtoms::form));
+  MOZ_ASSERT_IF(form, form->IsHTMLElement(nsGkAtoms::form));
   nsRefPtr<HTMLFormElement> ret = static_cast<HTMLFormElement*>(form);
   return ret.forget();
 }
 
 JSObject*
 HTMLLegendElement::WrapNode(JSContext* aCx)
 {
   return HTMLLegendElementBinding::Wrap(aCx, this);
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -809,17 +809,17 @@ void HTMLMediaElement::ResetState()
   }
 }
 
 static bool HasSourceChildren(nsIContent* aElement)
 {
   for (nsIContent* child = aElement->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsHTML(nsGkAtoms::source))
+    if (child->IsHTMLElement(nsGkAtoms::source))
     {
       return true;
     }
   }
   return false;
 }
 
 void HTMLMediaElement::SelectResourceWrapper()
@@ -3947,17 +3947,17 @@ nsIContent* HTMLMediaElement::GetNextSou
 
     // Advance the range to the next child.
     rv = mSourcePointer->SetStart(thisDomNode, startOffset + 1);
     NS_ENSURE_SUCCESS(rv, nullptr);
 
     nsIContent* child = GetChildAt(startOffset);
 
     // If child is a <source> element, it is the next candidate.
-    if (child && child->IsHTML(nsGkAtoms::source)) {
+    if (child && child->IsHTMLElement(nsGkAtoms::source)) {
       mSourceLoadCandidate = child;
       return child;
     }
   }
   NS_NOTREACHED("Execution should not reach here!");
   return nullptr;
 }
 
--- a/dom/html/HTMLOptGroupElement.cpp
+++ b/dom/html/HTMLOptGroupElement.cpp
@@ -67,17 +67,17 @@ HTMLOptGroupElement::PreHandleEvent(Even
 
   return nsGenericHTMLElement::PreHandleEvent(aVisitor);
 }
 
 nsIContent*
 HTMLOptGroupElement::GetSelect()
 {
   nsIContent* parent = this;
-  while ((parent = parent->GetParent()) && parent->IsHTML()) {
+  while ((parent = parent->GetParent()) && parent->IsHTMLElement()) {
     if (parent->Tag() == nsGkAtoms::select) {
       return parent;
     }
     if (parent->Tag() != nsGkAtoms::optgroup) {
       break;
     }
   }
   
@@ -109,17 +109,17 @@ nsresult
 HTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
                                   const nsAttrValue* aValue, bool aNotify)
 {
   if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled) {
     // All our children <option> have their :disabled state depending on our
     // disabled attribute. We should make sure their state is updated.
     for (nsIContent* child = nsINode::GetFirstChild(); child;
          child = child->GetNextSibling()) {
-      if (child->IsHTML(nsGkAtoms::option)) {
+      if (child->IsHTMLElement(nsGkAtoms::option)) {
         // No need to call |IsElement()| because it's an HTML element.
         child->AsElement()->UpdateState(true);
       }
     }
   }
 
   return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
                                             aNotify);
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -268,17 +268,18 @@ HTMLOptionElement::GetText(nsAString& aT
   nsAutoString text;
 
   nsIContent* child = nsINode::GetFirstChild();
   while (child) {
     if (child->NodeType() == nsIDOMNode::TEXT_NODE ||
         child->NodeType() == nsIDOMNode::CDATA_SECTION_NODE) {
       child->AppendTextTo(text);
     }
-    if (child->IsHTML(nsGkAtoms::script) || child->IsSVG(nsGkAtoms::script)) {
+    if (child->IsHTMLElement(nsGkAtoms::script) ||
+        child->IsSVGElement(nsGkAtoms::script)) {
       child = child->GetNextNonChildNode(this);
     } else {
       child = child->GetNextNode(this);
     }
   }
 
   // XXX No CompressWhitespace for nsAString.  Sad.
   text.CompressWhitespace(true, true);
@@ -331,17 +332,17 @@ HTMLOptionElement::IntrinsicState() cons
 
   // An <option> is disabled if it has @disabled set or if it's <optgroup> has
   // @disabled set.
   if (HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
     state |= NS_EVENT_STATE_DISABLED;
     state &= ~NS_EVENT_STATE_ENABLED;
   } else {
     nsIContent* parent = GetParent();
-    if (parent && parent->IsHTML(nsGkAtoms::optgroup) &&
+    if (parent && parent->IsHTMLElement(nsGkAtoms::optgroup) &&
         parent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
       state |= NS_EVENT_STATE_DISABLED;
       state &= ~NS_EVENT_STATE_ENABLED;
     } else {
       state &= ~NS_EVENT_STATE_DISABLED;
       state |= NS_EVENT_STATE_ENABLED;
     }
   }
@@ -350,17 +351,17 @@ HTMLOptionElement::IntrinsicState() cons
 }
 
 // Get the select content element that contains this option
 HTMLSelectElement*
 HTMLOptionElement::GetSelect()
 {
   nsIContent* parent = this;
   while ((parent = parent->GetParent()) &&
-         parent->IsHTML()) {
+         parent->IsHTMLElement()) {
     HTMLSelectElement* select = HTMLSelectElement::FromContent(parent);
     if (select) {
       return select;
     }
     if (parent->Tag() != nsGkAtoms::optgroup) {
       break;
     }
   }
--- a/dom/html/HTMLPropertiesCollection.cpp
+++ b/dom/html/HTMLPropertiesCollection.cpp
@@ -272,21 +272,21 @@ HTMLPropertiesCollection::CrawlPropertie
 
 void
 HTMLPropertiesCollection::CrawlSubtree(Element* aElement)
 {
   nsIContent* aContent = aElement;
   while (aContent) {
     // We must check aContent against mRoot because 
     // an element must not be its own property
-    if (aContent == mRoot || !aContent->IsHTML()) {
+    if (aContent == mRoot || !aContent->IsHTMLElement()) {
       // Move on to the next node in the tree
       aContent = aContent->GetNextNode(aElement);
     } else {
-      MOZ_ASSERT(aContent->IsElement(), "IsHTML() returned true!");
+      MOZ_ASSERT(aContent->IsElement(), "IsHTMLElement() returned true!");
       Element* element = aContent->AsElement();
       if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::itemprop) &&
           !mProperties.Contains(element)) {
         mProperties.AppendElement(static_cast<nsGenericHTMLElement*>(element));
       }
 
       if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope)) {
         aContent = element->GetNextNonChildNode(aElement);
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -345,17 +345,17 @@ HTMLSelectElement::InsertOptionsIntoList
 
   // If it's at the top level, then we just found out there are non-options
   // at the top level, which will throw off the insert count
   if (aDepth == 0) {
     mNonOptionChildren++;
   }
 
   // Recurse down into optgroups
-  if (aOptions->IsHTML(nsGkAtoms::optgroup)) {
+  if (aOptions->IsHTMLElement(nsGkAtoms::optgroup)) {
     mOptGroupCount++;
 
     for (nsIContent* child = aOptions->GetFirstChild();
          child;
          child = child->GetNextSibling()) {
       InsertOptionsIntoListRecurse(child, aInsertIndex, aDepth + 1);
     }
   }
@@ -386,17 +386,17 @@ HTMLSelectElement::RemoveOptionsFromList
   }
 
   // Yay, one less artifact at the top level.
   if (aDepth == 0) {
     mNonOptionChildren--;
   }
 
   // Recurse down deeper for options
-  if (mOptGroupCount && aOptions->IsHTML(nsGkAtoms::optgroup)) {
+  if (mOptGroupCount && aOptions->IsHTMLElement(nsGkAtoms::optgroup)) {
     mOptGroupCount--;
 
     for (nsIContent* child = aOptions->GetFirstChild();
          child;
          child = child->GetNextSibling()) {
       nsresult rv = RemoveOptionsFromListRecurse(child,
                                                  aRemoveIndex,
                                                  aNumRemoved,
@@ -1130,17 +1130,17 @@ HTMLSelectElement::IsOptionDisabled(HTML
 
   // Check for disabled optgroups
   // If there are no artifacts, there are no optgroups
   if (mNonOptionChildren) {
     for (nsCOMPtr<Element> node = static_cast<nsINode*>(aOption)->GetParentElement();
          node;
          node = node->GetParentElement()) {
       // If we reached the select element, we're done
-      if (node->IsHTML(nsGkAtoms::select)) {
+      if (node->IsHTMLElement(nsGkAtoms::select)) {
         return false;
       }
 
       nsRefPtr<HTMLOptGroupElement> optGroupElement =
         HTMLOptGroupElement::FromContent(node);
 
       if (!optGroupElement) {
         // If you put something else between you and the optgroup, you're a
@@ -1787,17 +1787,17 @@ static void
 AddOptionsRecurse(nsIContent* aRoot, HTMLOptionsCollection* aArray)
 {
   for (nsIContent* cur = aRoot->GetFirstChild();
        cur;
        cur = cur->GetNextSibling()) {
     HTMLOptionElement* opt = HTMLOptionElement::FromContent(cur);
     if (opt) {
       aArray->AppendOption(opt);
-    } else if (cur->IsHTML(nsGkAtoms::optgroup)) {
+    } else if (cur->IsHTMLElement(nsGkAtoms::optgroup)) {
       AddOptionsRecurse(cur, aArray);
     }
   }
 }
 
 void
 HTMLSelectElement::RebuildOptionsArray(bool aNotify)
 {
@@ -1868,17 +1868,17 @@ VerifyOptionsRecurse(nsIContent* aRoot, 
 {
   for (nsIContent* cur = aRoot->GetFirstChild();
        cur;
        cur = cur->GetNextSibling()) {
     nsCOMPtr<nsIDOMHTMLOptionElement> opt = do_QueryInterface(cur);
     if (opt) {
       NS_ASSERTION(opt == aArray->ItemAsOption(aIndex++),
                    "Options collection broken");
-    } else if (cur->IsHTML(nsGkAtoms::optgroup)) {
+    } else if (cur->IsHTMLElement(nsGkAtoms::optgroup)) {
       VerifyOptionsRecurse(cur, aIndex, aArray);
     }
   }
 }
 
 void
 HTMLSelectElement::VerifyOptionsArray()
 {
--- a/dom/html/HTMLShadowElement.cpp
+++ b/dom/html/HTMLShadowElement.cpp
@@ -89,18 +89,17 @@ HTMLShadowElement::SetProjectedShadow(Sh
   }
 }
 
 static bool
 IsInFallbackContent(nsIContent* aContent)
 {
   nsINode* parentNode = aContent->GetParentNode();
   while (parentNode) {
-    if (parentNode->IsElement() &&
-        parentNode->AsElement()->IsHTML(nsGkAtoms::content)) {
+    if (parentNode->IsHTMLElement(nsGkAtoms::content)) {
       return true;
     }
     parentNode = parentNode->GetParentNode();
   }
 
   return false;
 }
 
--- a/dom/html/HTMLSharedElement.cpp
+++ b/dom/html/HTMLSharedElement.cpp
@@ -152,17 +152,17 @@ HTMLSharedElement::IsAttributeMapped(con
 
 static void
 SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
 {
   NS_PRECONDITION(aDocument, "Need a document!");
 
   for (nsIContent* child = aDocument->GetFirstChild(); child;
        child = child->GetNextNode()) {
-    if (child->IsHTML(nsGkAtoms::base) &&
+    if (child->IsHTMLElement(nsGkAtoms::base) &&
         child->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
       if (aMustMatch && child != aMustMatch) {
         return;
       }
 
       // Resolve the <base> element's href relative to our document URI
       nsAutoString href;
       child->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
@@ -189,17 +189,17 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocu
 static void
 SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
                                       nsIContent* aMustMatch)
 {
   NS_PRECONDITION(aDocument, "Need a document!");
 
   for (nsIContent* child = aDocument->GetFirstChild(); child;
        child = child->GetNextNode()) {
-    if (child->IsHTML(nsGkAtoms::base) &&
+    if (child->IsHTMLElement(nsGkAtoms::base) &&
         child->HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
       if (aMustMatch && child != aMustMatch) {
         return;
       }
 
       nsString target;
       child->GetAttr(kNameSpaceID_None, nsGkAtoms::target, target);
       aDocument->SetBaseTarget(target);
--- a/dom/html/HTMLTableCellElement.cpp
+++ b/dom/html/HTMLTableCellElement.cpp
@@ -51,24 +51,24 @@ HTMLTableCellElement::GetTable() const
   }
 
   // parent should be a row.
   nsIContent* section = parent->GetParent();
   if (!section) {
     return nullptr;
   }
 
-  if (section->IsHTML(nsGkAtoms::table)) {
+  if (section->IsHTMLElement(nsGkAtoms::table)) {
     // XHTML, without a row group.
     return static_cast<HTMLTableElement*>(section);
   }
 
   // We have a row group.
   nsIContent* result = section->GetParent();
-  if (result && result->IsHTML(nsGkAtoms::table)) {
+  if (result && result->IsHTMLElement(nsGkAtoms::table)) {
     return static_cast<HTMLTableElement*>(result);
   }
 
   return nullptr;
 }
 
 int32_t
 HTMLTableCellElement::CellIndex() const
--- a/dom/html/HTMLTableElement.cpp
+++ b/dom/html/HTMLTableElement.cpp
@@ -114,17 +114,17 @@ NS_INTERFACE_MAP_END
         rows = rowGroup->Rows();                                     \
         do { /* gives scoping */                                     \
           _code                                                      \
         } while (0);                                                 \
       }                                                              \
       /* TBodies */                                                  \
       for (nsIContent* _node = mParent->nsINode::GetFirstChild();    \
            _node; _node = _node->GetNextSibling()) {                 \
-        if (_node->IsHTML(nsGkAtoms::tbody)) {                       \
+        if (_node->IsHTMLElement(nsGkAtoms::tbody)) {                \
           rowGroup = static_cast<HTMLTableSectionElement*>(_node);   \
           rows = rowGroup->Rows();                                   \
           do { /* gives scoping */                                   \
             _code                                                    \
           } while (0);                                               \
         }                                                            \
       }                                                              \
       /* orphan rows */                                              \
@@ -469,17 +469,17 @@ HTMLTableElement::CreateTBody()
   nsRefPtr<nsGenericHTMLElement> newBody =
     NS_NewHTMLTableSectionElement(nodeInfo.forget());
   MOZ_ASSERT(newBody);
 
   nsIContent* referenceNode = nullptr;
   for (nsIContent* child = nsINode::GetLastChild();
        child;
        child = child->GetPreviousSibling()) {
-    if (child->IsHTML(nsGkAtoms::tbody)) {
+    if (child->IsHTMLElement(nsGkAtoms::tbody)) {
       referenceNode = child->GetNextSibling();
       break;
     }
   }
 
   ErrorResult rv;
   nsINode::InsertBefore(*newBody, referenceNode, rv);
 
@@ -547,17 +547,17 @@ HTMLTableElement::InsertRow(int32_t aInd
     }
   } else {
     // the row count was 0, so 
     // find the last row group and insert there as first child
     nsCOMPtr<nsIContent> rowGroup;
     for (nsIContent* child = nsINode::GetLastChild();
          child;
          child = child->GetPreviousSibling()) {
-      if (child->IsHTML(nsGkAtoms::tbody)) {
+      if (child->IsHTMLElement(nsGkAtoms::tbody)) {
         rowGroup = child;
         break;
       }
     }
 
     if (!rowGroup) { // need to create a TBODY
       nsRefPtr<mozilla::dom::NodeInfo> nodeInfo;
       nsContentUtils::NameChanged(mNodeInfo, nsGkAtoms::tbody,
--- a/dom/html/HTMLTableElement.h
+++ b/dom/html/HTMLTableElement.h
@@ -49,17 +49,17 @@ public:
   void DeleteCaption();
 
   HTMLTableSectionElement* GetTHead() const
   {
     return static_cast<HTMLTableSectionElement*>(GetChild(nsGkAtoms::thead));
   }
   void SetTHead(HTMLTableSectionElement* aTHead, ErrorResult& aError)
   {
-    if (aTHead && !aTHead->IsHTML(nsGkAtoms::thead)) {
+    if (aTHead && !aTHead->IsHTMLElement(nsGkAtoms::thead)) {
       aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
       return;
     }
 
     DeleteTHead();
     if (aTHead) {
       nsINode::InsertBefore(*aTHead, nsINode::GetFirstChild(), aError);
     }
@@ -69,17 +69,17 @@ public:
   void DeleteTHead();
 
   HTMLTableSectionElement* GetTFoot() const
   {
     return static_cast<HTMLTableSectionElement*>(GetChild(nsGkAtoms::tfoot));
   }
   void SetTFoot(HTMLTableSectionElement* aTFoot, ErrorResult& aError)
   {
-    if (aTFoot && !aTFoot->IsHTML(nsGkAtoms::tfoot)) {
+    if (aTFoot && !aTFoot->IsHTMLElement(nsGkAtoms::tfoot)) {
       aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
       return;
     }
 
     DeleteTFoot();
     if (aTFoot) {
       nsINode::AppendChild(*aTFoot, aError);
     }
@@ -207,17 +207,17 @@ protected:
   virtual ~HTMLTableElement();
 
   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
 
   nsIContent* GetChild(nsIAtom *aTag) const
   {
     for (nsIContent* cur = nsINode::GetFirstChild(); cur;
          cur = cur->GetNextSibling()) {
-      if (cur->IsHTML(aTag)) {
+      if (cur->IsHTMLElement(aTag)) {
         return cur;
       }
     }
     return nullptr;
   }
 
   nsRefPtr<nsContentList> mTBodies;
   nsRefPtr<TableRowsCollection> mRows;
--- a/dom/html/HTMLTableRowElement.cpp
+++ b/dom/html/HTMLTableRowElement.cpp
@@ -46,19 +46,20 @@ NS_INTERFACE_MAP_END_INHERITING(nsGeneri
 NS_IMPL_ELEMENT_CLONE(HTMLTableRowElement)
 
 
 // protected method
 HTMLTableSectionElement*
 HTMLTableRowElement::GetSection() const
 {
   nsIContent* parent = GetParent();
-  if (parent && parent->IsHTML() && (parent->Tag() == nsGkAtoms::thead ||
-                                     parent->Tag() == nsGkAtoms::tbody ||
-                                     parent->Tag() == nsGkAtoms::tfoot)) {
+  if (parent && parent->IsHTMLElement() &&
+      (parent->Tag() == nsGkAtoms::thead ||
+       parent->Tag() == nsGkAtoms::tbody ||
+       parent->Tag() == nsGkAtoms::tfoot)) {
     return static_cast<HTMLTableSectionElement*>(parent);
   }
   return nullptr;
 }
 
 // protected method
 HTMLTableElement*
 HTMLTableRowElement::GetTable() const
@@ -119,17 +120,17 @@ HTMLTableRowElement::SectionRowIndex() c
 
 static bool
 IsCell(nsIContent *aContent, int32_t aNamespaceID,
        nsIAtom* aAtom, void *aData)
 {
   nsIAtom* tag = aContent->Tag();
 
   return ((tag == nsGkAtoms::td || tag == nsGkAtoms::th) &&
-          aContent->IsHTML());
+          aContent->IsHTMLElement());
 }
 
 nsIHTMLCollection*
 HTMLTableRowElement::Cells()
 {
   if (!mCells) {
     mCells = new nsContentList(this,
                                IsCell,
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -628,17 +628,17 @@ ImageDocument::CreateSyntheticDocument()
 
   // Add the image element
   Element* body = GetBodyElement();
   if (!body) {
     NS_WARNING("no body on image document!");
     return NS_ERROR_FAILURE;
   }
 
-  nsRefPtr<NodeInfo> nodeInfo;
+  nsRefPtr<mozilla::dom::NodeInfo> nodeInfo;
   nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nullptr,
                                            kNameSpaceID_XHTML,
                                            nsIDOMNode::ELEMENT_NODE);
 
   mImageContent = NS_NewHTMLImageElement(nodeInfo.forget());
   if (!mImageContent) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -311,18 +311,19 @@ IsOffsetParent(nsIFrame* aFrame)
   
   if (IS_TABLE_CELL(frameType) || frameType == nsGkAtoms::tableFrame) {
     // Per the IDL for Element, only td, th, and table are acceptable offsetParents
     // apart from body or positioned elements; we need to check the content type as
     // well as the frame type so we ignore anonymous tables created by an element
     // with display: table-cell with no actual table
     nsIContent* content = aFrame->GetContent();
 
-    return content->IsHTML(nsGkAtoms::table) || content->IsHTML(nsGkAtoms::td)
-      || content->IsHTML(nsGkAtoms::th);
+    return content->IsAnyOfHTMLElements(nsGkAtoms::table,
+                                        nsGkAtoms::td,
+                                        nsGkAtoms::th);
   }
   return false;
 }
 
 Element*
 nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
 {
   aRect = CSSIntRect();
@@ -340,17 +341,18 @@ nsGenericHTMLElement::GetOffsetRect(CSSI
     origin = parent->GetPositionIgnoringScrolling();
     parent = parent->GetParent();
   }
 
   nsIContent* offsetParent = nullptr;
   Element* docElement = GetComposedDoc()->GetRootElement();
   nsIContent* content = frame->GetContent();
 
-  if (content && (content->IsHTML(nsGkAtoms::body) || content == docElement)) {
+  if (content && (content->IsHTMLElement(nsGkAtoms::body) ||
+                  content == docElement)) {
     parent = frame;
   }
   else {
     const bool isPositioned = frame->IsPositioned();
     const bool isAbsolutelyPositioned = frame->IsAbsolutelyPositioned();
     origin += frame->GetPositionIgnoringScrolling();
 
     for ( ; parent ; parent = parent->GetParent()) {
@@ -372,17 +374,17 @@ nsGenericHTMLElement::GetOffsetRect(CSSI
       if (content) {
         // If we've hit the document element, break here.
         if (content == docElement) {
           break;
         }
 
         // Break if the ancestor frame type makes it suitable as offset parent
         // and this element is *not* positioned or if we found the body element.
-        if (isOffsetParent || content->IsHTML(nsGkAtoms::body)) {
+        if (isOffsetParent || content->IsHTMLElement(nsGkAtoms::body)) {
           offsetParent = content;
           break;
         }
       }
     }
 
     if (isAbsolutelyPositioned && !offsetParent) {
       // If this element is absolutely positioned, but we don't have
@@ -432,17 +434,17 @@ nsGenericHTMLElement::InsertAdjacentHTML
 }
 
 bool
 nsGenericHTMLElement::Spellcheck()
 {
   // Has the state has been explicitly set?
   nsIContent* node;
   for (node = this; node; node = node->GetParent()) {
-    if (node->IsHTML()) {
+    if (node->IsHTMLElement()) {
       static nsIContent::AttrValuesArray strings[] =
         {&nsGkAtoms::_true, &nsGkAtoms::_false, nullptr};
       switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
                                     strings, eCaseMatters)) {
         case 0:                         // spellcheck = "true"
           return true;
         case 1:                         // spellcheck = "false"
           return false;
@@ -584,27 +586,27 @@ nsGenericHTMLElement::UnbindFromTree(boo
 
   nsStyledElement::UnbindFromTree(aDeep, aNullParent);
 }
 
 HTMLFormElement*
 nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
 {
   NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
-               IsHTML(nsGkAtoms::img),
+               IsHTMLElement(nsGkAtoms::img),
                "FindAncestorForm should not be called if @form is set!");
 
   // Make sure we don't end up finding a form that's anonymous from
   // our point of view.
   nsIContent* bindingParent = GetBindingParent();
 
   nsIContent* content = this;
   while (content != bindingParent && content) {
     // If the current ancestor is a form, return it as our form
-    if (content->IsHTML(nsGkAtoms::form)) {
+    if (content->IsHTMLElement(nsGkAtoms::form)) {
 #ifdef DEBUG
       if (!nsContentUtils::IsInSameAnonymousTree(this, content)) {
         // It's possible that we started unbinding at |content| or
         // some ancestor of it, and |content| and |this| used to all be
         // anonymous.  Check for this the hard way.
         for (nsIContent* child = this; child != content;
              child = child->GetParent()) {
           NS_ASSERTION(child->GetParent()->IndexOf(child) != -1,
@@ -650,17 +652,18 @@ nsGenericHTMLElement::CheckHandleEventFo
   }
 
   //Need to check if we hit an imagemap area and if so see if we're handling
   //the event on that map or on a link farther up the tree.  If we're on a
   //link farther up, do nothing.
   nsCOMPtr<nsIContent> target = aVisitor.mPresContext->EventStateManager()->
     GetEventTargetContent(aVisitor.mEvent);
 
-  return !target || !target->IsHTML(nsGkAtoms::area) || IsHTML(nsGkAtoms::area);
+  return !target || !target->IsHTMLElement(nsGkAtoms::area) ||
+         IsHTMLElement(nsGkAtoms::area);
 }
 
 nsresult
 nsGenericHTMLElement::PreHandleEventForAnchors(EventChainPreVisitor& aVisitor)
 {
   nsresult rv = nsGenericHTMLElementBase::PreHandleEvent(aVisitor);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -2398,17 +2401,17 @@ nsGenericHTMLFormElement::RemoveFormIdOb
 bool
 nsGenericHTMLFormElement::FormIdUpdated(Element* aOldElement,
                                         Element* aNewElement,
                                         void* aData)
 {
   nsGenericHTMLFormElement* element =
     static_cast<nsGenericHTMLFormElement*>(aData);
 
-  NS_ASSERTION(element->IsHTML(), "aData should be an HTML element");
+  NS_ASSERTION(element->IsHTMLElement(), "aData should be an HTML element");
 
   element->UpdateFormOwner(false, aNewElement);
 
   return true;
 }
 
 bool 
 nsGenericHTMLFormElement::IsElementDisabledForEvents(uint32_t aMessage, 
@@ -2454,17 +2457,17 @@ nsGenericHTMLFormElement::UpdateFormOwne
 
         NS_ASSERTION(GetUncomposedDoc(), "The element should be in a document "
                                          "when UpdateFormOwner is called!");
         NS_ASSERTION(!GetUncomposedDoc() ||
                      element == GetUncomposedDoc()->GetElementById(formId),
                      "element should be equals to the current element "
                      "associated with the id in @form!");
 
-        if (element && element->IsHTML(nsGkAtoms::form)) {
+        if (element && element->IsHTMLElement(nsGkAtoms::form)) {
           mForm = static_cast<HTMLFormElement*>(element);
         }
       }
      } else {
       // We now have a parent, so we may have picked up an ancestor form.  Search
       // for it.  Note that if mForm is already set we don't want to do this,
       // because that means someone (probably the content sink) has already set
       // it to the right value.  Also note that even if being bound here didn't
@@ -2758,17 +2761,17 @@ nsGenericHTMLElement::GetAssociatedEdito
   return editor.forget();
 }
 
 bool
 nsGenericHTMLElement::IsCurrentBodyElement()
 {
   // TODO Bug 698498: Should this handle the case where GetBody returns a
   //                  frameset?
-  if (!IsHTML(nsGkAtoms::body)) {
+  if (!IsHTMLElement(nsGkAtoms::body)) {
     return false;
   }
 
   nsCOMPtr<nsIDOMHTMLDocument> htmlDocument =
     do_QueryInterface(GetUncomposedDoc());
   if (!htmlDocument) {
     return false;
   }
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -915,22 +915,22 @@ public:
            aTag == nsGkAtoms::form ||
            aTag == nsGkAtoms::applet ||
            aTag == nsGkAtoms::embed ||
            aTag == nsGkAtoms::object;
   }
   static inline bool
   ShouldExposeNameAsHTMLDocumentProperty(Element* aElement)
   {
-    return aElement->IsHTML() && CanHaveName(aElement->Tag());
+    return aElement->IsHTMLElement() && CanHaveName(aElement->Tag());
   }
   static inline bool
   ShouldExposeIdAsHTMLDocumentProperty(Element* aElement)
   {
-    if (!aElement->IsHTML()) {
+    if (!aElement->IsHTMLElement()) {
       return false;
     }
     nsIAtom* tag = aElement->Tag();
     return tag == nsGkAtoms::img ||
            tag == nsGkAtoms::applet ||
            tag == nsGkAtoms::embed ||
            tag == nsGkAtoms::object;
   }
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -679,19 +679,19 @@ nsHTMLDocument::StartDocumentLoad(const 
     executor = static_cast<nsHtml5TreeOpExecutor*> (mParser->GetContentSink());
     if (mReferrerPolicySet) {
       // CSP may have set the referrer policy, so a speculative parser should
       // start with the new referrer policy.
       executor->SetSpeculationReferrerPolicy(static_cast<ReferrerPolicy>(mReferrerPolicy));
     }
   }
 
-  if (!IsHTML() || !docShell) { // no docshell for text/html XHR
-    charsetSource = IsHTML() ? kCharsetFromFallback
-                             : kCharsetFromDocTypeDefault;
+  if (!IsHTMLDocument() || !docShell) { // no docshell for text/html XHR
+    charsetSource = IsHTMLDocument() ? kCharsetFromFallback
+                                     : kCharsetFromDocTypeDefault;
     charset.AssignLiteral("UTF-8");
     TryChannelCharset(aChannel, charsetSource, charset, executor);
     parserCharsetSource = charsetSource;
     parserCharset = charset;
   } else {
     NS_ASSERTION(docShell, "Unexpected null value");
 
     charsetSource = kCharsetUninitialized;
@@ -773,17 +773,17 @@ nsHTMLDocument::StartDocumentLoad(const 
 
 #ifdef DEBUG_charset
   printf(" charset = %s source %d\n",
         charset.get(), charsetSource);
 #endif
   mParser->SetDocumentCharset(parserCharset, parserCharsetSource);
   mParser->SetCommand(aCommand);
 
-  if (!IsHTML()) {
+  if (!IsHTMLDocument()) {
     MOZ_ASSERT(!loadAsHtml5);
     nsCOMPtr<nsIXMLContentSink> xmlsink;
     NS_NewXMLContentSink(getter_AddRefs(xmlsink), this, uri,
                          docShell, aChannel);
     mParser->SetContentSink(xmlsink);
   } else {
     if (loadAsHtml5) {
       nsHtml5Module::Initialize(mParser, this, uri, docShell, aChannel);
@@ -858,17 +858,17 @@ nsHTMLDocument::EndLoad()
   if (turnOnEditing) {
     EditingStateChanged();
   }
 }
 
 void
 nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
 {
-  NS_ASSERTION(IsHTML() || aMode == eCompatibility_FullStandards,
+  NS_ASSERTION(IsHTMLDocument() || aMode == eCompatibility_FullStandards,
                "Bad compat mode for XHTML document!");
 
   mCompatMode = aMode;
   CSSLoader()->SetCompatibilityMode(mCompatMode);
   nsCOMPtr<nsIPresShell> shell = GetShell();
   if (shell) {
     nsPresContext *pc = shell->GetPresContext();
     if (pc) {
@@ -1012,17 +1012,18 @@ nsHTMLDocument::GetBody()
   Element* html = GetHtmlElement();
   if (!html) {
     return nullptr;
   }
 
   for (nsIContent* child = html->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsHTML(nsGkAtoms::body) || child->IsHTML(nsGkAtoms::frameset)) {
+    if (child->IsHTMLElement(nsGkAtoms::body) ||
+        child->IsHTMLElement(nsGkAtoms::frameset)) {
       return static_cast<nsGenericHTMLElement*>(child);
     }
   }
 
   return nullptr;
 }
 
 NS_IMETHODIMP
@@ -1034,34 +1035,34 @@ nsHTMLDocument::GetBody(nsIDOMHTMLElemen
 
   return body ? CallQueryInterface(body, aBody) : NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
 {
   nsCOMPtr<nsIContent> newBody = do_QueryInterface(aBody);
-  MOZ_ASSERT(!newBody || newBody->IsHTML(),
+  MOZ_ASSERT(!newBody || newBody->IsHTMLElement(),
              "How could we be an nsIContent but not actually HTML here?");
   ErrorResult rv;
   SetBody(static_cast<nsGenericHTMLElement*>(newBody.get()), rv);
   return rv.ErrorCode();
 }
 
 void
 nsHTMLDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
 {
   Element* root = GetRootElement();
 
   // The body element must be either a body tag or a frameset tag. And we must
   // have a html root tag, otherwise GetBody will not return the newly set
   // body.
   if (!newBody || !(newBody->Tag() == nsGkAtoms::body ||
                     newBody->Tag() == nsGkAtoms::frameset) ||
-      !root || !root->IsHTML() ||
+      !root || !root->IsHTMLElement() ||
       root->Tag() != nsGkAtoms::html) {
     rv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
     return;
   }
 
   // Use DOM methods so that we pass through the appropriate security checks.
   nsCOMPtr<Element> currentBody = GetBodyElement();
   if (currentBody) {
@@ -1405,17 +1406,17 @@ nsHTMLDocument::Open(JSContext* /* unuse
 already_AddRefed<nsIDocument>
 nsHTMLDocument::Open(JSContext* cx,
                      const nsAString& aType,
                      const nsAString& aReplace,
                      ErrorResult& rv)
 {
   NS_ASSERTION(nsContentUtils::CanCallerAccess(static_cast<nsIDOMHTMLDocument*>(this)),
                "XOW should have caught this!");
-  if (!IsHTML() || mDisableDocWrite || !IsMasterDocument()) {
+  if (!IsHTMLDocument() || mDisableDocWrite || !IsMasterDocument()) {
     // No calling document.open() on XHTML
     rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   nsAutoCString contentType;
   contentType.AssignLiteral("text/html");
 
@@ -1751,17 +1752,17 @@ nsHTMLDocument::Close()
   ErrorResult rv;
   Close(rv);
   return rv.ErrorCode();
 }
 
 void
 nsHTMLDocument::Close(ErrorResult& rv)
 {
-  if (!IsHTML()) {
+  if (!IsHTMLDocument()) {
     // No calling document.close() on XHTML!
 
     rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
   if (!mParser || !mParser->IsScriptCreated()) {
     return;
@@ -1836,17 +1837,17 @@ nsresult
 nsHTMLDocument::WriteCommon(JSContext *cx,
                             const nsAString& aText,
                             bool aNewlineTerminate)
 {
   mTooDeepWriteRecursion =
     (mWriteLevel > NS_MAX_DOCUMENT_WRITE_DEPTH || mTooDeepWriteRecursion);
   NS_ENSURE_STATE(!mTooDeepWriteRecursion);
 
-  if (!IsHTML() || mDisableDocWrite || !IsMasterDocument()) {
+  if (!IsHTMLDocument() || mDisableDocWrite || !IsMasterDocument()) {
     // No calling document.write*() on XHTML!
 
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
 
   if (mParserAborted) {
     // Hixie says aborting the parser doesn't undefine the insertion point.
     // However, since we null out mParser in that case, we track the
@@ -1982,17 +1983,17 @@ nsHTMLDocument::GetElementsByName(const 
 {
   *aReturn = GetElementsByName(aElementName).take();
   return NS_OK;
 }
 
 static bool MatchItems(nsIContent* aContent, int32_t aNameSpaceID, 
                        nsIAtom* aAtom, void* aData)
 {
-  if (!(aContent->IsElement() && aContent->AsElement()->IsHTML())) {
+  if (!aContent->IsHTMLElement()) {
     return false;
   }
 
   nsGenericHTMLElement* elem = static_cast<nsGenericHTMLElement*>(aContent);
   if (!elem->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope) ||
       elem->HasAttr(kNameSpaceID_None, nsGkAtoms::itemprop)) {
     return false;
   }
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -128,17 +128,17 @@ nsITextControlElement::GetWrapPropertyEn
 {
   // soft is the default; "physical" defaults to soft as well because all other
   // browsers treat it that way and there is no real reason to maintain physical
   // and virtual as separate entities if no one else does.  Only hard and off
   // do anything different.
   aWrapProp = eHTMLTextWrap_Soft; // the default
 
   nsAutoString wrap;
-  if (aContent->IsHTML()) {
+  if (aContent->IsHTMLElement()) {
     static nsIContent::AttrValuesArray strings[] =
       {&nsGkAtoms::HARD, &nsGkAtoms::OFF, nullptr};
 
     switch (aContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::wrap,
                                       strings, eIgnoreCase)) {
       case 0: aWrapProp = eHTMLTextWrap_Hard; break;
       case 1: aWrapProp = eHTMLTextWrap_Off; break;
     }
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -133,17 +133,18 @@ SVGAnimationElement::TimedElement()
 nsSVGElement*
 SVGAnimationElement::GetTargetElement()
 {
   FlushAnimations();
 
   // We'll just call the other GetTargetElement method, and QI to the right type
   nsIContent* target = GetTargetElementContent();
 
-  return (target && target->IsSVG()) ? static_cast<nsSVGElement*>(target) : nullptr;
+  return (target && target->IsSVGElement())
+           ? static_cast<nsSVGElement*>(target) : nullptr;
 }
 
 float
 SVGAnimationElement::GetStartTime(ErrorResult& rv)
 {
   FlushAnimations();
 
   nsSMILTimeValue startTime = mTimedElement.GetStartTime();
--- a/dom/svg/SVGContentUtils.cpp
+++ b/dom/svg/SVGContentUtils.cpp
@@ -36,17 +36,17 @@ using namespace mozilla::dom;
 using namespace mozilla::gfx;
 
 SVGSVGElement*
 SVGContentUtils::GetOuterSVGElement(nsSVGElement *aSVGElement)
 {
   nsIContent *element = nullptr;
   nsIContent *ancestor = aSVGElement->GetFlattenedTreeParent();
 
-  while (ancestor && ancestor->IsSVG() &&
+  while (ancestor && ancestor->IsSVGElement() &&
                      ancestor->Tag() != nsGkAtoms::foreignObject) {
     element = ancestor;
     ancestor = element->GetFlattenedTreeParent();
   }
 
   if (element && element->Tag() == nsGkAtoms::svg) {
     return static_cast<SVGSVGElement*>(element);
   }
@@ -360,28 +360,28 @@ SVGContentUtils::ReportToConsole(nsIDocu
 }
 
 bool
 SVGContentUtils::EstablishesViewport(nsIContent *aContent)
 {
   // Although SVG 1.1 states that <image> is an element that establishes a
   // viewport, this is really only for the document it references, not
   // for any child content, which is what this function is used for.
-  return aContent && aContent->IsSVG() &&
+  return aContent && aContent->IsSVGElement() &&
            (aContent->Tag() == nsGkAtoms::svg ||
             aContent->Tag() == nsGkAtoms::foreignObject ||
             aContent->Tag() == nsGkAtoms::symbol);
 }
 
 nsSVGElement*
 SVGContentUtils::GetNearestViewportElement(nsIContent *aContent)
 {
   nsIContent *element = aContent->GetFlattenedTreeParent();
 
-  while (element && element->IsSVG()) {
+  while (element && element->IsSVGElement()) {
     if (EstablishesViewport(element)) {
       if (element->Tag() == nsGkAtoms::foreignObject) {
         return nullptr;
       }
       return static_cast<nsSVGElement*>(element);
     }
     element = element->GetFlattenedTreeParent();
   }
@@ -391,17 +391,17 @@ SVGContentUtils::GetNearestViewportEleme
 static gfx::Matrix
 GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
 {
   gfxMatrix matrix = aElement->PrependLocalTransformsTo(gfxMatrix(),
     aHaveRecursed ? nsSVGElement::eAllTransforms : nsSVGElement::eUserSpaceToParent);
   nsSVGElement *element = aElement;
   nsIContent *ancestor = aElement->GetFlattenedTreeParent();
 
-  while (ancestor && ancestor->IsSVG() &&
+  while (ancestor && ancestor->IsSVGElement() &&
                      ancestor->Tag() != nsGkAtoms::foreignObject) {
     element = static_cast<nsSVGElement*>(ancestor);
     matrix *= element->PrependLocalTransformsTo(gfxMatrix()); // i.e. *A*ppend
     if (!aScreenCTM && SVGContentUtils::EstablishesViewport(element)) {
       if (!element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG) &&
           !element->NodeInfo()->Equals(nsGkAtoms::symbol, kNameSpaceID_SVG)) {
         NS_ERROR("New (SVG > 1.1) SVG viewport establishing element?");
         return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
@@ -426,17 +426,17 @@ GetCTMInternal(nsSVGElement *aElement, b
     // transforms in this case since that's what we've been doing for
     // a while, and it keeps us consistent with WebKit and Opera (if not
     // really with the ambiguous spec).
     matrix = aElement->PrependLocalTransformsTo(gfxMatrix());
   }
   if (!ancestor || !ancestor->IsElement()) {
     return gfx::ToMatrix(matrix);
   }
-  if (ancestor->IsSVG()) {
+  if (ancestor->IsSVGElement()) {
     return
       gfx::ToMatrix(matrix) * GetCTMInternal(static_cast<nsSVGElement*>(ancestor), true, true);
   }
 
   // XXX this does not take into account CSS transform, or that the non-SVG
   // content that we've hit may itself be inside an SVG foreignObject higher up
   nsIDocument* currentDoc = aElement->GetComposedDoc();
   float x = 0.0f, y = 0.0f;
--- a/dom/svg/SVGDocument.cpp
+++ b/dom/svg/SVGDocument.cpp
@@ -53,29 +53,29 @@ SVGDocument::GetDomain(nsAString& aDomai
 
 nsSVGElement*
 SVGDocument::GetRootElement(ErrorResult& aRv)
 {
   Element* root = nsDocument::GetRootElement();
   if (!root) {
     return nullptr;
   }
-  if (!root->IsSVG()) {
+  if (!root->IsSVGElement()) {
     aRv.Throw(NS_NOINTERFACE);
     return nullptr;
   }
   return static_cast<nsSVGElement*>(root);
 }
 
 nsresult
 SVGDocument::InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify)
 {
   nsresult rv = XMLDocument::InsertChildAt(aKid, aIndex, aNotify);
 
-  if (NS_SUCCEEDED(rv) && aKid->IsElement() && !aKid->IsSVG()) {
+  if (NS_SUCCEEDED(rv) && aKid->IsElement() && !aKid->IsSVGElement()) {
     // We can get here when well formed XML with a non-SVG root element is
     // served with the SVG MIME type, for example. In that case we need to load
     // the non-SVG UA sheets or else we can get bugs like bug 1016145.
     EnsureNonSVGUserAgentStyleSheetsLoaded();
   }
 
   return rv;
 }
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -348,15 +348,15 @@ SVGFEImageElement::Notify(imgIRequest* a
 }
 
 //----------------------------------------------------------------------
 // helper methods
 
 void
 SVGFEImageElement::Invalidate()
 {
-  if (GetParent() && GetParent()->IsSVG(nsGkAtoms::filter)) {
+  if (GetParent() && GetParent()->IsSVGElement(nsGkAtoms::filter)) {
     static_cast<SVGFilterElement*>(GetParent())->Invalidate();
   }
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/svg/SVGFEMergeElement.cpp
+++ b/dom/svg/SVGFEMergeElement.cpp
@@ -37,17 +37,17 @@ SVGFEMergeElement::GetPrimitiveDescripti
 }
 
 void
 SVGFEMergeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
 {
   for (nsIContent* child = nsINode::GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsSVG(nsGkAtoms::feMergeNode)) {
+    if (child->IsSVGElement(nsGkAtoms::feMergeNode)) {
       SVGFEMergeNodeElement* node = static_cast<SVGFEMergeNodeElement*>(child);
       aSources.AppendElement(nsSVGStringInfo(node->GetIn1(), node));
     }
   }
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
--- a/dom/svg/SVGForeignObjectElement.cpp
+++ b/dom/svg/SVGForeignObjectElement.cpp
@@ -112,17 +112,17 @@ SVGForeignObjectElement::BindToTree(nsID
                                     bool aCompileEventHandlers)
 {
   nsresult rv = SVGGraphicsElement::BindToTree(aDocument, aParent,
                                                aBindingParent,
                                                aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsIDocument* doc = GetComposedDoc();
-  if (doc && doc->IsSVG()) {
+  if (doc && doc->IsSVGDocument()) {
     // We assume that we're going to have HTML content, so we ensure that the
     // UA style sheets that nsDocumentViewer::CreateStyleSet skipped when
     // it saw the document was an SVG document are loaded.
     //
     // We setup these style sheets during binding, not element construction,
     // because elements can be moved from the document that creates them to
     // another document.
     doc->AsSVGDocument()->EnsureNonSVGUserAgentStyleSheetsLoaded();
--- a/dom/svg/SVGFragmentIdentifier.cpp
+++ b/dom/svg/SVGFragmentIdentifier.cpp
@@ -28,17 +28,17 @@ IgnoreWhitespace(char16_t aChar)
 {
   return false;
 }
 
 static dom::SVGViewElement*
 GetViewElement(nsIDocument* aDocument, const nsAString& aId)
 {
   dom::Element* element = aDocument->GetElementById(aId);
-  return (element && element->IsSVG(nsGkAtoms::view)) ?
+  return (element && element->IsSVGElement(nsGkAtoms::view)) ?
             static_cast<dom::SVGViewElement*>(element) : nullptr;
 }
 
 void
 SVGFragmentIdentifier::SaveOldPreserveAspectRatio(dom::SVGSVGElement* root)
 {
   if (root->mPreserveAspectRatio.IsExplicitlySet()) {
     root->SetPreserveAspectRatioProperty(root->mPreserveAspectRatio.GetBaseValue());
@@ -233,17 +233,17 @@ SVGFragmentIdentifier::ProcessSVGViewSpe
 
   return true;
 }
 
 bool
 SVGFragmentIdentifier::ProcessFragmentIdentifier(nsIDocument* aDocument,
                                                  const nsAString& aAnchorName)
 {
-  MOZ_ASSERT(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg),
+  MOZ_ASSERT(aDocument->GetRootElement()->IsSVGElement(nsGkAtoms::svg),
              "expecting an SVG root element");
 
   dom::SVGSVGElement* rootElement =
     static_cast<dom::SVGSVGElement*>(aDocument->GetRootElement());
 
   if (!rootElement->mUseCurrentView) {
     SaveOldViewBox(rootElement);
     SaveOldPreserveAspectRatio(rootElement);
--- a/dom/svg/SVGMPathElement.cpp
+++ b/dom/svg/SVGMPathElement.cpp
@@ -182,17 +182,17 @@ SVGMPathElement::GetReferencedPath()
   if (!HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
     MOZ_ASSERT(!mHrefTarget.get(),
                "We shouldn't have an xlink:href target "
                "if we don't have an xlink:href attribute");
     return nullptr;
   }
 
   nsIContent* genericTarget = mHrefTarget.get();
-  if (genericTarget && genericTarget->IsSVG(nsGkAtoms::path)) {
+  if (genericTarget && genericTarget->IsSVGElement(nsGkAtoms::path)) {
     return static_cast<SVGPathElement*>(genericTarget);
   }
   return nullptr;
 }
 
 //----------------------------------------------------------------------
 // Protected helper methods
 
@@ -241,17 +241,17 @@ SVGMPathElement::UnlinkHrefTarget(bool a
   if (aNotifyParent) {
     NotifyParentOfMpathChange(GetParent());
   }
 }
 
 void
 SVGMPathElement::NotifyParentOfMpathChange(nsIContent* aParent)
 {
-  if (aParent && aParent->IsSVG(nsGkAtoms::animateMotion)) {
+  if (aParent && aParent->IsSVGElement(nsGkAtoms::animateMotion)) {
 
     SVGAnimateMotionElement* animateMotionParent =
       static_cast<SVGAnimateMotionElement*>(aParent);
 
     animateMotionParent->MpathChanged();
     AnimationNeedsResample();
   }
 }
--- a/dom/svg/SVGMotionSMILAnimationFunction.cpp
+++ b/dom/svg/SVGMotionSMILAnimationFunction.cpp
@@ -129,17 +129,17 @@ SVGMotionSMILAnimationFunction::GetCalcM
  */
 
 static SVGMPathElement*
 GetFirstMPathChild(nsIContent* aElem)
 {
   for (nsIContent* child = aElem->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsSVG(nsGkAtoms::mpath)) {
+    if (child->IsSVGElement(nsGkAtoms::mpath)) {
       return static_cast<SVGMPathElement*>(child);
     }
   }
 
   return nullptr;
 }
 
 void
@@ -147,17 +147,17 @@ SVGMotionSMILAnimationFunction::
   RebuildPathAndVerticesFromBasicAttrs(const nsIContent* aContextElem)
 {
   MOZ_ASSERT(!HasAttr(nsGkAtoms::path),
              "Should be using |path| attr if we have it");
   MOZ_ASSERT(!mPath, "regenerating when we aleady have path");
   MOZ_ASSERT(mPathVertices.IsEmpty(),
              "regenerating when we already have vertices");
 
-  if (!aContextElem->IsSVG()) {
+  if (!aContextElem->IsSVGElement()) {
     NS_ERROR("Uh oh, SVG animateMotion element targeting a non-SVG node");
     return;
   }
 
   SVGMotionSMILPathUtils::PathGenerator
     pathGenerator(static_cast<const nsSVGElement*>(aContextElem));
 
   bool success = false;
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -780,17 +780,17 @@ SVGSVGElement::UnbindFromTree(bool aDeep
 // implementation helpers
 
 bool
 SVGSVGElement::WillBeOutermostSVG(nsIContent* aParent,
                                   nsIContent* aBindingParent) const
 {
   nsIContent* parent = aBindingParent ? aBindingParent : aParent;
 
-  while (parent && parent->IsSVG()) {
+  while (parent && parent->IsSVGElement()) {
     nsIAtom* tag = parent->Tag();
     if (tag == nsGkAtoms::foreignObject) {
       // SVG in a foreignObject must have its own <svg> (nsSVGOuterSVGFrame).
       return false;
     }
     if (tag == nsGkAtoms::svg) {
       return false;
     }
@@ -821,17 +821,17 @@ SVGSVGElement::HasPreserveAspectRatio()
 SVGViewElement*
 SVGSVGElement::GetCurrentViewElement() const
 {
   if (mCurrentViewID) {
     //XXXsmaug It is unclear how this should work in case we're in Shadow DOM.
     nsIDocument* doc = GetUncomposedDoc();
     if (doc) {
       Element *element = doc->GetElementById(*mCurrentViewID);
-      if (element && element->IsSVG(nsGkAtoms::view)) {
+      if (element && element->IsSVGElement(nsGkAtoms::view)) {
         return static_cast<SVGViewElement*>(element);
       }
     }
   }
   return nullptr;
 }
 
 nsSVGViewBoxRect
--- a/dom/svg/SVGSVGElement.h
+++ b/dom/svg/SVGSVGElement.h
@@ -307,17 +307,17 @@ private:
   }
 
   /**
    * Returns true if this is an SVG <svg> element that is the child of
    * another non-foreignObject SVG element.
    */
   bool IsInner() const {
     const nsIContent *parent = GetFlattenedTreeParent();
-    return parent && parent->IsSVG() &&
+    return parent && parent->IsSVGElement() &&
            parent->Tag() != nsGkAtoms::foreignObject;
   }
 
   /* 
    * While binding to the tree we need to determine if we will be the outermost
    * <svg> element _before_ the children are bound (as they want to know what
    * timed document root to register with) and therefore _before_ our parent is
    * set (both actions are performed by Element::BindToTree) so we
--- a/dom/svg/SVGUseElement.cpp
+++ b/dom/svg/SVGUseElement.cpp
@@ -211,17 +211,17 @@ SVGUseElement::CreateAnonymousContent()
   mClone = nullptr;
 
   if (mSource.get()) {
     mSource.get()->RemoveMutationObserver(this);
   }
 
   LookupHref();
   nsIContent* targetContent = mSource.get();
-  if (!targetContent || !targetContent->IsSVG())
+  if (!targetContent || !targetContent->IsSVGElement())
     return nullptr;
 
   // make sure target is valid type for <use>
   // QIable nsSVGGraphicsElement would eliminate enumerating all elements
   nsIAtom *tag = targetContent->Tag();
   if (tag != nsGkAtoms::svg &&
       tag != nsGkAtoms::symbol &&
       tag != nsGkAtoms::g &&
@@ -243,17 +243,17 @@ SVGUseElement::CreateAnonymousContent()
   if (nsContentUtils::ContentIsDescendantOf(this, targetContent))
     return nullptr;
 
   // check 2 - check if we're a clone, and if we already exist in the hierarchy
   if (GetParent() && mOriginal) {
     for (nsCOMPtr<nsIContent> content = GetParent();
          content;
          content = content->GetParent()) {
-      if (content->IsSVG(nsGkAtoms::use) &&
+      if (content->IsSVGElement(nsGkAtoms::use) &&
           static_cast<SVGUseElement*>(content.get())->mOriginal == mOriginal) {
         return nullptr;
       }
     }
   }
 
   nsCOMPtr<nsINode> newnode;
   nsCOMArray<nsINode> unused;
@@ -263,17 +263,17 @@ SVGUseElement::CreateAnonymousContent()
   nsNodeUtils::Clone(targetContent, true, nodeInfoManager, unused,
                      getter_AddRefs(newnode));
 
   nsCOMPtr<nsIContent> newcontent = do_QueryInterface(newnode);
 
   if (!newcontent)
     return nullptr;
 
-  if (newcontent->IsSVG(nsGkAtoms::symbol)) {
+  if (newcontent->IsSVGElement(nsGkAtoms::symbol)) {
     nsIDocument *document = GetComposedDoc();
     if (!document)
       return nullptr;
 
     nsNodeInfoManager *nodeInfoManager = document->NodeInfoManager();
     if (!nodeInfoManager)
       return nullptr;
 
@@ -307,18 +307,17 @@ SVGUseElement::CreateAnonymousContent()
       nsCOMPtr<nsIContent> child = newcontent->GetFirstChild();
       newcontent->RemoveChildAt(0, false);
       svgNode->InsertChildAt(child, i, true);
     }
 
     newcontent = svgNode;
   }
 
-  if (newcontent->IsSVG() && (newcontent->Tag() == nsGkAtoms::svg ||
-                              newcontent->Tag() == nsGkAtoms::symbol)) {
+  if (newcontent->IsAnyOfSVGElements(nsGkAtoms::svg, nsGkAtoms::symbol)) {
     nsSVGElement *newElement = static_cast<nsSVGElement*>(newcontent.get());
 
     if (mLengthAttributes[ATTR_WIDTH].IsExplicitlySet())
       newElement->SetLength(nsGkAtoms::width, mLengthAttributes[ATTR_WIDTH]);
     if (mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet())
       newElement->SetLength(nsGkAtoms::height, mLengthAttributes[ATTR_HEIGHT]);
   }
 
@@ -337,18 +336,17 @@ void
 SVGUseElement::DestroyAnonymousContent()
 {
   nsContentUtils::DestroyAnonymousContent(&mClone);
 }
 
 bool
 SVGUseElement::OurWidthAndHeightAreUsed() const
 {
-  return mClone && mClone->IsSVG() && (mClone->Tag() == nsGkAtoms::svg ||
-                                       mClone->Tag() == nsGkAtoms::symbol);
+  return mClone && mClone->IsAnyOfSVGElements(nsGkAtoms::svg, nsGkAtoms::symbol);
 }
 
 //----------------------------------------------------------------------
 // implementation helpers
 
 void
 SVGUseElement::SyncWidthOrHeight(nsIAtom* aName)
 {
--- a/dom/svg/SVGZoomEvent.cpp
+++ b/dom/svg/SVGZoomEvent.cpp
@@ -51,17 +51,17 @@ SVGZoomEvent::SVGZoomEvent(EventTarget* 
     nsIDocument *doc = presShell->GetDocument();
     if (doc) {
       Element *rootElement = doc->GetRootElement();
       if (rootElement) {
         // If the root element isn't an SVG 'svg' element
         // (e.g. if this event was created by calling createEvent on a
         // non-SVGDocument), then the "New" and "Previous"
         // properties will be left null which is probably what we want.
-        if (rootElement->IsSVG(nsGkAtoms::svg)) {
+        if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
           SVGSVGElement *SVGSVGElem =
             static_cast<SVGSVGElement*>(rootElement);
 
           mNewScale = SVGSVGElem->GetCurrentScale();
           mPreviousScale = SVGSVGElem->GetPreviousScale();
 
           const SVGPoint& translate = SVGSVGElem->GetCurrentTranslate();
           mNewTranslate =
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -1511,17 +1511,17 @@ nsIAtom* nsSVGElement::GetEventNameForAt
   return aAttr;
 }
 
 SVGSVGElement *
 nsSVGElement::GetCtx() const
 {
   nsIContent* ancestor = GetFlattenedTreeParent();
 
-  while (ancestor && ancestor->IsSVG()) {
+  while (ancestor && ancestor->IsSVGElement()) {
     nsIAtom* tag = ancestor->Tag();
     if (tag == nsGkAtoms::foreignObject) {
       return nullptr;
     }
     if (tag == nsGkAtoms::svg) {
       return static_cast<SVGSVGElement*>(ancestor);
     }
     ancestor = ancestor->GetFlattenedTreeParent();
--- a/dom/svg/nsSVGFilters.cpp
+++ b/dom/svg/nsSVGFilters.cpp
@@ -484,19 +484,19 @@ nsSVGFELightingElement::GetSourceImageNa
 
 AttributeMap
 nsSVGFELightingElement::ComputeLightAttributes(nsSVGFilterInstance* aInstance)
 {
   // find specified light
   for (nsCOMPtr<nsIContent> child = nsINode::GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsSVG(nsGkAtoms::feDistantLight) ||
-        child->IsSVG(nsGkAtoms::fePointLight) ||
-        child->IsSVG(nsGkAtoms::feSpotLight)) {
+    if (child->IsAnyOfSVGElements(nsGkAtoms::feDistantLight,
+                                  nsGkAtoms::fePointLight,
+                                  nsGkAtoms::feSpotLight)) {
       return static_cast<SVGFELightElement*>(child.get())->ComputeLightAttributes(aInstance);
     }
   }
 
   AttributeMap map;
   map.Set(eLightType, (uint32_t)eLightTypeNone);
   return map;
 }
--- a/dom/svg/nsSVGLength2.cpp
+++ b/dom/svg/nsSVGLength2.cpp
@@ -222,17 +222,17 @@ nsSVGLength2::GetUnitScaleFactor(SVGSVGE
 {
   return GetUnitScaleFactor(SVGElementMetrics(aCtx, aCtx), aUnitType);
 }
 
 float
 nsSVGLength2::GetUnitScaleFactor(nsIFrame *aFrame, uint8_t aUnitType) const
 {
   nsIContent* content = aFrame->GetContent();
-  if (content->IsSVG()) {
+  if (content->IsSVGElement()) {
     return GetUnitScaleFactor(SVGElementMetrics(static_cast<nsSVGElement*>(content)), aUnitType);
   }
   return GetUnitScaleFactor(NonSVGFrameUserSpaceMetrics(aFrame), aUnitType);
 }
 
 float
 nsSVGLength2::GetUnitScaleFactor(const UserSpaceMetrics& aMetrics, uint8_t aUnitType) const
 {
--- a/dom/xbl/nsXBLContentSink.cpp
+++ b/dom/xbl/nsXBLContentSink.cpp
@@ -879,17 +879,17 @@ nsXBLContentSink::CreateElement(const ch
   return rv;
 #endif
 }
 
 nsresult 
 nsXBLContentSink::AddAttributes(const char16_t** aAtts,
                                 nsIContent* aContent)
 {
-  if (aContent->IsXUL())
+  if (aContent->IsXULElement())
     return NS_OK; // Nothing to do, since the proto already has the attrs.
 
   return nsXMLContentSink::AddAttributes(aAtts, aContent);
 }
 
 #ifdef MOZ_XUL
 nsresult
 nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts, 
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -479,17 +479,17 @@ nsXBLPrototypeHandler::DispatchXBLComman
     nsIContent *content = focusedContent;
 
     // if the focused element is a link then we do want space to 
     // scroll down. The focused element may be an element in a link,
     // we need to check the parent node too. Only do this check if an
     // element is focused and has a parent.
     if (focusedContent && focusedContent->GetParent()) {
       while (content) {
-        if (content->Tag() == nsGkAtoms::a && content->IsHTML()) {
+        if (content->Tag() == nsGkAtoms::a && content->IsHTMLElement()) {
           isLink = true;
           break;
         }
 
         if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
           isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
                                         nsGkAtoms::simple, eCaseMatters);
 
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -661,17 +661,18 @@ MayBindToContent(nsXBLPrototypeBinding* 
 {
   // If this binding explicitly allows untrusted content, we're done.
   if (aProtoBinding->BindToUntrustedContent()) {
     return true;
   }
 
   // We let XUL content and content in XUL documents through, since XUL is
   // restricted anyway and we want to minimize remote XUL breakage.
-  if (aBoundElement->IsXUL() || aBoundElement->OwnerDoc()->IsXUL()) {
+  if (aBoundElement->IsXULElement() ||
+      aBoundElement->OwnerDoc()->IsXULElement()) {
     return true;
   }
 
   // Similarly, we make an exception for anonymous content (which
   // lives in the XBL scope), because it's already protected from content,
   // and tends to use a lot of bindings that we wouldn't otherwise need to
   // whitelist.
   if (aBoundElement->IsInAnonymousSubtree()) {
@@ -950,17 +951,17 @@ nsXBLService::LoadBindingDocumentInfo(ns
     if (aBoundElement)
       ni = aBoundElement->NodeInfo();
 
     if (!info && bindingManager &&
         (!ni || !(ni->Equals(nsGkAtoms::scrollbar, kNameSpaceID_XUL) ||
                   ni->Equals(nsGkAtoms::thumb, kNameSpaceID_XUL) ||
                   ((ni->Equals(nsGkAtoms::input) ||
                     ni->Equals(nsGkAtoms::select)) &&
-                   aBoundElement->IsHTML()))) && !aForceSyncLoad) {
+                   aBoundElement->IsHTMLElement()))) && !aForceSyncLoad) {
       // The third line of defense is to investigate whether or not the
       // document is currently being loaded asynchronously.  If so, there's no
       // document yet, but we need to glom on our request so that it will be
       // processed whenever the doc does finish loading.
       nsCOMPtr<nsIStreamListener> listener;
       if (bindingManager)
         listener = bindingManager->GetLoadingDocListener(documentURI);
       if (listener) {
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -844,17 +844,17 @@ nsXMLContentSink::PushContent(nsIContent
   NS_PRECONDITION(aContent, "Null content being pushed!");
   StackNode *sn = mContentStack.AppendElement();
   NS_ENSURE_TRUE(sn, NS_ERROR_OUT_OF_MEMORY);
 
   nsIContent* contentToPush = aContent;
 
   // When an XML parser would append a node to a template element, it
   // must instead append it to the template element's template contents.
-  if (contentToPush->IsHTML(nsGkAtoms::_template)) {
+  if (contentToPush->IsHTMLElement(nsGkAtoms::_template)) {
     HTMLTemplateElement* templateElement =
       static_cast<HTMLTemplateElement*>(contentToPush);
     contentToPush = templateElement->Content();
   }
 
   sn->mContent = contentToPush;
   sn->mNumFlushed = 0;
   return NS_OK;
@@ -1111,17 +1111,17 @@ nsXMLContentSink::HandleEndElement(const
   if (mNotifyLevel >= stackLen) {
     if (numFlushed < content->GetChildCount()) {
     	  NotifyAppend(content, numFlushed);
     }
     mNotifyLevel = stackLen - 1;
   }
   DidAddContent();
 
-  if (content->IsSVG(nsGkAtoms::svg)) {
+  if (content->IsSVGElement(nsGkAtoms::svg)) {
     FlushTags();
     nsCOMPtr<nsIRunnable> event = new nsHtml5SVGLoadDispatcher(content);
     if (NS_FAILED(NS_DispatchToMainThread(event))) {
       NS_WARNING("failed to dispatch svg load dispatcher");
     }
   }
 
   return aInterruptable && NS_SUCCEEDED(result) ? DidProcessATokenImpl() :
--- a/dom/xml/nsXMLFragmentContentSink.cpp
+++ b/dom/xml/nsXMLFragmentContentSink.cpp
@@ -223,17 +223,17 @@ nsXMLFragmentContentSink::CreateElement(
   return rv;
 }
 
 nsresult
 nsXMLFragmentContentSink::CloseElement(nsIContent* aContent)
 {
   // don't do fancy stuff in nsXMLContentSink
   if (mPreventScriptExecution && aContent->Tag() == nsGkAtoms::script &&
-      (aContent->IsHTML() || aContent->IsSVG())) {
+      (aContent->IsHTMLElement() || aContent->IsSVGElement())) {
     nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent);
     NS_ASSERTION(sele, "script did QI correctly!");
     sele->PreventExecution();
   }
   return NS_OK;
 }
 
 void
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -116,26 +116,28 @@ XPathEvaluator::Evaluate(const nsAString
     return NS_OK;
 }
 
 XPathExpression*
 XPathEvaluator::CreateExpression(const nsAString& aExpression,
                                  XPathNSResolver* aResolver, ErrorResult& aRv)
 {
     nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
-    XPathEvaluatorParseContext pContext(aResolver, !(doc && doc->IsHTML()));
+    XPathEvaluatorParseContext pContext(aResolver,
+                                        !(doc && doc->IsHTMLDocument()));
     return CreateExpression(aExpression, &pContext, doc, aRv);
 }
 
 XPathExpression*
 XPathEvaluator::CreateExpression(const nsAString& aExpression,
                                  nsINode* aResolver, ErrorResult& aRv)
 {
     nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
-    XPathEvaluatorParseContext pContext(aResolver, !(doc && doc->IsHTML()));
+    XPathEvaluatorParseContext pContext(aResolver,
+                                        !(doc && doc->IsHTMLDocument()));
     return CreateExpression(aExpression, &pContext, doc, aRv);
 }
 
 XPathExpression*
 XPathEvaluator::CreateExpression(const nsAString & aExpression,
                                  txIParseContext* aContext,
                                  nsIDocument* aDocument,
                                  ErrorResult& aRv)
--- a/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
+++ b/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
@@ -415,17 +415,17 @@ txXPathNodeUtils::getLocalName(const txX
         return;
     }
 
     aNode.Content()->GetAttrNameAt(aNode.mIndex)->LocalName()->
       ToString(aLocalName);
 
     // Check for html
     if (aNode.Content()->NodeInfo()->NamespaceEquals(kNameSpaceID_None) &&
-        aNode.Content()->IsHTML()) {
+        aNode.Content()->IsHTMLElement()) {
         nsContentUtils::ASCIIToUpper(aLocalName);
     }
 }
 
 /* static */
 void
 txXPathNodeUtils::getNodeName(const txXPathNode& aNode, nsAString& aName)
 {
--- a/dom/xslt/xpath/txXPathTreeWalker.h
+++ b/dom/xslt/xpath/txXPathTreeWalker.h
@@ -105,17 +105,17 @@ public:
     static bool isComment(const txXPathNode& aNode);
     static bool isText(const txXPathNode& aNode);
     static inline bool isHTMLElementInHTMLDocument(const txXPathNode& aNode)
     {
       if (!aNode.isContent()) {
         return false;
       }
       nsIContent* content = aNode.Content();
-      return content->IsHTML() && content->IsInHTMLDocument();
+      return content->IsHTMLElement() && content->IsInHTMLDocument();
     }
 };
 
 class txXPathNativeNode
 {
 public:
     static txXPathNode* createXPathNode(nsINode* aNode,
                                         bool aKeepRootAlive = false);
--- a/dom/xslt/xslt/txMozillaXMLOutput.cpp
+++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp
@@ -276,17 +276,17 @@ txMozillaXMLOutput::endElement()
 
     NS_ASSERTION(mCurrentNode->IsElement(), "borked mCurrentNode");
     NS_ENSURE_TRUE(mCurrentNode->IsElement(), NS_ERROR_UNEXPECTED);
 
     Element* element = mCurrentNode->AsElement();
 
     // Handle html-elements
     if (!mNoFixup) {
-        if (element->IsHTML()) {
+        if (element->IsHTMLElement()) {
             rv = endHTMLElement(element);
             NS_ENSURE_SUCCESS(rv, rv);
         }
 
         // Handle elements that are different when parser-created
         int32_t ns = element->GetNameSpaceID();
         nsIAtom* localName = element->Tag();
 
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -189,17 +189,17 @@ txToFragmentHandlerFactory::createHandle
         {
             txOutputFormat format;
             format.merge(*aFormat);
             nsCOMPtr<nsIDOMDocument> domdoc;
             mFragment->GetOwnerDocument(getter_AddRefs(domdoc));
             NS_ASSERTION(domdoc, "unable to get ownerdocument");
             nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
 
-            if (doc && doc->IsHTML()) {
+            if (doc && doc->IsHTMLDocument()) {
                 format.mMethod = eHTMLOutput;
             } else {
                 format.mMethod = eXMLOutput;
             }
 
             *aHandler = new txMozillaXMLOutput(&format, mFragment, false);
             break;
         }
--- a/dom/xul/nsXULPopupListener.cpp
+++ b/dom/xul/nsXULPopupListener.cpp
@@ -136,17 +136,17 @@ nsXULPopupListener::HandleEvent(nsIDOMEv
     }
   }
 
   nsCOMPtr<nsIContent> targetContent = do_QueryInterface(target);
   if (!targetContent) {
     return NS_OK;
   }
   if (targetContent->Tag() == nsGkAtoms::browser &&
-      targetContent->IsXUL() &&
+      targetContent->IsXULElement() &&
       EventStateManager::IsRemoteTarget(targetContent)) {
     return NS_OK;
   }
 
   bool preventDefault;
   mouseEvent->GetDefaultPrevented(&preventDefault);
   if (preventDefault && targetNode && mIsContext) {
     // Someone called preventDefault on a context menu.
--- a/dom/xul/templates/nsXULContentBuilder.cpp
+++ b/dom/xul/templates/nsXULContentBuilder.cpp
@@ -1258,17 +1258,17 @@ nsXULContentBuilder::EnsureElementHasGen
         return NS_ELEMENT_WAS_THERE;
     }
 }
 
 bool
 nsXULContentBuilder::IsOpen(nsIContent* aElement)
 {
     // Determine if this is a <treeitem> or <menu> element
-    if (!aElement->IsXUL())
+    if (!aElement->IsXULElement())
         return true;
 
     // XXXhyatt Use the XBL service to obtain a base tag.
     nsIAtom *tag = aElement->Tag();
     if (tag == nsGkAtoms::menu ||
         tag == nsGkAtoms::menubutton ||
         tag == nsGkAtoms::toolbarbutton ||
         tag == nsGkAtoms::button ||
--- a/dom/xul/templates/nsXULSortService.cpp
+++ b/dom/xul/templates/nsXULSortService.cpp
@@ -70,17 +70,17 @@ XULSortServiceImpl::SetSortColumnHints(n
                                        const nsAString &sortResource,
                                        const nsAString &sortDirection)
 {
   // set sort info on current column. This ensures that the
   // column header sort indicator is updated properly.
   for (nsIContent* child = content->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsXUL()) {
+    if (child->IsXULElement()) {
       nsIAtom *tag = child->Tag();
 
       if (tag == nsGkAtoms::treecols) {
         SetSortColumnHints(child, sortResource, sortDirection);
       } else if (tag == nsGkAtoms::treecol) {
         nsAutoString value;
         child->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, value);
         // also check the resource attribute for older code
--- a/dom/xul/templates/nsXULTemplateBuilder.cpp
+++ b/dom/xul/templates/nsXULTemplateBuilder.cpp
@@ -1238,17 +1238,17 @@ nsXULTemplateBuilder::LoadDataSources(ns
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Now set the database on the element, so that script writers can
     // access it.
     nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(aDocument);
     if (xuldoc)
         xuldoc->SetTemplateBuilderFor(mRoot, this);
 
-    if (!mRoot->IsXUL()) {
+    if (!mRoot->IsXULElement()) {
         // Hmm. This must be an HTML element. Try to set it as a
         // JS property "by hand".
         InitHTMLTemplateRoot();
     }
   
     return NS_OK;
 }
   
--- a/editor/libeditor/nsEditorEventListener.cpp
+++ b/editor/libeditor/nsEditorEventListener.cpp
@@ -1139,17 +1139,17 @@ nsEditorEventListener::SpellCheckIfNeede
 bool
 nsEditorEventListener::IsFileControlTextBox()
 {
   dom::Element* root = mEditor->GetRoot();
   if (!root || !root->ChromeOnlyAccess()) {
     return false;
   }
   nsIContent* parent = root->FindFirstNonChromeOnlyAccessContent();
-  if (!parent || !parent->IsHTML(nsGkAtoms::input)) {
+  if (!parent || !parent->IsHTMLElement(nsGkAtoms::input)) {
     return false;
   }
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(parent);
   return formControl->GetType() == NS_FORM_INPUT_FILE;
 }
 
 bool
 nsEditorEventListener::ShouldHandleNativeKeyBindings(nsIDOMKeyEvent* aKeyEvent)
--- a/editor/libeditor/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/nsHTMLAbsPosition.cpp
@@ -543,17 +543,18 @@ nsHTMLEditor::AbsolutelyPositionElement(
     if (!nsHTMLEditUtils::IsImage(aElement)) {
       mHTMLCSSUtils->RemoveCSSProperty(*element, *nsGkAtoms::width,
                                        EmptyString());
       mHTMLCSSUtils->RemoveCSSProperty(*element, *nsGkAtoms::height,
                                        EmptyString());
     }
 
     nsCOMPtr<dom::Element> element = do_QueryInterface(aElement);
-    if (element && element->IsHTML(nsGkAtoms::div) && !HasStyleOrIdOrClass(element)) {
+    if (element && element->IsHTMLElement(nsGkAtoms::div) &&
+        !HasStyleOrIdOrClass(element)) {
       nsRefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
       NS_ENSURE_TRUE(htmlRules, NS_ERROR_FAILURE);
       nsresult res = htmlRules->MakeSureElemStartsOrEndsOnCR(aElement);
       NS_ENSURE_SUCCESS(res, res);
       res = RemoveContainer(element);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
--- a/editor/libeditor/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/nsHTMLCSSUtils.cpp
@@ -583,17 +583,17 @@ nsHTMLCSSUtils::RemoveCSSInlineStyle(nsI
 {
   nsCOMPtr<Element> element = do_QueryInterface(aNode);
   NS_ENSURE_STATE(element);
 
   // remove the property from the style attribute
   nsresult res = RemoveCSSProperty(*element, *aProperty, aPropertyValue);
   NS_ENSURE_SUCCESS(res, res);
 
-  if (!element->IsHTML(nsGkAtoms::span) ||
+  if (!element->IsHTMLElement(nsGkAtoms::span) ||
       nsHTMLEditor::HasAttributes(element)) {
     return NS_OK;
   }
 
   return mHTMLEditor->RemoveContainer(element);
 }
 
 // Answers true is the property can be removed by setting a "none" CSS value
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -698,31 +698,31 @@ nsHTMLEditRules::GetListState(bool *aMix
   // Examine list type for nodes in selection.
   int32_t listCount = arrayOfNodes.Count();
   for (int32_t i = listCount - 1; i >= 0; --i) {
     nsIDOMNode* curDOMNode = arrayOfNodes[i];
     nsCOMPtr<dom::Element> curElement = do_QueryInterface(curDOMNode);
 
     if (!curElement) {
       bNonList = true;
-    } else if (curElement->IsHTML(nsGkAtoms::ul)) {
+    } else if (curElement->IsHTMLElement(nsGkAtoms::ul)) {
       *aUL = true;
-    } else if (curElement->IsHTML(nsGkAtoms::ol)) {
+    } else if (curElement->IsHTMLElement(nsGkAtoms::ol)) {
       *aOL = true;
-    } else if (curElement->IsHTML(nsGkAtoms::li)) {
+    } else if (curElement->IsHTMLElement(nsGkAtoms::li)) {
       if (dom::Element* parent = curElement->GetParentElement()) {
-        if (parent->IsHTML(nsGkAtoms::ul)) {
+        if (parent->IsHTMLElement(nsGkAtoms::ul)) {
           *aUL = true;
-        } else if (parent->IsHTML(nsGkAtoms::ol)) {
+        } else if (parent->IsHTMLElement(nsGkAtoms::ol)) {
           *aOL = true;
         }
       }
-    } else if (curElement->IsHTML(nsGkAtoms::dl) ||
-               curElement->IsHTML(nsGkAtoms::dt) ||
-               curElement->IsHTML(nsGkAtoms::dd)) {
+    } else if (curElement->IsAnyOfHTMLElements(nsGkAtoms::dl,
+                                               nsGkAtoms::dt,
+                                               nsGkAtoms::dd)) {
       *aDL = true;
     } else {
       bNonList = true;
     }
   }  
   
   // hokey arithmetic with booleans
   if ((*aUL + *aOL + *aDL + bNonList) > 1) {
@@ -748,25 +748,25 @@ nsHTMLEditRules::GetListItemState(bool *
 
   // examine list type for nodes in selection
   int32_t listCount = arrayOfNodes.Count();
   for (int32_t i = listCount - 1; i >= 0; --i) {
     nsIDOMNode* curNode = arrayOfNodes[i];
     nsCOMPtr<dom::Element> element = do_QueryInterface(curNode);
     if (!element) {
       bNonList = true;
-    } else if (element->IsHTML(nsGkAtoms::ul) ||
-               element->IsHTML(nsGkAtoms::ol) ||
-               element->IsHTML(nsGkAtoms::li)) {
+    } else if (element->IsAnyOfHTMLElements(nsGkAtoms::ul,
+                                            nsGkAtoms::ol,
+                                            nsGkAtoms::li)) {
       *aLI = true;
-    } else if (element->IsHTML(nsGkAtoms::dt)) {
+    } else if (element->IsHTMLElement(nsGkAtoms::dt)) {
       *aDT = true;
-    } else if (element->IsHTML(nsGkAtoms::dd)) {
+    } else if (element->IsHTMLElement(nsGkAtoms::dd)) {
       *aDD = true;
-    } else if (element->IsHTML(nsGkAtoms::dl)) {
+    } else if (element->IsHTMLElement(nsGkAtoms::dl)) {
       // need to look inside dl and see which types of items it has
       bool bDT, bDD;
       GetDefinitionListItemTypes(element, &bDT, &bDD);
       *aDT |= bDT;
       *aDD |= bDD;
     } else {
       bNonList = true;
     }
@@ -2453,17 +2453,17 @@ nsHTMLEditRules::WillDeleteSelection(Sel
                 continue;
               }
               nsCOMPtr<nsIContent> content = somenode->AsContent();
               if (content->NodeType() == nsIDOMNode::TEXT_NODE) {
                 NS_ENSURE_STATE(mHTMLEditor);
                 mHTMLEditor->IsVisTextNode(content, &join, true);
               } else {
                 NS_ENSURE_STATE(mHTMLEditor);
-                join = content->IsHTML(nsGkAtoms::br) &&
+                join = content->IsHTMLElement(nsGkAtoms::br) &&
                        !mHTMLEditor->IsVisBreak(somenode);
               }
             }
           }
         }
 
         // Check endpoints for possible text deletion.  We can assume that if
         // text node is found, we can delete to end or to begining as
@@ -4479,32 +4479,33 @@ nsHTMLEditRules::ConvertListType(Element
   MOZ_ASSERT(aListType);
   MOZ_ASSERT(aItemType);
 
   nsCOMPtr<nsINode> child = aList->GetFirstChild();
   while (child)
   {
     if (child->IsElement()) {
       dom::Element* element = child->AsElement();
-      if (nsHTMLEditUtils::IsListItem(element) && !element->IsHTML(aItemType)) {
+      if (nsHTMLEditUtils::IsListItem(element) &&
+          !element->IsHTMLElement(aItemType)) {
         child = mHTMLEditor->ReplaceContainer(element, aItemType);
         NS_ENSURE_STATE(child);
       } else if (nsHTMLEditUtils::IsList(element) &&
-                 !element->IsHTML(aListType)) {
+                 !element->IsHTMLElement(aListType)) {
         nsCOMPtr<dom::Element> temp;
         nsresult rv = ConvertListType(child->AsElement(), getter_AddRefs(temp),
                                       aListType, aItemType);
         NS_ENSURE_SUCCESS(rv, rv);
         child = temp.forget();
       }
     }
     child = child->GetNextSibling();
   }
 
-  if (aList->IsElement() && aList->AsElement()->IsHTML(aListType)) {
+  if (aList->IsHTMLElement(aListType)) {
     nsCOMPtr<dom::Element> list = aList->AsElement();
     list.forget(aOutList);
     return NS_OK;
   }
 
   *aOutList = mHTMLEditor->ReplaceContainer(aList, aListType).take();
   NS_ENSURE_STATE(aOutList);
 
@@ -6130,77 +6131,76 @@ nsHTMLEditRules::LookInsideDivBQandList(
   if (listCount != 1) {
     return NS_OK;
   }
 
   nsCOMPtr<nsINode> curNode = do_QueryInterface(aNodeArray[0]);
   NS_ENSURE_STATE(curNode);
 
   while (curNode->IsElement() &&
-         (curNode->AsElement()->IsHTML(nsGkAtoms::div) ||
+         (curNode->IsHTMLElement(nsGkAtoms::div) ||
           nsHTMLEditUtils::IsList(curNode) ||
-          curNode->AsElement()->IsHTML(nsGkAtoms::blockquote))) {
+          curNode->IsHTMLElement(nsGkAtoms::blockquote))) {
     // dive as long as there is only one child, and it is a list, div, blockquote
     NS_ENSURE_STATE(mHTMLEditor);
     uint32_t numChildren = mHTMLEditor->CountEditableChildren(curNode);
     if (numChildren != 1) {
       break;
     }
 
     // keep diving
     // XXX One would expect to dive into the one editable node.
     nsIContent* tmp = curNode->GetFirstChild();
     if (!tmp->IsElement()) {
       break;
     }
 
     dom::Element* element = tmp->AsElement();
-    if (!element->IsHTML(nsGkAtoms::div) &&
+    if (!element->IsHTMLElement(nsGkAtoms::div) &&
         !nsHTMLEditUtils::IsList(element) &&
-        !element->IsHTML(nsGkAtoms::blockquote)) {
+        !element->IsHTMLElement(nsGkAtoms::blockquote)) {
       break;
     }
 
     // check editablility XXX floppy moose
     curNode = tmp;
   }
 
   // we've found innermost list/blockquote/div: 
   // replace the one node in the array with these nodes
   aNodeArray.RemoveObjectAt(0);
-  if (curNode->IsElement() &&
-      (curNode->AsElement()->IsHTML(nsGkAtoms::div) ||
-       curNode->AsElement()->IsHTML(nsGkAtoms::blockquote))) {
+  if (curNode->IsAnyOfHTMLElements(nsGkAtoms::div,
+                                   nsGkAtoms::blockquote)) {
     int32_t j = 0;
     return GetInnerContent(curNode->AsDOMNode(), aNodeArray, &j, false, false);
   }
 
   aNodeArray.AppendObject(curNode->AsDOMNode());
   return NS_OK;
 }
 
 
 ///////////////////////////////////////////////////////////////////////////
 // GetDefinitionListItemTypes: 
 //                       
 void
 nsHTMLEditRules::GetDefinitionListItemTypes(dom::Element* aElement, bool* aDT, bool* aDD)
 {
   MOZ_ASSERT(aElement);
-  MOZ_ASSERT(aElement->IsHTML(nsGkAtoms::dl));
+  MOZ_ASSERT(aElement->IsHTMLElement(nsGkAtoms::dl));
   MOZ_ASSERT(aDT);
   MOZ_ASSERT(aDD);
 
   *aDT = *aDD = false;
   for (nsIContent* child = aElement->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsHTML(nsGkAtoms::dt)) {
+    if (child->IsHTMLElement(nsGkAtoms::dt)) {
       *aDT = true;
-    } else if (child->IsHTML(nsGkAtoms::dd)) {
+    } else if (child->IsHTMLElement(nsGkAtoms::dd)) {
       *aDD = true;
     }
   }
 }
 
 ///////////////////////////////////////////////////////////////////////////
 // GetParagraphFormatNodes: 
 //                       
@@ -7085,24 +7085,24 @@ nsHTMLEditRules::RemoveBlockStyle(nsCOMA
         NS_ENSURE_SUCCESS(res, res);
         curBlock = 0;  firstNode = 0;  lastNode = 0;
       }
       // remove curent block
       NS_ENSURE_STATE(mHTMLEditor);
       res = mHTMLEditor->RemoveBlockContainer(curNode); 
       NS_ENSURE_SUCCESS(res, res);
     } else if (curElement &&
-               (curElement->IsHTML(nsGkAtoms::table)      ||
-                curElement->IsHTML(nsGkAtoms::tr)         ||
-                curElement->IsHTML(nsGkAtoms::tbody)      ||
-                curElement->IsHTML(nsGkAtoms::td)         ||
-                nsHTMLEditUtils::IsList(curElement)       ||
-                curElement->IsHTML(nsGkAtoms::li)         ||
-                curElement->IsHTML(nsGkAtoms::blockquote) ||
-                curElement->IsHTML(nsGkAtoms::div))) {
+               (curElement->IsAnyOfHTMLElements(nsGkAtoms::table,
+                                                nsGkAtoms::tr,
+                                                nsGkAtoms::tbody,
+                                                nsGkAtoms::td,
+                                                nsGkAtoms::li,
+                                                nsGkAtoms::blockquote,
+                                                nsGkAtoms::div) ||
+                nsHTMLEditUtils::IsList(curElement))) {
       // process any partial progress saved
       if (curBlock)
       {
         res = RemovePartOfBlock(curBlock, firstNode, lastNode);
         NS_ENSURE_SUCCESS(res, res);
         curBlock = 0;  firstNode = 0;  lastNode = 0;
       }
       // recursion time
@@ -8067,28 +8067,28 @@ nsHTMLEditRules::RemoveEmptyNodes()
       skipList[idx] = parent;
     } else {
       bool bIsCandidate = false;
       bool bIsEmptyNode = false;
       bool bIsMailCite = false;
 
       if (node->IsElement()) {
         dom::Element* element = node->AsElement();
-        if (element->IsHTML(nsGkAtoms::body)) {
+        if (element->IsHTMLElement(nsGkAtoms::body)) {
           // don't delete the body
         } else if ((bIsMailCite = nsHTMLEditUtils::IsMailCite(element))  ||
-                   element->IsHTML(nsGkAtoms::a)                         ||
+                   element->IsHTMLElement(nsGkAtoms::a)                  ||
                    nsHTMLEditUtils::IsInlineStyle(element)               ||
                    nsHTMLEditUtils::IsList(element)                      ||
-                   element->IsHTML(nsGkAtoms::div)) {
+                   element->IsHTMLElement(nsGkAtoms::div)) {
           // only consider certain nodes to be empty for purposes of removal
           bIsCandidate = true;
         } else if (nsHTMLEditUtils::IsFormatNode(element) ||
                    nsHTMLEditUtils::IsListItem(element)   ||
-                   element->IsHTML(nsGkAtoms::blockquote)) {
+                   element->IsHTMLElement(nsGkAtoms::blockquote)) {
           // these node types are candidates if selection is not in them
           // if it is one of these, don't delete if selection inside.
           // this is so we can create empty headings, etc, for the
           // user to type into.
           bool bIsSelInNode;
           res = SelectionEndpointInNode(node, &bIsSelInNode);
           NS_ENSURE_SUCCESS(res, res);
           if (!bIsSelInNode)
@@ -9002,17 +9002,17 @@ nsHTMLEditRules::RelativeChangeIndentati
                                                 value);
 
   // remove unnecessary DIV blocks:
   // we could skip this section but that would cause a FAIL in
   // editor/libeditor/tests/browserscope/richtext.html, which expects
   // to unapply a CSS "indent" (<div style="margin-left: 40px;">) by
   // removing the DIV container instead of just removing the CSS property.
   nsCOMPtr<dom::Element> node = do_QueryInterface(aNode);
-  if (!node || !node->IsHTML(nsGkAtoms::div) ||
+  if (!node || !node->IsHTMLElement(nsGkAtoms::div) ||
       !mHTMLEditor ||
       node == mHTMLEditor->GetActiveEditingHost() ||
       !mHTMLEditor->IsDescendantOfEditorRoot(node) ||
       nsHTMLEditor::HasAttributes(node)) {
     NS_ENSURE_STATE(mHTMLEditor);
     return NS_OK;
   }
 
--- a/editor/libeditor/nsHTMLEditUtils.cpp
+++ b/editor/libeditor/nsHTMLEditUtils.cpp
@@ -404,17 +404,17 @@ nsHTMLEditUtils::IsNamedAnchor(nsIDOMNod
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   return node && IsNamedAnchor(node);
 }
 
 bool
 nsHTMLEditUtils::IsNamedAnchor(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
-  if (!aNode->IsElement() || !aNode->AsElement()->IsHTML(nsGkAtoms::a)) {
+  if (!aNode->IsHTMLElement(nsGkAtoms::a)) {
     return false;
   }
 
   nsAutoString text;
   return aNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name,
                                      text) && !text.IsEmpty();
 }
 
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -1851,17 +1851,17 @@ nsHTMLEditor::GetHTMLBackgroundColorStat
     element->GetAttr(kNameSpaceID_None, nsGkAtoms::bgcolor, aOutColor);
 
     // Done if we have a color explicitly set
     if (!aOutColor.IsEmpty()) {
       return NS_OK;
     }
 
     // Once we hit the body, we're done
-    if (element->IsHTML(nsGkAtoms::body)) {
+    if (element->IsHTMLElement(nsGkAtoms::body)) {
       return NS_OK;
     }
 
     // No color is set, but we need to report visible color inherited 
     // from nested cells/tables, so search up parent chain
     element = element->GetParentElement();
   }
 
@@ -3043,20 +3043,19 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupp
   // Loop through the content iterator for each content node.
   while (!iter->IsDone()) {
     nsINode* node = iter->GetCurrentNode();
     if (node->IsElement()) {
       dom::Element* element = node->AsElement();
 
       // See if it's an image or an embed and also include all links.
       // Let mail decide which link to send or not
-      if (element->IsHTML(nsGkAtoms::img) ||
-          element->IsHTML(nsGkAtoms::embed) ||
-          element->IsHTML(nsGkAtoms::a) ||
-          (element->IsHTML(nsGkAtoms::body) &&
+      if (element->IsAnyOfHTMLElements(nsGkAtoms::img, nsGkAtoms::embed,
+                                       nsGkAtoms::a) ||
+          (element->IsHTMLElement(nsGkAtoms::body) &&
            element->HasAttr(kNameSpaceID_None, nsGkAtoms::background))) {
         nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(node);
         (*aNodeList)->AppendElement(domNode);
       }
     }
     iter->Next();
   }
 
@@ -3641,17 +3640,17 @@ void nsHTMLEditor::IsTextPropertySetByCo
 // Note: Table Editing methods are implemented in nsTableEditor.cpp
 //
 
 
 bool
 nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
 {
   nsCOMPtr<dom::Element> element = do_QueryInterface(aElement);
-  if (!element || !element->IsHTML() ||
+  if (!element || !element->IsHTMLElement() ||
       !nsHTMLEditUtils::IsTableElement(element) ||
       !IsDescendantOfEditorRoot(element)) {
     return false;
   }
 
   nsIContent* node = element;
   while (node->HasChildren()) {
     node = node->GetFirstChild();
@@ -4355,27 +4354,27 @@ nsHTMLEditor::IsEmptyNodeImpl(nsINode* a
         }
       } else {
         // An editable, non-text node. We need to check its content.
         // Is it the node we are iterating over?
         if (child == aNode) {
           break;
         }
 
-        if (aSingleBRDoesntCount && !*aSeenBR && child->IsHTML(nsGkAtoms::br)) {
+        if (aSingleBRDoesntCount && !*aSeenBR && child->IsHTMLElement(nsGkAtoms::br)) {
           // the first br in a block doesn't count if the caller so indicated
           *aSeenBR = true;
         } else {
           // is it an empty node of some sort?
           // note: list items or table cells are not considered empty
           // if they contain other lists or tables
           if (child->IsElement()) {
             if (isListItemOrCell) {
               if (nsHTMLEditUtils::IsList(child) ||
-                  child->IsHTML(nsGkAtoms::table)) {
+                  child->IsHTMLElement(nsGkAtoms::table)) {
                 // break out if we find we aren't empty
                 *outIsEmptyNode = false;
                 return NS_OK;
               }
             } else if (nsHTMLEditUtils::IsFormWidget(child)) {
               // is it a form widget?
               // break out if we find we aren't empty
               *outIsEmptyNode = false;
@@ -4742,17 +4741,17 @@ nsHTMLEditor::AreNodesSameType(nsIConten
 {
   MOZ_ASSERT(aNode1);
   MOZ_ASSERT(aNode2);
 
   if (aNode1->Tag() != aNode2->Tag()) {
     return false;
   }
 
-  if (!IsCSSEnabled() || !aNode1->IsHTML(nsGkAtoms::span)) {
+  if (!IsCSSEnabled() || !aNode1->IsHTMLElement(nsGkAtoms::span)) {
     return true;
   }
 
   // If CSS is enabled, we are stricter about span nodes.
   return mHTMLCSSUtils->ElementsSameStyle(aNode1->AsDOMNode(),
                                           aNode2->AsDOMNode());
 }
 
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -262,50 +262,55 @@ nsHTMLEditor::IsSimpleModifiableNode(nsI
   MOZ_ASSERT_IF(aAttribute, aValue);
 
   nsCOMPtr<dom::Element> element = do_QueryInterface(aContent);
   if (!element) {
     return false;
   }
 
   // First check for <b>, <i>, etc.
-  if (element->IsHTML(aProperty) && !element->GetAttrCount() &&
+  if (element->IsHTMLElement(aProperty) && !element->GetAttrCount() &&
       (!aAttribute || aAttribute->IsEmpty())) {
     return true;
   }
 
   // Special cases for various equivalencies: <strong>, <em>, <s>
   if (!element->GetAttrCount() &&
-      ((aProperty == nsGkAtoms::b && element->IsHTML(nsGkAtoms::strong)) ||
-       (aProperty == nsGkAtoms::i && element->IsHTML(nsGkAtoms::em)) ||
-       (aProperty == nsGkAtoms::strike && element->IsHTML(nsGkAtoms::s)))) {
+      ((aProperty == nsGkAtoms::b &&
+        element->IsHTMLElement(nsGkAtoms::strong)) ||
+       (aProperty == nsGkAtoms::i &&
+        element->IsHTMLElement(nsGkAtoms::em)) ||
+       (aProperty == nsGkAtoms::strike &&
+        element->IsHTMLElement(nsGkAtoms::s)))) {
     return true;
   }
 
   // Now look for things like <font>
   if (aAttribute && !aAttribute->IsEmpty()) {
     nsCOMPtr<nsIAtom> atom = do_GetAtom(*aAttribute);
     MOZ_ASSERT(atom);
 
     nsString attrValue;
-    if (element->IsHTML(aProperty) && IsOnlyAttribute(element, *aAttribute) &&
+    if (element->IsHTMLElement(aProperty) &&
+        IsOnlyAttribute(element, *aAttribute) &&
         element->GetAttr(kNameSpaceID_None, atom, attrValue) &&
         attrValue.Equals(*aValue, nsCaseInsensitiveStringComparator())) {
       // This is not quite correct, because it excludes cases like
       // <font face=000> being the same as <font face=#000000>.
       // Property-specific handling is needed (bug 760211).
       return true;
     }
   }
 
   // No luck so far.  Now we check for a <span> with a single style=""
   // attribute that sets only the style we're looking for, if this type of
   // style supports it
   if (!mHTMLCSSUtils->IsCSSEditableProperty(element, aProperty, aAttribute) ||
-      !element->IsHTML(nsGkAtoms::span) || element->GetAttrCount() != 1 ||
+      !element->IsHTMLElement(nsGkAtoms::span) ||
+      element->GetAttrCount() != 1 ||
       !element->HasAttr(kNameSpaceID_None, nsGkAtoms::style)) {
     return false;
   }
 
   // Some CSS styles are not so simple.  For instance, underline is
   // "text-decoration: underline", which decomposes into four different text-*
   // properties.  So for now, we just create a span, add the desired style, and
   // see if it matches.
@@ -470,17 +475,17 @@ nsHTMLEditor::SetInlinePropertyOnNodeImp
                  mHTMLCSSUtils->IsCSSEditableProperty(aNode, aProperty, aAttribute)) ||
                 // bgcolor is always done using CSS
                 aAttribute->EqualsLiteral("bgcolor");
 
   if (useCSS) {
     nsCOMPtr<dom::Element> tmp;
     // We only add style="" to <span>s with no attributes (bug 746515).  If we
     // don't have one, we need to make one.
-    if (aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::span) &&
+    if (aNode->IsHTMLElement(nsGkAtoms::span) &&
         !aNode->AsElement()->GetAttrCount()) {
       tmp = aNode->AsElement();
     } else {
       tmp = InsertContainerAbove(aNode, nsGkAtoms::span);
       NS_ENSURE_STATE(tmp);
     }
 
     // Add the CSS styles corresponding to the HTML style request
@@ -1716,17 +1721,17 @@ nsHTMLEditor::RelativeFontChangeHelper(i
   */
   
   // Can only change font size by + or - 1
   if (aSizeChange != 1 && aSizeChange != -1) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   // If this is a font node with size, put big/small inside it.
-  if (aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::font) &&
+  if (aNode->IsHTMLElement(nsGkAtoms::font) &&
       aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::size)) {
     // Cycle through children and adjust relative font size.
     for (uint32_t i = aNode->GetChildCount(); i--; ) {
       nsresult rv = RelativeFontChangeOnNode(aSizeChange, aNode->GetChildAt(i));
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // RelativeFontChangeOnNode already calls us recursively,
@@ -1756,19 +1761,18 @@ nsHTMLEditor::RelativeFontChangeOnNode(i
   nsIAtom* atom;
   if (aSizeChange == 1) {
     atom = nsGkAtoms::big;
   } else {
     atom = nsGkAtoms::small;
   }
   
   // Is it the opposite of what we want?
-  if (aNode->IsElement() &&
-      ((aSizeChange == 1 && aNode->AsElement()->IsHTML(nsGkAtoms::small)) ||
-       (aSizeChange == -1 && aNode->AsElement()->IsHTML(nsGkAtoms::big)))) {
+  if ((aSizeChange == 1 && aNode->IsHTMLElement(nsGkAtoms::small)) ||
+       (aSizeChange == -1 && aNode->IsHTMLElement(nsGkAtoms::big))) {
     // first populate any nested font tags that have the size attr set
     nsresult rv = RelativeFontChangeHelper(aSizeChange, aNode);
     NS_ENSURE_SUCCESS(rv, rv);
     // in that case, just remove this node and pull up the children
     return RemoveContainer(aNode);
   }
 
   // can it be put inside a "big" or "small"?
@@ -1776,23 +1780,23 @@ nsHTMLEditor::RelativeFontChangeOnNode(i
     // first populate any nested font tags that have the size attr set
     nsresult rv = RelativeFontChangeHelper(aSizeChange, aNode);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // ok, chuck it in.
     // first look at siblings of aNode for matching bigs or smalls.
     // if we find one, move aNode into it.
     nsIContent* sibling = GetPriorHTMLSibling(aNode);
-    if (sibling && sibling->IsHTML(atom)) {
+    if (sibling && sibling->IsHTMLElement(atom)) {
       // previous sib is already right kind of inline node; slide this over into it
       return MoveNode(aNode, sibling, -1);
     }
 
     sibling = GetNextHTMLSibling(aNode);
-    if (sibling && sibling->IsHTML(atom)) {
+    if (sibling && sibling->IsHTMLElement(atom)) {
       // following sib is already right kind of inline node; slide this over into it
       return MoveNode(aNode, sibling, 0);
     }
 
     // else insert it above aNode
     nsCOMPtr<Element> newElement = InsertContainerAbove(aNode, atom);
     NS_ENSURE_STATE(newElement);
 
@@ -1915,16 +1919,16 @@ nsHTMLEditor::HasStyleOrIdOrClass(dom::E
 
 nsresult
 nsHTMLEditor::RemoveElementIfNoStyleOrIdOrClass(nsIDOMNode* aElement)
 {
   nsCOMPtr<dom::Element> element = do_QueryInterface(aElement);
   NS_ENSURE_TRUE(element, NS_ERROR_NULL_POINTER);
 
   // early way out if node is not the right kind of element
-  if ((!element->IsHTML(nsGkAtoms::span) &&
-       !element->IsHTML(nsGkAtoms::font)) ||
+  if ((!element->IsHTMLElement(nsGkAtoms::span) &&
+       !element->IsHTMLElement(nsGkAtoms::font)) ||
       HasStyleOrIdOrClass(element)) {
     return NS_OK;
   }
 
   return RemoveContainer(element);
 }
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -1263,17 +1263,17 @@ nsPlaintextEditor::GetAndInitDocEncoder(
     NS_ENSURE_SUCCESS(rv, rv);
   }
   // ... or if the root element is not a body,
   // in which case we set the selection to encompass the root.
   else
   {
     dom::Element* rootElement = GetRoot();
     NS_ENSURE_TRUE(rootElement, NS_ERROR_FAILURE);
-    if (!rootElement->IsHTML(nsGkAtoms::body)) {
+    if (!rootElement->IsHTMLElement(nsGkAtoms::body)) {
       rv = docEncoder->SetNativeContainerNode(rootElement);
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   docEncoder.forget(encoder);
   return NS_OK;
 }
--- a/editor/libeditor/nsTableEditor.cpp
+++ b/editor/libeditor/nsTableEditor.cpp
@@ -3364,17 +3364,17 @@ nsHTMLEditor::IsEmptyCell(dom::Element* 
 
   nsCOMPtr<nsINode> nextChild = cellChild->GetNextSibling();
   if (nextChild) {
     return false;
   }
 
   // We insert a single break into a cell by default
   //   to have some place to locate a cursor -- it is dispensable
-  if (cellChild->IsElement() && cellChild->AsElement()->IsHTML(nsGkAtoms::br)) {
+  if (cellChild->IsHTMLElement(nsGkAtoms::br)) {
     return true;
   }
 
   bool isEmpty;
   // Or check if no real content
   nsresult rv = IsEmptyNode(cellChild, &isEmpty, false, false);
   NS_ENSURE_SUCCESS(rv, false);
   return isEmpty;
--- a/editor/libeditor/nsTextEditRules.cpp
+++ b/editor/libeditor/nsTextEditRules.cpp
@@ -1102,17 +1102,17 @@ nsTextEditRules::CreateTrailingBRIfNeede
   NS_ENSURE_STATE(mEditor);
   dom::Element* body = mEditor->GetRoot();
   NS_ENSURE_TRUE(body, NS_ERROR_NULL_POINTER);
 
   nsIContent* lastChild = body->GetLastChild();
   // assuming CreateBogusNodeIfNeeded() has been called first
   NS_ENSURE_TRUE(lastChild, NS_ERROR_NULL_POINTER);
 
-  if (!lastChild->IsHTML(nsGkAtoms::br)) {
+  if (!lastChild->IsHTMLElement(nsGkAtoms::br)) {
     nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
     nsCOMPtr<nsIDOMNode> domBody = do_QueryInterface(body);
     return CreateMozBR(domBody, body->Length());
   }
 
   // Check to see if the trailing BR is a former bogus node - this will have
   // stuck around if we previously morphed a trailing node into a bogus node.
   if (!mEditor->IsMozEditorBogusNode(lastChild)) {
--- a/editor/libeditor/nsTextEditUtils.cpp
+++ b/editor/libeditor/nsTextEditUtils.cpp
@@ -39,17 +39,17 @@ nsTextEditUtils::IsBreak(nsIDOMNode *nod
 {
   return nsEditor::NodeIsType(node, nsGkAtoms::br);
 }
  
 bool 
 nsTextEditUtils::IsBreak(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
-  return aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::br);
+  return aNode->IsHTMLElement(nsGkAtoms::br);
 }
 
 
 ///////////////////////////////////////////////////////////////////////////
 // IsMozBR: true if node an html br node with type = _moz
 //                  
 bool 
 nsTextEditUtils::IsMozBR(nsIDOMNode *node)
@@ -58,18 +58,17 @@ nsTextEditUtils::IsMozBR(nsIDOMNode *nod
   return IsBreak(node) && HasMozAttr(node);
 }
 
 
 bool
 nsTextEditUtils::IsMozBR(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
-  return aNode->IsElement() &&
-         aNode->AsElement()->IsHTML(nsGkAtoms::br) &&
+  return aNode->IsHTMLElement(nsGkAtoms::br) &&
          aNode->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                          NS_LITERAL_STRING("_moz"),
                                          eIgnoreCase);
 }
 
 ///////////////////////////////////////////////////////////////////////////
 // HasMozAttr: true if node has type attribute = _moz
 //             (used to indicate the div's and br's we use in
--- a/embedding/browser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/nsDocShellTreeOwner.cpp
@@ -997,17 +997,17 @@ DefaultTooltipTextProvider::DefaultToolt
 // A helper routine that determines whether we're still interested
 // in SVG titles. We need to stop at the SVG root element that
 // has a document node parent
 //
 static bool
 UseSVGTitle(nsIDOMElement *currElement)
 {
   nsCOMPtr<dom::Element> element(do_QueryInterface(currElement));
-  if (!element || !element->IsSVG() || !element->GetParentNode())
+  if (!element || !element->IsSVGElement() || !element->GetParentNode())
     return false;
 
   return element->GetParentNode()->NodeType() != nsIDOMNode::DOCUMENT_NODE;
 }
 
 /* void getNodeText(in nsIDOMNode aNode, out wstring aText); */
 NS_IMETHODIMP
 DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, char16_t **aText,
@@ -1074,17 +1074,17 @@ DefaultTooltipTextProvider::GetNodeText(
               if (lookingForSVGTitle) {
                 lookingForSVGTitle = UseSVGTitle(currElement);
               }
               if (lookingForSVGTitle) {
                 nsINodeList* childNodes = node->ChildNodes();
                 uint32_t childNodeCount = childNodes->Length();
                 for (uint32_t i = 0; i < childNodeCount; i++) {
                   nsIContent* child = childNodes->Item(i);
-                  if (child->IsSVG(nsGkAtoms::title)) {
+                  if (child->IsSVGElement(nsGkAtoms::title)) {
                     static_cast<dom::SVGTitleElement*>(child)->GetTextContent(outText);
                     if (outText.Length())
                       found = true;
                     break;
                   }
                 }
               }
             }
--- a/embedding/components/find/nsFind.cpp
+++ b/embedding/components/find/nsFind.cpp
@@ -732,17 +732,17 @@ nsFind::NextNode(nsIDOMRange* aSearchRan
 #ifdef DEBUG_FIND
   printf("Iterator gave: "); DumpNode(mIterNode);
 #endif
   return NS_OK;
 }
 
 bool nsFind::IsBlockNode(nsIContent* aContent)
 {
-  if (!aContent->IsHTML()) {
+  if (!aContent->IsHTMLElement()) {
     return false;
   }
 
   nsIAtom *atom = aContent->Tag();
 
   if (atom == nsGkAtoms::img ||
       atom == nsGkAtoms::hr ||
       atom == nsGkAtoms::th ||
@@ -781,34 +781,34 @@ bool nsFind::SkipNode(nsIContent* aConte
   nsIAtom *atom;
 
 #ifdef HAVE_BIDI_ITERATOR
   atom = aContent->Tag();
 
   // We may not need to skip comment nodes,
   // now that IsTextNode distinguishes them from real text nodes.
   return (aContent->IsNodeOfType(nsINode::eCOMMENT) ||
-          (aContent->IsHTML() &&
+          (aContent->IsHTMLElement() &&
            (atom == sScriptAtom ||
             atom == sNoframesAtom ||
             atom == sSelectAtom)));
 
 #else /* HAVE_BIDI_ITERATOR */
   // Temporary: eventually we will have an iterator to do this,
   // but for now, we have to climb up the tree for each node
   // and see whether any parent is a skipped node,
   // and take the performance hit.
 
   nsIContent *content = aContent;
   while (content)
   {
     atom = content->Tag();
 
     if (aContent->IsNodeOfType(nsINode::eCOMMENT) ||
-        (content->IsHTML() &&
+        (content->IsHTMLElement() &&
          (atom == nsGkAtoms::script ||
           atom == nsGkAtoms::noframes ||
           atom == nsGkAtoms::select)))
     {
 #ifdef DEBUG_FIND
       printf("Skipping node: ");
       nsCOMPtr<nsIDOMNode> node (do_QueryInterface(content));
       DumpNode(node);
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -2641,17 +2641,17 @@ nsresult nsWebBrowserPersist::OnWalkDOMN
     // Test the node to see if it's an image, frame, iframe, css, js
     nsCOMPtr<nsIDOMHTMLImageElement> nodeAsImage = do_QueryInterface(aNode);
     if (nodeAsImage)
     {
         StoreURIAttribute(aNode, "src");
         return NS_OK;
     }
 
-    if (content->IsSVG(nsGkAtoms::img))
+    if (content->IsSVGElement(nsGkAtoms::img))
     {
         StoreURIAttributeNS(aNode, "http://www.w3.org/1999/xlink", "href");
         return NS_OK;
     }
 
     nsCOMPtr<nsIDOMHTMLMediaElement> nodeAsMedia = do_QueryInterface(aNode);
     if (nodeAsMedia)
     {
@@ -2660,44 +2660,44 @@ nsresult nsWebBrowserPersist::OnWalkDOMN
     }
     nsCOMPtr<nsIDOMHTMLSourceElement> nodeAsSource = do_QueryInterface(aNode);
     if (nodeAsSource)
     {
         StoreURIAttribute(aNode, "src");
         return NS_OK;
     }
 
-    if (content->IsHTML(nsGkAtoms::body)) {
+    if (content->IsHTMLElement(nsGkAtoms::body)) {
         StoreURIAttribute(aNode, "background");
         return NS_OK;
     }
 
-    if (content->IsHTML(nsGkAtoms::table)) {
+    if (content->IsHTMLElement(nsGkAtoms::table)) {
         StoreURIAttribute(aNode, "background");
         return NS_OK;
     }
 
-    if (content->IsHTML(nsGkAtoms::tr)) {
+    if (content->IsHTMLElement(nsGkAtoms::tr)) {
         StoreURIAttribute(aNode, "background");
         return NS_OK;
     }
 
-    if (content->IsHTML(nsGkAtoms::td) || content->IsHTML(nsGkAtoms::th)) {
+    if (content->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th)) {
         StoreURIAttribute(aNode, "background");
         return NS_OK;
     }
 
     nsCOMPtr<nsIDOMHTMLScriptElement> nodeAsScript = do_QueryInterface(aNode);
     if (nodeAsScript)
     {
         StoreURIAttribute(aNode, "src");
         return NS_OK;
     }
 
-    if (content->IsSVG(nsGkAtoms::script))
+    if (content->IsSVGElement(nsGkAtoms::script))
     {
         StoreURIAttributeNS(aNode, "http://www.w3.org/1999/xlink", "href");
         return NS_OK;
     }
 
     nsCOMPtr<nsIDOMHTMLEmbedElement> nodeAsEmbed = do_QueryInterface(aNode);
     if (nodeAsEmbed)
     {
@@ -2943,44 +2943,44 @@ nsWebBrowserPersist::CloneNodeWithFixedU
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupAnchor(*aNodeOut);
         }
         return rv;
     }
 
-    if (content->IsHTML(nsGkAtoms::body)) {
+    if (content->IsHTMLElement(nsGkAtoms::body)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "background");
         }
         return rv;
     }
 
-    if (content->IsHTML(nsGkAtoms::table)) {
+    if (content->IsHTMLElement(nsGkAtoms::table)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "background");
         }
         return rv;
     }
 
-    if (content->IsHTML(nsGkAtoms::tr)) {
+    if (content->IsHTMLElement(nsGkAtoms::tr)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "background");
         }
         return rv;
     }
 
-    if (content->IsHTML(nsGkAtoms::td) || content->IsHTML(nsGkAtoms::th)) {
+    if (content->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "background");
         }
         return rv;
     }
 
@@ -3021,17 +3021,17 @@ nsWebBrowserPersist::CloneNodeWithFixedU
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "src");
         }
 
         return rv;
     }
 
-    if (content->IsSVG(nsGkAtoms::img))
+    if (content->IsSVGElement(nsGkAtoms::img))
     {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             // Disable image loads
             nsCOMPtr<nsIImageLoadingContent> imgCon =
                 do_QueryInterface(*aNodeOut);
             if (imgCon)
@@ -3049,17 +3049,17 @@ nsWebBrowserPersist::CloneNodeWithFixedU
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "src");
         }
         return rv;
     }
 
-    if (content->IsSVG(nsGkAtoms::script))
+    if (content->IsSVGElement(nsGkAtoms::script))
     {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttributeNS(*aNodeOut, "http://www.w3.org/1999/xlink", "href");
         }
         return rv;
     }
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -1232,24 +1232,24 @@ mozInlineSpellChecker::ShouldSpellCheckN
 
   nsIContent *content = aNode->AsContent();
 
   uint32_t flags;
   aEditor->GetFlags(&flags);
   if (flags & nsIPlaintextEditor::eEditorMailMask) {
     nsIContent *parent = content->GetParent();
     while (parent) {
-      if (parent->IsHTML(nsGkAtoms::blockquote) &&
+      if (parent->IsHTMLElement(nsGkAtoms::blockquote) &&
           parent->AttrValueIs(kNameSpaceID_None,
                               nsGkAtoms::type,
                               nsGkAtoms::cite,
                               eIgnoreCase)) {
         return false;
       }
-      if (parent->IsHTML(nsGkAtoms::pre) &&
+      if (parent->IsHTMLElement(nsGkAtoms::pre) &&
           parent->AttrValueIs(kNameSpaceID_None,
                               nsGkAtoms::_class,
                               nsGkAtoms::mozsignature,
                               eIgnoreCase)) {
         return false;
       }
 
       parent = parent->GetParent();
@@ -1273,17 +1273,17 @@ mozInlineSpellChecker::ShouldSpellCheckN
       if (textControl) {
         return true;
       }
     }
 
     // Get HTML element ancestor (might be aNode itself, although probably that
     // has to be a text node in real life here)
     nsIContent *parent = content;
-    while (!parent->IsHTML()) {
+    while (!parent->IsHTMLElement()) {
       parent = parent->GetParent();
       if (!parent) {
         return true;
       }
     }
 
     // See if it's spellcheckable
     return static_cast<nsGenericHTMLElement *>(parent)->Spellcheck();
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -361,18 +361,17 @@ IsDOMWordSeparator(char16_t ch)
 
   // otherwise not a space
   return false;
 }
 
 static inline bool
 IsBRElement(nsINode* aNode)
 {
-  return aNode->IsElement() &&
-         aNode->AsElement()->IsHTML(nsGkAtoms::br);
+  return aNode->IsHTMLElement(nsGkAtoms::br);
 }
 
 /**
  * Given a TextNode, checks to see if there's a DOM word separator before
  * aBeforeOffset within it. This function does not modify aSeparatorOffset when
  * it returns false.
  *
  * @param aNode the TextNode to check.
@@ -437,17 +436,17 @@ static bool
 IsBreakElement(nsINode* aNode)
 {
   if (!aNode->IsElement()) {
     return false;
   }
 
   dom::Element *element = aNode->AsElement();
     
-  if (element->IsHTML(nsGkAtoms::br))
+  if (element->IsHTMLElement(nsGkAtoms::br))
     return true;
 
   // If we don't have a frame, we don't consider ourselves a break
   // element.  In particular, words can span us.
   if (!element->GetPrimaryFrame())
     return false;
 
   // Anything that's not an inline element is a break element.
--- a/image/src/SVGDocumentWrapper.cpp
+++ b/image/src/SVGDocumentWrapper.cpp
@@ -405,17 +405,17 @@ SVGDocumentWrapper::GetRootSVGElem()
   if (!mViewer)
     return nullptr; // Can happen during destruction
 
   nsIDocument* doc = mViewer->GetDocument();
   if (!doc)
     return nullptr; // Can happen during destruction
 
   Element* rootElem = mViewer->GetDocument()->GetRootElement();
-  if (!rootElem || !rootElem->IsSVG(nsGkAtoms::svg)) {
+  if (!rootElem || !rootElem->IsSVGElement(nsGkAtoms::svg)) {
     return nullptr;
   }
 
   return static_cast<SVGSVGElement*>(rootElem);
 }
 
 } // namespace image
 } // namespace mozilla
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -175,23 +175,23 @@ HasTouchListener(nsIContent* aContent)
 static bool
 IsElementClickable(nsIFrame* aFrame, nsIAtom* stopAt = nullptr)
 {
   // Input events propagate up the content tree so we'll follow the content
   // ancestors to look for elements accepting the click.
   for (nsIContent* content = aFrame->GetContent(); content;
        content = content->GetFlattenedTreeParent()) {
     nsIAtom* tag = content->Tag();
-    if (content->IsHTML() && stopAt && tag == stopAt) {
+    if (content->IsHTMLElement() && stopAt && tag == stopAt) {
       break;
     }
     if (HasTouchListener(content) || HasMouseListener(content)) {
       return true;
     }
-    if (content->IsHTML()) {
+    if (content->IsHTMLElement()) {
       if (tag == nsGkAtoms::button ||
           tag == nsGkAtoms::input ||
           tag == nsGkAtoms::select ||
           tag == nsGkAtoms::textarea ||
           tag == nsGkAtoms::label) {
         return true;
       }
       // Bug 921928: we don't have access to the content of remote iframe.
@@ -199,17 +199,17 @@ IsElementClickable(nsIFrame* aFrame, nsI
       // that the content of the remote iframe needs to be a target.
       if (tag == nsGkAtoms::iframe &&
           content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozbrowser,
                                nsGkAtoms::_true, eIgnoreCase) &&
           content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
                                nsGkAtoms::_true, eIgnoreCase)) {
         return true;
       }
-    } else if (content->IsXUL()) {
+    } else if (content->IsXULElement()) {
       nsIAtom* tag = content->Tag();
       // See nsCSSFrameConstructor::FindXULTagData. This code is not
       // really intended to be used with XUL, though.
       if (tag == nsGkAtoms::button ||
           tag == nsGkAtoms::checkbox ||
           tag == nsGkAtoms::radio ||
           tag == nsGkAtoms::autorepeatbutton ||
           tag == nsGkAtoms::menu ||
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -262,17 +262,17 @@ DoApplyRenderingChangeToTree(nsIFrame* a
           !(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
         // Need to update our overflow rects:
         nsSVGUtils::ScheduleReflowSVG(aFrame);
       }
     }
     if (aChange & nsChangeHint_UpdateTextPath) {
       if (aFrame->IsSVGText()) {
         // Invalidate and reflow the entire SVGTextFrame:
-        NS_ASSERTION(aFrame->GetContent()->IsSVG(nsGkAtoms::textPath),
+        NS_ASSERTION(aFrame->GetContent()->IsSVGElement(nsGkAtoms::textPath),
                      "expected frame for a <textPath> element");
         nsIFrame* text = nsLayoutUtils::GetClosestFrameOfType(
                                                       aFrame,
                                                       nsGkAtoms::svgTextFrame);
         NS_ASSERTION(text, "expected to find an ancestor SVGTextFrame");
         static_cast<SVGTextFrame*>(text)->NotifyGlyphMetricsChange();
       } else {
         MOZ_ASSERT(false, "unexpected frame got nsChangeHint_UpdateTextPath");
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -88,17 +88,17 @@ struct BidiParagraphData {
        *
        * We also use logical order in XUL elements, since we expect that if a
        * XUL element appears in a visual page, it will be generated by an XBL
        * binding and contain localized text which will be in logical order.
        */
       for (nsIContent* content = aBlockFrame->GetContent() ; content; 
            content = content->GetParent()) {
         if (content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) ||
-            content->IsXUL()) {
+            content->IsXULElement()) {
           mIsVisual = false;
           break;
         }
       }
     }
   }
 
   BidiParagraphData* GetSubParagraph()
@@ -1143,17 +1143,17 @@ nsBidiPresUtils::TraverseFrames(nsBlockF
         aBpd->AppendUnichar(kLineSeparator);
         ResolveParagraphWithinBlock(aBlockFrame, aBpd);
       } else { 
         // other frame type -- see the Unicode Bidi Algorithm:
         // "...inline objects (such as graphics) are treated as if they are ...
         // U+FFFC"
         // <wbr>, however, is treated as U+200B ZERO WIDTH SPACE. See
         // http://dev.w3.org/html5/spec/Overview.html#phrasing-content-1
-        aBpd->AppendUnichar(content->IsHTML(nsGkAtoms::wbr) ?
+        aBpd->AppendUnichar(content->IsHTMLElement(nsGkAtoms::wbr) ?
                             kZWSP : kObjectSubstitute);
         if (!frame->IsInlineOutside()) {
           // if it is not inline, end the paragraph
           ResolveParagraphWithinBlock(aBlockFrame, aBpd);
         }
       }
     } else {
       // For a non-leaf frame, recurse into TraverseFrames
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1616,24 +1616,24 @@ nsCSSFrameConstructor::CreateGeneratedCo
       int32_t barIndex = contentString.FindChar('|'); // CSS namespace delimiter
       if (-1 != barIndex) {
         nsAutoString  nameSpaceVal;
         contentString.Left(nameSpaceVal, barIndex);
         nsresult error;
         attrNameSpace = nameSpaceVal.ToInteger(&error);
         contentString.Cut(0, barIndex + 1);
         if (contentString.Length()) {
-          if (mDocument->IsHTML() && aParentContent->IsHTML()) {
+          if (mDocument->IsHTMLDocument() && aParentContent->IsHTMLElement()) {
             ToLowerCase(contentString);
           }
           attrName = do_GetAtom(contentString);
         }
       }
       else {
-        if (mDocument->IsHTML() && aParentContent->IsHTML()) {
+        if (mDocument->IsHTMLDocument() && aParentContent->IsHTMLElement()) {
           ToLowerCase(contentString);
         }
         attrName = do_GetAtom(contentString);
       }
 
       if (!attrName) {
         return nullptr;
       }
@@ -1691,17 +1691,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
       // detect that and do the right thing here?
       if (aParentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::alt)) {
         nsCOMPtr<nsIContent> content;
         NS_NewAttributeContent(mDocument->NodeInfoManager(),
                                kNameSpaceID_None, nsGkAtoms::alt, getter_AddRefs(content));
         return content.forget();
       }
 
-      if (aParentContent->IsHTML() &&
+      if (aParentContent->IsHTMLElement() &&
           aParentContent->NodeInfo()->Equals(nsGkAtoms::input)) {
         if (aParentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
           nsCOMPtr<nsIContent> content;
           NS_NewAttributeContent(mDocument->NodeInfoManager(),
                                  kNameSpaceID_None, nsGkAtoms::value, getter_AddRefs(content));
           return content.forget();
         }
 
@@ -2356,17 +2356,17 @@ nsCSSFrameConstructor::PropagateScrollTo
 
   // Don't look in the BODY for non-HTML documents or HTML documents
   // with non-HTML roots
   // XXX this should be earlier; we shouldn't even look at the document root
   // for non-HTML documents. Fix this once we support explicit CSS styling
   // of the viewport
   // XXX what about XHTML?
   nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(mDocument));
-  if (!htmlDoc || !docElement->IsHTML()) {
+  if (!htmlDoc || !docElement->IsHTMLElement()) {
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMHTMLElement> body;
   htmlDoc->GetBody(getter_AddRefs(body));
   nsCOMPtr<nsIContent> bodyElement = do_QueryInterface(body);
 
   if (!bodyElement ||
@@ -2514,26 +2514,26 @@ nsCSSFrameConstructor::ConstructDocEleme
   // contentFrame is the out-of-flow frame and newFrame is the
   // placeholder.
   nsContainerFrame* contentFrame;
   nsIFrame* newFrame;
   bool processChildren = false;
 
   // Check whether we need to build a XUL box or SVG root frame
 #ifdef MOZ_XUL
-  if (aDocElement->IsXUL()) {
+  if (aDocElement->IsXULElement()) {
     contentFrame = NS_NewDocElementBoxFrame(mPresShell, styleContext);
     InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
                         contentFrame);
     newFrame = contentFrame;
     processChildren = true;
   }
   else
 #endif
-  if (aDocElement->IsSVG()) {
+  if (aDocElement->IsSVGElement()) {
     if (aDocElement->Tag() != nsGkAtoms::svg) {
       return nullptr;
     }
     // We're going to call the right function ourselves, so no need to give a
     // function to this FrameConstructionData.
 
     // XXXbz on the other hand, if we converted this whole function to
     // FrameConstructionData/Item, then we'd need the right function
@@ -2772,17 +2772,17 @@ nsCSSFrameConstructor::SetUpDocElementCo
   nsContainerFrame* viewportFrame = static_cast<nsContainerFrame*>(GetRootFrame());
   nsStyleContext* viewportPseudoStyle = viewportFrame->StyleContext();
 
   nsContainerFrame* rootFrame = nullptr;
   nsIAtom* rootPseudo;
 
   if (!isPaginated) {
 #ifdef MOZ_XUL
-    if (aDocElement->IsXUL())
+    if (aDocElement->IsXULElement())
     {
       // pass a temporary stylecontext, the correct one will be set later
       rootFrame = NS_NewRootBoxFrame(mPresShell, viewportPseudoStyle);
     } else
 #endif
     {
       // pass a temporary stylecontext, the correct one will be set later
       rootFrame = NS_NewCanvasFrame(mPresShell, viewportPseudoStyle);
@@ -2801,21 +2801,21 @@ nsCSSFrameConstructor::SetUpDocElementCo
 
   // --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
 
   // If the device supports scrolling (e.g., in galley mode on the screen and
   // for print-preview, but not when printing), then create a scroll frame that
   // will act as the scrolling mechanism for the viewport.
   // XXX Do we even need a viewport when printing to a printer?
 
-  bool isHTML = aDocElement->IsHTML();
+  bool isHTML = aDocElement->IsHTMLElement();
   bool isXUL = false;
 
   if (!isHTML) {
-    isXUL = aDocElement->IsXUL();
+    isXUL = aDocElement->IsXULElement();
   }
 
   // Never create scrollbars for XUL documents
   bool isScrollable = isPaginated ? presContext->HasPaginatedScrolling() : !isXUL;
 
   // We no longer need to do overflow propagation here. It's taken care of
   // when we construct frames for the element whose overflow might be
   // propagated
@@ -3461,17 +3461,17 @@ nsCSSFrameConstructor::FindHTMLData(Elem
                aParentFrame->StyleContext()->GetPseudo() !=
                  nsCSSAnonBoxes::fieldsetContent ||
                aParentFrame->GetParent()->GetType() == nsGkAtoms::fieldSetFrame,
                "Unexpected parent for fieldset content anon box");
   if (aTag == nsGkAtoms::legend &&
       (!aParentFrame ||
        !IsFrameForFieldSet(aParentFrame, aParentFrame->GetType()) ||
        !aElement->GetParent() ||
-       !aElement->GetParent()->IsHTML(nsGkAtoms::fieldset) ||
+       !aElement->GetParent()->IsHTMLElement(nsGkAtoms::fieldset) ||
        aStyleContext->StyleDisplay()->IsFloatingStyle() ||
        aStyleContext->StyleDisplay()->IsAbsolutelyPositionedStyle())) {
     // <legend> is only special inside fieldset, check both the frame tree
     // parent and content tree parent due to XBL issues. For floated or
     // absolutely positioned legends we want to construct by display type and
     // not do special legend stuff.
     // XXXbz it would be nice if we could just decide this based on the parent
     // tag, and hence just use a SIMPLE_TAG_CHAIN for legend below, but the
@@ -3684,17 +3684,17 @@ nsCSSFrameConstructor::ConstructFrameFro
 #undef CHECK_ONLY_ONE_BIT
   NS_ASSERTION(!(bits & FCDATA_FORCED_NON_SCROLLABLE_BLOCK) ||
                ((bits & FCDATA_FUNC_IS_FULL_CTOR) &&
                 data->mFullConstructor ==
                   &nsCSSFrameConstructor::ConstructNonScrollableBlock),
                "Unexpected FCDATA_FORCED_NON_SCROLLABLE_BLOCK flag");
 
   // Don't create a subdocument frame for iframes if we're creating extra frames
-  if (aState.mCreatingExtraFrames && aItem.mContent->IsHTML() &&
+  if (aState.mCreatingExtraFrames && aItem.mContent->IsHTMLElement() &&
       aItem.mContent->Tag() == nsGkAtoms::iframe)
   {
     return;
   }
 
   nsIContent* const content = aItem.mContent;
   nsIContent* parent = content->GetParent();
 
@@ -4511,17 +4511,17 @@ nsCSSFrameConstructor::FindDisplayData(c
 
   // If this is "body", try propagating its scroll style to the viewport
   // Note that we need to do this even if the body is NOT scrollable;
   // it might have dynamically changed from scrollable to not scrollable,
   // and that might need to be propagated.
   // XXXbz is this the right place to do this?  If this code moves,
   // make this function static.
   bool propagatedScrollToViewport = false;
-  if (aElement->IsHTML(nsGkAtoms::body)) {
+  if (aElement->IsHTMLElement(nsGkAtoms::body)) {
     propagatedScrollToViewport =
       PropagateScrollToViewport() == aElement;
   }
 
   NS_ASSERTION(!propagatedScrollToViewport ||
                !mPresShell->GetPresContext()->IsPaginated(),
                "Shouldn't propagate scroll in paginated contexts");
 
@@ -5513,21 +5513,21 @@ nsCSSFrameConstructor::AddFrameConstruct
   // never create frames for non-option/optgroup kids of <select> and
   // non-option kids of <optgroup> inside a <select>.
   // XXXbz it's not clear how this should best work with XBL.
   nsIContent *parent = aContent->GetParent();
   if (parent) {
     // Check tag first, since that check will usually fail
     nsIAtom* parentTag = parent->Tag();
     if ((parentTag == nsGkAtoms::select || parentTag == nsGkAtoms::optgroup) &&
-        parent->IsHTML() &&
+        parent->IsHTMLElement() &&
         // <option> is ok no matter what
-        !aContent->IsHTML(nsGkAtoms::option) &&
+        !aContent->IsHTMLElement(nsGkAtoms::option) &&
         // <optgroup> is OK in <select> but not in <optgroup>
-        (!aContent->IsHTML(nsGkAtoms::optgroup) ||
+        (!aContent->IsHTMLElement(nsGkAtoms::optgroup) ||
          parentTag != nsGkAtoms::select) &&
         // Allow native anonymous content no matter what
         !aContent->IsRootOfNativeAnonymousSubtree()) {
       // No frame for aContent
       if (!isText) {
         SetAsUndisplayedContent(aState, aItems, aContent, styleContext,
                                 isGeneratedContent);
       }
@@ -6359,17 +6359,17 @@ nsCSSFrameConstructor::IsValidSibling(ns
   }
 
   if (IsFrameForFieldSet(parentFrame, parentType)) {
     // Legends can be sibling of legends but not of other content in the fieldset
     if (nsContainerFrame* cif = aSibling->GetContentInsertionFrame()) {
       aSibling = cif;
     }
     nsIAtom* sibType = aSibling->GetType();
-    bool legendContent = aContent->IsHTML(nsGkAtoms::legend);
+    bool legendContent = aContent->IsHTMLElement(nsGkAtoms::legend);
 
     if ((legendContent  && (nsGkAtoms::legendFrame != sibType)) ||
         (!legendContent && (nsGkAtoms::legendFrame == sibType)))
       return false;
   }
 
   return true;
 }
@@ -6493,17 +6493,17 @@ GetAdjustedParentFrame(nsContainerFrame*
   NS_PRECONDITION(nsGkAtoms::tableOuterFrame != aParentFrameType,
                   "Shouldn't be happening!");
 
   nsContainerFrame* newParent = nullptr;
 
   if (nsGkAtoms::fieldSetFrame == aParentFrameType) {
     // If the parent is a fieldSet, use the fieldSet's area frame as the
     // parent unless the new content is a legend.
-    if (!aChildContent->IsHTML(nsGkAtoms::legend)) {
+    if (!aChildContent->IsHTMLElement(nsGkAtoms::legend)) {
       newParent = GetFieldSetBlockFrame(aParentFrame);
     }
   }
   return newParent ? newParent : aParentFrame;
 }
 
 nsIFrame*
 nsCSSFrameConstructor::GetInsertionPrevSibling(InsertionPoint* aInsertion,
@@ -6643,42 +6643,42 @@ nsCSSFrameConstructor::GetContentInserti
 
   return insertionFrame;
 }
 
 static bool
 IsSpecialFramesetChild(nsIContent* aContent)
 {
   // IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init.
-  return aContent->IsHTML() &&
+  return aContent->IsHTMLElement() &&
     (aContent->Tag() == nsGkAtoms::frameset ||
      aContent->Tag() == nsGkAtoms::frame);
 }
 
 static void
 InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node);
 
 #ifdef MOZ_XUL
 
 static
 bool
 IsXULListBox(nsIContent* aContainer)
 {
-  return (aContainer->IsXUL() && aContainer->Tag() == nsGkAtoms::listbox);
+  return (aContainer->IsXULElement(nsGkAtoms::listbox));
 }
 
 static
 nsListBoxBodyFrame*
 MaybeGetListBoxBodyFrame(nsIContent* aContainer, nsIContent* aChild)
 {
   if (!aContainer)
     return nullptr;
 
   if (IsXULListBox(aContainer) &&
-      aChild->IsXUL() && aChild->Tag() == nsGkAtoms::listitem) {
+      aChild->IsXULElement(nsGkAtoms::listitem)) {
     nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(aContainer);
     nsCOMPtr<nsIBoxObject> boxObject;
     xulElement->GetBoxObject(getter_AddRefs(boxObject));
     nsCOMPtr<nsPIListBoxObject> listBoxObject = do_QueryInterface(boxObject);
     if (listBoxObject) {
       return listBoxObject->GetListBoxBody(false);
     }
   }
@@ -6726,34 +6726,34 @@ nsCSSFrameConstructor::ReframeTextIfNeed
 // For inserts aChild should be valid, for appends it should be null.
 // Returns true if this operation can be lazy, false if not.
 bool
 nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
                                             nsIContent* aContainer,
                                             nsIContent* aChild)
 {
   if (mPresShell->GetPresContext()->IsChrome() || !aContainer ||
-      aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXUL()) {
+      aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXULElement()) {
     return false;
   }
 
   if (aOperation == CONTENTINSERT) {
     if (aChild->IsRootOfAnonymousSubtree() ||
         (aChild->HasFlag(NODE_IS_IN_SHADOW_TREE) &&
          !aChild->IsInNativeAnonymousSubtree()) ||
-        aChild->IsEditable() || aChild->IsXUL()) {
+        aChild->IsEditable() || aChild->IsXULElement()) {
       return false;
     }
   } else { // CONTENTAPPEND
     NS_ASSERTION(aOperation == CONTENTAPPEND,
                  "operation should be either insert or append");
     for (nsIContent* child = aChild; child; child = child->GetNextSibling()) {
       NS_ASSERTION(!child->IsRootOfAnonymousSubtree(),
                    "Should be coming through the CONTENTAPPEND case");
-      if (child->IsXUL() || child->IsEditable()) {
+      if (child->IsXULElement() || child->IsEditable()) {
         return false;
       }
     }
   }
 
   // We can construct lazily; just need to set suitable bits in the content
   // tree.
 
@@ -8279,17 +8279,17 @@ InvalidateCanvasIfNeeded(nsIPresShell* p
     nsIContent* grandParent = parent->GetParent();
     if (grandParent) {
       // Has a grandparent, so not what we want
       return;
     }
 
     // Check whether it's an HTML body
     if (node->Tag() != nsGkAtoms::body ||
-        !node->IsHTML()) {
+        !node->IsHTMLElement()) {
       return;
     }
   }
 
   // At this point the node has no parent or it's an HTML <body> child of the
   // root.  We might not need to invalidate in this case (eg we might be in
   // XHTML or something), but chances are we want to.  Play it safe.
   // Invalidate the viewport.
@@ -8906,17 +8906,17 @@ nsCSSFrameConstructor::GetInsertionPoint
 
   if (!insertionElement) {
     insertionElement = aContainer;
   }
   InsertionPoint insertion(GetContentInsertionFrameFor(insertionElement),
                            insertionElement);
 
   // Fieldsets have multiple insertion points.
-  if (insertionElement->IsHTML(nsGkAtoms::fieldset)) {
+  if (insertionElement->IsHTMLElement(nsGkAtoms::fieldset)) {
     insertion.mMultiple = true;
   }
 
   return insertion;
 }
 
 // Capture state for the frame tree rooted at the frame associated with the
 // content object, aContent
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -6073,17 +6073,17 @@ already_AddRefed<Layer>
 nsDisplaySVGEffects::BuildLayer(nsDisplayListBuilder* aBuilder,
                                 LayerManager* aManager,
                                 const ContainerLayerParameters& aContainerParameters)
 {
   const nsIContent* content = mFrame->GetContent();
   bool hasSVGLayout = (mFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT);
   if (hasSVGLayout) {
     nsISVGChildFrame *svgChildFrame = do_QueryFrame(mFrame);
-    if (!svgChildFrame || !mFrame->GetContent()->IsSVG()) {
+    if (!svgChildFrame || !mFrame->GetContent()->IsSVGElement()) {
       NS_ASSERTION(false, "why?");
       return nullptr;
     }
     if (!static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
       return nullptr; // The SVG spec says not to draw filters for this
     }
   }
 
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -964,17 +964,17 @@ nsDocumentViewer::LoadComplete(nsresult 
     // onload to the document content since that would likely confuse scripts
     // on the page.
 
     nsIDocShell *docShell = window->GetDocShell();
     NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
 
     docShell->GetRestoringDocument(&restoring);
     if (!restoring) {
-      NS_ASSERTION(mDocument->IsXUL() || // readyState for XUL is bogus
+      NS_ASSERTION(mDocument->IsXULDocument() || // readyState for XUL is bogus
                    mDocument->GetReadyStateEnum() ==
                      nsIDocument::READYSTATE_INTERACTIVE ||
                    // test_stricttransportsecurity.html has old-style
                    // docshell-generated about:blank docs reach this code!
                    (mDocument->GetReadyStateEnum() ==
                       nsIDocument::READYSTATE_UNINITIALIZED &&
                     NS_IsAboutBlank(mDocument->GetDocumentURI())),
                    "Bad readystate");
@@ -2190,17 +2190,17 @@ nsDocumentViewer::CreateStyleSet(nsIDocu
   // different sets for different media
   nsStyleSet *styleSet = new nsStyleSet();
 
   styleSet->BeginUpdate();
   
   // The document will fill in the document sheets when we create the presshell
 
   if (aDocument->IsBeingUsedAsImage()) {
-    MOZ_ASSERT(aDocument->IsSVG(),
+    MOZ_ASSERT(aDocument->IsSVGDocument(),
                "Do we want to skip most sheets for this new image type?");
 
     // SVG-as-an-image must be kept as light and small as possible. We
     // deliberately skip loading everything and leave svg.css (and html.css and
     // xul.css) to be loaded on-demand.
     // XXXjwatt Nothing else is loaded on-demand, but I don't think that
     // should matter for SVG-as-an-image. If it does, I want to know why!
 
@@ -2270,17 +2270,17 @@ nsDocumentViewer::CreateStyleSet(nsIDocu
     }
   }
 
   sheet = nsLayoutStylesheetCache::FullScreenOverrideSheet();
   if (sheet) {
     styleSet->PrependStyleSheet(nsStyleSet::eOverrideSheet, sheet);
   }
 
-  if (!aDocument->IsSVG()) {
+  if (!aDocument->IsSVGDocument()) {
     // !!! IMPORTANT - KEEP THIS BLOCK IN SYNC WITH
     // !!! SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded.
 
     // SVGForeignObjectElement::BindToTree calls SVGDocument::
     // EnsureNonSVGUserAgentStyleSheetsLoaded to loads these UA sheet
     // on-demand. (Excluding the quirks sheet, which should never be loaded for
     // an SVG document, and excluding xul.css which will be loaded on demand by
     // nsXULElement::BindToTree.)
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1005,17 +1005,17 @@ nsPresContext::Init(nsDeviceContext* aDe
       // We don't have our container set yet at this point
       nsCOMPtr<nsIDocShellTreeItem> ourItem = mDocument->GetDocShell();
       if (ourItem) {
         nsCOMPtr<nsIDocShellTreeItem> parentItem;
         ourItem->GetSameTypeParent(getter_AddRefs(parentItem));
         if (parentItem) {
           Element* containingElement =
             parent->FindContentForSubDocument(mDocument);
-          if (!containingElement->IsXUL() ||
+          if (!containingElement->IsXULElement() ||
               !containingElement->
                 HasAttr(kNameSpaceID_None,
                         nsGkAtoms::forceOwnRefreshDriver)) {
             mRefreshDriver = parent->GetShell()->GetPresContext()->RefreshDriver();
           }
         }
       }
     }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1984,17 +1984,17 @@ PresShell::Initialize(nscoord aWidth, ns
                             PAINTLOCK_EVENT_DELAY);
 
       mPaintSuppressionTimer->InitWithFuncCallback(sPaintSuppressionCallback,
                                                    this, delay,
                                                    nsITimer::TYPE_ONE_SHOT);
     }
   }
 
-  if (root && root->IsXUL()) {
+  if (root && root->IsXULElement()) {
     mozilla::Telemetry::AccumulateTimeDelta(Telemetry::XUL_INITIAL_FRAME_CONSTRUCTION,
                                             timerStart);
   }
 
   return NS_OK; //XXX this needs to be real. MMP
 }
 
 void
@@ -3166,17 +3166,17 @@ nsresult
 PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
                       uint32_t aAdditionalScrollFlags)
 {
   if (!mDocument) {
     return NS_ERROR_FAILURE;
   }
 
   const Element *root = mDocument->GetRootElement();
-  if (root && root->IsSVG(nsGkAtoms::svg)) {
+  if (root && root->IsSVGElement(nsGkAtoms::svg)) {
     // We need to execute this even if there is an empty anchor name
     // so that any existing SVG fragment identifier effect is removed
     if (SVGFragmentIdentifier::ProcessFragmentIdentifier(mDocument, aAnchorName)) {
       return NS_OK;
     }
   }
 
   // Hold a reference to the ESM in case event dispatch tears us down.
@@ -3209,17 +3209,17 @@ PresShell::GoToAnchor(const nsAString& a
         nsCOMPtr<nsIDOMNode> node;
         rv = list->Item(i, getter_AddRefs(node));
         if (!node) {  // End of list
           break;
         }
         // Ensure it's an anchor element
         content = do_QueryInterface(node);
         if (content) {
-          if (content->Tag() == nsGkAtoms::a && content->IsHTML()) {
+          if (content->Tag() == nsGkAtoms::a && content->IsHTMLElement()) {
             break;
           }
           content = nullptr;
         }
       }
     }
   }
 
@@ -6072,17 +6072,17 @@ PresShell::AssumeAllImagesVisible()
   }
 
   // We assume all images are visible in print, print preview, chrome, xul, and
   // resource docs and don't keep track of them.
   if (mPresContext->Type() == nsPresContext::eContext_PrintPreview ||
       mPresContext->Type() == nsPresContext::eContext_Print ||
       mPresContext->IsChrome() ||
       mDocument->IsResourceDoc() ||
-      mDocument->IsXUL()) {
+      mDocument->IsXULDocument()) {
     return true;
   }
 
   if (!sImageVisibilityEnabled &&
       sImageVisibilityEnabledForBrowserElementsOnly) {
     nsCOMPtr<nsIDocShell> docshell(mPresContext->GetDocShell());
     if (!docshell || !docshell->GetIsInBrowserElement()) {
       return true;
@@ -7003,17 +7003,17 @@ CheckPermissionForBeforeAfterKeyboardEve
 }
 
 static void
 BuildTargetChainForBeforeAfterKeyboardEvent(nsINode* aTarget,
                                             nsTArray<nsCOMPtr<Element> >& aChain,
                                             bool& aTargetIsIframe)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aTarget));
-  aTargetIsIframe = content && content->IsHTML(nsGkAtoms::iframe);
+  aTargetIsIframe = content && content->IsHTMLElement(nsGkAtoms::iframe);
 
   Element* frameElement;
   // If event target is not an iframe, skip the event target and get its
   // parent frame.
   if (aTargetIsIframe) {
     frameElement = aTarget->AsElement();
   } else {
     nsPIDOMWindow* window = aTarget->OwnerDoc()->GetWindow();
@@ -7426,17 +7426,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
         if (!captureRetarget) {
           // A check was already done above to ensure that capturingContent is
           // in this presshell.
           NS_ASSERTION(capturingContent->GetCrossShadowCurrentDoc() == GetDocument(),
                        "Unexpected document");
           nsIFrame* captureFrame = capturingContent->GetPrimaryFrame();
           if (captureFrame) {
             if (capturingContent->Tag() == nsGkAtoms::select &&
-                capturingContent->IsHTML()) {
+                capturingContent->IsHTMLElement()) {
               // a dropdown <select> has a child in its selectPopupList and we should
               // capture on that instead.
               nsIFrame* childFrame = captureFrame->GetChildList(nsIFrame::kSelectPopupList).FirstChild();
               if (childFrame) {
                 captureFrame = childFrame;
               }
             }
 
@@ -9403,17 +9403,17 @@ PresShell::ProcessReflowCommands(bool aI
     UnsuppressAndInvalidate();
   }
 
   if (mDocument->GetRootElement()) {
     TimeDuration elapsed = TimeStamp::Now() - timerStart;
     int32_t intElapsed = int32_t(elapsed.ToMilliseconds());
 
     Telemetry::ID id;
-    if (mDocument->GetRootElement()->IsXUL()) {
+    if (mDocument->GetRootElement()->IsXULElement()) {
       id = mIsActive
         ? Telemetry::XUL_FOREGROUND_REFLOW_MS
         : Telemetry::XUL_BACKGROUND_REFLOW_MS;
     } else {
       id = mIsActive
         ? Telemetry::HTML_FOREGROUND_REFLOW_MS_2
         : Telemetry::HTML_BACKGROUND_REFLOW_MS_2;
     }
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -702,17 +702,17 @@ static uint32_t
 CountOptionsAndOptgroups(nsIFrame* aFrame)
 {
   uint32_t count = 0;
   nsFrameList::Enumerator e(aFrame->PrincipalChildList());
   for (; !e.AtEnd(); e.Next()) {
     nsIFrame* child = e.get();
     nsIContent* content = child->GetContent();
     if (content) {
-      if (content->IsHTML(nsGkAtoms::option)) {
+      if (content->IsHTMLElement(nsGkAtoms::option)) {
         ++count;
       } else {
         nsCOMPtr<nsIDOMHTMLOptGroupElement> optgroup = do_QueryInterface(content);
         if (optgroup) {
           nsAutoString label;
           optgroup->GetLabel(label);
           if (label.Length() > 0) {
             ++count;
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -525,17 +525,17 @@ nsNumberControlFrame::GetNumberControlFr
   // the frame of its mContent's grandparent to be that input's frame. We
   // have to check for this via the content tree because we don't know whether
   // extra frames will be wrapped around any of the elements between aFrame and
   // the nsNumberControlFrame that we're looking for (e.g. flex wrappers).
   nsIContent* content = aFrame->GetContent();
   if (content->IsInNativeAnonymousSubtree() &&
       content->GetParent() && content->GetParent()->GetParent()) {
     nsIContent* grandparent = content->GetParent()->GetParent();
-    if (grandparent->IsHTML(nsGkAtoms::input) &&
+    if (grandparent->IsHTMLElement(nsGkAtoms::input) &&
         grandparent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                  nsGkAtoms::number, eCaseMatters)) {
       return do_QueryFrame(grandparent->GetPrimaryFrame());
     }
   }
   return nullptr;
 }
 
@@ -547,17 +547,17 @@ nsNumberControlFrame::GetNumberControlFr
   // have to check for this via the content tree because we don't know whether
   // extra frames will be wrapped around any of the elements between aFrame and
   // the nsNumberControlFrame that we're looking for (e.g. flex wrappers).
   nsIContent* content = aFrame->GetContent();
   if (content->IsInNativeAnonymousSubtree() &&
       content->GetParent() && content->GetParent()->GetParent() &&
       content->GetParent()->GetParent()->GetParent()) {
     nsIContent* greatgrandparent = content->GetParent()->GetParent()->GetParent();
-    if (greatgrandparent->IsHTML(nsGkAtoms::input) &&
+    if (greatgrandparent->IsHTMLElement(nsGkAtoms::input) &&
         greatgrandparent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                       nsGkAtoms::number, eCaseMatters)) {
       return do_QueryFrame(greatgrandparent->GetPrimaryFrame());
     }
   }
   return nullptr;
 }
 
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -445,17 +445,17 @@ nsRangeFrame::AccessibleType()
 {
   return a11y::eHTMLRangeType;
 }
 #endif
 
 double
 nsRangeFrame::GetValueAsFractionOfRange()
 {
-  MOZ_ASSERT(mContent->IsHTML(nsGkAtoms::input), "bad cast");
+  MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
   dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
 
   MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
 
   Decimal value = input->GetValueAsDecimal();
   Decimal minimum = input->GetMinimum();
   Decimal maximum = input->GetMaximum();
 
@@ -474,17 +474,17 @@ nsRangeFrame::GetValueAsFractionOfRange(
 
 Decimal
 nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
 {
   MOZ_ASSERT(aEvent->mClass == eMouseEventClass ||
              aEvent->mClass == eTouchEventClass,
              "Unexpected event type - aEvent->refPoint may be meaningless");
 
-  MOZ_ASSERT(mContent->IsHTML(nsGkAtoms::input), "bad cast");
+  MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
   dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
 
   MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
 
   Decimal minimum = input->GetMinimum();
   Decimal maximum = input->GetMaximum();
   MOZ_ASSERT(minimum.isFinite() && maximum.isFinite(),
              "type=range should have a default maximum/minimum");
@@ -705,17 +705,17 @@ nsRangeFrame::AttributeChanged(int32_t  
       // in the middle of a type change away from type=range, under the
       // SetAttr(..., nsGkAtoms::value, ...) call in HTMLInputElement::
       // HandleTypeChange. In that case the HTMLInputElement's type will
       // already have changed, and if we call UpdateForValueChange()
       // we'll fail the asserts under that call that check the type of our
       // HTMLInputElement. Given that we're changing away from being a range
       // and this frame will shortly be destroyed, there's no point in calling
       // UpdateForValueChange() anyway.
-      MOZ_ASSERT(mContent->IsHTML(nsGkAtoms::input), "bad cast");
+      MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
       bool typeIsRange = static_cast<dom::HTMLInputElement*>(mContent)->GetType() ==
                            NS_FORM_INPUT_RANGE;
       // If script changed the <input>'s type before setting these attributes
       // then we don't need to do anything since we are going to be reframed.
       if (typeIsRange) {
         UpdateForValueChange();
       }
     } else if (aAttribute == nsGkAtoms::orient) {
--- a/layout/forms/nsSelectsAreaFrame.cpp
+++ b/layout/forms/nsSelectsAreaFrame.cpp
@@ -48,17 +48,17 @@ void nsDisplayOptionEventGrabber::HitTes
 {
   nsTArray<nsIFrame*> outFrames;
   mList.HitTest(aBuilder, aRect, aState, &outFrames);
 
   for (uint32_t i = 0; i < outFrames.Length(); i++) {
     nsIFrame* selectedFrame = outFrames.ElementAt(i);
     while (selectedFrame &&
            !(selectedFrame->GetContent() &&
-             selectedFrame->GetContent()->IsHTML(nsGkAtoms::option))) {
+             selectedFrame->GetContent()->IsHTMLElement(nsGkAtoms::option))) {
       selectedFrame = selectedFrame->GetParent();
     }
     if (selectedFrame) {
       aOutFrames->AppendElement(selectedFrame);
     } else {
       // keep the original result, which could be this frame
       aOutFrames->AppendElement(outFrames.ElementAt(i));
     }
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2889,17 +2889,18 @@ nsBlockFrame::AttributeChanged(int32_t  
 {
   nsresult rv = nsBlockFrameSuper::AttributeChanged(aNameSpaceID,
                                                     aAttribute, aModType);
 
   if (NS_FAILED(rv)) {
     return rv;
   }
   if (nsGkAtoms::start == aAttribute ||
-      (nsGkAtoms::reversed == aAttribute && mContent->IsHTML(nsGkAtoms::ol))) {
+      (nsGkAtoms::reversed == aAttribute &&
+       mContent->IsHTMLElement(nsGkAtoms::ol))) {
     nsPresContext* presContext = PresContext();
 
     // XXX Not sure if this is necessary anymore
     if (RenumberLists(presContext)) {
       presContext->PresShell()->
         FrameNeedsReflow(this, nsIPresShell::eStyleChange,
                          NS_FRAME_HAS_DIRTY_CHILDREN);
     }
@@ -6258,18 +6259,17 @@ static void ComputeVisualOverflowArea(ns
   aResult.width = xb - xa;
   aResult.height = yb - ya;
 }
 #endif
 
 bool
 nsBlockFrame::IsVisibleInSelection(nsISelection* aSelection)
 {
-  if (mContent->IsHTML() && (mContent->Tag() == nsGkAtoms::html ||
-                             mContent->Tag() == nsGkAtoms::body))
+  if (mContent->IsAnyOfHTMLElements(nsGkAtoms::html, nsGkAtoms::body))
     return true;
 
   nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));
   bool visible;
   nsresult rv = aSelection->ContainsNode(node, true, &visible);
   return NS_SUCCEEDED(rv) && visible;
 }
 
@@ -6796,17 +6796,17 @@ nsBlockFrame::GetSpokenBulletText(nsAStr
   }
 }
 
 // static
 bool
 nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
 {
   nsIContent* content = aFrame->GetContent();
-  if (!content || !content->IsHTML())
+  if (!content || !content->IsHTMLElement())
     return false;
 
   nsIAtom *localName = content->NodeInfo()->NameAtom();
   return localName == nsGkAtoms::ol ||
          localName == nsGkAtoms::ul ||
          localName == nsGkAtoms::dir ||
          localName == nsGkAtoms::menu;
 }
@@ -6815,17 +6815,17 @@ bool
 nsBlockFrame::RenumberLists(nsPresContext* aPresContext)
 {
   if (!FrameStartsCounterScope(this)) {
     // If this frame doesn't start a counter scope then we don't need
     // to renumber child list items.
     return false;
   }
 
-  MOZ_ASSERT(mContent->IsHTML(),
+  MOZ_ASSERT(mContent->IsHTMLElement(),
              "FrameStartsCounterScope should only return true for HTML elements");
 
   // Setup initial list ordinal value
   // XXX Map html's start property to counter-reset style
   int32_t ordinal = 1;
   int32_t increment;
   if (mContent->Tag() == nsGkAtoms::ol &&
       mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::reversed)) {
@@ -6842,17 +6842,17 @@ nsBlockFrame::RenumberLists(nsPresContex
   if (attr && attr->Type() == nsAttrValue::eInteger) {
     ordinal = attr->GetIntegerValue();
   } else if (increment < 0) {
     // <ol reversed> case, or some other case with a negative increment: count
     // up the child list
     ordinal = 0;
     for (nsIContent* kid = mContent->GetFirstChild(); kid;
          kid = kid->GetNextSibling()) {
-      if (kid->IsHTML(nsGkAtoms::li)) {
+      if (kid->IsHTMLElement(nsGkAtoms::li)) {
         // FIXME: This isn't right in terms of what CSS says to do for
         // overflow of counters (but it only matters when this node has
         // more than numeric_limits<int32_t>::max() children).
         ordinal -= increment;
       }
     }
   }
 
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -620,17 +620,17 @@ nsContainerFrame::SyncWindowProperties(n
 
   nsViewManager* vm = aView->GetViewManager();
   nsView* rootView = vm->GetRootView();
 
   if (aView != rootView)
     return;
 
   Element* rootElement = aPresContext->Document()->GetRootElement();
-  if (!rootElement || !rootElement->IsXUL()) {
+  if (!rootElement || !rootElement->IsXULElement()) {
     // Scrollframes use native widgets which don't work well with
     // translucent windows, at least in Windows XP. So if the document
     // has a root scrollrame it's useless to try to make it transparent,
     // we'll just get something broken.
     // nsCSSFrameConstructor::ConstructRootFrame constructs root
     // scrollframes whenever the root element is not a XUL element, so
     // we test for that here. We can't just call
     // presShell->GetRootScrollFrame() since that might not have
--- a/layout/generic/nsFontInflationData.cpp
+++ b/layout/generic/nsFontInflationData.cpp
@@ -287,17 +287,17 @@ nsFontInflationData::ScanText()
 
 static uint32_t
 DoCharCountOfLargestOption(nsIFrame *aContainer)
 {
   uint32_t result = 0;
   for (nsIFrame* option = aContainer->GetFirstPrincipalChild();
        option; option = option->GetNextSibling()) {
     uint32_t optionResult;
-    if (option->GetContent()->IsHTML(nsGkAtoms::optgroup)) {
+    if (option->GetContent()->IsHTMLElement(nsGkAtoms::optgroup)) {
       optionResult = DoCharCountOfLargestOption(option);
     } else {
       // REVIEW: Check the frame structure for this!
       optionResult = 0;
       for (nsIFrame *optionChild = option->GetFirstPrincipalChild();
            optionChild; optionChild = optionChild->GetNextSibling()) {
         if (optionChild->GetType() == nsGkAtoms::textFrame) {
           optionResult += nsTextFrameUtils::
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -483,19 +483,19 @@ IsFontSizeInflationContainer(nsIFrame* a
   bool isInline = (aFrame->GetDisplay() == NS_STYLE_DISPLAY_INLINE ||
                    aFrame->StyleDisplay()->IsRubyDisplayType() ||
                    (aFrame->IsFloating() &&
                     aFrame->GetType() == nsGkAtoms::letterFrame) ||
                    // Given multiple frames for the same node, only the
                    // outer one should be considered a container.
                    // (Important, e.g., for nsSelectsAreaFrame.)
                    (aFrame->GetParent()->GetContent() == content) ||
-                   (content && (content->IsHTML(nsGkAtoms::option) ||
-                                content->IsHTML(nsGkAtoms::optgroup) ||
-                                content->IsHTML(nsGkAtoms::select) ||
+                   (content && (content->IsAnyOfHTMLElements(nsGkAtoms::option,
+                                                             nsGkAtoms::optgroup,
+                                                             nsGkAtoms::select) ||
                                 content->IsInNativeAnonymousSubtree()))) &&
                   !(aFrame->IsBoxFrame() && aFrame->GetParent()->IsBoxFrame());
   NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) ||
                isInline ||
                // br frames and mathml frames report being line
                // participants even when their position or display is
                // set
                aFrame->GetType() == nsGkAtoms::brFrame ||
@@ -7978,17 +7978,17 @@ nsIFrame::IsFocusable(int32_t *aTabIndex
     if (ui->mUserFocus != NS_STYLE_USER_FOCUS_IGNORE &&
         ui->mUserFocus != NS_STYLE_USER_FOCUS_NONE) {
       // Pass in default tabindex of -1 for nonfocusable and 0 for focusable
       tabIndex = 0;
     }
     isFocusable = mContent->IsFocusable(&tabIndex, aWithMouse);
     if (!isFocusable && !aWithMouse &&
         GetType() == nsGkAtoms::scrollFrame &&
-        mContent->IsHTML() &&
+        mContent->IsHTMLElement() &&
         !mContent->IsRootOfNativeAnonymousSubtree() &&
         mContent->GetParent() &&
         !mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
       // Elements with scrollable view are focusable with script & tabbable
       // Otherwise you couldn't scroll them with keyboard, which is
       // an accessibility issue (e.g. Section 508 rules)
       // However, we don't make them to be focusable with the mouse,
       // because the extra focus outlines are considered unnecessarily ugly.
@@ -8752,17 +8752,17 @@ nsIFrame::SetParent(nsContainerFrame* aP
   }
 }
 
 void
 nsIFrame::CreateOwnLayerIfNeeded(nsDisplayListBuilder* aBuilder, 
                                  nsDisplayList* aList)
 {
   if (GetContent() &&
-      GetContent()->IsXUL() &&
+      GetContent()->IsXULElement() &&
       GetContent()->HasAttr(kNameSpaceID_None, nsGkAtoms::layer)) {
     aList->AppendNewToTop(new (aBuilder) 
         nsDisplayOwnLayer(aBuilder, this, aList));
   }
 }
 
 bool
 nsIFrame::IsSelected() const
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -336,17 +336,17 @@ nsHTMLFramesetFrame::Init(nsIContent*   
     // Also clear the restyle flags in the child like
     // nsCSSFrameConstructor::ProcessChildren does.
     if (child->IsElement()) {
       child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
     }
 
     // IMPORTANT: This must match the conditions in
     // nsCSSFrameConstructor::ContentAppended/Inserted/Removed
-    if (!child->IsHTML())
+    if (!child->IsHTMLElement())
       continue;
 
     nsIAtom *tag = child->Tag();
     if (tag == nsGkAtoms::frameset || tag == nsGkAtoms::frame) {
       nsRefPtr<nsStyleContext> kidSC;
 
       kidSC = shell->StyleSet()->ResolveStyleFor(child->AsElement(),
                                                  mStyleContext);
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -386,18 +386,18 @@ nsHTMLReflowState::Init(nsPresContext* a
   } else if (type == nsGkAtoms::svgForeignObjectFrame) {
     // An SVG foreignObject frame is inherently constrained height.
     frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
   } else if ((mStylePosition->mHeight.GetUnit() != eStyleUnit_Auto ||
               mStylePosition->mMaxHeight.GetUnit() != eStyleUnit_None) &&
               // Don't set NS_FRAME_IN_CONSTRAINED_HEIGHT on body or html
               // elements.
              (frame->GetContent() &&
-            !(frame->GetContent()->IsHTML(nsGkAtoms::body) ||
-              frame->GetContent()->IsHTML(nsGkAtoms::html)))) {
+            !(frame->GetContent()->IsAnyOfHTMLElements(nsGkAtoms::body,
+                                                       nsGkAtoms::html)))) {
 
     // If our height was specified as a percentage, then this could
     // actually resolve to 'auto', based on:
     // http://www.w3.org/TR/CSS21/visudet.html#the-height-property
     nsIFrame* containingBlk = frame;
     while (containingBlk) {
       const nsStylePosition* stylePos = containingBlk->StylePosition();
       if ((stylePos->mHeight.IsCoordPercentCalcUnit() &&
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -479,18 +479,18 @@ nsImageFrame::ShouldCreateImageFrameFor(
   if (aStyleContext->StyleUIReset()->mForceBrokenImageIcon) {
     useSizedBox = true;
   }
   else if (gIconLoad && gIconLoad->mPrefForceInlineAltText) {
     useSizedBox = false;
   }
   else if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
            !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::alt) &&
-           !aElement->IsHTML(nsGkAtoms::object) &&
-           !aElement->IsHTML(nsGkAtoms::input)) {
+           !aElement->IsHTMLElement(nsGkAtoms::object) &&
+           !aElement->IsHTMLElement(nsGkAtoms::input)) {
     // Use a sized box if we have no alt text.  This means no alt attribute
     // and the node is not an object or an input (since those always have alt
     // text).
     useSizedBox = true;
   }
   else if (aStyleContext->PresContext()->CompatibilityMode() !=
            eCompatibility_NavQuirks) {
     useSizedBox = false;
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -754,17 +754,17 @@ nsImageMap::SearchForAreas(nsIContent* a
 {
   nsresult rv = NS_OK;
   uint32_t i, n = aParent->GetChildCount();
 
   // Look for <area> or <a> elements. We'll use whichever type we find first.
   for (i = 0; i < n; i++) {
     nsIContent *child = aParent->GetChildAt(i);
 
-    if (child->IsHTML()) {
+    if (child->IsHTMLElement()) {
       // If we haven't determined that the map element contains an
       // <a> element yet, then look for <area>.
       if (!aFoundAnchor && child->Tag() == nsGkAtoms::area) {
         aFoundArea = true;
         rv = AddArea(child);
         NS_ENSURE_SUCCESS(rv, rv);
 
         // Continue to next child. This stops mContainsBlockContents from
@@ -921,17 +921,17 @@ nsImageMap::AttributeChanged(nsIDocument
                              int32_t       aModType)
 {
   // If the parent of the changing content node is our map then update
   // the map.  But only do this if the node is an HTML <area> or <a>
   // and the attribute that's changing is "shape" or "coords" -- those
   // are the only cases we care about.
   if ((aElement->NodeInfo()->Equals(nsGkAtoms::area) ||
        aElement->NodeInfo()->Equals(nsGkAtoms::a)) &&
-      aElement->IsHTML() &&
+      aElement->IsHTMLElement() &&
       aNameSpaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::shape ||
        aAttribute == nsGkAtoms::coords)) {
     MaybeUpdateAreas(aElement->GetParent());
   } else if (aElement == mMap &&
              aNameSpaceID == kNameSpaceID_None &&
              (aAttribute == nsGkAtoms::name ||
               aAttribute == nsGkAtoms::id) &&
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2186,17 +2186,17 @@ nsFrameSelection::NotifySelectionListene
 }
 
 // Start of Table Selection methods
 
 static bool IsCell(nsIContent *aContent)
 {
   return ((aContent->Tag() == nsGkAtoms::td ||
            aContent->Tag() == nsGkAtoms::th) &&
-          aContent->IsHTML());
+          aContent->IsHTMLElement());
 }
 
 nsITableCellLayout* 
 nsFrameSelection::GetCellLayout(nsIContent *aCellContent) const
 {
   NS_ENSURE_TRUE(mShell, nullptr);
   nsITableCellLayout *cellLayoutObject =
     do_QueryFrame(aCellContent->GetPrimaryFrame());
@@ -2943,17 +2943,17 @@ nsFrameSelection::GetParentTable(nsICont
 {
   if (!aCell) {
     return nullptr;
   }
 
   for (nsIContent* parent = aCell->GetParent(); parent;
        parent = parent->GetParent()) {
     if (parent->Tag() == nsGkAtoms::table &&
-        parent->IsHTML()) {
+        parent->IsHTMLElement()) {
       return parent;
     }
   }
 
   return nullptr;
 }
 
 nsresult
@@ -3077,17 +3077,17 @@ Selection::GetTableSelectionType(nsIDOMR
   int32_t startOffset = range->StartOffset();
   int32_t endOffset = range->EndOffset();
 
   // Not a single selected node
   if ((endOffset - startOffset) != 1)
     return NS_OK;
 
   nsIContent* startContent = static_cast<nsIContent*>(startNode);
-  if (!(startNode->IsElement() && startContent->IsHTML())) {
+  if (!(startNode->IsElement() && startContent->IsHTMLElement())) {
     // Implies a check for being an element; if we ever make this work
     // for non-HTML, need to keep checking for elements.
     return NS_OK;
   }
 
   nsIAtom *tag = startContent->Tag();
 
   if (tag == nsGkAtoms::tr)
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -585,17 +585,17 @@ nsSubDocumentFrame::BuildDisplayList(nsD
 
 nscoord
 nsSubDocumentFrame::GetIntrinsicISize()
 {
   if (!IsInline()) {
     return 0;  // HTML <frame> has no useful intrinsic width
   }
 
-  if (mContent->IsXUL()) {
+  if (mContent->IsXULElement()) {
     return 0;  // XUL <iframe> and <browser> have no useful intrinsic width
   }
 
   NS_ASSERTION(ObtainIntrinsicSizeFrame() == nullptr,
                "Intrinsic width should come from the embedded document.");
 
   // We must be an HTML <iframe>.  Default to a width of 300, for IE
   // compat (and per CSS2.1 draft).
@@ -603,17 +603,17 @@ nsSubDocumentFrame::GetIntrinsicISize()
 }
 
 nscoord
 nsSubDocumentFrame::GetIntrinsicBSize()
 {
   // <frame> processing does not use this routine, only <iframe>
   NS_ASSERTION(IsInline(), "Shouldn't have been called");
 
-  if (mContent->IsXUL()) {
+  if (mContent->IsXULElement()) {
     return 0;
   }
 
   NS_ASSERTION(ObtainIntrinsicSizeFrame() == nullptr,
                "Intrinsic height should come from the embedded document.");
 
   // Use 150px, for compatibility with IE, and per CSS2.1 draft.
   return nsPresContext::CSSPixelsToAppUnits(150);
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -4910,17 +4910,17 @@ nsTextFrame::GetTextDecorations(
         (!nsStyleDisplay::IsRubyDisplayType(display) ||
          display == NS_STYLE_DISPLAY_RUBY_TEXT_CONTAINER) &&
         nsStyleDisplay::IsDisplayTypeInlineOutside(display)) {
       break;
     }
 
     // In quirks mode, if we're on an HTML table element, we're done.
     if (compatMode == eCompatibility_NavQuirks &&
-        f->GetContent()->IsHTML(nsGkAtoms::table)) {
+        f->GetContent()->IsHTMLElement(nsGkAtoms::table)) {
       break;
     }
 
     // If we're on an absolutely-positioned element or a floating
     // element, we're done.
     if (f->IsFloating() || f->IsAbsolutelyPositioned()) {
       break;
     }
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -1338,17 +1338,17 @@ static ForceReflow gForceReflow;
 
 void
 nsMathMLContainerFrame::SetIncrementScriptLevel(int32_t aChildIndex, bool aIncrement)
 {
   nsIFrame* child = PrincipalChildList().FrameAt(aChildIndex);
   if (!child)
     return;
   nsIContent* content = child->GetContent();
-  if (!content->IsMathML())
+  if (!content->IsMathMLElement())
     return;
   nsMathMLElement* element = static_cast<nsMathMLElement*>(content);
 
   if (element->GetIncrementScriptLevel() == aIncrement)
     return;
 
   // XXXroc this does a ContentStatesChanged, is it safe to call here? If
   // not we should do it in a post-reflow callback.
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -3036,17 +3036,17 @@ bool nsPrintEngine::HasFramesetChild(nsI
   if (!aContent) {
     return false;
   }
 
   // do a breadth search across all siblings
   for (nsIContent* child = aContent->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsHTML(nsGkAtoms::frameset)) {
+    if (child->IsHTMLElement(nsGkAtoms::frameset)) {
       return true;
     }
   }
 
   return false;
 }
  
 
--- a/layout/printing/nsPrintPreviewListener.cpp
+++ b/layout/printing/nsPrintPreviewListener.cpp
@@ -157,17 +157,17 @@ GetActionForEvent(nsIDOMEvent* aEvent)
   return eEventAction_Suppress;
 }
 
 NS_IMETHODIMP
 nsPrintPreviewListener::HandleEvent(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(
     aEvent ? aEvent->InternalDOMEvent()->GetOriginalTarget() : nullptr);
-  if (content && !content->IsXUL()) {
+  if (content && !content->IsXULElement()) {
     eEventAction action = ::GetActionForEvent(aEvent);
     switch (action) {
       case eEventAction_Tab:
       case eEventAction_ShiftTab:
       {
         nsAutoString eventString;
         aEvent->GetType(eventString);
         if (eventString.EqualsLiteral("keydown")) {
--- a/layout/style/SVGAttrAnimationRuleProcessor.cpp
+++ b/layout/style/SVGAttrAnimationRuleProcessor.cpp
@@ -32,17 +32,17 @@ SVGAttrAnimationRuleProcessor::RulesMatc
 {
   ElementRulesMatching(aData->mElement, aData->mRuleWalker);
 }
 
 void
 SVGAttrAnimationRuleProcessor::ElementRulesMatching(Element* aElement,
                                                     nsRuleWalker* aRuleWalker)
 {
-  if (aElement->IsSVG()) {
+  if (aElement->IsSVGElement()) {
     static_cast<nsSVGElement*>(aElement)->
       WalkAnimatedContentStyleRules(aRuleWalker);
   }
 }
 
 /* virtual */ nsRestyleHint
 SVGAttrAnimationRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
 {
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1678,17 +1678,17 @@ StateSelectorMatches(Element* aElement,
                   "should only need to call StateSelectorMatches if "
                   "aStatesToCheck is not empty");
 
   // Bit-based pseudo-classes
   if (aStatesToCheck.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE |
                                            NS_EVENT_STATE_HOVER) &&
       aTreeMatchContext.mCompatMode == eCompatibility_NavQuirks &&
       ActiveHoverQuirkMatches(aSelector, aSelectorFlags) &&
-      aElement->IsHTML() && !nsCSSRuleProcessor::IsLink(aElement)) {
+      aElement->IsHTMLElement() && !nsCSSRuleProcessor::IsLink(aElement)) {
     // In quirks mode, only make links sensitive to selectors ":active"
     // and ":hover".
     return false;
   }
 
   if (aTreeMatchContext.mForStyling &&
       aStatesToCheck.HasAtLeastOneOfStates(NS_EVENT_STATE_HOVER)) {
     // Mark the element as having :hover-dependent style
@@ -1757,17 +1757,17 @@ static bool SelectorMatches(Element* aEl
   // namespace/tag match
   // optimization : bail out early if we can
   if ((kNameSpaceID_Unknown != aSelector->mNameSpace &&
        aElement->GetNameSpaceID() != aSelector->mNameSpace))
     return false;
 
   if (aSelector->mLowercaseTag) {
     nsIAtom* selectorTag =
-      (aTreeMatchContext.mIsHTMLDocument && aElement->IsHTML()) ?
+      (aTreeMatchContext.mIsHTMLDocument && aElement->IsHTMLElement()) ?
         aSelector->mLowercaseTag : aSelector->mCasedTag;
     if (selectorTag != aElement->Tag()) {
       return false;
     }
   }
 
   nsAtomList* IDList = aSelector->mIDList;
   if (IDList) {
@@ -2073,17 +2073,17 @@ static bool SelectorMatches(Element* aEl
       case nsCSSPseudoClasses::ePseudoClass_nthLastOfType:
         if (!nthChildGenericMatches(aElement, aTreeMatchContext, pseudoClass,
                                     true, true)) {
           return false;
         }
         break;
 
       case nsCSSPseudoClasses::ePseudoClass_mozIsHTML:
-        if (!aTreeMatchContext.mIsHTMLDocument || !aElement->IsHTML()) {
+        if (!aTreeMatchContext.mIsHTMLDocument || !aElement->IsHTMLElement()) {
           return false;
         }
         break;
 
       case nsCSSPseudoClasses::ePseudoClass_mozNativeAnonymous:
         if (!aElement->IsInNativeAnonymousSubtree()) {
           return false;
         }
@@ -2152,17 +2152,17 @@ static bool SelectorMatches(Element* aEl
         if (!aTreeMatchContext.mDocument->GetDocumentState().
                HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
           return false;
         }
         break;
 
       case nsCSSPseudoClasses::ePseudoClass_mozTableBorderNonzero:
         {
-          if (!aElement->IsHTML(nsGkAtoms::table)) {
+          if (!aElement->IsHTMLElement(nsGkAtoms::table)) {
             return false;
           }
           const nsAttrValue *val = aElement->GetParsedAttr(nsGkAtoms::border);
           if (!val ||
               (val->Type() == nsAttrValue::eInteger &&
                val->GetIntegerValue() == 0)) {
             return false;
           }
@@ -2247,17 +2247,17 @@ static bool SelectorMatches(Element* aEl
       return false;
     } else {
       result = true;
       nsAttrSelector* attr = aSelector->mAttrList;
       nsIAtom* matchAttribute;
 
       do {
         bool isHTML =
-          (aTreeMatchContext.mIsHTMLDocument && aElement->IsHTML());
+          (aTreeMatchContext.mIsHTMLDocument && aElement->IsHTMLElement());
         matchAttribute = isHTML ? attr->mLowercaseAttr : attr->mCasedAttr;
         if (attr->mNameSpace == kNameSpaceID_Unknown) {
           // Attr selector with a wildcard namespace.  We have to examine all
           // the attributes on our content node....  This sort of selector is
           // essentially a boolean OR, over all namespaces, of equivalent attr
           // selectors with those namespaces.  So to evaluate whether it
           // matches, evaluate for each namespace (the only namespaces that
           // have a chance at matching, of course, are ones that the element
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -427,20 +427,21 @@ nsComputedDOMStyle::GetStyleContextForEl
   // correct document.
   nsIPresShell *presShell = GetPresShellForContent(aElement);
   if (!presShell) {
     presShell = aPresShell;
     if (!presShell)
       return nullptr;
   }
 
-  // XXX the !aElement->IsHTML(nsGkAtoms::area)
-  // check is needed due to bug 135040 (to avoid using 
+  // XXX the !aElement->IsHTMLElement(nsGkAtoms::area)
+  // check is needed due to bug 135040 (to avoid using
   // mPrimaryFrame). Remove it once that's fixed.
-  if (!aPseudo && aStyleType == eAll && !aElement->IsHTML(nsGkAtoms::area)) {
+  if (!aPseudo && aStyleType == eAll &&
+      !aElement->IsHTMLElement(nsGkAtoms::area)) {
     nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
     if (frame) {
       nsStyleContext* result = frame->StyleContext();
       // Don't use the style context if it was influenced by
       // pseudo-elements, since then it's not the primary style
       // for this element.
       if (!result->HasPseudoElementData()) {
         // this function returns an addrefed style context
@@ -592,20 +593,21 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
   mFlushedPendingReflows = aNeedsLayoutFlush;
 #endif
 
   mPresShell = document->GetShell();
   if (!mPresShell || !mPresShell->GetPresContext()) {
     return;
   }
 
-  // XXX the !mContent->IsHTML(nsGkAtoms::area)
-  // check is needed due to bug 135040 (to avoid using 
+  // XXX the !mContent->IsHTMLElement(nsGkAtoms::area)
+  // check is needed due to bug 135040 (to avoid using
   // mPrimaryFrame). Remove it once that's fixed.
-  if (!mPseudo && mStyleType == eAll && !mContent->IsHTML(nsGkAtoms::area)) {
+  if (!mPseudo && mStyleType == eAll &&
+      !mContent->IsHTMLElement(nsGkAtoms::area)) {
     mOuterFrame = mContent->GetPrimaryFrame();
     mInnerFrame = mOuterFrame;
     if (mOuterFrame) {
       nsIAtom* type = mOuterFrame->GetType();
       if (type == nsGkAtoms::tableOuterFrame) {
         // If the frame is an outer table frame then we should get the style
         // from the inner table frame.
         mInnerFrame = mOuterFrame->GetFirstPrincipalChild();
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -248,17 +248,17 @@ nsHTMLStyleSheet::~nsHTMLStyleSheet()
 }
 
 NS_IMPL_ISUPPORTS(nsHTMLStyleSheet, nsIStyleRuleProcessor)
 
 /* virtual */ void
 nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
 {
   nsRuleWalker *ruleWalker = aData->mRuleWalker;
-  if (aData->mElement->IsHTML() && !ruleWalker->AuthorStyleDisabled()) {
+  if (aData->mElement->IsHTMLElement() && !ruleWalker->AuthorStyleDisabled()) {
     nsIAtom* tag = aData->mElement->Tag();
 
     // if we have anchor colors, check if this is an anchor with an href
     if (tag == nsGkAtoms::a) {
       if (mLinkRule || mVisitedRule || mActiveRule) {
         EventStates state =
           nsCSSRuleProcessor::GetContentStateForVisitedHandling(
                                   aData->mElement,
@@ -292,34 +292,34 @@ nsHTMLStyleSheet::RulesMatching(ElementR
         ruleWalker->Forward(mTableQuirkColorRule);
       }
     }
   } // end html element
 
   // just get the style rules from the content.  For SVG we do this even if
   // author style is disabled, because SVG presentational hints aren't
   // considered style.
-  if (!ruleWalker->AuthorStyleDisabled() || aData->mElement->IsSVG()) {
+  if (!ruleWalker->AuthorStyleDisabled() || aData->mElement->IsSVGElement()) {
     aData->mElement->WalkContentStyleRules(ruleWalker);
   }
 
   // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#language
   // says that the xml:lang attribute overrides HTML's lang attribute,
   // so we need to do this after WalkContentStyleRules.
   nsString lang;
   if (aData->mElement->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang, lang)) {
     ruleWalker->Forward(LangRuleFor(lang));
   }
 }
 
 // Test if style is dependent on content state
 /* virtual */ nsRestyleHint
 nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData)
 {
-  if (aData->mElement->IsHTML(nsGkAtoms::a) &&
+  if (aData->mElement->IsHTMLElement(nsGkAtoms::a) &&
       nsCSSRuleProcessor::IsLink(aData->mElement) &&
       ((mActiveRule && aData->mStateMask.HasState(NS_EVENT_STATE_ACTIVE)) ||
        (mLinkRule && aData->mStateMask.HasState(NS_EVENT_STATE_VISITED)) ||
        (mVisitedRule && aData->mStateMask.HasState(NS_EVENT_STATE_VISITED)))) {
     return eRestyle_Self;
   }
   
   return nsRestyleHint(0);
@@ -348,29 +348,29 @@ nsHTMLStyleSheet::HasAttributeDependentS
   // Note: no need to worry about whether some states changed with this
   // attribute here, because we handle that under HasStateDependentStyle() as
   // needed.
 
   // Result is true for |href| changes on HTML links if we have link rules.
   Element *element = aData->mElement;
   if (aData->mAttribute == nsGkAtoms::href &&
       (mLinkRule || mVisitedRule || mActiveRule) &&
-      element->IsHTML(nsGkAtoms::a)) {
+      element->IsHTMLElement(nsGkAtoms::a)) {
     return eRestyle_Self;
   }
 
   // Don't worry about the mDocumentColorRule since it only applies
   // to descendants of body, when we're already reresolving.
 
   // Handle the content style rules.
   if (element->IsAttributeMapped(aData->mAttribute)) {
     // cellpadding on tables is special and requires reresolving all
     // the cells in the table
     if (aData->mAttribute == nsGkAtoms::cellpadding &&
-        element->IsHTML(nsGkAtoms::table)) {
+        element->IsHTMLElement(nsGkAtoms::table)) {
       return eRestyle_Subtree;
     }
     return eRestyle_Self;
   }
 
   return nsRestyleHint(0);
 }
 
--- a/layout/style/nsRuleProcessorData.h
+++ b/layout/style/nsRuleProcessorData.h
@@ -392,17 +392,17 @@ struct MOZ_STACK_CLASS TreeMatchContext 
                    nsIDocument* aDocument,
                    MatchVisited aMatchVisited = eMatchVisitedDefault)
     : mForStyling(aForStyling)
     , mHaveRelevantLink(false)
     , mHaveSpecifiedScope(false)
     , mVisitedHandling(aVisitedHandling)
     , mDocument(aDocument)
     , mScopedRoot(nullptr)
-    , mIsHTMLDocument(aDocument->IsHTML())
+    , mIsHTMLDocument(aDocument->IsHTMLDocument())
     , mCompatMode(aDocument->GetCompatibilityMode())
     , mUsingPrivateBrowsing(false)
     , mSkippingParentDisplayBasedStyleFixup(false)
     , mForScopedStyle(false)
     , mCurrentStyleScope(nullptr)
   {
     if (aMatchVisited != eNeverMatchVisited) {
       nsCOMPtr<nsISupports> container = mDocument->GetContainer();
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -909,17 +909,18 @@ nsStyleSet::GetContext(nsStyleContext* a
                    GetAnimationRule(visitedRuleNode),
                  "animation rule mismatch between rule nodes");
       result = GetContext(aParentContext, ruleNode, visitedRuleNode,
                           aPseudoTag, aPseudoType, nullptr,
                           aFlags & ~eDoAnimation);
     }
   }
 
-  if (aElementForAnimation && aElementForAnimation->IsHTML(nsGkAtoms::body) &&
+  if (aElementForAnimation &&
+      aElementForAnimation->IsHTMLElement(nsGkAtoms::body) &&
       aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement &&
       PresContext()->CompatibilityMode() == eCompatibility_NavQuirks) {
     nsIDocument* doc = aElementForAnimation->GetCurrentDoc();
     if (doc && doc->GetBodyElement() == aElementForAnimation) {
       // Update the prescontext's body color
       PresContext()->SetBodyTextColor(result->StyleColor()->mColor);
     }
   }
@@ -1677,17 +1678,17 @@ nsStyleSet::WalkRestrictionRule(nsCSSPse
   else if (aPseudoType == nsCSSPseudoElements::ePseudo_mozPlaceholder)
     aRuleWalker->Forward(mPlaceholderRule);
 }
 
 void
 nsStyleSet::WalkDisableTextZoomRule(Element* aElement, nsRuleWalker* aRuleWalker)
 {
   aRuleWalker->SetLevel(eAgentSheet, false, false);
-  if (aElement->IsSVG(nsGkAtoms::text))
+  if (aElement->IsSVGElement(nsGkAtoms::text))
     aRuleWalker->Forward(mDisableTextZoomStyleRule);
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
                                       nsCSSPseudoElements::Type aType,
                                       nsStyleContext* aParentContext,
                                       Element* aPseudoElement)
--- a/layout/svg/SVGFEImageFrame.cpp
+++ b/layout/svg/SVGFEImageFrame.cpp
@@ -89,17 +89,17 @@ SVGFEImageFrame::DestroyFrom(nsIFrame* a
   SVGFEImageFrameBase::DestroyFrom(aDestructRoot);
 }
 
 void
 SVGFEImageFrame::Init(nsIContent*       aContent,
                       nsContainerFrame* aParent,
                       nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::feImage),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::feImage),
                "Trying to construct an SVGFEImageFrame for a "
                "content element that doesn't support the right interfaces");
 
   SVGFEImageFrameBase::Init(aContent, aParent, aPrevInFlow);
   nsCOMPtr<nsIImageLoadingContent> imageLoader =
     do_QueryInterface(SVGFEImageFrameBase::mContent);
 
   if (imageLoader) {
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -204,17 +204,17 @@ TrimOffsets(uint32_t& aStart, uint32_t& 
 
 /**
  * Returns the closest ancestor-or-self node that is not an SVG <a>
  * element.
  */
 static nsIContent*
 GetFirstNonAAncestor(nsIContent* aContent)
 {
-  while (aContent && aContent->IsSVG(nsGkAtoms::a)) {
+  while (aContent && aContent->IsSVGElement(nsGkAtoms::a)) {
     aContent = aContent->GetParent();
   }
   return aContent;
 }
 
 /**
  * Returns whether the given node is a text content element[1], taking into
  * account whether it has a valid parent.
@@ -234,28 +234,28 @@ GetFirstNonAAncestor(nsIContent* aConten
  * Note that we don't support the <tref> element yet and this function
  * returns false for it.
  *
  * [1] https://svgwg.org/svg2-draft/intro.html#TermTextContentElement
  */
 static bool
 IsTextContentElement(nsIContent* aContent)
 {
-  if (!aContent->IsSVG()) {
+  if (!aContent->IsSVGElement()) {
     return false;
   }
 
   if (aContent->Tag() == nsGkAtoms::text) {
     nsIContent* parent = GetFirstNonAAncestor(aContent->GetParent());
     return !parent || !IsTextContentElement(parent);
   }
 
   if (aContent->Tag() == nsGkAtoms::textPath) {
     nsIContent* parent = GetFirstNonAAncestor(aContent->GetParent());
-    return parent && parent->IsSVG(nsGkAtoms::text);
+    return parent && parent->IsSVGElement(nsGkAtoms::text);
   }
 
   if (aContent->Tag() == nsGkAtoms::a ||
       aContent->Tag() == nsGkAtoms::tspan ||
       aContent->Tag() == nsGkAtoms::altGlyph) {
     return true;
   }
 
@@ -2962,17 +2962,17 @@ SVGTextDrawPathCallbacks::StrokeGeometry
 {
   // We don't paint the stroke when we are filling with a selection color.
   if (mColor == NS_SAME_AS_FOREGROUND_COLOR ||
       mColor == NS_40PERCENT_FOREGROUND_COLOR) {
     if (nsSVGUtils::HasStroke(mFrame, /*aContextPaint*/ nullptr)) {
       GeneralPattern strokePattern;
       nsSVGUtils::MakeStrokePatternFor(mFrame, gfx, &strokePattern, /*aContextPaint*/ nullptr);
       if (strokePattern.GetPattern()) {
-        if (!mFrame->GetParent()->GetContent()->IsSVG()) {
+        if (!mFrame->GetParent()->GetContent()->IsSVGElement()) {
           // The cast that follows would be unsafe
           MOZ_ASSERT(false, "Our nsTextFrame's parent's content should be SVG");
           return;
         }
         nsSVGElement* svgOwner =
           static_cast<nsSVGElement*>(mFrame->GetParent()->GetContent());
 
         // Apply any stroke-specific transform
@@ -3192,17 +3192,17 @@ NS_IMPL_FRAMEARENA_HELPERS(SVGTextFrame)
 // ---------------------------------------------------------------------
 // nsIFrame methods
 
 void
 SVGTextFrame::Init(nsIContent*       aContent,
                    nsContainerFrame* aParent,
                    nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::text), "Content is not an SVG text");
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::text), "Content is not an SVG text");
 
   SVGTextFrameBase::Init(aContent, aParent, aPrevInFlow);
   AddStateBits((aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) |
                NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_SVG_TEXT);
 
   mMutationObserver = new MutationObserver(this);
 }
 
@@ -3400,17 +3400,17 @@ SVGTextFrame::MutationObserver::Characte
 void
 SVGTextFrame::MutationObserver::AttributeChanged(
                                                 nsIDocument* aDocument,
                                                 mozilla::dom::Element* aElement,
                                                 int32_t aNameSpaceID,
                                                 nsIAtom* aAttribute,
                                                 int32_t aModType)
 {
-  if (!aElement->IsSVG()) {
+  if (!aElement->IsSVGElement()) {
     return;
   }
 
   // Attribute changes on this element will be handled by
   // SVGTextFrame::AttributeChanged.
   if (aElement == mFrame->GetContent()) {
     return;
   }
@@ -4803,17 +4803,17 @@ SVGTextFrame::GetTextPathPathElement(nsI
 
     property = nsSVGEffects::GetTextPathProperty(targetURI, aTextPathFrame,
                                                  nsSVGEffects::HrefProperty());
     if (!property)
       return nullptr;
   }
 
   Element* element = property->GetReferencedElement();
-  return (element && element->IsSVG(nsGkAtoms::path)) ?
+  return (element && element->IsSVGElement(nsGkAtoms::path)) ?
     static_cast<SVGPathElement*>(element) : nullptr;
 }
 
 TemporaryRef<Path>
 SVGTextFrame::GetTextPath(nsIFrame* aTextPathFrame)
 {
   SVGPathElement* element = GetTextPathPathElement(aTextPathFrame);
   if (!element) {
--- a/layout/svg/SVGViewFrame.cpp
+++ b/layout/svg/SVGViewFrame.cpp
@@ -78,17 +78,17 @@ NS_NewSVGViewFrame(nsIPresShell* aPresSh
 NS_IMPL_FRAMEARENA_HELPERS(SVGViewFrame)
 
 #ifdef DEBUG
 void
 SVGViewFrame::Init(nsIContent*       aContent,
                    nsContainerFrame* aParent,
                    nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::view),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::view),
                "Content is not an SVG view");
 
   SVGViewFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 SVGViewFrame::GetType() const
@@ -104,17 +104,17 @@ SVGViewFrame::AttributeChanged(int32_t  
   // Ignore zoomAndPan as it does not cause the <svg> element to re-render
     
   if (aNameSpaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::preserveAspectRatio ||
        aAttribute == nsGkAtoms::viewBox ||
        aAttribute == nsGkAtoms::viewTarget)) {
 
     nsSVGOuterSVGFrame *outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
-    NS_ASSERTION(outerSVGFrame->GetContent()->IsSVG(nsGkAtoms::svg),
+    NS_ASSERTION(outerSVGFrame->GetContent()->IsSVGElement(nsGkAtoms::svg),
                  "Expecting an <svg> element");
 
     SVGSVGElement* svgElement =
       static_cast<SVGSVGElement*>(outerSVGFrame->GetContent());
 
     nsAutoString viewID;
     mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, viewID);
 
--- a/layout/svg/nsFilterInstance.cpp
+++ b/layout/svg/nsFilterInstance.cpp
@@ -44,17 +44,17 @@ nsFilterInstance::GetFilterDescription(n
     return FilterDescription();
   }
   return instance.ExtractDescriptionAndAdditionalImages(aOutAdditionalImages);
 }
 
 static UniquePtr<UserSpaceMetrics>
 UserSpaceMetricsForFrame(nsIFrame* aFrame)
 {
-  if (aFrame->GetContent()->IsSVG()) {
+  if (aFrame->GetContent()->IsSVGElement()) {
     nsSVGElement* element = static_cast<nsSVGElement*>(aFrame->GetContent());
     return MakeUnique<SVGElementMetrics>(element);
   }
   return MakeUnique<NonSVGFrameUserSpaceMetrics>(aFrame);
 }
 
 nsresult
 nsFilterInstance::PaintFilteredFrame(nsIFrame *aFilteredFrame,
--- a/layout/svg/nsSVGAFrame.cpp
+++ b/layout/svg/nsSVGAFrame.cpp
@@ -74,17 +74,17 @@ NS_IMPL_FRAMEARENA_HELPERS(nsSVGAFrame)
 //----------------------------------------------------------------------
 // nsIFrame methods
 #ifdef DEBUG
 void
 nsSVGAFrame::Init(nsIContent*       aContent,
                   nsContainerFrame* aParent,
                   nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::a),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::a),
                "Trying to construct an SVGAFrame for a "
                "content element that doesn't support the right interfaces");
 
   nsSVGAFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsresult
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -123,17 +123,17 @@ nsSVGClipPathFrame::ApplyClipOrPaintClip
         } else {
           aContext.PushGroup(gfxContentType::ALPHA);
         }
       }
 
       gfxMatrix toChildsUserSpace = mMatrixForChildren;
       nsIFrame* child = do_QueryFrame(SVGFrame);
       nsIContent* childContent = child->GetContent();
-      if (childContent->IsSVG()) {
+      if (childContent->IsSVGElement()) {
         toChildsUserSpace =
           static_cast<const nsSVGElement*>(childContent)->
             PrependLocalTransformsTo(mMatrixForChildren,
                                      nsSVGElement::eUserSpaceToParent);
       }
       SVGFrame->PaintSVG(aContext, toChildsUserSpace);
 
       if (clipPathFrame) {
@@ -323,17 +323,17 @@ nsSVGClipPathFrame::AttributeChanged(int
                                                   aAttribute, aModType);
 }
 
 void
 nsSVGClipPathFrame::Init(nsIContent*       aContent,
                          nsContainerFrame* aParent,
                          nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::clipPath),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::clipPath),
                "Content is not an SVG clipPath!");
 
   AddStateBits(NS_STATE_SVG_CLIPPATH_CHILD);
   nsSVGClipPathFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 
 nsIAtom *
 nsSVGClipPathFrame::GetType() const
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -139,17 +139,17 @@ nsSVGDisplayContainerFrame::Init(nsICont
 }
 
 void
 nsSVGDisplayContainerFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                              const nsRect&           aDirtyRect,
                                              const nsDisplayListSet& aLists)
 {
   // mContent could be a XUL element so check for an SVG element before casting
-  if (mContent->IsSVG() &&
+  if (mContent->IsSVGElement() &&
       !static_cast<const nsSVGElement*>(mContent)->HasValidDimensions()) {
     return;
   }
   return BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, aLists);
 }
 
 void
 nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID,
@@ -223,17 +223,17 @@ nsSVGDisplayContainerFrame::IsSVGTransfo
   nsIFrame *parent = GetParent();
   if (parent &&
       parent->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
     foundTransform = static_cast<nsSVGContainerFrame*>(parent)->
                        HasChildrenOnlyTransform(aFromParentTransform);
   }
 
   // mContent could be a XUL element so check for an SVG element before casting
-  if (mContent->IsSVG()) {
+  if (mContent->IsSVGElement()) {
     nsSVGElement *content = static_cast<nsSVGElement*>(mContent);
     nsSVGAnimatedTransformList* transformList =
       content->GetAnimatedTransformList();
     if ((transformList && transformList->HasTransform()) ||
         content->GetAnimateMotionTransform()) {
       if (aOwnTransform) {
         *aOwnTransform = gfx::ToMatrix(content->PrependLocalTransformsTo(gfxMatrix(),
                                     nsSVGElement::eUserSpaceToParent));
@@ -259,32 +259,32 @@ nsSVGDisplayContainerFrame::PaintSVG(gfx
                "SVG should take this code path");
 
   const nsStyleDisplay *display = StyleDisplay();
   if (display->mOpacity == 0.0) {
     return NS_OK;
   }
 
   gfxMatrix matrix = aTransform;
-  if (GetContent()->IsSVG()) { // must check before cast
+  if (GetContent()->IsSVGElement()) { // must check before cast
     matrix = static_cast<const nsSVGElement*>(GetContent())->
                PrependLocalTransformsTo(matrix,
                                         nsSVGElement::eChildToUserSpace);
     if (matrix.IsSingular()) {
       return NS_OK;
     }
   }
 
   for (nsIFrame* kid = mFrames.FirstChild(); kid;
        kid = kid->GetNextSibling()) {
     gfxMatrix m = matrix;
     // PaintFrameWithEffects() expects the transform that is passed to it to
     // include the transform to the passed frame's user space, so add it:
     const nsIContent* content = kid->GetContent();
-    if (content->IsSVG()) { // must check before cast
+    if (content->IsSVGElement()) { // must check before cast
       const nsSVGElement* element = static_cast<const nsSVGElement*>(content);
       if (!element->HasValidDimensions()) {
         continue; // nothing to paint for kid
       }
       m = element->
             PrependLocalTransformsTo(m, nsSVGElement::eUserSpaceToParent);
       if (m.IsSingular()) {
         continue;
@@ -362,17 +362,17 @@ nsSVGDisplayContainerFrame::ReflowSVG()
     } else {
       // Inside a non-display container frame, we might have some
       // SVGTextFrames.  We need to cause those to get reflowed in
       // case they are the target of a rendering observer.
       NS_ASSERTION(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY,
                    "expected kid to be a NS_FRAME_IS_NONDISPLAY frame");
       if (kid->GetStateBits() & NS_FRAME_IS_DIRTY) {
         nsSVGContainerFrame* container = do_QueryFrame(kid);
-        if (container && container->GetContent()->IsSVG()) {
+        if (container && container->GetContent()->IsSVGElement()) {
           ReflowSVGNonDisplayText(container);
         }
       }
     }
   }
 
   // <svg> can create an SVG viewport with an offset due to its
   // x/y/width/height attributes, and <use> can introduce an offset with an
@@ -418,21 +418,21 @@ nsSVGDisplayContainerFrame::GetBBoxContr
 {
   SVGBBox bboxUnion;
 
   nsIFrame* kid = mFrames.FirstChild();
   while (kid) {
     nsIContent *content = kid->GetContent();
     nsISVGChildFrame* svgKid = do_QueryFrame(kid);
     // content could be a XUL element so check for an SVG element before casting
-    if (svgKid && (!content->IsSVG() ||
+    if (svgKid && (!content->IsSVGElement() ||
                    static_cast<const nsSVGElement*>(content)->HasValidDimensions())) {
 
       gfxMatrix transform = gfx::ThebesMatrix(aToBBoxUserspace);
-      if (content->IsSVG()) {
+      if (content->IsSVGElement()) {
         transform = static_cast<nsSVGElement*>(content)->
                       PrependLocalTransformsTo(transform);
       }
       // We need to include zero width/height vertical/horizontal lines, so we have
       // to use UnionEdges.
       bboxUnion.UnionEdges(svgKid->GetBBoxContribution(gfx::ToMatrix(transform), aFlags));
     }
     kid = kid->GetNextSibling();
--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -362,17 +362,17 @@ nsSVGMarkerProperty::DoUpdate()
   frame->PresContext()->RestyleManager()->PostRestyleEvent(
     frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint);
 }
 
 bool
 nsSVGTextPathProperty::TargetIsValid()
 {
   Element* target = GetTarget();
-  return target && target->IsSVG(nsGkAtoms::path);
+  return target && target->IsSVGElement(nsGkAtoms::path);
 }
 
 void
 nsSVGTextPathProperty::DoUpdate()
 {
   nsSVGRenderingObserverProperty::DoUpdate();
 
   nsIFrame* frame = mFrameReference.Get();
--- a/layout/svg/nsSVGFilterFrame.cpp
+++ b/layout/svg/nsSVGFilterFrame.cpp
@@ -184,17 +184,17 @@ nsSVGFilterFrame::AttributeChanged(int32
 }
 
 #ifdef DEBUG
 void
 nsSVGFilterFrame::Init(nsIContent*       aContent,
                        nsContainerFrame* aParent,
                        nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::filter),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::filter),
                "Content is not an SVG filter");
 
   nsSVGFilterFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 nsSVGFilterFrame::GetType() const
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -51,17 +51,17 @@ NS_QUERYFRAME_HEAD(nsSVGForeignObjectFra
   NS_QUERYFRAME_ENTRY(nsISVGChildFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsSVGForeignObjectFrameBase)
 
 void
 nsSVGForeignObjectFrame::Init(nsIContent*       aContent,
                               nsContainerFrame* aParent,
                               nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::foreignObject),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::foreignObject),
                "Content is not an SVG foreignObject!");
 
   nsSVGForeignObjectFrameBase::Init(aContent, aParent, aPrevInFlow);
   AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD);
   AddStateBits(NS_FRAME_FONT_INFLATION_CONTAINER |
                NS_FRAME_FONT_INFLATION_FLOW_ROOT);
   if (!(mState & NS_FRAME_IS_NONDISPLAY)) {
     nsSVGUtils::GetOuterSVGFrame(this)->RegisterForeignObject(this);
--- a/layout/svg/nsSVGGFrame.cpp
+++ b/layout/svg/nsSVGGFrame.cpp
@@ -28,17 +28,17 @@ NS_NewSVGGFrame(nsIPresShell* aPresShell
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGGFrame)
 
 #ifdef DEBUG
 void
 nsSVGGFrame::Init(nsIContent*       aContent,
                   nsContainerFrame* aParent,
                   nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG() &&
+  NS_ASSERTION(aContent->IsSVGElement() &&
                static_cast<nsSVGElement*>(aContent)->IsTransformable(),
                "The element doesn't support nsIDOMSVGTransformable");
 
   nsSVGGFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
--- a/layout/svg/nsSVGGradientFrame.cpp
+++ b/layout/svg/nsSVGGradientFrame.cpp
@@ -193,17 +193,17 @@ nsSVGGradientFrame::GetRadialGradientWit
 
 //helper
 static void GetStopInformation(nsIFrame* aStopFrame,
                                float *aOffset,
                                nscolor *aStopColor,
                                float *aStopOpacity)
 {
   nsIContent* stopContent = aStopFrame->GetContent();
-  MOZ_ASSERT(stopContent && stopContent->IsSVG(nsGkAtoms::stop));
+  MOZ_ASSERT(stopContent && stopContent->IsSVGElement(nsGkAtoms::stop));
 
   static_cast<SVGStopElement*>(stopContent)->
     GetAnimatedNumberValues(aOffset, nullptr);
 
   *aOffset = mozilla::clamped(*aOffset, 0.0f, 1.0f);
   *aStopColor = aStopFrame->StyleSVGReset()->mStopColor;
   *aStopOpacity = aStopFrame->StyleSVGReset()->mStopOpacity;
 }
@@ -405,17 +405,17 @@ nsSVGGradientFrame::GetStopFrames(nsTArr
 // -------------------------------------------------------------------------
 
 #ifdef DEBUG
 void
 nsSVGLinearGradientFrame::Init(nsIContent*       aContent,
                                nsContainerFrame* aParent,
                                nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::linearGradient),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::linearGradient),
                "Content is not an SVG linearGradient");
 
   nsSVGLinearGradientFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom*
 nsSVGLinearGradientFrame::GetType() const
@@ -514,17 +514,17 @@ nsSVGLinearGradientFrame::CreateGradient
 // -------------------------------------------------------------------------
 
 #ifdef DEBUG
 void
 nsSVGRadialGradientFrame::Init(nsIContent*       aContent,
                                nsContainerFrame* aParent,
                                nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::radialGradient),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::radialGradient),
                "Content is not an SVG radialGradient");
 
   nsSVGRadialGradientFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom*
 nsSVGRadialGradientFrame::GetType() const
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -137,17 +137,17 @@ nsSVGImageFrame::~nsSVGImageFrame()
   mListener = nullptr;
 }
 
 void
 nsSVGImageFrame::Init(nsIContent*       aContent,
                       nsContainerFrame* aParent,
                       nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::image),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::image),
                "Content is not an SVG image!");
 
   nsSVGImageFrameBase::Init(aContent, aParent, aPrevInFlow);
 
   mListener = new nsSVGImageListener(this);
   nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
   if (!imageLoader) {
     NS_RUNTIMEABORT("Why is this not an image loading content?");
--- a/layout/svg/nsSVGInnerSVGFrame.cpp
+++ b/layout/svg/nsSVGInnerSVGFrame.cpp
@@ -36,17 +36,17 @@ NS_QUERYFRAME_HEAD(nsSVGInnerSVGFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsSVGInnerSVGFrameBase)
 
 #ifdef DEBUG
 void
 nsSVGInnerSVGFrame::Init(nsIContent*       aContent,
                          nsContainerFrame* aParent,
                          nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::svg),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg),
                "Content is not an SVG 'svg' element!");
 
   nsSVGInnerSVGFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 nsSVGInnerSVGFrame::GetType() const
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -432,17 +432,17 @@ nsSVGIntegrationUtils::PaintFramesWithEf
    *
    * + Merge opacity and masking if both used together.
    */
 
   const nsIContent* content = aFrame->GetContent();
   bool hasSVGLayout = (aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT);
   if (hasSVGLayout) {
     nsISVGChildFrame *svgChildFrame = do_QueryFrame(aFrame);
-    if (!svgChildFrame || !aFrame->GetContent()->IsSVG()) {
+    if (!svgChildFrame || !aFrame->GetContent()->IsSVGElement()) {
       NS_ASSERTION(false, "why?");
       return;
     }
     if (!static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
       return; // The SVG spec says not to draw _anything_
     }
   }
 
--- a/layout/svg/nsSVGMarkerFrame.cpp
+++ b/layout/svg/nsSVGMarkerFrame.cpp
@@ -49,17 +49,17 @@ nsSVGMarkerFrame::AttributeChanged(int32
 }
 
 #ifdef DEBUG
 void
 nsSVGMarkerFrame::Init(nsIContent*       aContent,
                        nsContainerFrame* aParent,
                        nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::marker), "Content is not an SVG marker");
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::marker), "Content is not an SVG marker");
 
   nsSVGMarkerFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 nsSVGMarkerFrame::GetType() const
 {
--- a/layout/svg/nsSVGMaskFrame.cpp
+++ b/layout/svg/nsSVGMaskFrame.cpp
@@ -268,17 +268,17 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gf
   for (nsIFrame* kid = mFrames.FirstChild(); kid;
        kid = kid->GetNextSibling()) {
     // The CTM of each frame referencing us can be different
     nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
     if (SVGFrame) {
       SVGFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
     }
     gfxMatrix m = mMatrixForChildren;
-    if (kid->GetContent()->IsSVG()) {
+    if (kid->GetContent()->IsSVGElement()) {
       m = static_cast<nsSVGElement*>(kid->GetContent())->
             PrependLocalTransformsTo(m);
     }
     nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m);
   }
 
   RefPtr<SourceSurface> maskSnapshot = maskDT->Snapshot();
   if (!maskSnapshot) {
@@ -356,17 +356,17 @@ nsSVGMaskFrame::AttributeChanged(int32_t
 }
 
 #ifdef DEBUG
 void
 nsSVGMaskFrame::Init(nsIContent*       aContent,
                      nsContainerFrame* aParent,
                      nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::mask),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::mask),
                "Content is not an SVG mask");
 
   nsSVGMaskFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 nsSVGMaskFrame::GetType() const
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -88,17 +88,17 @@ DependsOnIntrinsicSize(const nsIFrame* a
          !height.ConvertsToLength();
 }
 
 void
 nsSVGOuterSVGFrame::Init(nsIContent*       aContent,
                          nsContainerFrame* aParent,
                          nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::svg),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg),
                "Content is not an SVG 'svg' element!");
 
   AddStateBits(NS_STATE_IS_OUTER_SVG |
                NS_FRAME_FONT_INFLATION_CONTAINER |
                NS_FRAME_FONT_INFLATION_FLOW_ROOT);
 
   // Check for conditional processing attributes here rather than in
   // nsCSSFrameConstructor::FindSVGData because we want to avoid
--- a/layout/svg/nsSVGPatternFrame.cpp
+++ b/layout/svg/nsSVGPatternFrame.cpp
@@ -100,17 +100,17 @@ nsSVGPatternFrame::AttributeChanged(int3
 }
 
 #ifdef DEBUG
 void
 nsSVGPatternFrame::Init(nsIContent*       aContent,
                         nsContainerFrame* aParent,
                         nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::pattern), "Content is not an SVG pattern");
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::pattern), "Content is not an SVG pattern");
 
   nsSVGPatternFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom*
 nsSVGPatternFrame::GetType() const
 {
@@ -401,17 +401,17 @@ nsSVGPatternFrame::PaintPattern(const Dr
     for (nsIFrame* kid = firstKid; kid;
          kid = kid->GetNextSibling()) {
       // The CTM of each frame referencing us can be different
       nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
       if (SVGFrame) {
         SVGFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
       }
       gfxMatrix tm = *(patternWithChildren->mCTM);
-      if (kid->GetContent()->IsSVG()) {
+      if (kid->GetContent()->IsSVGElement()) {
         tm = static_cast<nsSVGElement*>(kid->GetContent())->
               PrependLocalTransformsTo(tm, nsSVGElement::eUserSpaceToParent);
       }
       nsSVGUtils::PaintFrameWithEffects(kid, *gfx, tm);
     }
     patternWithChildren->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
   }
 
@@ -642,34 +642,34 @@ nsSVGPatternFrame::ConstructCTM(const ns
   gfxMatrix tCTM;
   SVGSVGElement *ctx = nullptr;
   nsIContent* targetContent = aTarget->GetContent();
 
   // The objectBoundingBox conversion must be handled in the CTM:
   if (IncludeBBoxScale(aViewBox, aPatternContentUnits, aPatternUnits)) {
     tCTM.Scale(callerBBox.Width(), callerBBox.Height());
   } else {
-    if (targetContent->IsSVG()) {
+    if (targetContent->IsSVGElement()) {
       ctx = static_cast<nsSVGElement*>(targetContent)->GetCtx();
     }
     float scale = MaxExpansion(callerCTM);
     tCTM.Scale(scale, scale);
   }
 
   if (!aViewBox.IsExplicitlySet()) {
     return tCTM;
   }
   const nsSVGViewBoxRect viewBoxRect = aViewBox.GetAnimValue();
 
   if (viewBoxRect.height <= 0.0f || viewBoxRect.width <= 0.0f) {
     return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
   }
 
   float viewportWidth, viewportHeight;
-  if (targetContent->IsSVG()) {
+  if (targetContent->IsSVGElement()) {
     // If we're dealing with an SVG target only retrieve the context once.
     // Calling the nsIFrame* variant of GetAnimValue would look it up on
     // every call.
     viewportWidth =
       GetLengthValue(SVGPatternElement::ATTR_WIDTH)->GetAnimValue(ctx);
     viewportHeight =
       GetLengthValue(SVGPatternElement::ATTR_HEIGHT)->GetAnimValue(ctx);
   } else {
--- a/layout/svg/nsSVGStopFrame.cpp
+++ b/layout/svg/nsSVGStopFrame.cpp
@@ -74,17 +74,17 @@ NS_IMPL_FRAMEARENA_HELPERS(nsSVGStopFram
 // nsIFrame methods:
 
 #ifdef DEBUG
 void
 nsSVGStopFrame::Init(nsIContent*       aContent,
                      nsContainerFrame* aParent,
                      nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::stop), "Content is not a stop element");
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::stop), "Content is not a stop element");
 
   nsSVGStopFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 nsSVGStopFrame::GetType() const
 {
--- a/layout/svg/nsSVGSwitchFrame.cpp
+++ b/layout/svg/nsSVGSwitchFrame.cpp
@@ -75,17 +75,17 @@ NS_NewSVGSwitchFrame(nsIPresShell* aPres
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGSwitchFrame)
 
 #ifdef DEBUG
 void
 nsSVGSwitchFrame::Init(nsIContent*       aContent,
                        nsContainerFrame* aParent,
                        nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::svgSwitch),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svgSwitch),
                "Content is not an SVG switch");
 
   nsSVGSwitchFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 #endif /* DEBUG */
 
 nsIAtom *
 nsSVGSwitchFrame::GetType() const
@@ -115,17 +115,17 @@ nsSVGSwitchFrame::PaintSVG(gfxContext& a
                "SVG should take this code path");
 
   if (StyleDisplay()->mOpacity == 0.0)
     return NS_OK;
 
   nsIFrame *kid = GetActiveChildFrame();
   if (kid) {
     gfxMatrix tm = aTransform;
-    if (kid->GetContent()->IsSVG()) {
+    if (kid->GetContent()->IsSVGElement()) {
       tm = static_cast<nsSVGElement*>(kid->GetContent())->
              PrependLocalTransformsTo(tm, nsSVGElement::eUserSpaceToParent);
     }
     nsSVGUtils::PaintFrameWithEffects(kid, aContext, tm, aDirtyRect);
   }
   return NS_OK;
 }
 
@@ -236,17 +236,17 @@ SVGBBox
 nsSVGSwitchFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
                                       uint32_t aFlags)
 {
   nsIFrame* kid = GetActiveChildFrame();
   nsISVGChildFrame* svgKid = do_QueryFrame(kid);
   if (svgKid) {
     nsIContent *content = kid->GetContent();
     gfxMatrix transform = ThebesMatrix(aToBBoxUserspace);
-    if (content->IsSVG()) {
+    if (content->IsSVGElement()) {
       transform = static_cast<nsSVGElement*>(content)->
                     PrependLocalTransformsTo(transform);
     }
     return svgKid->GetBBoxContribution(ToMatrix(transform), aFlags);
   }
   return SVGBBox();
 }
 
--- a/layout/svg/nsSVGUseFrame.cpp
+++ b/layout/svg/nsSVGUseFrame.cpp
@@ -98,17 +98,17 @@ NS_QUERYFRAME_TAIL_INHERITING(nsSVGUseFr
 //----------------------------------------------------------------------
 // nsIFrame methods:
 
 void
 nsSVGUseFrame::Init(nsIContent*       aContent,
                     nsContainerFrame* aParent,
                     nsIFrame*         aPrevInFlow)
 {
-  NS_ASSERTION(aContent->IsSVG(nsGkAtoms::use),
+  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::use),
                "Content is not an SVG use!");
 
   mHasValidDimensions =
     static_cast<SVGUseElement*>(aContent)->HasValidDimensions();
 
   nsSVGUseFrameBase::Init(aContent, aParent, aPrevInFlow);
 }
 
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -485,17 +485,17 @@ nsSVGUtils::PaintFrameWithEffects(nsIFra
   if (!svgChildFrame)
     return;
 
   float opacity = aFrame->StyleDisplay()->mOpacity;
   if (opacity == 0.0f)
     return;
 
   const nsIContent* content = aFrame->GetContent();
-  if (content->IsSVG() &&
+  if (content->IsSVGElement() &&
       !static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
     return;
   }
 
   /* Properties are added lazily and may have been removed by a restyle,
      so make sure all applicable ones are set again. */
 
   nsSVGEffects::EffectProperties effectProperties =
@@ -701,17 +701,17 @@ nsSVGUtils::HitTestClip(nsIFrame *aFrame
 
 nsIFrame *
 nsSVGUtils::HitTestChildren(nsSVGDisplayContainerFrame* aFrame,
                             const gfxPoint& aPoint)
 {
   // First we transform aPoint into the coordinate space established by aFrame
   // for its children (e.g. take account of any 'viewBox' attribute):
   gfxPoint point = aPoint;
-  if (aFrame->GetContent()->IsSVG()) { // must check before cast
+  if (aFrame->GetContent()->IsSVGElement()) { // must check before cast
     gfxMatrix m = static_cast<const nsSVGElement*>(aFrame->GetContent())->
                     PrependLocalTransformsTo(gfxMatrix(),
                                              nsSVGElement::eChildToUserSpace);
     if (!m.IsIdentity()) {
       if (!m.Invert()) {
         return nullptr;
       }
       point = m.Transform(point);
@@ -722,24 +722,24 @@ nsSVGUtils::HitTestChildren(nsSVGDisplay
   // the topmost frame that intersects the point; then we can just return it.
   nsIFrame* result = nullptr;
   for (nsIFrame* current = aFrame->PrincipalChildList().LastChild();
        current;
        current = current->GetPrevSibling()) {
     nsISVGChildFrame* SVGFrame = do_QueryFrame(current);
     if (SVGFrame) {
       const nsIContent* content = current->GetContent();
-      if (content->IsSVG() &&
+      if (content->IsSVGElement() &&
           !static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
         continue;
       }
       // GetFrameForPoint() expects a point in its frame's SVG user space, so
       // we need to convert to that space:
       gfxPoint p = point;
-      if (content->IsSVG()) { // must check before cast
+      if (content->IsSVGElement()) { // must check before cast
         gfxMatrix m = static_cast<const nsSVGElement*>(content)->
                         PrependLocalTransformsTo(gfxMatrix(),
                                                  nsSVGElement::eUserSpaceToParent);
         if (!m.IsIdentity()) {
           if (!m.Invert()) {
             continue;
           }
           p = m.Transform(p);
@@ -894,29 +894,29 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, ui
       if (ancestor && ancestor->IsSVGText()) {
         while (ancestor->GetType() != nsGkAtoms::svgTextFrame) {
           ancestor = ancestor->GetParent();
         }
       }
       svg = do_QueryFrame(ancestor);
     }
     nsIContent* content = aFrame->GetContent();
-    if (content->IsSVG() &&
+    if (content->IsSVGElement() &&
         !static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
       return bbox;
     }
     gfxMatrix matrix;
     if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame ||
         aFrame->GetType() == nsGkAtoms::svgUseFrame) {
       // The spec says getBBox "Returns the tight bounding box in *current user
       // space*". So we should really be doing this for all elements, but that
       // needs investigation to check that we won't break too much content.
       // NOTE: When changing this to apply to other frame types, make sure to
       // also update nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset.
-      MOZ_ASSERT(content->IsSVG(), "bad cast");
+      MOZ_ASSERT(content->IsSVGElement(), "bad cast");
       nsSVGElement *element = static_cast<nsSVGElement*>(content);
       matrix = element->PrependLocalTransformsTo(matrix,
                           nsSVGElement::eChildToUserSpace);
     }
     bbox = svg->GetBBoxContribution(ToMatrix(matrix), aFlags).ToThebesRect();
     // Account for 'clipped'.
     if (aFlags & nsSVGUtils::eBBoxIncludeClipped) {
       gfxRect clipRect(0, 0, 0, 0);
@@ -1033,17 +1033,17 @@ nsSVGUtils::GetRelativeRect(uint16_t aUn
 gfxRect
 nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2 *aXYWH,
                             const gfxRect& aBBox, nsIFrame *aFrame)
 {
   if (aUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
     return GetBoundingBoxRelativeRect(aXYWH, aBBox);
   }
   nsIContent* content = aFrame->GetContent();
-  if (content->IsSVG()) {
+  if (content->IsSVGElement()) {
     nsSVGElement* svgElement = static_cast<nsSVGElement*>(content);
     return GetRelativeRect(aUnits, aXYWH, aBBox, SVGElementMetrics(svgElement));
   }
   return GetRelativeRect(aUnits, aXYWH, aBBox, NonSVGFrameUserSpaceMetrics(aFrame));
 }
 
 bool
 nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame)
@@ -1109,17 +1109,17 @@ nsSVGUtils::GetNonScalingStrokeTransform
     aFrame = aFrame->GetParent();
   }
 
   if (!aFrame->StyleSVGReset()->HasNonScalingStroke()) {
     return false;
   }
 
   nsIContent *content = aFrame->GetContent();
-  MOZ_ASSERT(content->IsSVG(), "bad cast");
+  MOZ_ASSERT(content->IsSVGElement(), "bad cast");
 
   *aUserToOuterSVG = ThebesMatrix(SVGContentUtils::GetCTM(
                        static_cast<nsSVGElement*>(content), true));
 
   return !aUserToOuterSVG->IsIdentity();
 }
 
 // The logic here comes from _cairo_stroke_style_max_distance_from_path
@@ -1590,17 +1590,17 @@ nsSVGUtils::PaintSVGGlyph(Element* aElem
   nsIFrame* frame = aElement->GetPrimaryFrame();
   nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
   if (!svgFrame) {
     return false;
   }
   aContext->GetDrawTarget()->AddUserData(&gfxTextContextPaint::sUserDataKey,
                                          aContextPaint, nullptr);
   gfxMatrix m;
-  if (frame->GetContent()->IsSVG()) {
+  if (frame->GetContent()->IsSVGElement()) {
     // PaintSVG() expects the passed transform to be the transform to its own
     // SVG user space, so we need to account for any 'transform' attribute:
     m = static_cast<nsSVGElement*>(frame->GetContent())->
           PrependLocalTransformsTo(gfxMatrix(), nsSVGElement::eUserSpaceToParent);
   }
   nsresult rv = svgFrame->PaintSVG(*aContext, m);
   return NS_SUCCEEDED(rv);
 }
@@ -1613,17 +1613,17 @@ nsSVGUtils::GetSVGGlyphExtents(Element* 
   nsIFrame* frame = aElement->GetPrimaryFrame();
   nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
   if (!svgFrame) {
     return false;
   }
 
   gfxMatrix transform(aSVGToAppSpace);
   nsIContent* content = frame->GetContent();
-  if (content->IsSVG()) {
+  if (content->IsSVGElement()) {
     transform = static_cast<nsSVGElement*>(content)->
                   PrependLocalTransformsTo(aSVGToAppSpace);
   }
 
   *aResult = svgFrame->GetBBoxContribution(gfx::ToMatrix(transform),
     nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeFillGeometry |
     nsSVGUtils::eBBoxIncludeStroke | nsSVGUtils::eBBoxIncludeStrokeGeometry |
     nsSVGUtils::eBBoxIncludeMarkers).ToThebesRect();
--- a/layout/xul/nsBox.cpp
+++ b/layout/xul/nsBox.cpp
@@ -463,17 +463,17 @@ nsBox::GetFlex(nsBoxLayoutState& aState)
 
 uint32_t
 nsIFrame::GetOrdinal()
 {
   uint32_t ordinal = StyleXUL()->mBoxOrdinal;
 
   // When present, attribute value overrides CSS.
   nsIContent* content = GetContent();
-  if (content && content->IsXUL()) {
+  if (content && content->IsXULElement()) {
     nsresult error;
     nsAutoString value;
 
     content->GetAttr(kNameSpaceID_None, nsGkAtoms::ordinal, value);
     if (!value.IsEmpty()) {
       ordinal = value.ToInteger(&error);
     }
   }
@@ -635,17 +635,17 @@ nsIFrame::AddCSSPrefSize(nsIFrame* aBox,
             aHeightSet = true;
         }
     }
 
     nsIContent* content = aBox->GetContent();
     // ignore 'height' and 'width' attributes if the actual element is not XUL
     // For example, we might be magic XUL frames whose primary content is an HTML
     // <select>
-    if (content && content->IsXUL()) {
+    if (content && content->IsXULElement()) {
         nsAutoString value;
         nsresult error;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
         if (!value.IsEmpty()) {
             value.Trim("%");
 
             aSize.width =
@@ -736,17 +736,17 @@ nsIFrame::AddCSSMinSize(nsBoxLayoutState
           "Non-zero percentage values not currently supported");
         aSize.height = 0;
         aHeightSet = true; // FIXME: should we really do this for
                               // nonzero values?
     }
     // calc() with percentage is treated like '0' (unset)
 
     nsIContent* content = aBox->GetContent();
-    if (content && content->IsXUL()) {
+    if (content && content->IsXULElement()) {
         nsAutoString value;
         nsresult error;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::minwidth, value);
         if (!value.IsEmpty())
         {
             value.Trim("%");
 
@@ -799,17 +799,17 @@ nsIFrame::AddCSSMaxSize(nsIFrame* aBox, 
     const nsStyleCoord &maxHeight = position->mMaxHeight;
     if (maxHeight.ConvertsToLength()) {
         aSize.height = nsRuleNode::ComputeCoordPercentCalc(maxHeight, 0);
         aHeightSet = true;
     }
     // percentages and calc() with percentages are treated like 'none'
 
     nsIContent* content = aBox->GetContent();
-    if (content && content->IsXUL()) {
+    if (content && content->IsXULElement()) {
         nsAutoString value;