Backed out changeset 4aa19414e651 (bug 488249) to fix test orange.
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 24 Aug 2009 20:51:57 -0400
changeset 31803 2e8b6f1bf670fc64652d0f82cd140fc339b96daf
parent 31802 7687616b2a35d841691da03b55eb482965eb1548
child 31804 35cb659d031c6acd8351b995823121bc86eec0fc
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs488249
milestone1.9.3a1pre
backs out4aa19414e651669fa16f4c4a5ac53567f8f471c9
Backed out changeset 4aa19414e651 (bug 488249) to fix test orange.
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessibleTreeWalker.cpp
accessible/src/base/nsCoreUtils.cpp
accessible/src/base/nsTextEquivUtils.cpp
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHyperTextAccessible.cpp
content/base/public/nsIContent.h
content/base/public/nsINode.h
content/base/src/mozSanitizingSerializer.cpp
content/base/src/nsContentUtils.cpp
content/base/src/nsCopySupport.cpp
content/base/src/nsDOMAttributeMap.cpp
content/base/src/nsDocument.cpp
content/base/src/nsFrameLoader.cpp
content/base/src/nsGenericElement.cpp
content/base/src/nsNodeUtils.cpp
content/base/src/nsObjectLoadingContent.cpp
content/base/src/nsPlainTextSerializer.cpp
content/base/src/nsScriptElement.cpp
content/base/src/nsXHTMLContentSerializer.cpp
content/base/src/nsXMLContentSerializer.cpp
content/events/src/nsContentEventHandler.cpp
content/events/src/nsEventStateManager.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
content/html/content/src/nsHTMLMediaElement.cpp
content/html/content/src/nsHTMLOptGroupElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/content/src/nsHTMLSelectElement.cpp
content/html/content/src/nsHTMLTableCellElement.cpp
content/html/content/src/nsHTMLTableRowElement.cpp
content/html/document/src/nsHTMLDocument.cpp
content/mathml/content/src/nsMathMLElement.cpp
content/svg/content/src/nsSVGElement.cpp
content/svg/content/src/nsSVGLength2.cpp
content/xbl/src/nsXBLContentSink.cpp
content/xbl/src/nsXBLPrototypeHandler.cpp
content/xbl/src/nsXBLService.cpp
content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp
content/xslt/src/xpath/txXPathTreeWalker.h
content/xslt/src/xslt/txMozillaXMLOutput.cpp
content/xul/content/src/nsXULElement.cpp
content/xul/content/src/nsXULElement.h
content/xul/templates/src/nsXULContentBuilder.cpp
content/xul/templates/src/nsXULSortService.cpp
content/xul/templates/src/nsXULTemplateBuilder.cpp
docshell/base/nsDocShell.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsFocusManager.cpp
embedding/components/find/src/nsFind.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsPresShell.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsImageMap.cpp
layout/generic/nsInlineFrame.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsSelection.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/printing/nsPrintEngine.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsHTMLStyleSheet.cpp
layout/style/nsStyleUtil.cpp
layout/svg/base/src/nsSVGContainerFrame.cpp
layout/svg/base/src/nsSVGSwitchFrame.cpp
layout/xul/base/src/nsBox.cpp
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeContentView.cpp
toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
widget/src/gtk2/nsNativeThemeGTK.cpp
widget/src/windows/nsNativeThemeWin.cpp
widget/src/xpwidgets/nsNativeTheme.cpp
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1478,17 +1478,17 @@ NS_IMETHODIMP nsAccessibilityService::Ge
         *aIsHidden = PR_TRUE;
         return NS_OK;
       }
     }
     frame->GetAccessible(getter_AddRefs(newAcc));
     return InitAccessible(newAcc, aAccessible, nsnull);
   }
 
-  PRBool isHTML = content->IsHTML();
+  PRBool isHTML = content->IsNodeOfType(nsINode::eHTML);
   if (isHTML && content->Tag() == nsAccessibilityAtoms::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 doesn't have 'name' attribute (or has empty name attribute) then we
     // suppose it is used for links grouping. Otherwise we think it is used in
     // conjuction 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
     // (nsHTMLAreaAccessible) the map contains are attached as children of the
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -293,19 +293,19 @@ nsAccessible::GetName(nsAString& aName)
 
   // In the end get the name from tooltip.
   nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
   if (!content)
     return NS_OK;
 
   nsIAtom *tooltipAttr = nsnull;
 
-  if (content->IsHTML())
+  if (content->IsNodeOfType(nsINode::eHTML))
     tooltipAttr = nsAccessibilityAtoms::title;
-  else if (content->IsXUL())
+  else if (content->IsNodeOfType(nsINode::eXUL))
     tooltipAttr = nsAccessibilityAtoms::tooltiptext;
   else
     return NS_OK;
 
   // XXX: if CompressWhiteSpace worked on nsAString we could avoid a copy.
   nsAutoString name;
   if (content->GetAttr(kNameSpaceID_None, tooltipAttr, name)) {
     name.CompressWhitespace();
@@ -337,17 +337,17 @@ NS_IMETHODIMP nsAccessible::GetDescripti
   if (!content->IsNodeOfType(nsINode::eTEXT)) {
     nsAutoString description;
     nsresult rv = nsTextEquivUtils::
       GetTextEquivFromIDRefs(this, nsAccessibilityAtoms::aria_describedby,
                              description);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (description.IsEmpty()) {
-      PRBool isXUL = content->IsXUL();
+      PRBool isXUL = content->IsNodeOfType(nsINode::eXUL);
       if (isXUL) {
         // Try XUL <description control="[id]">description text</description>
         nsIContent *descriptionContent =
           nsCoreUtils::FindNeighbourPointingToNode(content,
                                                    nsAccessibilityAtoms::control,
                                                    nsAccessibilityAtoms::description);
 
         if (descriptionContent) {
@@ -1004,17 +1004,17 @@ nsAccessible::GetStateInternal(PRUint32 
     return NS_OK;  // On document, this is not an error
   }
 
   // Set STATE_UNAVAILABLE state based on disabled attribute
   // The disabled attribute is mostly used in XUL elements and HTML forms, but
   // if someone sets it on another attribute, 
   // it seems reasonable to consider it unavailable
   PRBool isDisabled;
-  if (content->IsHTML()) {
+  if (content->IsNodeOfType(nsINode::eHTML)) {
     // In HTML, just the presence of the disabled attribute means it is disabled,
     // therefore disabled="false" indicates disabled!
     isDisabled = content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::disabled);
   }
   else {
     isDisabled = content->AttrValueIs(kNameSpaceID_None,
                                       nsAccessibilityAtoms::disabled,
                                       nsAccessibilityAtoms::_true,
@@ -2405,17 +2405,17 @@ nsAccessible::GetRelationByType(PRUint32
 
   nsresult rv;
 
   switch (aRelationType)
   {
   case nsIAccessibleRelation::RELATION_LABEL_FOR:
     {
       if (content->Tag() == nsAccessibilityAtoms::label) {
-        nsIAtom *IDAttr = content->IsHTML() ?
+        nsIAtom *IDAttr = content->IsNodeOfType(nsINode::eHTML) ?
           nsAccessibilityAtoms::_for : nsAccessibilityAtoms::control;
         rv = nsRelUtils::
           AddTargetFromIDRefAttr(aRelationType, aRelation, content, IDAttr);
         NS_ENSURE_SUCCESS(rv, rv);
 
         if (rv != NS_OK_NO_RELATION_TARGET)
           return NS_OK; // XXX bug 381599, avoid performance problems
       }
@@ -2462,17 +2462,17 @@ nsAccessible::GetRelationByType(PRUint32
         AddTargetFromNeighbour(aRelationType, aRelation, content,
                                nsAccessibilityAtoms::aria_describedby);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (rv != NS_OK_NO_RELATION_TARGET)
         return NS_OK; // XXX bug 381599, avoid performance problems
 
       if (content->Tag() == nsAccessibilityAtoms::description &&
-          content->IsXUL()) {
+          content->IsNodeOfType(nsINode::eXUL)) {
         // This affectively adds an optional control attribute to xul:description,
         // which only affects accessibility, by allowing the description to be
         // tied to a control.
         return nsRelUtils::
           AddTargetFromIDRefAttr(aRelationType, aRelation, content,
                                  nsAccessibilityAtoms::control);
       }
 
@@ -2546,17 +2546,17 @@ nsAccessible::GetRelationByType(PRUint32
     {
       return nsRelUtils::
         AddTargetFromNeighbour(aRelationType, aRelation, content,
                                nsAccessibilityAtoms::aria_flowto);
     }
 
   case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON:
     {
-      if (content->IsHTML()) {
+      if (content->IsNodeOfType(nsINode::eHTML)) {
         // HTML form controls implements nsIFormControl interface.
         nsCOMPtr<nsIFormControl> control(do_QueryInterface(content));
         if (control) {
           nsCOMPtr<nsIDOMHTMLFormElement> htmlform;
           control->GetForm(getter_AddRefs(htmlform));
           nsCOMPtr<nsIForm> form(do_QueryInterface(htmlform));
           if (form) {
             nsCOMPtr<nsIContent> formContent =
@@ -3093,20 +3093,20 @@ nsAccessible::GetARIAName(nsAString& aNa
 
 nsresult
 nsAccessible::GetNameInternal(nsAString& aName)
 {
   nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
   if (!content)
     return NS_OK;
 
-  if (content->IsHTML())
+  if (content->IsNodeOfType(nsINode::eHTML))
     return GetHTMLName(aName);
 
-  if (content->IsXUL())
+  if (content->IsNodeOfType(nsINode::eXUL))
     return GetXULName(aName);
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible private methods
 
--- a/accessible/src/base/nsAccessibleTreeWalker.cpp
+++ b/accessible/src/base/nsAccessibleTreeWalker.cpp
@@ -70,17 +70,17 @@ nsAccessibleTreeWalker::~nsAccessibleTre
   while (NS_SUCCEEDED(PopState()))
     /* do nothing */ ;
    MOZ_COUNT_DTOR(nsAccessibleTreeWalker);
 }
 
 void nsAccessibleTreeWalker::GetKids(nsIDOMNode *aParentNode)
 {
   nsCOMPtr<nsIContent> parentContent(do_QueryInterface(aParentNode));
-  if (!parentContent || !parentContent->IsHTML()) {
+  if (!parentContent || !parentContent->IsNodeOfType(nsINode::eHTML)) {
     mState.frame = nsnull;  // Don't walk frames in non-HTML content, just walk the DOM.
   }
 
   UpdateFrame(PR_TRUE);
 
   // Walk frames? UpdateFrame() sets this when it sees anonymous frames
   if (mState.siblingIndex == eSiblingsWalkFrames) {
     return;
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -755,17 +755,17 @@ nsCoreUtils::FindDescendantPointingToIDI
     }
   }
   return nsnull;
 }
 
 nsIContent*
 nsCoreUtils::GetLabelContent(nsIContent *aForNode)
 {
-  if (aForNode->IsXUL())
+  if (aForNode->IsNodeOfType(nsINode::eXUL))
     return FindNeighbourPointingToNode(aForNode, nsAccessibilityAtoms::control,
                                        nsAccessibilityAtoms::label);
 
   return GetHTMLLabelContent(aForNode);
 }
 
 nsIContent*
 nsCoreUtils::GetHTMLLabelContent(nsIContent *aForNode)
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -214,17 +214,17 @@ nsTextEquivUtils::AppendTextEquivFromTex
       if (isHTMLBlock && !aString->IsEmpty()) {
         aString->Append(PRUnichar(' '));
       }
     }
     
     return NS_OK;
   }
   
-  if (aContent->IsHTML() &&
+  if (aContent->IsNodeOfType(nsINode::eHTML) &&
       aContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
     aString->AppendLiteral("\r\n");
     return NS_OK;
   }
   
   return NS_OK_NO_NAME_CLAUSE_HANDLED;
 }
 
@@ -388,17 +388,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->IsNodeOfType(nsINode::eXUL)) {
     nsAutoString textEquivalent;
     nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl =
       do_QueryInterface(aContent);
 
     if (labeledEl) {
       labeledEl->GetLabel(textEquivalent);
     } else {
       if (aContent->NodeInfo()->Equals(nsAccessibilityAtoms::label,
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -403,17 +403,17 @@ nsHTMLSelectListAccessible::CacheOptSibl
   // Recursive helper for CacheChildren()
 
   PRUint32 numChildren = aParentContent->GetChildCount();
   nsCOMPtr<nsIAccessible> lastGoodAccessible(aLastGoodAccessible);
   nsCOMPtr<nsIAccessible> newAccessible;
 
   for (PRUint32 count = 0; count < numChildren; count ++) {
     nsIContent *childContent = aParentContent->GetChildAt(count);
-    if (!childContent->IsHTML()) {
+    if (!childContent->IsNodeOfType(nsINode::eHTML)) {
       continue;
     }
     nsCOMPtr<nsIAtom> tag = childContent->Tag();
     if (tag == nsAccessibilityAtoms::option || tag == nsAccessibilityAtoms::optgroup) {
       newAccessible = AccessibleForOption(aAccService,
                                            childContent,
                                            lastGoodAccessible,
                                            aChildCount);
@@ -830,17 +830,17 @@ nsresult nsHTMLSelectOptionAccessible::G
   }
 
   return rv;
 }
 
 void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOption)
 {
   if (!aPossibleOption || aPossibleOption->Tag() != nsAccessibilityAtoms::option ||
-      !aPossibleOption->IsHTML()) {
+      !aPossibleOption->IsNodeOfType(nsINode::eHTML)) {
     return;
   }
 
   nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(aPossibleOption));
   NS_ASSERTION(optionNode, "No option node for nsIContent with option tag!");
 
   nsCOMPtr<nsIAccessible> multiSelect =
     nsAccUtils::GetMultiSelectFor(optionNode);
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -628,17 +628,17 @@ nsresult nsHyperTextAccessible::DOMPoint
     }
   }
 
   // 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)
   nsCOMPtr<nsIAccessible> descendantAccessible;
   if (findNode) {
     nsCOMPtr<nsIContent> findContent = do_QueryInterface(findNode);
-    if (findContent->IsHTML() && 
+    if (findContent->IsNodeOfType(nsINode::eHTML) && 
         findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
       nsIContent *parent = findContent->GetParent();
       if (parent &&
           parent->IsRootOfNativeAnonymousSubtree() &&
           parent->GetChildCount() == 1) {
         // This <br> is the only node in a text control, therefore it is the hacky
         // "bogus node" used when there is no text in a control
         *aHyperTextOffset = 0;
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -242,36 +242,16 @@ public:
    * Get the NodeInfo for this element
    * @return the nodes node info
    */
   nsINodeInfo *NodeInfo() const
   {
     return mNodeInfo;
   }
 
-  inline PRBool IsInNamespace(PRInt32 aNamespace) const {
-    return mNodeInfo->NamespaceID() == aNamespace;
-  }
-
-  inline PRBool IsHTML() const {
-    return IsInNamespace(kNameSpaceID_XHTML);
-  }
-
-  inline PRBool IsSVG() const {
-    return IsInNamespace(kNameSpaceID_SVG);
-  }
-
-  inline PRBool IsXUL() const {
-    return IsInNamespace(kNameSpaceID_XUL);
-  }
-
-  inline PRBool IsMathML() const {
-    return IsInNamespace(kNameSpaceID_MathML);
-  }
-
   /**
    * Returns an atom holding the name of the attribute of type ID on
    * this content node (if applicable).  Returns null for non-element
    * content nodes.
    */
   virtual nsIAtom *GetIDAttributeName() const = 0;
 
   /**
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -288,31 +288,38 @@ public:
     /** elements */
     eELEMENT             = 1 << 3,
     /** text nodes */
     eTEXT                = 1 << 4,
     /** xml processing instructions */
     ePROCESSING_INSTRUCTION = 1 << 5,
     /** comment nodes */
     eCOMMENT             = 1 << 6,
+    /** html elements */
+    eHTML                = 1 << 7,
     /** form control elements */
-    eHTML_FORM_CONTROL   = 1 << 7,
+    eHTML_FORM_CONTROL   = 1 << 8,
     /** XUL elements */
+    eXUL                 = 1 << 9,
+    /** svg elements */
+    eSVG                 = 1 << 10,
     /** document fragments */
-    eDOCUMENT_FRAGMENT   = 1 << 8,
+    eDOCUMENT_FRAGMENT   = 1 << 11,
     /** data nodes (comments, PIs, text). Nodes of this type always
      returns a non-null value for nsIContent::GetText() */
-    eDATA_NODE           = 1 << 9,
+    eDATA_NODE           = 1 << 12,
+    /** nsMathMLElement */
+    eMATHML              = 1 << 13,
     /** nsHTMLMediaElement */
-    eMEDIA               = 1 << 10
+    eMEDIA               = 1 << 14
   };
 
   /**
    * API for doing a quick check if a content is of a given
-   * type, such as Text, Document, Comment ...  Use this when you can instead of
+   * type, such as HTML, XUL, Text, ...  Use this when you can instead of
    * checking the tag.
    *
    * @param aFlags what types you want to test for (see above)
    * @return whether the content matches ALL flags passed in
    */
   virtual PRBool IsNodeOfType(PRUint32 aFlags) const = 0;
 
   /**
--- a/content/base/src/mozSanitizingSerializer.cpp
+++ b/content/base/src/mozSanitizingSerializer.cpp
@@ -209,17 +209,17 @@ mozSanitizingHTMLSerializer::IsContainer
    "I wonder if the sanitizing class could inherit from nsHTMLSerializer,
    so that at least these methods that none of us understand only have to be
    written once?" */
 
 // static
 PRInt32
 mozSanitizingHTMLSerializer::GetIdForContent(nsIContent* aContent)
 {
-  if (!aContent->IsHTML()) {
+  if (!aContent->IsNodeOfType(nsINode::eHTML)) {
     return eHTMLTag_unknown;
   }
 
   nsIParserService* parserService = nsContentUtils::GetParserService();
 
   return parserService ? parserService->HTMLAtomTagToId(aContent->Tag()) :
                          eHTMLTag_unknown;
 }
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -2087,17 +2087,17 @@ nsContentUtils::BelongsInForm(nsIDOMHTML
   while (content) {
     if (content == form) {
       // aContent is contained within the form so we return true.
 
       return PR_TRUE;
     }
 
     if (content->Tag() == nsGkAtoms::form &&
-        content->IsHTML()) {
+        content->IsNodeOfType(nsINode::eHTML)) {
       // The child is contained within a form, but not the right form
       // so we ignore it.
 
       return PR_FALSE;
     }
 
     content = content->GetParent();
   }
--- a/content/base/src/nsCopySupport.cpp
+++ b/content/base/src/nsCopySupport.cpp
@@ -344,17 +344,17 @@ nsresult nsCopySupport::IsPlainTextConte
   range->GetCommonAncestorContainer(getter_AddRefs(commonParent));
 
   for (nsCOMPtr<nsIContent> selContent(do_QueryInterface(commonParent));
        selContent;
        selContent = selContent->GetParent())
   {
     // checking for selection inside a plaintext form widget
 
-    if (!selContent->IsHTML()) {
+    if (!selContent->IsNodeOfType(nsINode::eHTML)) {
       continue;
     }
 
     nsIAtom *atom = selContent->Tag();
 
     if (atom == nsGkAtoms::input ||
         atom == nsGkAtoms::textarea)
     {
--- a/content/base/src/nsDOMAttributeMap.cpp
+++ b/content/base/src/nsDOMAttributeMap.cpp
@@ -349,17 +349,17 @@ nsDOMAttributeMap::SetNamedItemInternal(
     // Add the new attribute to the attribute map before updating
     // its value in the element. @see bug 364413.
     nsAttrKey attrkey(ni->NamespaceID(), ni->NameAtom());
     rv = mAttributeCache.Put(attrkey, attribute);
     NS_ENSURE_SUCCESS(rv, rv);
     iAttribute->SetMap(this);
 
     if (!aWithNS && ni->NamespaceID() == kNameSpaceID_None &&
-        mContent->IsHTML()) {
+        mContent->IsNodeOfType(nsINode::eHTML)) {
       // Set via setAttribute(), which may do normalization on the
       // attribute name for HTML
       nsCOMPtr<nsIDOMElement> ourElement(do_QueryInterface(mContent));
       NS_ASSERTION(ourElement, "HTML content that's not an element?");
       rv = ourElement->SetAttribute(name, value);
     }
     else {
       // It's OK to just use SetAttr
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -4820,40 +4820,40 @@ nsDocument::GetLocation(nsIDOMLocation *
   return w->GetLocation(_retval);
 }
 
 nsIContent*
 nsDocument::GetHtmlContent()
 {
   nsIContent* rootContent = GetRootContent();
   if (rootContent && rootContent->Tag() == nsGkAtoms::html &&
-      rootContent->IsHTML())
+      rootContent->IsNodeOfType(nsINode::eHTML))
     return rootContent;
   return nsnull;
 }
 
 nsIContent*
 nsDocument::GetHtmlChildContent(nsIAtom* aTag)
 {
   nsIContent* html = GetHtmlContent();
   if (!html)
     return nsnull;
 
   // Look for the element with aTag inside html. This needs to run
   // forwards to find the first such element.
   for (PRUint32 i = 0; i < html->GetChildCount(); ++i) {
     nsIContent* result = html->GetChildAt(i);
-    if (result->Tag() == aTag && result->IsHTML())
+    if (result->Tag() == aTag && result->IsNodeOfType(nsINode::eHTML))
       return result;
   }
   return nsnull;
 }
 
 nsIContent*
-nsDocument::GetTitleContent(PRUint32 aNamespace)
+nsDocument::GetTitleContent(PRUint32 aNodeType)
 {
   // mMayHaveTitleElement will have been set to true if any HTML or SVG
   // <title> element has been bound to this document. So if it's false,
   // we know there is nothing to do here. This avoids us having to search
   // the whole DOM if someone calls document.title on a large document
   // without a title.
   if (!mMayHaveTitleElement)
     return nsnull;
@@ -4865,25 +4865,25 @@ nsDocument::GetTitleContent(PRUint32 aNa
 
   for (PRUint32 i = 0; ; ++i) {
     // Avoid calling list->Length --- by calling Item one at a time,
     // we can avoid scanning the whole document to build the list of all
     // matches
     nsIContent* elem = list->Item(i, PR_FALSE);
     if (!elem)
       return nsnull;
-    if (elem->IsInNamespace(aNamespace))
+    if (elem->IsNodeOfType(aNodeType))
       return elem;
   }
 }
 
 void
-nsDocument::GetTitleFromElement(PRUint32 aNamespace, nsAString& aTitle)
-{
-  nsIContent* title = GetTitleContent(aNamespace);
+nsDocument::GetTitleFromElement(PRUint32 aNodeType, nsAString& aTitle)
+{
+  nsIContent* title = GetTitleContent(aNodeType);
   if (!title)
     return;
   nsContentUtils::GetNodeTextContent(title, PR_FALSE, aTitle);
 }
 
 NS_IMETHODIMP
 nsDocument::GetTitle(nsAString& aTitle)
 {
@@ -4899,22 +4899,22 @@ nsDocument::GetTitle(nsAString& aTitle)
 #ifdef MOZ_XUL
     case kNameSpaceID_XUL:
       rootContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, tmp);
       break;
 #endif
 #ifdef MOZ_SVG
     case kNameSpaceID_SVG:
       if (rootContent->Tag() == nsGkAtoms::svg) {
-        GetTitleFromElement(kNameSpaceID_SVG, tmp);
+        GetTitleFromElement(nsINode::eSVG, tmp);
         break;
       } // else fall through
 #endif
     default:
-      GetTitleFromElement(kNameSpaceID_XHTML, tmp);
+      GetTitleFromElement(nsINode::eHTML, tmp);
       break;
   }
 
   tmp.CompressWhitespace();
   aTitle = tmp;
   return NS_OK;
 }
 
@@ -4936,17 +4936,17 @@ nsDocument::SetTitle(const nsAString& aT
                                   aTitle, PR_TRUE);
 #endif
   }
 
   // Batch updates so that mutation events don't change "the title
   // element" under us
   mozAutoDocUpdate updateBatch(this, UPDATE_CONTENT_MODEL, PR_TRUE);
 
-  nsIContent* title = GetTitleContent(kNameSpaceID_XHTML);
+  nsIContent* title = GetTitleContent(nsINode::eHTML);
   if (!title) {
     nsIContent *head = GetHeadContent();
     if (!head)
       return NS_OK;
 
     {
       nsCOMPtr<nsINodeInfo> titleInfo;
       titleInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::title, nsnull,
@@ -5015,17 +5015,17 @@ NS_IMETHODIMP
 nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
   NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
 
   nsIDocument* doc = content->GetOwnerDoc();
   NS_ENSURE_TRUE(doc == this, NS_ERROR_DOM_WRONG_DOCUMENT_ERR);
 
-  if (!mHasWarnedAboutBoxObjects && !content->IsXUL()) {
+  if (!mHasWarnedAboutBoxObjects && !content->IsNodeOfType(eXUL)) {
     mHasWarnedAboutBoxObjects = PR_TRUE;
     nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
                                     "UseOfGetBoxObjectForWarning",
                                     nsnull, 0,
                                     static_cast<nsIDocument*>(this)->
                                       GetDocumentURI(),
                                     EmptyString(), 0, 0,
                                     nsIScriptError::warningFlag,
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -395,17 +395,17 @@ AddTreeItemToTreeOwner(nsIDocShellTreeIt
                        nsIDocShellTreeNode* aParentNode)
 {
   NS_PRECONDITION(aItem, "Must have docshell treeitem");
   NS_PRECONDITION(aOwningContent, "Must have owning content");
   
   nsAutoString value;
   PRBool isContent = PR_FALSE;
 
-  if (aOwningContent->IsXUL()) {
+  if (aOwningContent->IsNodeOfType(nsINode::eXUL)) {
       aOwningContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
   }
 
   // we accept "content" and "content-xxx" values.
   // at time of writing, we expect "xxx" to be "primary" or "targetable", but
   // someday it might be an integer expressing priority or something else.
 
   isContent = value.LowerCaseEqualsLiteral("content") ||
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -333,18 +333,17 @@ static nsIContent* GetEditorRootContent(
 }
 
 nsIContent*
 nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
 {
   if (aEditor)
     *aEditor = nsnull;
   for (nsINode* node = this; node; node = node->GetNodeParent()) {
-    if (!node->IsNodeOfType(eELEMENT) ||
-        !static_cast<nsIContent*>(node)->IsHTML())
+    if (!node->IsNodeOfType(eHTML))
       continue;
 
     nsCOMPtr<nsIEditor> editor;
     static_cast<nsGenericHTMLElement*>(node)->
         GetEditorInternal(getter_AddRefs(editor));
     if (!editor)
       continue;
 
@@ -1140,17 +1139,17 @@ nsGenericElement::GetOffsetRect(nsRect& 
 
 void
 nsNSElementTearoff::GetScrollInfo(nsIScrollableView **aScrollableView,
                                   nsIFrame **aFrame)
 {
   *aScrollableView = nsnull;
 
   // it isn't clear what to return for SVG nodes, so just return nothing
-  if (mContent->IsSVG()) {
+  if (mContent->IsNodeOfType(nsINode::eSVG)) {
     if (aFrame)
       *aFrame = nsnull;
     return;
   }
 
   nsIFrame* frame =
     (static_cast<nsGenericElement*>(mContent))->GetStyledFrame();
 
@@ -1292,17 +1291,17 @@ nsNSElementTearoff::SetScrollLeft(PRInt3
 }
 
 nsresult
 nsNSElementTearoff::GetScrollHeight(PRInt32* aScrollHeight)
 {
   NS_ENSURE_ARG_POINTER(aScrollHeight);
   *aScrollHeight = 0;
 
-  if (mContent->IsSVG())
+  if (mContent->IsNodeOfType(nsINode::eSVG))
     return NS_OK;
 
   nsIScrollableView *scrollView;
   nsresult rv = NS_OK;
 
   GetScrollInfo(&scrollView);
 
   if (!scrollView) {
@@ -1323,17 +1322,17 @@ nsNSElementTearoff::GetScrollHeight(PRIn
 }
 
 nsresult
 nsNSElementTearoff::GetScrollWidth(PRInt32* aScrollWidth)
 {
   NS_ENSURE_ARG_POINTER(aScrollWidth);
   *aScrollWidth = 0;
 
-  if (mContent->IsSVG())
+  if (mContent->IsNodeOfType(nsINode::eSVG))
     return NS_OK;
 
   nsIScrollableView *scrollView;
   nsresult rv = NS_OK;
 
   GetScrollInfo(&scrollView);
 
   if (!scrollView) {
@@ -1354,17 +1353,17 @@ nsNSElementTearoff::GetScrollWidth(PRInt
 
 nsRect
 nsNSElementTearoff::GetClientAreaRect()
 {
   nsIScrollableView *scrollView;
   nsIFrame *frame;
 
   // it isn't clear what to return for SVG nodes, so just return 0
-  if (mContent->IsSVG())
+  if (mContent->IsNodeOfType(nsINode::eSVG))
     return nsRect(0, 0, 0, 0);
 
   GetScrollInfo(&scrollView, &frame);
 
   if (scrollView) {
     return scrollView->View()->GetBounds();
   }
 
@@ -3945,17 +3944,17 @@ nsGenericElement::doReplaceOrInsertBefor
         if (newContent->GetNodeParent() ||
             !IsAllowedAsChild(newContent, nodeType, aParent, aDocument,
                               PR_FALSE, refContent)) {
           return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
         }
       }
     }
 
-    if (!newContent->IsXUL()) {
+    if (!newContent->IsNodeOfType(eXUL)) {
       nsContentUtils::ReparentContentWrapper(newContent, aParent,
                                              container->GetOwnerDoc(),
                                              container->GetOwnerDoc());
     }
 
     res = container->InsertChildAt(newContent, insPos, PR_TRUE);
     NS_ENSURE_SUCCESS(res, res);
   }
@@ -4004,17 +4003,17 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsGeneric
 NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(nsGenericElement)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_ROOT_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
   NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
 
-  if (tmp->HasProperties() && tmp->IsXUL()) {
+  if (tmp->HasProperties() && tmp->IsNodeOfType(nsINode::eXUL)) {
     tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
     tmp->DeleteProperty(nsGkAtoms::popuplistener);
   }
 
   // Unlink child content (and unbind our subtree).
   {
     PRUint32 childCount = tmp->mAttrsAndChildren.ChildCount();
     if (childCount) {
@@ -4034,17 +4033,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
   {
     nsDOMSlots *slots = tmp->GetExistingDOMSlots();
     if (slots) {
       slots->mStyle = nsnull;
       if (slots->mAttributeMap) {
         slots->mAttributeMap->DropReference();
         slots->mAttributeMap = nsnull;
       }
-      if (tmp->IsXUL())
+      if (tmp->IsNodeOfType(nsINode::eXUL))
         NS_IF_RELEASE(slots->mControllers);
       slots->mChildrenList = nsnull;
     }
   }
 
   {
     nsIDocument *doc;
     if (!tmp->GetNodeParent() && (doc = tmp->GetOwnerDoc()) &&
@@ -4072,17 +4071,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
   nsIDocument* ownerDoc = tmp->GetOwnerDoc();
   if (ownerDoc) {
     ownerDoc->BindingManager()->Traverse(tmp, cb);
   }
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
 
-  if (tmp->HasProperties() && tmp->IsXUL()) {
+  if (tmp->HasProperties() && tmp->IsNodeOfType(nsINode::eXUL)) {
     nsISupports* property =
       static_cast<nsISupports*>
                  (tmp->GetProperty(nsGkAtoms::contextmenulistener));
     cb.NoteXPCOMChild(property);
     property = static_cast<nsISupports*>
                           (tmp->GetProperty(nsGkAtoms::popuplistener));
     cb.NoteXPCOMChild(property);
   }
@@ -4114,17 +4113,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
     nsDOMSlots *slots = tmp->GetExistingDOMSlots();
     if (slots) {
       NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mStyle");
       cb.NoteXPCOMChild(slots->mStyle.get());
 
       NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mAttributeMap");
       cb.NoteXPCOMChild(slots->mAttributeMap.get());
 
-      if (tmp->IsXUL())
+      if (tmp->IsNodeOfType(nsINode::eXUL))
         cb.NoteXPCOMChild(slots->mControllers);
       cb.NoteXPCOMChild(
         static_cast<nsIDOMNodeList*>(slots->mChildrenList.get()));
     }
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 
--- a/content/base/src/nsNodeUtils.cpp
+++ b/content/base/src/nsNodeUtils.cpp
@@ -685,17 +685,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->IsNodeOfType(nsINode::eELEMENT) && static_cast<nsIContent*>(aNode)->IsXUL()) {
+  if (aClone && !aParent && aNode->IsNodeOfType(nsINode::eXUL)) {
     nsXULElement *xulElem = static_cast<nsXULElement*>(elem);
     if (!xulElem->mPrototype || xulElem->IsInDoc()) {
       clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
     }
   }
 #endif
 
   if (aNode->HasProperties()) {
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -1783,34 +1783,34 @@ nsObjectLoadingContent::ShouldShowDefaul
 
   return GetPluginSupportState(aContent, aContentType) == ePluginUnsupported;
 }
 
 /* static */ PluginSupportState
 nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
                                               const nsCString& aContentType)
 {
-  if (!aContent->IsHTML()) {
+  if (!aContent->IsNodeOfType(nsINode::eHTML)) {
     return ePluginOtherState;
   }
 
   if (aContent->Tag() == nsGkAtoms::embed ||
       aContent->Tag() == nsGkAtoms::applet) {
     return GetPluginDisabledState(aContentType);
   }
 
   PRBool hasAlternateContent = PR_FALSE;
 
   // Search for a child <param> with a pluginurl name
   PRUint32 count = aContent->GetChildCount();
   for (PRUint32 i = 0; i < count; ++i) {
     nsIContent* child = aContent->GetChildAt(i);
     NS_ASSERTION(child, "GetChildCount lied!");
 
-    if (child->IsHTML() &&
+    if (child->IsNodeOfType(nsINode::eHTML) &&
         child->Tag() == nsGkAtoms::param) {
       if (child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
                              NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {
         return GetPluginDisabledState(aContentType);
       }
     } else if (!hasAlternateContent) {
       hasAlternateContent =
         nsStyleUtil::IsSignificantChild(child, PR_TRUE, PR_FALSE);
--- a/content/base/src/nsPlainTextSerializer.cpp
+++ b/content/base/src/nsPlainTextSerializer.cpp
@@ -1848,17 +1848,17 @@ nsPlainTextSerializer::IsCurrentNodeConv
            value.EqualsIgnoreCase("\"moz-txt", 8)));
 }
 
 
 // static
 PRInt32
 nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
 {
-  if (!aContent->IsHTML()) {
+  if (!aContent->IsNodeOfType(nsINode::eHTML)) {
     return eHTMLTag_unknown;
   }
 
   nsIParserService* parserService = nsContentUtils::GetParserService();
 
   return parserService ? parserService->HTMLAtomTagToId(aContent->Tag()) :
                          eHTMLTag_unknown;
 }
--- a/content/base/src/nsScriptElement.cpp
+++ b/content/base/src/nsScriptElement.cpp
@@ -140,33 +140,33 @@ nsScriptElement::ContentInserted(nsIDocu
                                  nsIContent* aContainer,
                                  nsIContent* aChild,
                                  PRInt32 aIndexInContainer)
 {
   MaybeProcessScript();
 }
 
 static PRBool
-InNonScriptingContainer(nsIContent* aNode)
+InNonScriptingContainer(nsINode* aNode)
 {
-  aNode = aNode->GetParent();
+  aNode = aNode->GetNodeParent();
   while (aNode) {
     // XXX noframes and noembed are currently unconditionally not
     // displayed and processed. This might change if we support either
     // prefs or per-document container settings for not allowing
     // frames or plugins.
-    if (aNode->IsHTML()) {
-      nsIAtom *localName = aNode->Tag();
+    if (aNode->IsNodeOfType(nsINode::eHTML)) {
+      nsIAtom *localName = static_cast<nsIContent*>(aNode)->Tag();
       if (localName == nsGkAtoms::iframe ||
           localName == nsGkAtoms::noframes ||
           localName == nsGkAtoms::noembed) {
         return PR_TRUE;
       }
     }
-    aNode = aNode->GetParent();
+    aNode = aNode->GetNodeParent();
   }
 
   return PR_FALSE;
 }
 
 nsresult
 nsScriptElement::MaybeProcessScript()
 {
--- a/content/base/src/nsXHTMLContentSerializer.cpp
+++ b/content/base/src/nsXHTMLContentSerializer.cpp
@@ -498,17 +498,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.
     PRBool hasMeta = PR_FALSE;
     PRUint32 i, childCount = aContent->GetChildCount();
     for (i = 0; i < childCount; ++i) {
       nsIContent* child = aContent->GetChildAt(i);
-      if (child->IsHTML() &&
+      if (child->IsNodeOfType(nsINode::eHTML) &&
           child->Tag() == nsGkAtoms::meta &&
           child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
         nsAutoString header;
         child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
 
         if (header.LowerCaseEqualsLiteral("content-type")) {
           hasMeta = PR_TRUE;
           break;
--- a/content/base/src/nsXMLContentSerializer.cpp
+++ b/content/base/src/nsXMLContentSerializer.cpp
@@ -767,17 +767,17 @@ nsXMLContentSerializer::ScanNamespaceDec
 }
 
 
 PRBool
 nsXMLContentSerializer::IsJavaScript(nsIContent * aContent, nsIAtom* aAttrNameAtom,
                                      PRInt32 aAttrNamespaceID, const nsAString& aValueString)
 {
   PRInt32 namespaceID = aContent->GetNameSpaceID();
-  PRBool isHtml = aContent->IsHTML();
+  PRBool isHtml = aContent->IsNodeOfType(nsINode::eHTML);
 
   if (aAttrNamespaceID == kNameSpaceID_None &&
       (isHtml ||
        namespaceID == kNameSpaceID_XUL ||
        namespaceID == kNameSpaceID_SVG) &&
       (aAttrNameAtom == nsGkAtoms::href ||
        aAttrNameAtom == nsGkAtoms::src)) {
 
--- a/content/events/src/nsContentEventHandler.cpp
+++ b/content/events/src/nsContentEventHandler.cpp
@@ -136,17 +136,17 @@ nsContentEventHandler::Init(nsQueryConte
 }
 
 // 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 PRBool IsContentBR(nsIContent* aContent)
 {
-  return aContent->IsHTML() &&
+  return aContent->IsNodeOfType(nsINode::eHTML) &&
          aContent->Tag() == nsGkAtoms::br &&
          !aContent->AttrValueIs(kNameSpaceID_None,
                                 nsGkAtoms::type,
                                 nsGkAtoms::moz,
                                 eIgnoreCase) &&
          !aContent->AttrValueIs(kNameSpaceID_None,
                                 nsGkAtoms::mozeditorbogusnode,
                                 nsGkAtoms::_true,
@@ -852,22 +852,22 @@ static void AdjustRangeForSelection(nsIC
 {
   nsINode* node = *aNode;
   PRInt32 offset = *aOffset;
   if (aRoot != node && node->GetParent() &&
       !node->IsNodeOfType(nsINode::eTEXT)) {
     node = node->GetParent();
     offset = node->IndexOf(*aNode) + (offset ? 1 : 0);
   }
-  
-  nsIContent* brContent = node->GetChildAt(offset - 1);
-  while (brContent && brContent->IsHTML()) {
+  nsINode* brNode = node->GetChildAt(offset - 1);
+  while (brNode && brNode->IsNodeOfType(nsINode::eHTML)) {
+    nsIContent* brContent = static_cast<nsIContent*>(brNode);
     if (brContent->Tag() != nsGkAtoms::br || IsContentBR(brContent))
       break;
-    brContent = node->GetChildAt(--offset - 1);
+    brNode = node->GetChildAt(--offset - 1);
   }
   *aNode = node;
   *aOffset = PR_MAX(offset, 0);
 }
 
 nsresult
 nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
 {
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -1238,17 +1238,17 @@ static PRBool
 IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
 {
   if (!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::accesskey, aKey,
                              eIgnoreCase))
     return PR_FALSE;
 
   nsCOMPtr<nsIDOMXULDocument> xulDoc =
     do_QueryInterface(aContent->GetOwnerDoc());
-  if (!xulDoc && !aContent->IsXUL())
+  if (!xulDoc && !aContent->IsNodeOfType(nsINode::eXUL))
     return PR_TRUE;
 
     // For XUL we do visibility checks.
   if (!aFrame)
     return PR_FALSE;
 
   if (aFrame->IsFocusable())
     return PR_TRUE;
@@ -1259,27 +1259,27 @@ IsAccessKeyTarget(nsIContent* aContent, 
   if (!aFrame->AreAncestorViewsVisible())
     return PR_FALSE;
 
   // XUL controls can be activated.
   nsCOMPtr<nsIDOMXULControlElement> control(do_QueryInterface(aContent));
   if (control)
     return PR_TRUE;
 
-  if (aContent->IsHTML()) {
+  if (aContent->IsNodeOfType(nsINode::eHTML)) {
     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 PR_TRUE;
 
-  } else if (aContent->IsXUL()) {
+  } else if (aContent->IsNodeOfType(nsINode::eXUL)) {
     // XUL label elements are never focusable, so we need to check for them
     // explicitly before giving up.
     if (aContent->Tag() == nsGkAtoms::label)
       return PR_TRUE;
   }
 
   return PR_FALSE;
 }
@@ -1552,17 +1552,17 @@ nsEventStateManager::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();
       PRBool allowedToDispatch = PR_TRUE;
 
-      if (mGestureDownContent->IsXUL()) {
+      if (mGestureDownContent->IsNodeOfType(nsINode::eXUL)) {
         if (tag == nsGkAtoms::scrollbar ||
             tag == nsGkAtoms::scrollbarbutton ||
             tag == nsGkAtoms::button)
           allowedToDispatch = PR_FALSE;
         else if (tag == nsGkAtoms::toolbarbutton) {
           // a <toolbarbutton> that has the container attribute set
           // will already have its own dropdown.
           if (nsContentUtils::HasNonEmptyAttr(mGestureDownContent,
@@ -1573,17 +1573,17 @@ nsEventStateManager::FireContextClick()
             // a second menu
             if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
                                                  nsGkAtoms::_true, eCaseMatters)) {
               allowedToDispatch = PR_FALSE;
             }
           }
         }
       }
-      else if (mGestureDownContent->IsHTML()) {
+      else if (mGestureDownContent->IsNodeOfType(nsINode::eHTML)) {
         nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
 
         if (formCtrl) {
           // of all form controls, only ones dealing with text are
           // allowed to have context menus
           PRInt32 type = formCtrl->GetType();
 
           allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
@@ -2202,17 +2202,17 @@ nsEventStateManager::DoScrollHistory(PRI
 void
 nsEventStateManager::DoScrollZoom(nsIFrame *aTargetFrame,
                                   PRInt32 adjustment)
 {
   // Exclude form controls and XUL content.
   nsIContent *content = aTargetFrame->GetContent();
   if (content &&
       !content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) &&
-      !content->IsXUL())
+      !content->IsNodeOfType(nsINode::eXUL))
     {
       // positive adjustment to decrease zoom, negative to increase
       PRInt32 change = (adjustment > 0) ? -1 : 1;
 
       if (nsContentUtils::GetBoolPref("browser.zoom.full"))
         ChangeFullZoom(change);
       else
         ChangeTextSize(change);
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -431,18 +431,18 @@ nsGenericHTMLElement::SetClassName(const
 {
   SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName, PR_TRUE);
   return NS_OK;
 }
 
 static PRBool
 IsBody(nsIContent *aContent)
 {
-  return aContent->NodeInfo()->Equals(nsGkAtoms::body) &&
-         aContent->IsHTML();
+  return (aContent->NodeInfo()->Equals(nsGkAtoms::body) &&
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 static PRBool IS_TABLE_CELL(nsIAtom* frameType) {
   return nsGkAtoms::tableCellFrame == frameType ||
     nsGkAtoms::bcTableCellFrame == frameType;
 }
 
 static PRBool
@@ -747,23 +747,24 @@ nsGenericHTMLElement::ScrollIntoView(PRB
 
 NS_IMETHODIMP
 nsGenericHTMLElement::GetSpellcheck(PRBool* aSpellcheck)
 {
   NS_ENSURE_ARG_POINTER(aSpellcheck);
   *aSpellcheck = PR_FALSE;              // Default answer is to not spellcheck
 
   // Has the state has been explicitly set?
-  nsIContent* node;
-  for (node = this; node; node = node->GetParent()) {
-    if (node->IsHTML()) {
+  nsINode* node;
+  for (node = this; node; node = node->GetNodeParent()) {
+    if (node->IsNodeOfType(nsINode::eHTML)) {
       static nsIContent::AttrValuesArray strings[] =
         {&nsGkAtoms::_true, &nsGkAtoms::_false, nsnull};
-      switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
-                                    strings, eCaseMatters)) {
+      switch (static_cast<nsIContent*>(node)->
+              FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
+                              strings, eCaseMatters)) {
         case 0:                         // spellcheck = "true"
           *aSpellcheck = PR_TRUE;
           // Fall through
         case 1:                         // spellcheck = "false"
           return NS_OK;
       }
     }
   }
@@ -900,17 +901,17 @@ nsGenericHTMLElement::FindForm(nsIForm* 
   // 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->Tag() == nsGkAtoms::form &&
-        content->IsHTML()) {
+        content->IsNodeOfType(nsINode::eHTML)) {
 #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,
@@ -953,17 +954,17 @@ nsGenericHTMLElement::FindForm(nsIForm* 
 
   return nsnull;
 }
 
 static PRBool
 IsArea(nsIContent *aContent)
 {
   return (aContent->Tag() == nsGkAtoms::area &&
-          aContent->IsHTML());
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 PRBool
 nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(nsEventChainVisitor& aVisitor)
 {
   NS_PRECONDITION(nsCOMPtr<nsILink>(do_QueryInterface(this)),
                   "should be called only when |this| implements |nsILink|");
 
@@ -1205,17 +1206,17 @@ nsGenericHTMLElement::GetBaseTarget(nsAS
   } else {
     aBaseTarget.Truncate();
   }
 }
 
 PRBool
 nsGenericHTMLElement::IsNodeOfType(PRUint32 aFlags) const
 {
-  return !(aFlags & ~(eCONTENT | eELEMENT));
+  return !(aFlags & ~(eCONTENT | eELEMENT | eHTML));
 }
 
 //----------------------------------------------------------------------
 
 
 PRBool
 nsGenericHTMLElement::ParseAttribute(PRInt32 aNamespaceID,
                                      nsIAtom* aAttribute,
@@ -2287,17 +2288,17 @@ nsGenericHTMLFormElement::~nsGenericHTML
 
 NS_IMPL_QUERY_INTERFACE_INHERITED1(nsGenericHTMLFormElement,
                                    nsGenericHTMLElement,
                                    nsIFormControl)
 
 PRBool
 nsGenericHTMLFormElement::IsNodeOfType(PRUint32 aFlags) const
 {
-  return !(aFlags & ~(eCONTENT | eELEMENT | eHTML_FORM_CONTROL));
+  return !(aFlags & ~(eCONTENT | eELEMENT | eHTML | eHTML_FORM_CONTROL));
 }
 
 void
 nsGenericHTMLFormElement::SaveSubtreeState()
 {
   SaveState();
 
   nsGenericHTMLElement::SaveSubtreeState();
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -74,17 +74,17 @@ public:
   nsGenericHTMLElement(nsINodeInfo *aNodeInfo)
     : nsGenericHTMLElementBase(aNodeInfo)
   {
   }
 
   /** Typesafe, non-refcounting cast from nsIContent.  Cheaper than QI. **/
   static nsGenericHTMLElement* FromContent(nsIContent *aContent)
   {
-    if (aContent->IsHTML())
+    if (aContent->IsNodeOfType(eHTML))
       return static_cast<nsGenericHTMLElement*>(aContent);
     return nsnull;
   }
 
   /** Call on shutdown to release globals */
   static void Shutdown();
 
   /**
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -431,17 +431,17 @@ NS_IMETHODIMP nsHTMLMediaElement::Load()
 static PRBool HasSourceChildren(nsIContent *aElement)
 {
   PRUint32 count = aElement->GetChildCount();
   for (PRUint32 i = 0; i < count; ++i) {
     nsIContent* child = aElement->GetChildAt(i);
     NS_ASSERTION(child, "GetChildCount lied!");
     if (child &&
         child->Tag() == nsGkAtoms::source &&
-        child->IsHTML())
+        child->IsNodeOfType(nsINode::eHTML))
     {
       return PR_TRUE;
     }
   }
   return PR_FALSE;
 }
 
 // Returns true if aElement has a src attribute, or a <source> child.
@@ -1621,17 +1621,17 @@ void nsHTMLMediaElement::Thaw()
   if (mDecoder) {
     mDecoder->Resume();
   }
 }
 
 PRBool
 nsHTMLMediaElement::IsNodeOfType(PRUint32 aFlags) const
 {
-  return !(aFlags & ~(eCONTENT | eELEMENT | eMEDIA));
+  return !(aFlags & ~(eCONTENT | eELEMENT | eHTML | eMEDIA));
 }
 
 void nsHTMLMediaElement::NotifyAddedSource()
 {
   if (mLoadWaitStatus == WAITING_FOR_SRC_OR_SOURCE) {
     QueueSelectResourceTask();
   } else if (mLoadWaitStatus == WAITING_FOR_SOURCE) { 
     QueueLoadFromSourceTask();
@@ -1674,17 +1674,17 @@ already_AddRefed<nsIURI> nsHTMLMediaElem
     rv = mSourcePointer->SetStart(thisDomNode, startOffset+1);
     NS_ENSURE_SUCCESS(rv, nsnull);
 
     nsIContent* child = GetChildAt(startOffset);
 
     // If child is a <source> element, it may be the next candidate.
     if (child &&
         child->Tag() == nsGkAtoms::source &&
-        child->IsHTML())
+        child->IsNodeOfType(nsINode::eHTML))
     {
       nsCOMPtr<nsIURI> uri;
       nsAutoString src,type;
 
       // Must have src attribute.
       if (!child->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src))
         continue;
 
--- a/content/html/content/src/nsHTMLOptGroupElement.cpp
+++ b/content/html/content/src/nsHTMLOptGroupElement.cpp
@@ -153,17 +153,18 @@ nsHTMLOptGroupElement::PreHandleEvent(ns
 
   return nsGenericHTMLElement::PreHandleEvent(aVisitor);
 }
 
 nsIContent*
 nsHTMLOptGroupElement::GetSelect()
 {
   nsIContent* parent = this;
-  while ((parent = parent->GetParent()) && parent->IsHTML()) {
+  while ((parent = parent->GetParent()) &&
+         parent->IsNodeOfType(eHTML)) {
     if (parent->Tag() == nsGkAtoms::select) {
       return parent;
     }
     if (parent->Tag() != nsGkAtoms::optgroup) {
       break;
     }
   }
   
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -437,17 +437,17 @@ nsHTMLOptionElement::IntrinsicState() co
 }
 
 // Get the select content element that contains this option
 nsIContent*
 nsHTMLOptionElement::GetSelect()
 {
   nsIContent* parent = this;
   while ((parent = parent->GetParent()) &&
-         parent->IsHTML()) {
+         parent->IsNodeOfType(eHTML)) {
     if (parent->Tag() == nsGkAtoms::select) {
       return parent;
     }
     if (parent->Tag() != nsGkAtoms::optgroup) {
       break;
     }
   }
   
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -326,17 +326,17 @@ nsHTMLSelectElement::RemoveOptionsFromLi
   }
 
   return NS_OK;
 }
 
 static PRBool IsOptGroup(nsIContent *aContent)
 {
   return (aContent->NodeInfo()->Equals(nsGkAtoms::optgroup) &&
-          aContent->IsHTML());
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 // If the document is such that recursing over these options gets us
 // deeper than four levels, there is something terribly wrong with the
 // world.
 nsresult
 nsHTMLSelectElement::InsertOptionsIntoListRecurse(nsIContent* aOptions,
                                                   PRInt32* aInsertIndex,
--- a/content/html/content/src/nsHTMLTableCellElement.cpp
+++ b/content/html/content/src/nsHTMLTableCellElement.cpp
@@ -135,17 +135,17 @@ nsIContent*
 nsHTMLTableCellElement::GetTable()
 {
   nsIContent *result = nsnull;
 
   nsIContent *parent = GetParent();
   if (parent) {  // GetParent() should be a row
     nsIContent* section = parent->GetParent();
     if (section) {
-      if (section->IsHTML() &&
+      if (section->IsNodeOfType(eHTML) &&
           section->NodeInfo()->Equals(nsGkAtoms::table)) {
         // XHTML, without a row group
         result = section;
       } else {
         // we have a row group.
         result = section->GetParent();
       }
     }
--- a/content/html/content/src/nsHTMLTableRowElement.cpp
+++ b/content/html/content/src/nsHTMLTableRowElement.cpp
@@ -232,17 +232,17 @@ nsHTMLTableRowElement::GetSectionRowInde
 
 static PRBool
 IsCell(nsIContent *aContent, PRInt32 aNamespaceID,
        nsIAtom* aAtom, void *aData)
 {
   nsIAtom* tag = aContent->Tag();
 
   return ((tag == nsGkAtoms::td || tag == nsGkAtoms::th) &&
-          aContent->IsHTML());
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 NS_IMETHODIMP
 nsHTMLTableRowElement::GetCells(nsIDOMHTMLCollection** aValue)
 {
   if (!mCells) {
     mCells = new nsContentList(this,
                                IsCell,
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -1587,17 +1587,17 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElemen
   nsCOMPtr<nsIContent> newBody = do_QueryInterface(aBody);
   nsIContent* root = GetRootContent();
 
   // 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->IsNodeOfType(nsINode::eHTML) ||
       root->Tag() != nsGkAtoms::html) {
     return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
   }
 
   nsCOMPtr<nsIDOMElement> rootElem = do_QueryInterface(root);
   nsCOMPtr<nsIDOMNode> tmp;
 
   // Use DOM methods so that we pass through the appropriate security checks.
@@ -2819,17 +2819,17 @@ nsHTMLDocument::ResolveName(const nsAStr
 
   // No named items were found, see if there's one registerd by id for
   // aName. If we get this far, FindNamedItems() will have been called
   // for aName, so we're guaranteed that if there is an element with
   // the id aName, it'll be entry's IdContent.
 
   nsIContent *e = entry->GetIdContent();
 
-  if (e && e->IsHTML()) {
+  if (e && e->IsNodeOfType(nsINode::eHTML)) {
     nsIAtom *tag = e->Tag();
 
     if ((tag == nsGkAtoms::embed  ||
          tag == nsGkAtoms::img    ||
          tag == nsGkAtoms::object ||
          tag == nsGkAtoms::applet) &&
         (!aForm || nsContentUtils::BelongsInForm(aForm, e))) {
       NS_ADDREF(*aResult = e);
--- a/content/mathml/content/src/nsMathMLElement.cpp
+++ b/content/mathml/content/src/nsMathMLElement.cpp
@@ -405,17 +405,17 @@ nsMathMLElement::IntrinsicState() const
 {
   return nsMathMLElementBase::IntrinsicState() |
     (mIncrementScriptLevel ? NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : 0);
 }
 
 PRBool
 nsMathMLElement::IsNodeOfType(PRUint32 aFlags) const
 {
-  return !(aFlags & ~(eCONTENT | eELEMENT));
+  return !(aFlags & ~(eCONTENT | eELEMENT | eMATHML));
 }
 
 void
 nsMathMLElement::SetIncrementScriptLevel(PRBool aIncrementScriptLevel,
                                          PRBool aNotify)
 {
   if (aIncrementScriptLevel == mIncrementScriptLevel)
     return;
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -694,17 +694,17 @@ nsSVGElement::GetAttributeChangeHint(con
     NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
   }
   return retval;
 }
 
 PRBool
 nsSVGElement::IsNodeOfType(PRUint32 aFlags) const
 {
-  return !(aFlags & ~(eCONTENT | eELEMENT));
+  return !(aFlags & ~(eCONTENT | eELEMENT | eSVG));
 }
 
 already_AddRefed<nsIURI>
 nsSVGElement::GetBaseURI() const
 {
   nsCOMPtr<nsIURI> baseURI = nsSVGElementBase::GetBaseURI();
 
   nsIContent* bindingParent = GetBindingParent();
--- a/content/svg/content/src/nsSVGLength2.cpp
+++ b/content/svg/content/src/nsSVGLength2.cpp
@@ -284,17 +284,17 @@ nsSVGLength2::GetUnitScaleFactor(nsSVGSV
     return 0;
   }
 }
 
 float
 nsSVGLength2::GetUnitScaleFactor(nsIFrame *aFrame, PRUint8 aUnitType) const
 {
   nsIContent* content = aFrame->GetContent();
-  if (content->IsSVG())
+  if (content->IsNodeOfType(nsINode::eSVG))
     return GetUnitScaleFactor(static_cast<nsSVGElement*>(content), aUnitType);
 
   switch (aUnitType) {
   case nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER:
   case nsIDOMSVGLength::SVG_LENGTHTYPE_PX:
     return 1;
   case nsIDOMSVGLength::SVG_LENGTHTYPE_MM:
     return GetMMPerPixel(aFrame);
--- a/content/xbl/src/nsXBLContentSink.cpp
+++ b/content/xbl/src/nsXBLContentSink.cpp
@@ -894,17 +894,17 @@ nsXBLContentSink::CreateElement(const PR
   return nsXULElement::Create(prototype, mDocument, PR_FALSE, aResult);
 #endif
 }
 
 nsresult 
 nsXBLContentSink::AddAttributes(const PRUnichar** aAtts,
                                 nsIContent* aContent)
 {
-  if (aContent->IsXUL())
+  if (aContent->IsNodeOfType(nsINode::eXUL))
     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 PRUnichar **aAtts, 
--- a/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ b/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -476,17 +476,18 @@ 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->IsNodeOfType(nsINode::eHTML)) {
           isLink = PR_TRUE;
           break;
         }
 
         if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
           isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
                                         nsGkAtoms::simple, eCaseMatters);
 
--- a/content/xbl/src/nsXBLService.cpp
+++ b/content/xbl/src/nsXBLService.cpp
@@ -1167,17 +1167,18 @@ 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->IsNodeOfType(nsINode::eHTML)))) &&
+        !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/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp
+++ b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp
@@ -432,16 +432,23 @@ txXPathNodeUtils::getLocalName(const txX
 
         return;
     }
 
     if (aNode.isContent()) {
         if (aNode.mNode->IsNodeOfType(nsINode::eELEMENT)) {
             nsINodeInfo* nodeInfo = aNode.Content()->NodeInfo();
             nodeInfo->GetLocalName(aLocalName);
+
+            // Check for html
+            if (nodeInfo->NamespaceEquals(kNameSpaceID_None) &&
+                aNode.mNode->IsNodeOfType(nsINode::eHTML)) {
+                ToUpperCase(aLocalName);
+            }
+
             return;
         }
 
         if (aNode.mNode->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
             // PIs don't have a nodeinfo but do have a name
             nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode.mNode);
             node->GetNodeName(aLocalName);
 
@@ -453,17 +460,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()->IsNodeOfType(nsINode::eHTML)) {
         ToUpperCase(aLocalName);
     }
 }
 
 /* static */
 void
 txXPathNodeUtils::getNodeName(const txXPathNode& aNode, nsAString& aName)
 {
@@ -474,19 +481,21 @@ txXPathNodeUtils::getNodeName(const txXP
     }
 
     if (aNode.isContent()) {
         if (aNode.mNode->IsNodeOfType(nsINode::eELEMENT)) {
             nsINodeInfo* nodeInfo = aNode.Content()->NodeInfo();
             nodeInfo->GetQualifiedName(aName);
 
             // Check for html
-            if (aNode.Content()->IsHTML()) {
+            if (nodeInfo->NamespaceEquals(kNameSpaceID_None) &&
+                aNode.Content()->IsNodeOfType(nsINode::eHTML)) {
                 ToUpperCase(aName);
             }
+
             return;
         }
 
         if (aNode.mNode->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
             // PIs don't have a nodeinfo but do have a name
             nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode.mNode);
             node->GetNodeName(aName);
 
@@ -496,17 +505,18 @@ txXPathNodeUtils::getNodeName(const txXP
         aName.Truncate();
 
         return;
     }
 
     aNode.Content()->GetAttrNameAt(aNode.mIndex)->GetQualifiedName(aName);
 
     // Check for html
-    if (aNode.Content()->IsHTML()) {
+    if (aNode.Content()->NodeInfo()->NamespaceEquals(kNameSpaceID_None) &&
+        aNode.Content()->IsNodeOfType(nsINode::eHTML)) {
         ToUpperCase(aName);
     }
 }
 
 /* static */
 PRInt32
 txXPathNodeUtils::getNamespaceID(const txXPathNode& aNode)
 {
--- a/content/xslt/src/xpath/txXPathTreeWalker.h
+++ b/content/xslt/src/xpath/txXPathTreeWalker.h
@@ -145,17 +145,17 @@ public:
     static PRBool isText(const txXPathNode& aNode);
 #ifndef TX_EXE
     static inline PRBool isHTMLElementInHTMLDocument(const txXPathNode& aNode)
     {
       if (!aNode.isContent()) {
         return PR_FALSE;
       }
       nsIContent* content = aNode.Content();
-      return content->IsHTML() && content->IsInHTMLDocument();
+      return content->IsNodeOfType(nsINode::eHTML) && content->IsInHTMLDocument();
     }
 #else
 private:
     static void appendNodeValueHelper(NodeDefinition* aNode, nsAString& aResult);
 #endif
 };
 
 #ifdef TX_EXE
--- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp
+++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp
@@ -303,24 +303,24 @@ txMozillaXMLOutput::endElement()
                    NS_ERROR_UNEXPECTED);
 
     nsIContent* element = static_cast<nsIContent*>
                                      (static_cast<nsINode*>
                                                  (mCurrentNode));
 
     // Handle html-elements
     if (!mNoFixup) {
-        if (element->IsHTML()) {
+        if (element->IsNodeOfType(nsINode::eHTML)) {
             rv = endHTMLElement(element);
             NS_ENSURE_SUCCESS(rv, rv);
         }
 
         // Handle script elements
         if (element->Tag() == nsGkAtoms::script &&
-            (element->IsHTML() ||
+            (element->IsNodeOfType(nsINode::eHTML) ||
             element->GetNameSpaceID() == kNameSpaceID_SVG)) {
 
             rv = element->DoneAddingChildren(PR_TRUE);
 
             // If the act of insertion evaluated the script, we're fine.
             // Else, add this script element to the array of loading scripts.
             if (rv == NS_ERROR_HTMLPARSER_BLOCK) {
                 nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(element);
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2147,17 +2147,17 @@ nsIContent *
 nsXULElement::GetBindingParent() const
 {
     return mBindingParent;
 }
 
 PRBool
 nsXULElement::IsNodeOfType(PRUint32 aFlags) const
 {
-    return !(aFlags & ~(eCONTENT | eELEMENT));
+    return !(aFlags & ~(eCONTENT | eELEMENT | eXUL));
 }
 
 static void
 PopupListenerPropertyDtor(void* aObject, nsIAtom* aPropertyName,
                           void* aPropertyValue, void* aData)
 {
   nsIDOMEventListener* listener =
     static_cast<nsIDOMEventListener*>(aPropertyValue);
--- a/content/xul/content/src/nsXULElement.h
+++ b/content/xul/content/src/nsXULElement.h
@@ -471,17 +471,17 @@ class nsScriptEventHandlerOwnerTearoff;
 
 class nsXULElement : public nsGenericElement, public nsIDOMXULElement
 {
 public:
 
     /** Typesafe, non-refcounting cast from nsIContent.  Cheaper than QI. **/
     static nsXULElement* FromContent(nsIContent *aContent)
     {
-        if (aContent->IsXUL())
+        if (aContent->IsNodeOfType(eXUL))
             return static_cast<nsXULElement*>(aContent);
         return nsnull;
     }
 
 public:
     static nsIXBLService* GetXBLService() {
         if (!gXBLService)
             CallGetService("@mozilla.org/xbl;1", &gXBLService);
--- a/content/xul/templates/src/nsXULContentBuilder.cpp
+++ b/content/xul/templates/src/nsXULContentBuilder.cpp
@@ -1297,17 +1297,17 @@ nsXULContentBuilder::EnsureElementHasGen
         return NS_ELEMENT_WAS_THERE;
     }
 }
 
 PRBool
 nsXULContentBuilder::IsOpen(nsIContent* aElement)
 {
     // Determine if this is a <treeitem> or <menu> element
-    if (!aElement->IsXUL())
+    if (!aElement->IsNodeOfType(nsINode::eXUL))
         return PR_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/content/xul/templates/src/nsXULSortService.cpp
+++ b/content/xul/templates/src/nsXULSortService.cpp
@@ -107,17 +107,17 @@ XULSortServiceImpl::SetSortColumnHints(n
 {
   // set sort info on current column. This ensures that the
   // column header sort indicator is updated properly.
   PRUint32 numChildren = content->GetChildCount();
 
   for (PRUint32 childIndex = 0; childIndex < numChildren; ++childIndex) {
     nsIContent *child = content->GetChildAt(childIndex);
 
-    if (child->IsXUL()) {
+    if (child->IsNodeOfType(nsINode::eXUL)) {
       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/content/xul/templates/src/nsXULTemplateBuilder.cpp
+++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp
@@ -1244,17 +1244,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->IsNodeOfType(nsINode::eXUL)) {
         // Hmm. This must be an HTML element. Try to set it as a
         // JS property "by hand".
         InitHTMLTemplateRoot();
     }
   
     return NS_OK;
 }
   
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -351,17 +351,17 @@ ForEachPing(nsIContent *content, ForEach
 {
   // NOTE: Using nsIDOMNSHTMLAnchorElement2::GetPing isn't really worth it here
   //       since we'd still need to parse the resulting string.  Instead, we
   //       just parse the raw attribute.  It might be nice if the content node
   //       implemented an interface that exposed an enumeration of nsIURIs.
 
   // Make sure we are dealing with either an <A> or <AREA> element in the HTML
   // or XHTML namespace.
-  if (!content->IsHTML())
+  if (!content->IsNodeOfType(nsINode::eHTML))
     return;
   nsIAtom *nameAtom = content->Tag();
   if (!nameAtom->EqualsUTF8(NS_LITERAL_CSTRING("a")) &&
       !nameAtom->EqualsUTF8(NS_LITERAL_CSTRING("area")))
     return;
 
   nsCOMPtr<nsIAtom> pingAtom = do_GetAtom("ping");
   if (!pingAtom)
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -6995,35 +6995,35 @@ nsNodeSH::PreCreate(nsISupports *nativeO
   PRBool hasHadScriptHandlingObject = PR_FALSE;
   NS_ENSURE_STATE(doc->GetScriptHandlingObject(hasHadScriptHandlingObject) ||
                   hasHadScriptHandlingObject ||
                   IsPrivilegedScript());
 
   nsISupports *native_parent;
 
   PRBool slimWrappers = PR_TRUE;
-  PRBool nodeIsElement = node->IsNodeOfType(nsINode::eELEMENT);
-  if (nodeIsElement && static_cast<nsIContent*>(node)->IsXUL()) {
+  if (node->IsNodeOfType(nsINode::eELEMENT | nsINode::eXUL)) {
     // For XUL elements, use the parent, if any.
     native_parent = node->GetParent();
 
     if (!native_parent) {
       native_parent = doc;
     }
   } else if (!node->IsNodeOfType(nsINode::eDOCUMENT)) {
     NS_ASSERTION(node->IsNodeOfType(nsINode::eCONTENT) ||
                  node->IsNodeOfType(nsINode::eATTRIBUTE),
                  "Unexpected node type");
                  
     // For attributes and non-XUL content, use the document as scope parent.
     native_parent = doc;
 
     // But for HTML form controls, use the form as scope parent.
-    if (nodeIsElement &&
-        node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
+    if (node->IsNodeOfType(nsINode::eELEMENT |
+                           nsIContent::eHTML |
+                           nsIContent::eHTML_FORM_CONTROL)) {
       nsCOMPtr<nsIFormControl> form_control(do_QueryInterface(node));
 
       if (form_control) {
         nsCOMPtr<nsIDOMHTMLFormElement> form;
         form_control->GetForm(getter_AddRefs(form));
 
         if (form) {
           // Found a form, use it.
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -260,17 +260,17 @@ nsFocusManager::GetFocusedDescendant(nsP
   return currentContent;
 }
 
 // static
 nsIContent*
 nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
 {
 #ifdef MOZ_XUL
-  if (aContent->IsXUL()) {
+  if (aContent->IsNodeOfType(nsINode::eXUL)) {
     nsCOMPtr<nsIDOMNode> inputField;
 
     nsCOMPtr<nsIDOMXULTextBoxElement> textbox = do_QueryInterface(aContent);
     if (textbox) {
       textbox->GetInputField(getter_AddRefs(inputField));
     }
     else {
       nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aContent);
@@ -1249,17 +1249,17 @@ nsFocusManager::CheckIfFocusable(nsICont
   nsPresContext* presContext = shell->GetPresContext();
   if (presContext && presContext->Type() == nsPresContext::eContext_PrintPreview)
     return nsnull;
 
   nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
   if (!frame)
     return nsnull;
 
-  if (aContent->Tag() == nsGkAtoms::area && aContent->IsHTML()) {
+  if (aContent->Tag() == nsGkAtoms::area && aContent->IsNodeOfType(nsINode::eHTML)) {
     // HTML areas do not have their own frame, and the img frame we get from
     // GetPrimaryFrameFor() 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->AreAncestorViewsVisible() &&
            frame->GetStyleVisibility()->IsVisible() &&
            aContent->IsFocusable() ? aContent : nsnull;
   }
 
@@ -2069,17 +2069,17 @@ nsFocusManager::DetermineElementToMoveFo
   // within the most recently opened panel. If a popup is open, its frame will
   // be stored in popupFrame.
   nsIFrame* popupFrame = nsnull;
 
   PRInt32 tabIndex = forward ? 1 : 0;
   if (startContent) {
     nsIFrame* frame = presShell->GetPrimaryFrameFor(startContent);
     if (startContent->Tag() == nsGkAtoms::area &&
-        startContent->IsHTML())
+        startContent->IsNodeOfType(nsINode::eHTML))
       startContent->IsFocusable(&tabIndex);
     else if (frame)
       frame->IsFocusable(&tabIndex, 0);
 
     // 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
     // so just treat this as the beginning of the tab order.
     if (tabIndex < 0) {
@@ -2349,17 +2349,17 @@ nsFocusManager::GetNextTabbableContent(n
                                        );
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (aStartContent == aRootContent) {
       if (!aForward)
         frameTraversal->Last();
     }
     else if (!aStartContent || aStartContent->Tag() != nsGkAtoms::area ||
-             !aStartContent->IsHTML()) {
+             !aStartContent->IsNodeOfType(nsINode::eHTML)) {
       // 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();
     }
 
@@ -2633,17 +2633,17 @@ nsFocusManager::GetRootForFocus(nsPIDOMW
 
     // Finally, check if this is a frameset
     nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDocument);
     if (htmlDoc) {
       PRUint32 childCount = rootContent->GetChildCount();
       for (PRUint32 i = 0; i < childCount; ++i) {
         nsIContent *childContent = rootContent->GetChildAt(i);
         nsINodeInfo *ni = childContent->NodeInfo();
-        if (childContent->IsHTML() &&
+        if (childContent->IsNodeOfType(nsINode::eHTML) &&
             ni->Equals(nsGkAtoms::frameset))
           return nsnull;
       }
     }
   }
 
   return rootContent;
 }
--- a/embedding/components/find/src/nsFind.cpp
+++ b/embedding/components/find/src/nsFind.cpp
@@ -784,17 +784,17 @@ nsFind::NextNode(nsIDOMRange* aSearchRan
 #ifdef DEBUG_FIND
   printf("Iterator gave: "); DumpNode(mIterNode);
 #endif
   return NS_OK;
 }
 
 PRBool nsFind::IsBlockNode(nsIContent* aContent)
 {
-  if (!aContent->IsHTML()) {
+  if (!aContent->IsNodeOfType(nsINode::eHTML)) {
     return PR_FALSE;
   }
 
   nsIAtom *atom = aContent->Tag();
 
   if (atom == sImgAtom ||
       atom == sHRAtom ||
       atom == sThAtom ||
@@ -849,34 +849,34 @@ PRBool nsFind::SkipNode(nsIContent* aCon
   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->IsNodeOfType(nsINode::eHTML) &&
            (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->IsNodeOfType(nsINode::eHTML) &&
          (atom == sScriptAtom ||
           atom == sNoframesAtom ||
           atom == sSelectAtom)))
     {
 #ifdef DEBUG_FIND
       printf("Skipping node: ");
       nsCOMPtr<nsIDOMNode> node (do_QueryInterface(content));
       DumpNode(node);
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1793,17 +1793,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->IsNodeOfType(nsINode::eHTML) &&
           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();
         }
 
@@ -2402,17 +2402,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->IsNodeOfType(nsINode::eHTML)) {
     return nsnull;
   }
   
   nsCOMPtr<nsIDOMHTMLElement> body;
   htmlDoc->GetBody(getter_AddRefs(body));
   nsCOMPtr<nsIContent> bodyElement = do_QueryInterface(body);
   
   if (!bodyElement ||
@@ -2535,17 +2535,17 @@ nsCSSFrameConstructor::ConstructDocEleme
   // particular if the root frame is positioned, in which case
   // contentFrame is the out-of-flow frame and *aNewFrame is the
   // placeholder.
   nsIFrame* contentFrame;
   PRBool processChildren = PR_FALSE;
 
   // Check whether we need to build a XUL box or SVG root frame
 #ifdef MOZ_XUL
-  if (aDocElement->IsXUL()) {
+  if (aDocElement->IsNodeOfType(nsINode::eXUL)) {
     contentFrame = NS_NewDocElementBoxFrame(mPresShell, styleContext);
     if (NS_UNLIKELY(!contentFrame)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
     InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock, nsnull,
                         contentFrame);
     *aNewFrame = contentFrame;
     processChildren = PR_TRUE;
@@ -2794,17 +2794,17 @@ nsCSSFrameConstructor::SetUpDocElementCo
   nsIFrame* viewportFrame = mFixedContainingBlock;
   nsStyleContext* viewportPseudoStyle = viewportFrame->GetStyleContext();
 
   nsIFrame* rootFrame = nsnull;
   nsIAtom* rootPseudo;
         
   if (!isPaginated) {
 #ifdef MOZ_XUL
-    if (aDocElement->IsXUL())
+    if (aDocElement->IsNodeOfType(nsINode::eXUL))
     {
       // 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);
@@ -2833,21 +2833,21 @@ nsCSSFrameConstructor::SetUpDocElementCo
   // the viewport.
   //
   // Threre are three possible values stored in the docshell:
   //  1) nsIScrollable::Scrollbar_Never = no scrollbars
   //  2) nsIScrollable::Scrollbar_Auto = scrollbars appear if needed
   //  3) nsIScrollable::Scrollbar_Always = scrollbars always
   // Only need to create a scroll frame/view for cases 2 and 3.
 
-  PRBool isHTML = aDocElement->IsHTML();
+  PRBool isHTML = aDocElement->IsNodeOfType(nsINode::eHTML);
   PRBool isXUL = PR_FALSE;
 
   if (!isHTML) {
-    isXUL = aDocElement->IsXUL();
+    isXUL = aDocElement->IsNodeOfType(nsINode::eXUL);
   }
 
   // Never create scrollbars for XUL documents
   PRBool isScrollable = !isXUL;
 
   // Never create scrollbars for frameset documents.
   if (isHTML) {
     nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
@@ -3651,17 +3651,17 @@ nsCSSFrameConstructor::FindHTMLData(nsIC
                                     nsIAtom* aTag,
                                     PRInt32 aNameSpaceID,
                                     nsIFrame* aParentFrame,
                                     nsStyleContext* aStyleContext)
 {
   // Ignore the tag if it's not HTML content and if it doesn't extend (via XBL)
   // a valid HTML namespace.  This check must match the one in
   // ShouldHaveFirstLineStyle.
-  if (!aContent->IsHTML() &&
+  if (!aContent->IsNodeOfType(nsINode::eHTML) &&
       aNameSpaceID != kNameSpaceID_XHTML) {
     return nsnull;
   }
 
   NS_ASSERTION(!aParentFrame ||
                aParentFrame->GetStyleContext()->GetPseudoType() !=
                  nsCSSAnonBoxes::fieldsetContent ||
                aParentFrame->GetParent()->GetType() == nsGkAtoms::fieldSetFrame,
@@ -4491,17 +4491,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.
   PRBool propagatedScrollToViewport = PR_FALSE;
   if (aContent->NodeInfo()->Equals(nsGkAtoms::body) &&
-      aContent->IsHTML()) {
+      aContent->IsNodeOfType(nsINode::eHTML)) {
     propagatedScrollToViewport =
       PropagateScrollToViewport() == aContent;
   }
 
   // If the frame is a block-level frame and is scrollable, then wrap it
   // in a scroll frame.
   // XXX Ignore tables for the time being
   // XXXbz it would be nice to combine this with the other block
@@ -6059,35 +6059,35 @@ nsCSSFrameConstructor::GetInsertionPrevS
 
   return prevSibling;
 }
 
 static PRBool
 IsSpecialFramesetChild(nsIContent* aContent)
 {
   // IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init.
-  return aContent->IsHTML() &&
+  return aContent->IsNodeOfType(nsINode::eHTML) &&
     (aContent->Tag() == nsGkAtoms::frameset ||
      aContent->Tag() == nsGkAtoms::frame);
 }
 
 static void
 InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node);
 
 #ifdef MOZ_XUL
 
 static
 nsListBoxBodyFrame*
 MaybeGetListBoxBodyFrame(nsIContent* aContainer, nsIContent* aChild)
 {
   if (!aContainer)
     return nsnull;
 
-  if (aContainer->IsXUL() &&
-      aChild->IsXUL() &&
+  if (aContainer->IsNodeOfType(nsINode::eXUL) &&
+      aChild->IsNodeOfType(nsINode::eXUL) &&
       aContainer->Tag() == nsGkAtoms::listbox &&
       aChild->Tag() == 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(PR_FALSE);
@@ -7551,17 +7551,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->IsNodeOfType(nsINode::eHTML)) {
       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.
@@ -8828,17 +8828,17 @@ nsCSSFrameConstructor::GetInsertionPoint
       *aInsertionPoint = nsnull;
     }
   }
 
   // fieldsets have multiple insertion points.  Note that we might
   // have to look at insertionElement here...
   if (aMultiple && !*aMultiple) {
     nsIContent* content = insertionElement ? insertionElement : container;
-    if (content->IsHTML() &&
+    if (content->IsNodeOfType(nsINode::eHTML) &&
         content->Tag() == nsGkAtoms::fieldset) {
       *aMultiple = PR_TRUE;
     }
   }
 
   return NS_OK;
 }
 
@@ -9189,17 +9189,17 @@ nsCSSFrameConstructor::ShouldHaveFirstLi
   if (hasFirstLine) {
     // But disable for fieldsets
     PRInt32 namespaceID;
     nsIAtom* tag = mDocument->BindingManager()->ResolveTag(aContent,
                                                            &namespaceID);
     // This check must match the one in FindHTMLData.
     hasFirstLine = tag != nsGkAtoms::fieldset ||
       (namespaceID != kNameSpaceID_XHTML &&
-       !aContent->IsHTML());
+       !aContent->IsNodeOfType(nsINode::eHTML));
   }
 
   return hasFirstLine;
 }
 
 void
 nsCSSFrameConstructor::ShouldHaveSpecialBlockStyle(nsIContent* aContent,
                                                    nsStyleContext* aStyleContext,
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1419,17 +1419,17 @@ public:
        if (mBaseObserver->ObservesNativeAnonMutationsForPrint() &&
            aContent->IsInNativeAnonymousSubtree()) {
          return PR_TRUE;
        }
        // Changes to scrollbar are always ok.
        nsIContent* root = aContent->GetCurrentDoc()->GetRootContent();
        while (aContent && aContent->IsInNativeAnonymousSubtree()) {
          nsIContent* parent = aContent->GetParent();
-         if (parent == root && aContent->IsXUL()) {
+         if (parent == root && aContent->IsNodeOfType(nsINode::eXUL)) {
            nsIAtom* tag = aContent->Tag();
            return tag == nsGkAtoms::scrollbar || tag == nsGkAtoms::scrollcorner;
          }
          aContent = parent;
        }
     }
     return PR_FALSE;
   }
@@ -3739,17 +3739,17 @@ PresShell::GoToAnchor(const nsAString& a
         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()) {
+              content->IsNodeOfType(nsINode::eHTML)) {
             break;
           }
           content = nsnull;
         }
       }
     }
   }
 
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -428,24 +428,24 @@ GetMaxOptionHeight(nsIFrame* aContainer)
   }
   return result;
 }
 
 static inline PRBool
 IsOptGroup(nsIContent *aContent)
 {
   return (aContent->NodeInfo()->Equals(nsGkAtoms::optgroup) &&
-          aContent->IsHTML());
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 static inline PRBool
 IsOption(nsIContent *aContent)
 {
   return (aContent->NodeInfo()->Equals(nsGkAtoms::option) &&
-          aContent->IsHTML());
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 static PRUint32
 GetNumberOfOptionsRecursive(nsIContent* aContent)
 {
   PRUint32 optionCount = 0;
   const PRUint32 childCount = aContent ? aContent->GetChildCount() : 0;
   for (PRUint32 index = 0; index < childCount; ++index) {
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -160,17 +160,17 @@ GetWrapPropertyEnum(nsIContent* aContent
 {
   // 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->IsNodeOfType(nsINode::eHTML)) {
     static nsIContent::AttrValuesArray strings[] =
       {&nsGkAtoms::HARD, &nsGkAtoms::OFF, nsnull};
 
     switch (aContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::wrap,
                                       strings, eIgnoreCase)) {
       case 0: aWrapProp = eHTMLTextWrap_Hard; break;
       case 1: aWrapProp = eHTMLTextWrap_Off; break;
     }
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6547,17 +6547,17 @@ nsBlockFrame::SetInitialChildList(nsIAto
   return NS_OK;
 }
 
 // static
 PRBool
 nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
 {
   nsIContent* content = aFrame->GetContent();
-  if (!content || !content->IsHTML())
+  if (!content || !content->IsNodeOfType(nsINode::eHTML))
     return PR_FALSE;
 
   nsIAtom *localName = content->NodeInfo()->NameAtom();
   return localName == nsGkAtoms::ol ||
          localName == nsGkAtoms::ul ||
          localName == nsGkAtoms::dir ||
          localName == nsGkAtoms::menu;
 }
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -511,17 +511,17 @@ nsContainerFrame::SyncWindowProperties(n
   nsIViewManager* vm = aView->GetViewManager();
   nsIView* rootView;
   vm->GetRootView(rootView);
 
   if (aView != rootView)
     return;
 
   nsIContent* rootContent = aPresContext->Document()->GetRootContent();
-  if (!rootContent || !rootContent->IsXUL()) {
+  if (!rootContent || !rootContent->IsNodeOfType(nsINode::eXUL)) {
     // 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/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6042,17 +6042,17 @@ nsIFrame::IsFocusable(PRInt32 *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);
       if (!isFocusable && !aWithMouse &&
           GetType() == nsGkAtoms::scrollFrame &&
-          mContent->IsHTML() &&
+          mContent->IsNodeOfType(nsINode::eHTML) &&
           !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.
--- a/layout/generic/nsFrameFrame.cpp
+++ b/layout/generic/nsFrameFrame.cpp
@@ -389,17 +389,17 @@ nsSubDocumentFrame::BuildDisplayList(nsD
 
 nscoord
 nsSubDocumentFrame::GetIntrinsicWidth()
 {
   if (!IsInline()) {
     return 0;  // HTML <frame> has no useful intrinsic width
   }
 
-  if (mContent->IsXUL()) {
+  if (mContent->IsNodeOfType(nsINode::eXUL)) {
     return 0;  // XUL <iframe> and <browser> have no useful intrinsic width
   }
 
   NS_ASSERTION(ObtainIntrinsicSizeFrame() == nsnull,
                "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).
@@ -407,17 +407,17 @@ nsSubDocumentFrame::GetIntrinsicWidth()
 }
 
 nscoord
 nsSubDocumentFrame::GetIntrinsicHeight()
 {
   // <frame> processing does not use this routine, only <iframe>
   NS_ASSERTION(IsInline(), "Shouldn't have been called");
 
-  if (mContent->IsXUL()) {
+  if (mContent->IsNodeOfType(nsINode::eXUL)) {
     return 0;
   }
 
   NS_ASSERTION(ObtainIntrinsicSizeFrame() == nsnull,
                "Intrinsic height should come from the embedded document.");
 
   // Use 150px, for compatibility with IE, and per CSS2.1 draft.
   return nsPresContext::CSSPixelsToAppUnits(150);
@@ -680,17 +680,17 @@ nsSubDocumentFrame::AttributeChanged(PRI
         }
       }
     }
   }
   else if (aAttribute == nsGkAtoms::type) {
     if (!mFrameLoader) 
       return NS_OK;
 
-    if (!mContent->IsXUL()) {
+    if (!mContent->IsNodeOfType(nsINode::eXUL)) {
       return NS_OK;
     }
 
     // Note: This logic duplicates a lot of logic in
     // nsFrameLoader::EnsureDocShell.  We should fix that.
 
     // Notify our enclosing chrome that our type has changed.  We only do this
     // if our parent is chrome, since in all other cases we're random content
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -378,17 +378,17 @@ nsHTMLFramesetFrame::Init(nsIContent*   
   for (PRUint32 childX = 0; childX < numChildren; childX++) {
     if (mChildCount == numCells) { // we have more <frame> or <frameset> than cells
       break;
     }
     nsIContent *child = mContent->GetChildAt(childX);
 
     // IMPORTANT: This must match the conditions in
     // nsCSSFrameConstructor::ContentAppended/Inserted/Removed    
-    if (!child->IsHTML())
+    if (!child->IsNodeOfType(nsINode::eHTML))
       continue;
 
     nsIAtom *tag = child->Tag();
     if (tag == nsGkAtoms::frameset || tag == nsGkAtoms::frame) {
       nsRefPtr<nsStyleContext> kidSC;
       nsresult result;
 
       kidSC = shell->StyleSet()->ResolveStyleFor(child, mStyleContext);
@@ -731,17 +731,17 @@ nsHTMLFramesetFrame::GetDesiredSize(nsPr
 nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
 {
   nsHTMLFramesetFrame* parent = nsnull;
   nsIContent* content = aChild->GetContent();
 
   if (content) { 
     nsCOMPtr<nsIContent> contentParent = content->GetParent();
 
-    if (contentParent && contentParent->IsHTML() &&
+    if (contentParent && contentParent->IsNodeOfType(nsINode::eHTML) &&
         contentParent->Tag() == nsGkAtoms::frameset) {
       nsIFrame* fptr = aChild->GetParent();
       parent = (nsHTMLFramesetFrame*) fptr;
     }
   }
 
   return parent;
 }
@@ -1388,17 +1388,17 @@ nsHTMLFramesetFrame::RecalculateBorderRe
   }
   PRUint32 childIndex, childTypeIndex = 0;
 
   // number of any type of children
   PRUint32 numChildren = mContent->GetChildCount();
   for (childIndex = 0; childIndex < numChildren; childIndex++) {
     nsIContent *child = mContent->GetChildAt(childIndex);
 
-    if (child->IsHTML()) {
+    if (child->IsNodeOfType(nsINode::eHTML)) {
       nsINodeInfo *ni = child->NodeInfo();
 
       if (ni->Equals(nsGkAtoms::frameset)) {
         childTypes[childTypeIndex++] = FRAMESET;
       } else if (ni->Equals(nsGkAtoms::frame)) {
         childTypes[childTypeIndex++] = FRAME;
       }
       // Don't overflow childTypes array
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -801,17 +801,17 @@ nsImageMap::SearchForAreas(nsIContent* a
 {
   nsresult rv = NS_OK;
   PRUint32 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->IsNodeOfType(nsINode::eHTML)) {
       // 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 = PR_TRUE;
         rv = AddArea(child);
         NS_ENSURE_SUCCESS(rv, rv);
         
         // Continue to next child. This stops mContainsBlockContents from
@@ -952,17 +952,17 @@ nsImageMap::AttributeChanged(nsIDocument
                              PRUint32     aStateMask)
 {
   // 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 ((aContent->NodeInfo()->Equals(nsGkAtoms::area) ||
        aContent->NodeInfo()->Equals(nsGkAtoms::a)) &&
-      aContent->IsHTML() &&
+      aContent->IsNodeOfType(nsINode::eHTML) &&
       aNameSpaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::shape ||
        aAttribute == nsGkAtoms::coords)) {
     MaybeUpdateAreas(aContent->GetParent());
   }
 }
 
 void
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -854,17 +854,17 @@ nsInlineFrame::GetSkipSides() const
 #ifdef ACCESSIBILITY
 NS_IMETHODIMP nsInlineFrame::GetAccessible(nsIAccessible** aAccessible)
 {
   // Broken image accessibles are created here, because layout
   // replaces the image or image control frame with an inline frame
   *aAccessible = nsnull;
   nsIAtom *tagAtom = mContent->Tag();
   if ((tagAtom == nsGkAtoms::img || tagAtom == nsGkAtoms::input || 
-       tagAtom == nsGkAtoms::label) && mContent->IsHTML()) {
+       tagAtom == nsGkAtoms::label) && mContent->IsNodeOfType(nsINode::eHTML)) {
     // Only get accessibility service if we're going to use it
     nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
     if (!accService)
       return NS_ERROR_FAILURE;
     if (tagAtom == nsGkAtoms::input)  // Broken <input type=image ... />
       return accService->CreateHTMLButtonAccessible(static_cast<nsIFrame*>(this), aAccessible);
     else if (tagAtom == nsGkAtoms::img)  // Create accessible for broken <img>
       return accService->CreateHTMLImageAccessible(static_cast<nsIFrame*>(this), aAccessible);
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -3249,17 +3249,17 @@ nsresult nsPluginInstanceOwner::EnsureCa
 
   // Some plugins (eg Flash, see bug 234675.) are actually sensitive to the
   // attribute order.  So we want to make sure we give the plugin the
   // attributes in the order they came in in the source, to be compatible with
   // other browsers.  Now in HTML, the storage order is the reverse of the
   // source order, while in XML and XHTML it's the same as the source order
   // (see the AddAttributes functions in the HTML and XML content sinks).
   PRInt16 start, end, increment;
-  if (mContent->IsHTML() &&
+  if (mContent->IsNodeOfType(nsINode::eHTML) &&
       mContent->IsInHTMLDocument()) {
     // HTML.  Walk attributes in reverse order.
     start = numRealAttrs - 1;
     end = -1;
     increment = -1;
   } else {
     // XHTML or XML.  Walk attributes in forward order.
     start = 0;
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2362,17 +2362,17 @@ nsFrameSelection::NotifySelectionListene
 }
 
 // Start of Table Selection methods
 
 static PRBool IsCell(nsIContent *aContent)
 {
   return ((aContent->Tag() == nsGkAtoms::td ||
            aContent->Tag() == nsGkAtoms::th) &&
-          aContent->IsHTML());
+          aContent->IsNodeOfType(nsINode::eHTML));
 }
 
 nsITableCellLayout* 
 nsFrameSelection::GetCellLayout(nsIContent *aCellContent) const
 {
   NS_ENSURE_TRUE(mShell, nsnull);
   // Get frame for cell
   nsIFrame *cellFrame = mShell->GetPrimaryFrameFor(aCellContent);
@@ -3070,17 +3070,17 @@ nsFrameSelection::GetParentTable(nsICont
 {
   if (!aCell) {
     return nsnull;
   }
 
   for (nsIContent* parent = aCell->GetParent(); parent;
        parent = parent->GetParent()) {
     if (parent->Tag() == nsGkAtoms::table &&
-        parent->IsHTML()) {
+        parent->IsNodeOfType(nsINode::eHTML)) {
       return parent;
     }
   }
 
   return nsnull;
 }
 
 nsresult
@@ -3208,24 +3208,23 @@ nsTypedSelection::GetTableSelectionType(
 
   PRInt32 startOffset = aRange->StartOffset();
   PRInt32 endOffset = aRange->EndOffset();
 
   // Not a single selected node
   if ((endOffset - startOffset) != 1)
     return NS_OK;
 
-  nsIContent* startContent = static_cast<nsIContent*>(startNode);
-  if (!(startNode->IsNodeOfType(nsINode::eELEMENT) && startContent->IsHTML())) {
+  if (!startNode->IsNodeOfType(nsINode::eHTML)) {
     // 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();
+  nsIAtom *tag = static_cast<nsIContent*>(startNode)->Tag();
 
   if (tag == nsGkAtoms::tr)
   {
     *aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
   }
   else //check to see if we are selecting a table or row (column and all cells not done yet)
   {
     nsIContent *child = startNode->GetChildAt(startOffset);
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -1339,17 +1339,17 @@ static ForceReflow gForceReflow;
 
 void
 nsMathMLContainerFrame::SetIncrementScriptLevel(PRInt32 aChildIndex, PRBool aIncrement)
 {
   nsIFrame* child = nsFrameList(GetFirstChild(nsnull)).FrameAt(aChildIndex);
   if (!child)
     return;
   nsIContent* content = child->GetContent();
-  if (!content->IsMathML())
+  if (!content->IsNodeOfType(nsINode::eMATHML))
     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
@@ -2671,17 +2671,17 @@ PRBool nsPrintEngine::HasFramesetChild(n
   }
 
   PRUint32 numChildren = aContent->GetChildCount();
 
   // do a breadth search across all siblings
   for (PRUint32 i = 0; i < numChildren; ++i) {
     nsIContent *child = aContent->GetChildAt(i);
     if (child->Tag() == nsGkAtoms::frameset &&
-        child->IsHTML()) {
+        child->IsNodeOfType(nsINode::eHTML)) {
       return PR_TRUE;
     }
   }
 
   return PR_FALSE;
 }
  
 
--- a/layout/printing/nsPrintPreviewListener.cpp
+++ b/layout/printing/nsPrintPreviewListener.cpp
@@ -170,17 +170,17 @@ GetActionForEvent(nsIDOMEvent* aEvent)
 NS_IMETHODIMP
 nsPrintPreviewListener::HandleEvent(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIDOMEventTarget> target;
   nsCOMPtr<nsIDOMNSEvent> nsEvent = do_QueryInterface(aEvent);
   if (nsEvent)
     nsEvent->GetOriginalTarget(getter_AddRefs(target));
   nsCOMPtr<nsIContent> content(do_QueryInterface(target));
-  if (content && !content->IsXUL()) {
+  if (content && !content->IsNodeOfType(nsINode::eXUL)) {
     eEventAction action = ::GetActionForEvent(aEvent);
     switch (action) {
       case eEventAction_Tab:
       case eEventAction_ShiftTab:
       {
         nsAutoString eventString;
         aEvent->GetType(eventString);
         if (eventString == NS_LITERAL_STRING("keydown")) {
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -951,17 +951,17 @@ RuleProcessorData::RuleProcessorData(nsP
         mIsLink = PR_TRUE;
       }
     } 
 
     // if not an HTML link, check for a simple xlink (cannot be both HTML link and xlink)
     // NOTE: optimization: cannot be an XLink if no attributes (since it needs an 
     if(!mIsLink &&
        mHasAttributes && 
-       !(mIsHTMLContent || aContent->IsXUL()) && 
+       !(mIsHTMLContent || aContent->IsNodeOfType(nsINode::eXUL)) && 
        nsStyleUtil::IsLink(aContent, linkHandler, &mLinkState)) {
       mIsLink = PR_TRUE;
     } 
   }
 
   if (mLinkState == eLinkState_Visited && !gSupportVisitedPseudo) {
     mLinkState = eLinkState_Unvisited;
   }
@@ -1007,17 +1007,17 @@ const nsString* RuleProcessorData::GetLa
       return nsnull;
     for (nsIContent* content = mContent; content;
          content = content->GetParent()) {
       if (content->GetAttrCount() > 0) {
         // xml:lang has precedence over lang on HTML elements (see
         // XHTML1 section C.7).
         PRBool hasAttr = content->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang,
                                           *mLanguage);
-        if (!hasAttr && content->IsHTML()) {
+        if (!hasAttr && content->IsNodeOfType(nsINode::eHTML)) {
           hasAttr = content->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
                                      *mLanguage);
         }
         NS_ASSERTION(hasAttr || mLanguage->IsEmpty(),
                      "GetAttr that returns false should not make string non-empty");
         if (hasAttr) {
           break;
         }
@@ -1429,17 +1429,17 @@ static PRBool SelectorMatches(RuleProces
       nsIContent *child = nsnull;
       nsIContent *element = data.mContent;
       PRInt32 index = -1;
 
       result = PR_FALSE;
       if (element) {
         do {
           child = element->GetChildAt(++index);
-          if (child && child->IsHTML() &&
+          if (child && child->IsNodeOfType(nsINode::eHTML) &&
               child->Tag() == nsGkAtoms::param &&
               child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
                                  NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {
             result = PR_TRUE;
             break;
           }
         } while (child);
       }
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -457,17 +457,17 @@ nsHTMLStyleSheet::RulesMatching(ElementR
       else if (tag == nsGkAtoms::tr) {
         ruleWalker->Forward(mTableRowRule);
       }
       else if ((tag == nsGkAtoms::thead) || (tag == nsGkAtoms::tbody) || (tag == nsGkAtoms::tfoot)) {
         ruleWalker->Forward(mTableTbodyRule);
       }
       else if (tag == nsGkAtoms::col) {
         nsIContent* parent = aData->mParentContent;
-        if (parent && parent->IsHTML() &&
+        if (parent && parent->IsNodeOfType(nsIContent::eHTML) &&
             parent->Tag() == nsGkAtoms::colgroup) {
           ruleWalker->Forward(mTableColRule);
         } else {
           ruleWalker->Forward(mTableUngroupedColRule);
         }
       }
       else if (tag == nsGkAtoms::colgroup) {
         ruleWalker->Forward(mTableColgroupRule);
@@ -528,17 +528,17 @@ nsHTMLStyleSheet::HasAttributeDependentS
   // attribute here, because we handle that under HasStateDependentStyle() as
   // needed.
 
   // Result is true for |href| changes on HTML links if we have link rules.
   nsIContent *content = aData->mContent;
   if (aData->mAttribute == nsGkAtoms::href &&
       (mLinkRule || mVisitedRule || mActiveRule) &&
       content &&
-      content->IsHTML() &&
+      content->IsNodeOfType(nsINode::eHTML) &&
       aData->mContentTag == nsGkAtoms::a) {
     *aResult = eReStyle_Self;
     return NS_OK;
   }
 
   // Don't worry about the mDocumentColorRule since it only applies
   // to descendants of body, when we're already reresolving.
 
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -427,17 +427,17 @@ GetLinkStateFromURI(nsIURI* aURI, nsICon
   return state;  
 }
 
 /*static*/
 PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent,
                                nsILinkHandler *aLinkHandler,
                                nsLinkState *aState)
 {
-  NS_ASSERTION(aContent->IsHTML(),
+  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eHTML),
                "Only use this function with HTML elements");
   NS_ASSERTION(aState, "null arg in IsHTMLLink");
 
   nsLinkState linkState = aContent->GetLinkState();
   if (linkState == eLinkState_Unknown) {
     // if it is an anchor, area or link then check the href attribute
     // make sure this anchor has a link even if we are not testing state
     // if there is no link, then this anchor is not really a linkpseudo.
--- a/layout/svg/base/src/nsSVGContainerFrame.cpp
+++ b/layout/svg/base/src/nsSVGContainerFrame.cpp
@@ -264,17 +264,17 @@ nsSVGDisplayContainerFrame::GetBBoxContr
   nsIFrame* kid = mFrames.FirstChild();
   while (kid) {
     nsISVGChildFrame* svgKid = do_QueryFrame(kid);
     if (svgKid) {
       gfxMatrix transform = aToBBoxUserspace;
       // nsSVGGlyphFrame's mContent is a nsTextNode!
       if (kid->GetType() != nsGkAtoms::svgGlyphFrame) {
         nsIContent *content = kid->GetContent();
-        if (content->IsSVG()) {
+        if (content->IsNodeOfType(nsINode::eSVG)) {
           transform = static_cast<nsSVGElement*>(content)->
                         PrependLocalTransformTo(aToBBoxUserspace);
         }
       }
       bboxUnion = bboxUnion.Union(svgKid->GetBBoxContribution(transform));
     }
     kid = kid->GetNextSibling();
   }
--- a/layout/svg/base/src/nsSVGSwitchFrame.cpp
+++ b/layout/svg/base/src/nsSVGSwitchFrame.cpp
@@ -186,17 +186,17 @@ nsSVGSwitchFrame::NotifyRedrawUnsuspende
 gfxRect
 nsSVGSwitchFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace)
 {
   nsIFrame* kid = GetActiveChildFrame();
   nsISVGChildFrame* svgKid = do_QueryFrame(kid);
   if (svgKid) {
     nsIContent *content = kid->GetContent();
     gfxMatrix transform = aToBBoxUserspace;
-    if (content->IsSVG()) {
+    if (content->IsNodeOfType(nsINode::eSVG)) {
       transform = static_cast<nsSVGElement*>(content)->
                     PrependLocalTransformTo(aToBBoxUserspace);
     }
     return svgKid->GetBBoxContribution(transform);
   }
   return gfxRect(0.0, 0.0, 0.0, 0.0);
 }
 
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -665,17 +665,17 @@ nsIBox::AddCSSPrefSize(nsBoxLayoutState&
         aSize.height = position->mHeight.GetCoordValue();     
         heightSet = PR_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->IsNodeOfType(nsINode::eXUL)) {
         nsAutoString value;
         PRInt32 error;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
         if (!value.IsEmpty()) {
             value.Trim("%");
 
             aSize.width =
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -1215,17 +1215,17 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBo
 
     PRInt32 i = parentContent->IndexOf(prevContent);
 
     PRUint32 childCount = parentContent->GetChildCount();
     if (((PRUint32)i + aOffset + 1) < childCount) {
       // There is a content node that wants a frame.
       nsIContent *nextContent = parentContent->GetChildAt(i + aOffset + 1);
 
-      if (!nextContent->IsXUL() ||
+      if (!nextContent->IsNodeOfType(nsINode::eXUL) ||
           nextContent->Tag() != nsGkAtoms::listitem)
         return GetNextItemBox(aBox, ++aOffset, aCreated);
 
       nsPresContext* presContext = PresContext();
       nsIFrame* existingFrame =
         presContext->GetPresShell()->GetPrimaryFrameFor(nextContent);
 
       if (!existingFrame) {
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -222,17 +222,17 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutS
   nsIContent* baseElement = GetBaseElement();
 
   nsSize min(0,0);
   PRInt32 desiredRows;
   if (NS_UNLIKELY(!baseElement)) {
     desiredRows = 0;
   }
   else if (baseElement->Tag() == nsGkAtoms::select &&
-           baseElement->IsHTML()) {
+           baseElement->IsNodeOfType(nsINode::eHTML)) {
     min.width = CalcMaxRowWidth();
     nsAutoString size;
     baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size);
     if (!size.IsEmpty()) {
       PRInt32 err;
       desiredRows = size.ToInteger(&err);
       mHasFixedRowCount = PR_TRUE;
       mPageLength = desiredRows;
@@ -1819,17 +1819,17 @@ nsTreeBodyFrame::IsCellCropped(PRInt32 a
 }
 
 void
 nsTreeBodyFrame::MarkDirtyIfSelect()
 {
   nsIContent* baseElement = GetBaseElement();
 
   if (baseElement && baseElement->Tag() == nsGkAtoms::select &&
-      baseElement->IsHTML()) {
+      baseElement->IsNodeOfType(nsINode::eHTML)) {
     // If we are an intrinsically sized select widget, we may need to
     // resize, if the widest item was removed or a new item was added.
     // XXX optimize this more
 
     mStringWidth = -1;
     PresContext()->PresShell()->FrameNeedsReflow(this,
                                                  nsIPresShell::eTreeChange,
                                                  NS_FRAME_IS_DIRTY);
@@ -4298,17 +4298,17 @@ nsTreeBodyFrame::GetBaseElement()
   nsIFrame* parent = GetParent();
   while (parent) {
     nsIContent* content = parent->GetContent();
     if (content) {
       nsINodeInfo* ni = content->NodeInfo();
 
       if (ni->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) ||
           (ni->Equals(nsGkAtoms::select) &&
-           content->IsHTML()))
+           content->IsNodeOfType(nsINode::eHTML)))
         return content;
     }
 
     parent = parent->GetParent();
   }
 
   return nsnull;
 }
--- a/layout/xul/base/src/tree/src/nsTreeContentView.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeContentView.cpp
@@ -512,28 +512,28 @@ nsTreeContentView::GetCellText(PRInt32 a
   // Check for a "label" attribute - this is valid on an <treeitem>
   // or an <option>, with a single implied column.
   if (row->mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, _retval)
       && !_retval.IsEmpty())
     return NS_OK;
 
   nsIAtom *rowTag = row->mContent->Tag();
   if (rowTag == nsGkAtoms::option &&
-      row->mContent->IsHTML()) {
+      row->mContent->IsNodeOfType(nsINode::eHTML)) {
     // Use the text node child as the label
     nsCOMPtr<nsIDOMHTMLOptionElement> elem = do_QueryInterface(row->mContent);
     elem->GetText(_retval);
   }
   else if (rowTag == nsGkAtoms::optgroup &&
-           row->mContent->IsHTML()) {
+           row->mContent->IsNodeOfType(nsINode::eHTML)) {
     nsCOMPtr<nsIDOMHTMLOptGroupElement> elem = do_QueryInterface(row->mContent);
     elem->GetLabel(_retval);
   }
   else if (rowTag == nsGkAtoms::treeitem &&
-           row->mContent->IsXUL()) {
+           row->mContent->IsNodeOfType(nsINode::eXUL)) {
     nsIContent* realRow =
       nsTreeUtils::GetImmediateChild(row->mContent, nsGkAtoms::treerow);
     if (realRow) {
       nsIContent* cell = GetCell(realRow, aCol);
       if (cell)
         cell->GetAttr(kNameSpaceID_None, nsGkAtoms::label, _retval);
     }
   }
@@ -583,17 +583,17 @@ nsTreeContentView::ToggleOpenState(PRInt
   if (aIndex < 0 || aIndex >= PRInt32(mRows.Length()))
     return NS_ERROR_INVALID_ARG;   
 
   // We don't serialize content right here, since content might be generated
   // lazily.
   Row* row = mRows[aIndex];
 
   if (row->mContent->Tag() == nsGkAtoms::optgroup &&
-      row->mContent->IsHTML()) {
+      row->mContent->IsNodeOfType(nsINode::eHTML)) {
     // we don't use an attribute for optgroup's open state
     if (row->IsOpen())
       CloseContainer(aIndex);
     else
       OpenContainer(aIndex);
   }
   else {
     if (row->IsOpen())
@@ -789,17 +789,17 @@ nsTreeContentView::GetIndexOfItem(nsIDOM
 
 void
 nsTreeContentView::ContentStatesChanged(nsIDocument* aDocument,
                                         nsIContent* aContent1,
                                         nsIContent* aContent2,
                                         PRInt32 aStateMask)
 {
   if (!aContent1 || !mSelection ||
-      !aContent1->IsHTML() ||
+      !aContent1->IsNodeOfType(nsINode::eHTML) ||
       !(aStateMask & NS_EVENT_STATE_CHECKED))
     return;
 
   if (aContent1->Tag() == nsGkAtoms::option) {
     // update the selected state for this node
     PRInt32 index = FindContent(aContent1);
     if (index >= 0)
       mSelection->ToggleSelect(index);
@@ -818,17 +818,17 @@ nsTreeContentView::AttributeChanged(nsID
   // First check the tag to see if it's one that we care about.
   nsIAtom *tag = aContent->Tag();
 
   if (mBoxObject && (aContent == mRoot || aContent == mBody)) {
     mBoxObject->ClearStyleAndImageCaches();
     mBoxObject->Invalidate();
   }
 
-  if (aContent->IsXUL()) {
+  if (aContent->IsNodeOfType(nsINode::eXUL)) {
     if (tag != nsGkAtoms::treecol &&
         tag != nsGkAtoms::treeitem &&
         tag != nsGkAtoms::treeseparator &&
         tag != nsGkAtoms::treerow &&
         tag != nsGkAtoms::treecell)
       return;
   }
   else {
@@ -837,18 +837,18 @@ nsTreeContentView::AttributeChanged(nsID
 
   // If we have a legal tag, go up to the tree/select and make sure
   // that it's ours.
 
   for (nsIContent* element = aContent; element != mBody; element = element->GetParent()) {
     if (!element)
       return; // this is not for us
     nsIAtom *parentTag = element->Tag();
-    if ((element->IsXUL() && parentTag == nsGkAtoms::tree) ||
-        (element->IsHTML() && parentTag == nsGkAtoms::select))
+    if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
+        (element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
       return; // this is not for us
   }
 
   // Handle changes of the hidden attribute.
   if (aAttribute == nsGkAtoms::hidden &&
      (tag == nsGkAtoms::treeitem || tag == nsGkAtoms::treeseparator)) {
     PRBool hidden = aContent->AttrValueIs(kNameSpaceID_None,
                                           nsGkAtoms::hidden,
@@ -979,22 +979,22 @@ nsTreeContentView::ContentInserted(nsIDo
                                    PRInt32 aIndexInContainer)
 {
   NS_ASSERTION(aChild, "null ptr");
 
   // Make sure this notification concerns us.
   // First check the tag to see if it's one that we care about.
   nsIAtom *childTag = aChild->Tag();
 
-  if (aChild->IsHTML()) {
+  if (aChild->IsNodeOfType(nsINode::eHTML)) {
     if (childTag != nsGkAtoms::option &&
         childTag != nsGkAtoms::optgroup)
       return;
   }
-  else if (aChild->IsXUL()) {
+  else if (aChild->IsNodeOfType(nsINode::eXUL)) {
     if (childTag != nsGkAtoms::treeitem &&
         childTag != nsGkAtoms::treeseparator &&
         childTag != nsGkAtoms::treechildren &&
         childTag != nsGkAtoms::treerow &&
         childTag != nsGkAtoms::treecell)
       return;
   }
   else {
@@ -1003,18 +1003,18 @@ nsTreeContentView::ContentInserted(nsIDo
 
   // If we have a legal tag, go up to the tree/select and make sure
   // that it's ours.
 
   for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) {
     if (!element)
       return; // this is not for us
     nsIAtom *parentTag = element->Tag();
-    if ((element->IsXUL() && parentTag == nsGkAtoms::tree) ||
-        (element->IsHTML() && parentTag == nsGkAtoms::select))
+    if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
+        (element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
       return; // this is not for us
   }
 
   if (childTag == nsGkAtoms::treechildren) {
     PRInt32 index = FindContent(aContainer);
     if (index >= 0) {
       Row* row = mRows[index];
       row->SetEmpty(PR_FALSE);
@@ -1062,22 +1062,22 @@ nsTreeContentView::ContentRemoved(nsIDoc
                                      PRInt32 aIndexInContainer)
 {
   NS_ASSERTION(aChild, "null ptr");
 
   // Make sure this notification concerns us.
   // First check the tag to see if it's one that we care about.
   nsIAtom *tag = aChild->Tag();
 
-  if (aChild->IsHTML()) {
+  if (aChild->IsNodeOfType(nsINode::eHTML)) {
     if (tag != nsGkAtoms::option &&
         tag != nsGkAtoms::optgroup)
       return;
   }
-  else if (aChild->IsXUL()) {
+  else if (aChild->IsNodeOfType(nsINode::eXUL)) {
     if (tag != nsGkAtoms::treeitem &&
         tag != nsGkAtoms::treeseparator &&
         tag != nsGkAtoms::treechildren &&
         tag != nsGkAtoms::treerow &&
         tag != nsGkAtoms::treecell)
       return;
   }
   else {
@@ -1086,18 +1086,18 @@ nsTreeContentView::ContentRemoved(nsIDoc
 
   // If we have a legal tag, go up to the tree/select and make sure
   // that it's ours.
 
   for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) {
     if (!element)
       return; // this is not for us
     nsIAtom *parentTag = element->Tag();
-    if ((element->IsXUL() && parentTag == nsGkAtoms::tree) ||
-        (element->IsHTML() && parentTag == nsGkAtoms::select))
+    if ((element->IsNodeOfType(nsINode::eXUL) && parentTag == nsGkAtoms::tree) ||
+        (element->IsNodeOfType(nsINode::eHTML) && parentTag == nsGkAtoms::select))
       return; // this is not for us
   }
 
   if (tag == nsGkAtoms::treechildren) {
     PRInt32 index = FindContent(aContainer);
     if (index >= 0) {
       Row* row = mRows[index];
       row->SetEmpty(PR_TRUE);
@@ -1149,23 +1149,23 @@ nsTreeContentView::Serialize(nsIContent*
                              PRInt32* aIndex, nsTArray<Row*>& aRows)
 {
   ChildIterator iter, last;
   for (ChildIterator::Init(aContent, &iter, &last); iter != last; ++iter) {
     nsIContent* content = *iter;
     nsIAtom *tag = content->Tag();
     PRInt32 count = aRows.Length();
 
-    if (content->IsXUL()) {
+    if (content->IsNodeOfType(nsINode::eXUL)) {
       if (tag == nsGkAtoms::treeitem)
         SerializeItem(content, aParentIndex, aIndex, aRows);
       else if (tag == nsGkAtoms::treeseparator)
         SerializeSeparator(content, aParentIndex, aIndex, aRows);
     }
-    else if (content->IsHTML()) {
+    else if (content->IsNodeOfType(nsINode::eHTML)) {
       if (tag == nsGkAtoms::option)
         SerializeOption(content, aParentIndex, aIndex, aRows);
       else if (tag == nsGkAtoms::optgroup)
         SerializeOptGroup(content, aParentIndex, aIndex, aRows);
     }
     *aIndex += aRows.Length() - count;
   }
 }
@@ -1266,17 +1266,17 @@ nsTreeContentView::GetIndexInSubtree(nsI
   for (PRUint32 i = 0; i < childCount; i++) {
     nsIContent *content = aContainer->GetChildAt(i);
 
     if (content == aContent)
       break;
 
     nsIAtom *tag = content->Tag();
 
-    if (content->IsXUL()) {
+    if (content->IsNodeOfType(nsINode::eXUL)) {
       if (tag == nsGkAtoms::treeitem) {
         if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
                                    nsGkAtoms::_true, eCaseMatters)) {
           (*aIndex)++;
           if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
                                    nsGkAtoms::_true, eCaseMatters) &&
               content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
                                    nsGkAtoms::_true, eCaseMatters)) {
@@ -1288,17 +1288,17 @@ nsTreeContentView::GetIndexInSubtree(nsI
         }
       }
       else if (tag == nsGkAtoms::treeseparator) {
         if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
                                    nsGkAtoms::_true, eCaseMatters))
           (*aIndex)++;
       }
     }
-    else if (content->IsHTML()) {
+    else if (content->IsNodeOfType(nsINode::eHTML)) {
       if (tag == nsGkAtoms::optgroup) {
         (*aIndex)++;
         GetIndexInSubtree(content, aContent, aIndex);
       }
       else if (tag == nsGkAtoms::option)
         (*aIndex)++;
     }
   }
@@ -1360,18 +1360,18 @@ void
 nsTreeContentView::InsertRowFor(nsIContent* aParent, nsIContent* aChild)
 {
   PRInt32 grandParentIndex = -1;
   PRBool insertRow = PR_FALSE;
 
   nsCOMPtr<nsIContent> grandParent = aParent->GetParent();
   nsIAtom* grandParentTag = grandParent->Tag();
 
-  if ((grandParent->IsXUL() && grandParentTag == nsGkAtoms::tree) ||
-      (grandParent->IsHTML() && grandParentTag == nsGkAtoms::select)
+  if ((grandParent->IsNodeOfType(nsINode::eXUL) && grandParentTag == nsGkAtoms::tree) ||
+      (grandParent->IsNodeOfType(nsINode::eHTML) && grandParentTag == nsGkAtoms::select)
      ) {
     // Allow insertion to the outermost container.
     insertRow = PR_TRUE;
   }
   else {
     // Test insertion to an inner container.
 
     // First try to find this parent in our array of rows, if we find one
@@ -1394,23 +1394,23 @@ nsTreeContentView::InsertRowFor(nsIConte
   }
 }
 
 PRInt32
 nsTreeContentView::InsertRow(PRInt32 aParentIndex, PRInt32 aIndex, nsIContent* aContent)
 {
   nsAutoTArray<Row*, 8> rows;
   nsIAtom *tag = aContent->Tag();
-  if (aContent->IsXUL()) {
+  if (aContent->IsNodeOfType(nsINode::eXUL)) {
     if (tag == nsGkAtoms::treeitem)
       SerializeItem(aContent, aParentIndex, &aIndex, rows);
     else if (tag == nsGkAtoms::treeseparator)
       SerializeSeparator(aContent, aParentIndex, &aIndex, rows);
   }
-  else if (aContent->IsHTML()) {
+  else if (aContent->IsNodeOfType(nsINode::eHTML)) {
     if (tag == nsGkAtoms::option)
       SerializeOption(aContent, aParentIndex, &aIndex, rows);
     else if (tag == nsGkAtoms::optgroup)
       SerializeOptGroup(aContent, aParentIndex, &aIndex, rows);
   }
 
   mRows.InsertElementsAt(aParentIndex + aIndex + 1, rows);
   PRInt32 count = rows.Length();
--- a/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
@@ -826,17 +826,17 @@ nsTypeAheadFind::RangeStartsInsideLink(n
 
   nsCOMPtr<nsIAtom> tag, hrefAtom(do_GetAtom("href"));
   nsCOMPtr<nsIAtom> typeAtom(do_GetAtom("type"));
 
   while (PR_TRUE) {
     // Keep testing while startContent is equal to something,
     // eventually we'll run out of ancestors
 
-    if (startContent->IsHTML()) {
+    if (startContent->IsNodeOfType(nsINode::eHTML)) {
       nsCOMPtr<nsILink> link(do_QueryInterface(startContent));
       if (link) {
         // Check to see if inside HTML link
         *aIsInsideLink = startContent->HasAttr(kNameSpaceID_None, hrefAtom);
         return;
       }
     }
     else {
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -115,22 +115,22 @@ nsNativeThemeGTK::RefreshWidgetWindow(ns
 
   nsIViewManager* vm = shell->GetViewManager();
   if (!vm)
     return;
  
   vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);
 }
 
-static PRBool IsFrameContentNodeInNamespace(nsIFrame *aFrame, PRUint32 aNamespace)
+static PRBool IsFrameContentNodeOfType(nsIFrame *aFrame, PRUint32 aFlags)
 {
   nsIContent *content = aFrame ? aFrame->GetContent() : nsnull;
   if (!content)
     return false;
-  return content->IsInNamespace(aNamespace);
+  return content->IsNodeOfType(aFlags);
 }
 
 static PRBool IsWidgetTypeDisabled(PRUint8* aDisabledVector, PRUint8 aWidgetType) {
   return (aDisabledVector[aWidgetType >> 3] & (1 << (aWidgetType & 7))) != 0;
 }
 
 static void SetWidgetTypeDisabled(PRUint8* aDisabledVector, PRUint8 aWidgetType) {
   aDisabledVector[aWidgetType >> 3] |= (1 << (aWidgetType & 7));
@@ -194,17 +194,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
       // determines our state.
       nsIFrame *stateFrame = aFrame;
       if (aFrame && ((aWidgetFlags && (aWidgetType == NS_THEME_CHECKBOX ||
                                        aWidgetType == NS_THEME_RADIO)) ||
                      aWidgetType == NS_THEME_CHECKBOX_LABEL ||
                      aWidgetType == NS_THEME_RADIO_LABEL)) {
 
         nsIAtom* atom = nsnull;
-        if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
+        if (IsFrameContentNodeOfType(aFrame, nsINode::eXUL)) {
           if (aWidgetType == NS_THEME_CHECKBOX_LABEL ||
               aWidgetType == NS_THEME_RADIO_LABEL) {
             // Adjust stateFrame so GetContentState finds the correct state.
             stateFrame = aFrame = aFrame->GetParent()->GetParent();
           } else {
             // GetContentState knows to look one frame up for radio/checkbox
             // widgets, so don't adjust stateFrame here.
             aFrame = aFrame->GetParent();
@@ -242,17 +242,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
       aState->disabled = (IsDisabled(aFrame) || IsReadOnly(aFrame));
       aState->active  = (eventState & NS_EVENT_STATE_ACTIVE) == NS_EVENT_STATE_ACTIVE;
       aState->focused = (eventState & NS_EVENT_STATE_FOCUS) == NS_EVENT_STATE_FOCUS;
       aState->inHover = (eventState & NS_EVENT_STATE_HOVER) == NS_EVENT_STATE_HOVER;
       aState->isDefault = IsDefaultButton(aFrame);
       aState->canDefault = FALSE; // XXX fix me
       aState->depressed = FALSE;
 
-      if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
+      if (IsFrameContentNodeOfType(aFrame, nsINode::eXUL)) {
         // For these widget types, some element (either a child or parent)
         // actually has element focus, so we check the focused attribute
         // to see whether to draw in the focused state.
         if (aWidgetType == NS_THEME_TEXTFIELD ||
             aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
             aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD ||
             aWidgetType == NS_THEME_SPINNER_TEXTFIELD ||
             aWidgetType == NS_THEME_RADIO_CONTAINER ||
@@ -491,17 +491,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
   case NS_THEME_TREEVIEW_TWISTY_OPEN:
     aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
     if (aWidgetFlags)
       *aWidgetFlags = GTK_EXPANDER_EXPANDED;
     break;
   case NS_THEME_DROPDOWN:
     aGtkWidgetType = MOZ_GTK_DROPDOWN;
     if (aWidgetFlags)
-        *aWidgetFlags = IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML);
+        *aWidgetFlags = IsFrameContentNodeOfType(aFrame, nsINode::eHTML);
     break;
   case NS_THEME_DROPDOWN_TEXT:
     return PR_FALSE; // nothing to do, but prevents the bg from being drawn
   case NS_THEME_DROPDOWN_TEXTFIELD:
     aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
     break;
   case NS_THEME_DROPDOWN_BUTTON:
     aGtkWidgetType = MOZ_GTK_DROPDOWN_ARROW;
@@ -866,17 +866,17 @@ nsNativeThemeGTK::GetWidgetBorder(nsIDev
     break;
   default:
     {
       GtkThemeWidgetType gtkWidgetType;
       if (GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, nsnull,
                                nsnull))
         moz_gtk_get_widget_border(gtkWidgetType, &aResult->left, &aResult->top,
                                   &aResult->right, &aResult->bottom, direction,
-                                  IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML));
+                                  IsFrameContentNodeOfType(aFrame, nsINode::eHTML));
     }
   }
   return NS_OK;
 }
 
 PRBool
 nsNativeThemeGTK::GetWidgetPadding(nsIDeviceContext* aContext,
                                    nsIFrame* aFrame, PRUint8 aWidgetType,
@@ -1299,17 +1299,17 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
   case NS_THEME_DIALOG:
   case NS_THEME_DROPDOWN:
   case NS_THEME_DROPDOWN_TEXT:
     return !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
 
   case NS_THEME_DROPDOWN_BUTTON:
     // "Native" dropdown buttons cause padding and margin problems, but only
     // in HTML so allow them in XUL.
-    return (!aFrame || IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) &&
+    return (!aFrame || IsFrameContentNodeOfType(aFrame, nsINode::eXUL)) &&
            !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
 
   }
 
   return PR_FALSE;
 }
 
 NS_IMETHODIMP_(PRBool)
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -113,17 +113,17 @@ GetViewportOrgEx(HDC hdc, LPPOINT lpPoin
     SetViewportOrgEx(hdc, lpPoint->x, lpPoint->y, NULL);
   return TRUE;
 }
 #endif
 
 static inline bool IsHTMLContent(nsIFrame *frame)
 {
   nsIContent* content = frame->GetContent();
-  return content && content->IsHTML();
+  return content && content->IsNodeOfType(nsINode::eHTML);
 }
 
 nsNativeThemeWin::nsNativeThemeWin() {
   // If there is a relevant change in forms.css for windows platform,
   // static widget style variables (e.g. sButtonBorderSize) should be 
   // reinitialized here.
 }
 
@@ -385,17 +385,17 @@ nsNativeThemeWin::StandardGetState(nsIFr
 
   return TS_NORMAL;
 }
 
 PRBool
 nsNativeThemeWin::IsMenuActive(nsIFrame *aFrame, PRUint8 aWidgetType)
 {
   nsIContent* content = aFrame->GetContent();
-  if (content->IsXUL() &&
+  if (content->IsNodeOfType(nsINode::eXUL) &&
       content->NodeInfo()->Equals(nsWidgetAtoms::richlistitem))
     return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected);
 
   return CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive);
 }
 
 nsresult 
 nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, 
@@ -492,17 +492,17 @@ nsNativeThemeWin::GetThemePartAndState(n
           aState = TFS_EDITBORDER_NORMAL;
         } else {
           PRInt32 eventState = GetContentState(aFrame, aWidgetType);
           nsIContent* content = aFrame->GetContent();
 
           /* XUL textboxes don't get focused themselves, because they have child
            * html:input.. but we can check the XUL focused attributes on them
            */
-          if (content && content->IsXUL() && IsFocused(aFrame))
+          if (content && content->IsNodeOfType(nsINode::eXUL) && IsFocused(aFrame))
             aState = TFS_EDITBORDER_FOCUSED;
           else if (eventState & NS_EVENT_STATE_ACTIVE || eventState & NS_EVENT_STATE_FOCUS)
             aState = TFS_EDITBORDER_FOCUSED;
           else if (eventState & NS_EVENT_STATE_HOVER)
             aState = TFS_EDITBORDER_HOVER;
           else
             aState = TFS_EDITBORDER_NORMAL;
         }
@@ -773,17 +773,17 @@ nsNativeThemeWin::GetThemePartAndState(n
       }
       
       aState = StandardGetState(aFrame, aWidgetType, PR_TRUE);
       
       return NS_OK;
     }
     case NS_THEME_DROPDOWN: {
       nsIContent* content = aFrame->GetContent();
-      PRBool isHTML = content && content->IsHTML();
+      PRBool isHTML = content && content->IsNodeOfType(nsINode::eHTML);
 
       /* On vista, in HTML, we use CBP_DROPBORDER instead of DROPFRAME for HTML content;
        * this gives us the thin outline in HTML content, instead of the gradient-filled
        * background */
       if (isHTML)
         aPart = CBP_DROPBORDER;
       else
         aPart = CBP_DROPFRAME;
@@ -1182,17 +1182,17 @@ RENDER_AGAIN:
   // background, instead opting to be drawn specially below.
   else if (part >= 0) {
     nsUXThemeData::drawThemeBG(theme, hdc, part, state, &widgetRect, &clipRect);
   }
 
   // Draw focus rectangles for XP HTML checkboxes and radio buttons
   // XXX it'd be nice to draw these outside of the frame
   if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) &&
-      aFrame->GetContent()->IsHTML() ||
+      aFrame->GetContent()->IsNodeOfType(nsINode::eHTML) ||
       aWidgetType == NS_THEME_SCALE_HORIZONTAL ||
       aWidgetType == NS_THEME_SCALE_VERTICAL) {
       PRInt32 contentState;
       contentState = GetContentState(aFrame, aWidgetType);  
 
       if (contentState & NS_EVENT_STATE_FOCUS) {
         POINT vpOrg;
         HPEN hPen = nsnull;
@@ -1345,17 +1345,17 @@ nsNativeThemeWin::GetWidgetBorder(nsIDev
       aResult->right = 0;
     else if (IsRightToSelectedTab(aFrame))
       // Remove the left edge, since we won't be drawing it.
       aResult->left = 0;
   }
 
   if (aFrame && (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
     nsIContent* content = aFrame->GetContent();
-    if (content && content->IsHTML()) {
+    if (content && content->IsNodeOfType(nsINode::eHTML)) {
       // We need to pad textfields by 1 pixel, since the caret will draw
       // flush against the edge by default if we don't.
       aResult->top++;
       aResult->left++;
       aResult->bottom++;
       aResult->right++;
     }
   }
@@ -1627,17 +1627,17 @@ nsNativeThemeWin::GetMinimumWidgetSize(n
                  // In our app, we want these widgets to be able to really shrink down,
                  // so use the min-size request value (of 0).
 
   // We should let HTML buttons shrink to their min size.
   // FIXME bug 403934: We should probably really separate
   // GetPreferredWidgetSize from GetMinimumWidgetSize, so callers can
   // use the one they want.
   if (aWidgetType == NS_THEME_BUTTON &&
-      aFrame->GetContent()->IsHTML())
+      aFrame->GetContent()->IsNodeOfType(nsINode::eHTML))
     sizeReq = 0; /* TS_MIN */
 
   SIZE sz;
   nsUXThemeData::getThemePartSize(theme, hdc, part, state, NULL, sizeReq, &sz);
   aResult->width = sz.cx;
   aResult->height = sz.cy;
 
   if (aWidgetType == NS_THEME_SPINNER_UP_BUTTON ||
@@ -2078,17 +2078,17 @@ nsresult nsNativeThemeWin::ClassicGetThe
         aState |= DFCS_CHECKED;
       else {
         if (contentState & NS_EVENT_STATE_ACTIVE && contentState & NS_EVENT_STATE_HOVER) {
           aState |= DFCS_PUSHED;
           const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
           // The down state is flat if the button is focusable
           if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
 #ifndef WINCE
-            if (!aFrame->GetContent()->IsHTML())
+            if (!aFrame->GetContent()->IsNodeOfType(nsINode::eHTML))
               aState |= DFCS_FLAT;
 #endif
             aFocused = PR_TRUE;
           }
         }
         if ((contentState & NS_EVENT_STATE_FOCUS) || 
           (aState == DFCS_BUTTONPUSH && IsDefaultButton(aFrame))) {
           aFocused = PR_TRUE;          
@@ -2120,17 +2120,17 @@ nsresult nsNativeThemeWin::ClassicGetThe
       } else {
         aState = DFCS_BUTTONRADIO;
       }
       if (isChecked) {
         aState |= DFCS_CHECKED;
       }
 
       contentState = GetContentState(aFrame, aWidgetType);
-      if (!content->IsXUL() &&
+      if (!content->IsNodeOfType(nsINode::eXUL) &&
           (contentState & NS_EVENT_STATE_FOCUS)) {
         aFocused = PR_TRUE;
       }
 
       if (IsDisabled(aFrame)) {
         aState |= DFCS_INACTIVE;
       } else if (contentState & NS_EVENT_STATE_ACTIVE &&
                  contentState & NS_EVENT_STATE_HOVER) {
@@ -2599,17 +2599,17 @@ RENDER_AGAIN:
     case NS_THEME_LISTBOX:
     case NS_THEME_DROPDOWN:
     case NS_THEME_DROPDOWN_TEXTFIELD: {
       // Draw inset edge
       ::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
 
       // Fill in background
       if (IsDisabled(aFrame) ||
-          (aFrame->GetContent()->IsXUL() &&
+          (aFrame->GetContent()->IsNodeOfType(nsINode::eXUL) &&
            IsReadOnly(aFrame)))
         ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
       else
         ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_WINDOW+1));
 
       break;
     }
     case NS_THEME_TREEVIEW: {
--- a/widget/src/xpwidgets/nsNativeTheme.cpp
+++ b/widget/src/xpwidgets/nsNativeTheme.cpp
@@ -72,17 +72,17 @@ PRInt32
 nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
 {
   if (!aFrame)
     return 0;
 
   PRBool isXULCheckboxRadio = 
     (aWidgetType == NS_THEME_CHECKBOX ||
      aWidgetType == NS_THEME_RADIO) &&
-    aFrame->GetContent()->IsXUL();
+    aFrame->GetContent()->IsNodeOfType(nsINode::eXUL);
   if (isXULCheckboxRadio)
     aFrame = aFrame->GetParent();
 
   if (!aFrame->GetContent())
     return 0;
 
   nsIPresShell *shell = GetPresShell(aFrame);
   if (!shell)
@@ -104,17 +104,17 @@ nsNativeTheme::CheckBooleanAttr(nsIFrame
 {
   if (!aFrame)
     return PR_FALSE;
 
   nsIContent* content = aFrame->GetContent();
   if (!content)
     return PR_FALSE;
 
-  if (content->IsHTML())
+  if (content->IsNodeOfType(nsINode::eHTML))
     return content->HasAttr(kNameSpaceID_None, aAtom);
 
   // For XML/XUL elements, an attribute must be equal to the literal
   // string "true" to be counted as true.  An empty string should _not_
   // be counted as true.
   return content->AttrValueIs(kNameSpaceID_None, aAtom,
                               NS_LITERAL_STRING("true"), eCaseMatters);
 }
@@ -137,17 +137,17 @@ nsNativeTheme::CheckIntAttr(nsIFrame* aF
 PRBool
 nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, PRBool aCheckSelected)
 {
   if (!aFrame)
     return PR_FALSE;
 
   nsIContent* content = aFrame->GetContent();
 
-  if (content->IsXUL()) {
+  if (content->IsNodeOfType(nsINode::eXUL)) {
     // For a XUL checkbox or radio button, the state of the parent determines
     // the checked state
     aFrame = aFrame->GetParent();
   } else {
     // Check for an HTML input element
     nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(content);
     if (inputElt) {
       PRBool checked;
@@ -174,17 +174,17 @@ nsNativeTheme::IsButtonTypeMenu(nsIFrame
 PRBool
 nsNativeTheme::GetIndeterminate(nsIFrame* aFrame)
 {
   if (!aFrame)
     return PR_FALSE;
 
   nsIContent* content = aFrame->GetContent();
 
-  if (content->IsXUL()) {
+  if (content->IsNodeOfType(nsINode::eXUL)) {
     // For a XUL checkbox or radio button, the state of the parent determines
     // the state
     return CheckBooleanAttr(aFrame->GetParent(), nsWidgetAtoms::indeterminate);
   }
 
   // Check for an HTML input element
   nsCOMPtr<nsIDOMNSHTMLInputElement> inputElt = do_QueryInterface(content);
   if (inputElt) {
@@ -202,17 +202,17 @@ nsNativeTheme::IsWidgetStyled(nsPresCont
 {
   // Check for specific widgets to see if HTML has overridden the style.
   return aFrame &&
          (aWidgetType == NS_THEME_BUTTON ||
           aWidgetType == NS_THEME_TEXTFIELD ||
           aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
           aWidgetType == NS_THEME_LISTBOX ||
           aWidgetType == NS_THEME_DROPDOWN) &&
-         aFrame->GetContent()->IsHTML() &&
+         aFrame->GetContent()->IsNodeOfType(nsINode::eHTML) &&
          aPresContext->HasAuthorSpecifiedRules(aFrame,
                                                NS_AUTHOR_SPECIFIED_BORDER |
                                                NS_AUTHOR_SPECIFIED_BACKGROUND);
 }
 
 PRBool
 nsNativeTheme::IsFrameRTL(nsIFrame* aFrame)
 {