Bug 1449670, part 1 - Convert IsNodeOfType(nsINode::eTEXT) to IsText(). r=bz draft
authorAndrew McCreight <continuation@gmail.com>
Thu, 12 Apr 2018 15:41:00 -0700
changeset 781931 520d5cd6630a829bb03ce4d8a72bcfe74a97f4ac
parent 781409 325ef357e5b73d63794e47c02c7f8e7cf58ccb48
child 781932 925c3197ec2750d9cb0aa30746061d3d5505c0ef
push id106446
push userbmo:continuation@gmail.com
push dateFri, 13 Apr 2018 20:06:52 +0000
reviewersbz
bugs1449670
milestone61.0a1
Bug 1449670, part 1 - Convert IsNodeOfType(nsINode::eTEXT) to IsText(). r=bz This method is not a virtual call, and also looks nicer. This patch was mostly generated by a Python script, but I manually cleaned up the code in a few places where statements didn't need to be split across multiple lines any more. MozReview-Commit-ID: 8JExxqSRc59
accessible/base/Logging.cpp
accessible/base/nsAccessibilityService.cpp
accessible/base/nsCoreUtils.cpp
accessible/generic/Accessible.cpp
accessible/generic/HyperTextAccessible.cpp
accessible/html/HTMLSelectAccessible.cpp
dom/base/Selection.cpp
dom/base/nsContentUtils.cpp
dom/base/nsDocument.cpp
dom/base/nsDocumentEncoder.cpp
dom/base/nsINode.h
dom/base/nsRange.cpp
dom/base/nsXHTMLContentSerializer.cpp
dom/events/ContentEventHandler.cpp
dom/events/EventStateManager.cpp
dom/events/IMEContentObserver.cpp
dom/svg/SVGTextContentElement.cpp
dom/xslt/xpath/txXPathTreeWalker.h
editor/libeditor/CompositionTransaction.cpp
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorDOMPoint.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/WSRunObject.cpp
editor/spellchecker/TextServicesDocument.cpp
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
layout/base/GeometryUtils.cpp
layout/base/PositionedEventTargeting.cpp
layout/base/RestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsStyleChangeList.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsTextFrame.cpp
layout/style/ServoStyleSet.cpp
layout/style/nsStyleUtil.cpp
layout/svg/SVGObserverUtils.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGGradientFrame.cpp
layout/svg/nsSVGUtils.cpp
toolkit/components/find/nsFind.cpp
--- a/accessible/base/Logging.cpp
+++ b/accessible/base/Logging.cpp
@@ -832,17 +832,17 @@ logging::Node(const char* aDescr, nsINod
   if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
     printf("%s: %p, document\n", aDescr, static_cast<void*>(aNode));
     return;
   }
 
   nsINode* parentNode = aNode->GetParentNode();
   int32_t idxInParent = parentNode ? parentNode->ComputeIndexOf(aNode) : - 1;
 
-  if (aNode->IsNodeOfType(nsINode::eTEXT)) {
+  if (aNode->IsText()) {
     printf("%s: %p, text node, idx in parent: %d\n",
            aDescr, static_cast<void*>(aNode), idxInParent);
     return;
   }
 
   if (!aNode->IsElement()) {
     printf("%s: %p, not accessible node type, idx in parent: %d\n",
            aDescr, static_cast<void*>(aNode), idxInParent);
@@ -906,17 +906,17 @@ logging::AccessibleInfo(const char* aDes
 
   nsINode* node = aAccessible->GetNode();
   if (!node) {
     printf(", node: null\n");
   }
   else if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
     printf(", document node: %p\n", static_cast<void*>(node));
   }
-  else if (node->IsNodeOfType(nsINode::eTEXT)) {
+  else if (node->IsText()) {
     printf(", text node: %p\n", static_cast<void*>(node));
   }
   else if (node->IsElement()) {
     dom::Element* el = node->AsElement();
 
     nsAutoCString tag;
     el->NodeInfo()->NameAtom()->ToUTF8String(tag);
 
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1104,17 +1104,17 @@ nsAccessibilityService::CreateAccessible
   NS_ASSERTION(!imageFrame || !content->IsHTMLElement(nsGkAtoms::area),
                "Image map manages the area accessible creation!");
 #endif
 
   // Attempt to create an accessible based on what we know.
   RefPtr<Accessible> newAcc;
 
   // Create accessible for visible text frames.
-  if (content->IsNodeOfType(nsINode::eTEXT)) {
+  if (content->IsText()) {
     nsIFrame::RenderedText text = frame->GetRenderedText(0,
         UINT32_MAX, nsIFrame::TextOffsetType::OFFSETS_IN_CONTENT_TEXT,
         nsIFrame::TrailingWhitespace::DONT_TRIM_TRAILING_WHITESPACE);
     // Ignore not rendered text nodes and whitespace text nodes between table
     // cells.
     if (text.mString.IsEmpty() ||
         (aContext->IsTableRow() && nsCoreUtils::IsWhitespaceString(text.mString))) {
       if (aIsSubtreeHidden)
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -199,17 +199,17 @@ nsCoreUtils::GetAccessKeyFor(nsIContent*
 }
 
 nsIContent *
 nsCoreUtils::GetDOMElementFor(nsIContent *aContent)
 {
   if (aContent->IsElement())
     return aContent;
 
-  if (aContent->IsNodeOfType(nsINode::eTEXT))
+  if (aContent->IsText())
     return aContent->GetFlattenedTreeParent();
 
   return nullptr;
 }
 
 nsINode *
 nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode *aNode, uint32_t aOffset)
 {
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -179,17 +179,17 @@ void
 Accessible::Description(nsString& aDescription)
 {
   // There are 4 conditions that make an accessible have no accDescription:
   // 1. it's a text node; or
   // 2. It has no DHTML describedby property
   // 3. it doesn't have an accName; or
   // 4. its title attribute already equals to its accName nsAutoString name;
 
-  if (!HasOwnContent() || mContent->IsNodeOfType(nsINode::eTEXT))
+  if (!HasOwnContent() || mContent->IsText())
     return;
 
   nsTextEquivUtils::
     GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
                            aDescription);
 
   if (aDescription.IsEmpty()) {
     NativeDescription(aDescription);
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -214,17 +214,17 @@ HyperTextAccessible::DOMPointToOffset(ns
     return 0;
 
   uint32_t offset = 0;
   nsINode* findNode = nullptr;
 
   if (aNodeOffset == -1) {
     findNode = aNode;
 
-  } else if (aNode->IsNodeOfType(nsINode::eTEXT)) {
+  } else if (aNode->IsText()) {
     // For text nodes, aNodeOffset comes in as a character offset
     // Text offset will be added at the end, if we find the offset in this hypertext
     // We want the "skipped" offset into the text (rendered text without the extra whitespace)
     nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
     NS_ENSURE_TRUE(frame, 0);
 
     nsresult rv = ContentToRenderedOffset(frame, aNodeOffset, &offset);
     NS_ENSURE_SUCCESS(rv, 0);
@@ -1388,17 +1388,17 @@ HyperTextAccessible::CaretOffset() const
   if (caretOffset != -1) {
     if (text == this)
       return caretOffset;
 
     nsINode* textNode = text->GetNode();
     // Ignore offset if cached accessible isn't a text leaf.
     if (nsCoreUtils::IsAncestorOf(GetNode(), textNode))
       return TransformOffset(text,
-        textNode->IsNodeOfType(nsINode::eTEXT) ? caretOffset : 0, false);
+        textNode->IsText() ? caretOffset : 0, false);
   }
 
   // No caret if the focused node is not inside this DOM node and this DOM node
   // is not inside of focused node.
   FocusManager::FocusDisposition focusDisp =
     FocusMgr()->IsInOrContainsFocus(this);
   if (focusDisp == FocusManager::eNone)
     return -1;
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -154,17 +154,17 @@ HTMLSelectOptionAccessible::NativeName(n
   // find the label attribute - this is what the W3C says we should use
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
   if (!aName.IsEmpty())
     return eNameOK;
 
   // CASE #2 -- no label parameter, get the first child,
   // use it if it is a text node
   nsIContent* text = mContent->GetFirstChild();
-  if (text && text->IsNodeOfType(nsINode::eTEXT)) {
+  if (text && text->IsText()) {
     nsTextEquivUtils::AppendTextEquivFromTextContent(text, &aName);
     aName.CompressWhitespace();
     return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
   }
 
   return eNameOK;
 }
 
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -1801,17 +1801,17 @@ Selection::SelectFrames(nsPresContext* a
     // Don't warn, bug 1055722
     // XXX The range can start from a document node and such range can be
     //     added to Selection with JS.  Therefore, even in such cases,
     //     shouldn't we handle selection in the range?
     return NS_ERROR_UNEXPECTED;
   }
 
   // We must call first one explicitly
-  bool isFirstContentTextNode = startContent->IsNodeOfType(nsINode::eTEXT);
+  bool isFirstContentTextNode = startContent->IsText();
   nsINode* endNode = aRange->GetEndContainer();
   if (isFirstContentTextNode) {
     nsIFrame* frame = startContent->GetPrimaryFrame();
     // The frame could be an SVG text frame, in which case we don't treat it
     // as a text frame.
     if (frame) {
       if (frame->IsTextFrame()) {
         nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
@@ -1859,17 +1859,17 @@ Selection::SelectFrames(nsPresContext* a
     nsIContent* endContent =
       endNode->IsContent() ? endNode->AsContent() : nullptr;
     // XXX The range can end at a document node and such range can be
     //     added to Selection with JS.  Therefore, even in such cases,
     //     shouldn't we handle selection in the range?
     if (NS_WARN_IF(!endContent)) {
       return NS_ERROR_UNEXPECTED;
     }
-    if (endContent->IsNodeOfType(nsINode::eTEXT)) {
+    if (endContent->IsText()) {
       nsIFrame* frame = endContent->GetPrimaryFrame();
       // The frame could be an SVG text frame, in which case we'll ignore it.
       if (frame && frame->IsTextFrame()) {
         nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
         textFrame->SetSelectedRange(0, aRange->EndOffset(), aSelect,
                                     mSelectionType);
       }
     }
@@ -2382,22 +2382,22 @@ Selection::RemoveRange(nsRange& aRange, 
 
   if (!beginNode || !endNode) {
     // Detached range; nothing else to do here.
     return;
   }
 
   // find out the length of the end node, so we can select all of it
   int32_t beginOffset, endOffset;
-  if (endNode->IsNodeOfType(nsINode::eTEXT)) {
+  if (endNode->IsText()) {
     // Get the length of the text. We can't just use the offset because
     // another range could be touching this text node but not intersect our
     // range.
     beginOffset = 0;
-    endOffset = static_cast<nsIContent*>(endNode)->TextLength();
+    endOffset = endNode->AsText()->TextLength();
   } else {
     // For non-text nodes, the given offsets should be sufficient.
     beginOffset = aRange.StartOffset();
     endOffset = aRange.EndOffset();
   }
 
   // clear the selected bit from the removed range's frames
   RefPtr<nsPresContext>  presContext = GetPresContext();
@@ -3212,17 +3212,17 @@ Selection::ContainsNode(nsINode& aNode, 
   if (mRanges.Length() == 0) {
     return false;
   }
 
   // XXXbz this duplicates the GetNodeLength code in nsRange.cpp
   uint32_t nodeLength;
   bool isData = aNode.IsNodeOfType(nsINode::eDATA_NODE);
   if (isData) {
-    nodeLength = static_cast<nsIContent&>(aNode).TextLength();
+    nodeLength = aNode.AsText()->TextLength();
   } else {
     nodeLength = aNode.GetChildCount();
   }
 
   nsTArray<nsRange*> overlappingRanges;
   rv = GetRangesForIntervalArray(&aNode, 0, &aNode, nodeLength,
                                  false, &overlappingRanges);
   if (NS_FAILED(rv)) {
@@ -3426,17 +3426,17 @@ Selection::GetSelectionEndPointGeometry(
   frame = mFrameSelection->GetFrameForNodeOffset(content, nodeOffset,
                                                  mFrameSelection->GetHint(),
                                                  &frameOffset);
   if (!frame)
     return nullptr;
 
   // Figure out what node type we have, then get the
   // appropriate rect for it's nodeOffset.
-  bool isText = node->IsNodeOfType(nsINode::eTEXT);
+  bool isText = node->IsText();
 
   nsPoint pt(0, 0);
   if (isText) {
     nsIFrame* childFrame = nullptr;
     frameOffset = 0;
     nsresult rv =
       frame->GetChildFrameContainingOffset(nodeOffset,
                                            mFrameSelection->GetHint(),
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5287,17 +5287,17 @@ nsContentUtils::SetNodeTextContent(nsICo
     if (HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
       subtree.UpdateTarget(doc, nullptr);
       owningContent = aContent;
       nsCOMPtr<nsINode> child;
       bool skipFirst = aTryReuse;
       for (child = aContent->GetFirstChild();
            child && child->GetParentNode() == aContent;
            child = child->GetNextSibling()) {
-        if (skipFirst && child->IsNodeOfType(nsINode::eTEXT)) {
+        if (skipFirst && child->IsText()) {
           skipFirst = false;
           continue;
         }
         nsContentUtils::MaybeFireNodeRemoved(child, aContent, doc);
       }
     }
   }
 
@@ -5408,17 +5408,17 @@ nsContentUtils::AppendNodeTextContent(ns
 
 bool
 nsContentUtils::HasNonEmptyTextContent(nsINode* aNode,
                                        TextContentDiscoverMode aDiscoverMode)
 {
   for (nsIContent* child = aNode->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
-    if (child->IsNodeOfType(nsINode::eTEXT) &&
+    if (child->IsText() &&
         child->TextLength() > 0) {
         return true;
     }
 
     if (aDiscoverMode == eRecurseIntoChildren &&
         HasNonEmptyTextContent(child, aDiscoverMode)) {
       return true;
     }
@@ -7435,17 +7435,17 @@ nsContentUtils::GetSelectionInTextContro
 #ifdef DEBUG
   nsCOMPtr<nsIContent> lastChild = aRoot->GetLastChild();
   NS_ASSERTION(startContainer == aRoot || startContainer == firstChild ||
                startContainer == lastChild, "Unexpected startContainer");
   NS_ASSERTION(endContainer == aRoot || endContainer == firstChild ||
                endContainer == lastChild, "Unexpected endContainer");
   // firstChild is either text or a <br> (hence an element).
   MOZ_ASSERT_IF(firstChild,
-                firstChild->IsNodeOfType(nsINode::eTEXT) || firstChild->IsElement());
+                firstChild->IsText() || firstChild->IsElement());
 #endif
   // Testing IsElement() is faster than testing IsNodeOfType(), since it's
   // non-virtual.
   if (!firstChild || firstChild->IsElement()) {
     // No text node, so everything is 0
     startOffset = endOffset = 0;
   } else {
     // First child is text.  If the start/end is already in the text node,
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3588,17 +3588,17 @@ nsIDocument::NodesFromRectHelper(float a
     (aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0));
 
   // Used to filter out repeated elements in sequence.
   nsIContent* lastAdded = nullptr;
 
   for (uint32_t i = 0; i < outFrames.Length(); i++) {
     nsIContent* node = GetContentInThisDocument(outFrames[i]);
 
-    if (node && !node->IsElement() && !node->IsNodeOfType(nsINode::eTEXT)) {
+    if (node && !node->IsElement() && !node->IsText()) {
       // We have a node that isn't an element or a text node,
       // use its parent content instead.
       node = node->GetParent();
     }
     if (node && node != lastAdded) {
       elements->AppendElement(node);
       lastAdded = node;
     }
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -109,29 +109,29 @@ protected:
       nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
       if (ShadowRoot* shadowRoot = ShadowRoot::FromNodeOrNull(content)) {
         content = shadowRoot->GetHost();
       }
 
       if (content) {
         nsIFrame* frame = content->GetPrimaryFrame();
         if (!frame) {
-          if (aNode->IsNodeOfType(nsINode::eTEXT)) {
+          if (aNode->IsText()) {
             // We have already checked that our parent is visible.
             return true;
           }
           if (aNode->IsHTMLElement(nsGkAtoms::rp)) {
             // Ruby parentheses are part of ruby structure, hence
             // shouldn't be stripped out even if it is not displayed.
             return true;
           }
           return false;
         }
         bool isVisible = frame->StyleVisibility()->IsVisible();
-        if (!isVisible && aNode->IsNodeOfType(nsINode::eTEXT))
+        if (!isVisible && aNode->IsText())
           return false;
       }
     }
     return true;
   }
 
   virtual bool IncludeInContext(nsINode *aNode);
 
@@ -627,17 +627,17 @@ nsDocumentEncoder::FlushText(nsAString& 
     aString.Truncate();
   }
 
   return rv;
 }
 
 static bool IsTextNode(nsINode *aNode)
 {
-  return aNode && aNode->IsNodeOfType(nsINode::eTEXT);
+  return aNode && aNode->IsText();
 }
 
 nsresult
 nsDocumentEncoder::SerializeRangeNodes(nsRange* aRange,
                                        nsINode* aNode,
                                        nsAString& aString,
                                        int32_t aDepth)
 {
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -445,27 +445,23 @@ public:
    * @param aFlags what types you want to test for (see above)
    * @return whether the content matches ALL flags passed in
    */
   virtual bool IsNodeOfType(uint32_t aFlags) const = 0;
 
   bool
   IsContainerNode() const
   {
-    return IsElement() ||
-      !(IsNodeOfType(eTEXT) ||
-        IsNodeOfType(ePROCESSING_INSTRUCTION) ||
-        IsNodeOfType(eCOMMENT) ||
-        IsNodeOfType(eDATA_NODE));
+    return IsElement() || !IsCharacterData();
   }
 
   bool
   IsSlotable() const
   {
-    return IsElement() || IsNodeOfType(eTEXT);
+    return IsElement() || IsText();
   }
 
   virtual JSObject* WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   /**
    * returns true if we are in priviliged code or
    * layout.css.getBoxQuads.enabled == true.
    */
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -2719,18 +2719,18 @@ nsRange::SurroundContents(nsINode& aNewP
 
   if (!mRoot) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
   // INVALID_STATE_ERROR: Raised if the Range partially selects a non-text
   // node.
   if (mStart.Container() != mEnd.Container()) {
-    bool startIsText = mStart.Container()->IsNodeOfType(nsINode::eTEXT);
-    bool endIsText = mEnd.Container()->IsNodeOfType(nsINode::eTEXT);
+    bool startIsText = mStart.Container()->IsText();
+    bool endIsText = mEnd.Container()->IsText();
     nsINode* startGrandParent = mStart.Container()->GetParentNode();
     nsINode* endGrandParent = mEnd.Container()->GetParentNode();
     if (!((startIsText && endIsText &&
            startGrandParent &&
            startGrandParent == endGrandParent) ||
           (startIsText &&
            startGrandParent &&
            startGrandParent == mEnd.Container()) ||
@@ -3069,19 +3069,18 @@ nsRange::CollectClientRectsAndText(nsLay
 
   RangeSubtreeIterator iter;
 
   nsresult rv = iter.Init(aRange);
   if (NS_FAILED(rv)) return;
 
   if (iter.IsDone()) {
     // the range is collapsed, only continue if the cursor is in a text node
-    nsCOMPtr<nsIContent> content = do_QueryInterface(aStartContainer);
-    if (content && content->IsNodeOfType(nsINode::eTEXT)) {
-      nsTextFrame* textFrame = GetTextFrameForContent(content, aFlushLayout);
+    if (aStartContainer->IsText()) {
+      nsTextFrame* textFrame = GetTextFrameForContent(aStartContainer->AsText(), aFlushLayout);
       if (textFrame) {
         int32_t outOffset;
         nsIFrame* outFrame;
         textFrame->GetChildFrameContainingOffset(
                      static_cast<int32_t>(aStartOffset), false,
                      &outOffset, &outFrame);
         if (outFrame) {
            nsIFrame* relativeTo =
@@ -3099,17 +3098,17 @@ nsRange::CollectClientRectsAndText(nsLay
   }
 
   do {
     nsCOMPtr<nsINode> node = iter.GetCurrentNode();
     iter.Next();
     nsCOMPtr<nsIContent> content = do_QueryInterface(node);
     if (!content)
       continue;
-    if (content->IsNodeOfType(nsINode::eTEXT)) {
+    if (content->IsText()) {
        if (node == startContainer) {
          int32_t offset = startContainer == endContainer ?
            static_cast<int32_t>(aEndOffset) : content->GetText()->GetLength();
          GetPartialTextRect(aCollector, aTextList, content,
                             static_cast<int32_t>(aStartOffset), offset,
                             aClampToEdge, aFlushLayout);
          continue;
        } else if (node == endContainer) {
@@ -3218,17 +3217,17 @@ nsRange::GetUsedFontFaces(nsTArray<nsAut
     if (!content) {
       continue;
     }
     nsIFrame* frame = content->GetPrimaryFrame();
     if (!frame) {
       continue;
     }
 
-    if (content->IsNodeOfType(nsINode::eTEXT)) {
+    if (content->IsText()) {
        if (node == startContainer) {
          int32_t offset = startContainer == endContainer ?
            mEnd.Offset() : content->GetText()->GetLength();
          nsLayoutUtils::GetFontFacesForText(frame, mStart.Offset(), offset,
                                             true, fontFaces, aMaxRanges);
          continue;
        }
        if (node == endContainer) {
@@ -3295,17 +3294,17 @@ nsRange::Constructor(const GlobalObject&
     return nullptr;
   }
 
   return window->GetDoc()->CreateRange(aRv);
 }
 
 static bool ExcludeIfNextToNonSelectable(nsIContent* aContent)
 {
-  return aContent->IsNodeOfType(nsINode::eTEXT) &&
+  return aContent->IsText() &&
     aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE);
 }
 
 void
 nsRange::ExcludeNonSelectableNodes(nsTArray<RefPtr<nsRange>>* aOutRanges)
 {
   MOZ_ASSERT(mIsPositioned);
   MOZ_ASSERT(mEnd.Container());
@@ -3568,17 +3567,17 @@ IsLastNonemptyRowGroupOfTable(nsIFrame* 
 }
 
 void
 nsRange::GetInnerTextNoFlush(DOMString& aValue, ErrorResult& aError,
                              nsIContent* aContainer)
 {
   InnerTextAccumulator result(aValue);
 
-  if (aContainer->IsNodeOfType(nsINode::eTEXT)) {
+  if (aContainer->IsText()) {
     AppendTransformedText(result, aContainer);
     return;
   }
 
   nsIContent* currentNode = aContainer;
   TreeTraversalState currentState = AFTER_NODE;
 
   nsIContent* endNode = aContainer;
@@ -3589,17 +3588,17 @@ nsRange::GetInnerTextNoFlush(DOMString& 
     currentNode = firstChild;
     currentState = AT_NODE;
   }
 
   while (currentNode != endNode || currentState != endState) {
     nsIFrame* f = currentNode->GetPrimaryFrame();
     bool isVisibleAndNotReplaced = IsVisibleAndNotInReplacedElement(f);
     if (currentState == AT_NODE) {
-      bool isText = currentNode->IsNodeOfType(nsINode::eTEXT);
+      bool isText = currentNode->IsText();
       if (isText && currentNode->GetParent()->IsHTMLElement(nsGkAtoms::rp) &&
           ElementIsVisibleNoFlush(currentNode->GetParent()->AsElement())) {
         nsAutoString str;
         currentNode->GetTextContent(str, aError);
         result.Append(str);
       } else if (isVisibleAndNotReplaced) {
         result.AddRequiredLineBreakCount(GetRequiredInnerTextLineBreakCount(f));
         if (isText) {
--- a/dom/base/nsXHTMLContentSerializer.cpp
+++ b/dom/base/nsXHTMLContentSerializer.cpp
@@ -821,17 +821,17 @@ nsXHTMLContentSerializer::IsFirstChildOf
 
 bool
 nsXHTMLContentSerializer::HasNoChildren(nsIContent* aContent) {
 
   for (nsIContent* child = aContent->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
 
-    if (!child->IsNodeOfType(nsINode::eTEXT))
+    if (!child->IsText())
       return false;
 
     if (child->TextLength())
       return false;
   }
 
   return true;
 }
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -559,42 +559,42 @@ static void ConvertToNativeNewlines(nsSt
 {
 #if defined(XP_WIN)
   aString.ReplaceSubstring(NS_LITERAL_STRING("\n"), NS_LITERAL_STRING("\r\n"));
 #endif
 }
 
 static void AppendString(nsAString& aString, nsIContent* aContent)
 {
-  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
+  NS_ASSERTION(aContent->IsText(),
                "aContent is not a text node!");
   const nsTextFragment* text = aContent->GetText();
   if (!text) {
     return;
   }
   text->AppendTo(aString);
 }
 
 static void AppendSubString(nsAString& aString, nsIContent* aContent,
                             uint32_t aXPOffset, uint32_t aXPLength)
 {
-  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
+  NS_ASSERTION(aContent->IsText(),
                "aContent is not a text node!");
   const nsTextFragment* text = aContent->GetText();
   if (!text) {
     return;
   }
   text->AppendTo(aString, int32_t(aXPOffset), int32_t(aXPLength));
 }
 
 #if defined(XP_WIN)
 static uint32_t CountNewlinesInXPLength(nsIContent* aContent,
                                         uint32_t aXPLength)
 {
-  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
+  NS_ASSERTION(aContent->IsText(),
                "aContent is not a text node!");
   const nsTextFragment* text = aContent->GetText();
   if (!text) {
     return 0;
   }
   // For automated tests, we should abort on debug build.
   MOZ_ASSERT(aXPLength == UINT32_MAX || aXPLength <= text->GetLength(),
              "aXPLength is out-of-bounds");
@@ -606,17 +606,17 @@ static uint32_t CountNewlinesInXPLength(
     }
   }
   return newlines;
 }
 
 static uint32_t CountNewlinesInNativeLength(nsIContent* aContent,
                                             uint32_t aNativeLength)
 {
-  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
+  NS_ASSERTION(aContent->IsText(),
                "aContent is not a text node!");
   const nsTextFragment* text = aContent->GetText();
   if (!text) {
     return 0;
   }
   // For automated tests, we should abort on debug build.
   MOZ_ASSERT(
     (aNativeLength == UINT32_MAX || aNativeLength <= text->GetLength() * 2),
@@ -639,41 +639,41 @@ static uint32_t CountNewlinesInNativeLen
 
 /* static */ uint32_t
 ContentEventHandler::GetNativeTextLength(nsIContent* aContent,
                                          uint32_t aStartOffset,
                                          uint32_t aEndOffset)
 {
   MOZ_ASSERT(aEndOffset >= aStartOffset,
              "aEndOffset must be equals or larger than aStartOffset");
-  if (NS_WARN_IF(!aContent->IsNodeOfType(nsINode::eTEXT))) {
+  if (NS_WARN_IF(!aContent->IsText())) {
     return 0;
   }
   if (aStartOffset == aEndOffset) {
     return 0;
   }
   return GetTextLength(aContent, LINE_BREAK_TYPE_NATIVE, aEndOffset) -
            GetTextLength(aContent, LINE_BREAK_TYPE_NATIVE, aStartOffset);
 }
 
 /* static */ uint32_t
 ContentEventHandler::GetNativeTextLength(nsIContent* aContent,
                                          uint32_t aMaxLength)
 {
-  if (NS_WARN_IF(!aContent->IsNodeOfType(nsINode::eTEXT))) {
+  if (NS_WARN_IF(!aContent->IsText())) {
     return 0;
   }
   return GetTextLength(aContent, LINE_BREAK_TYPE_NATIVE, aMaxLength);
 }
 
 /* static */ uint32_t
 ContentEventHandler::GetNativeTextLengthBefore(nsIContent* aContent,
                                                nsINode* aRootNode)
 {
-  if (NS_WARN_IF(aContent->IsNodeOfType(nsINode::eTEXT))) {
+  if (NS_WARN_IF(aContent->IsText())) {
     return 0;
   }
   return ShouldBreakLineBefore(aContent, aRootNode) ?
            GetBRLength(LINE_BREAK_TYPE_NATIVE) : 0;
 }
 
 /* static inline */ uint32_t
 ContentEventHandler::GetBRLength(LineBreakType aLineBreakType)
@@ -686,17 +686,17 @@ ContentEventHandler::GetBRLength(LineBre
 #endif
 }
 
 /* static */ uint32_t
 ContentEventHandler::GetTextLength(nsIContent* aContent,
                                    LineBreakType aLineBreakType,
                                    uint32_t aMaxLength)
 {
-  MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eTEXT));
+  MOZ_ASSERT(aContent->IsText());
 
   uint32_t textLengthDifference =
 #if defined(XP_WIN)
     // On Windows, the length of a native newline ("\r\n") is twice the length
     // of the XP newline ("\n"), so XP length is equal to the length of the
     // native offset plus the number of newlines encountered in the string.
     (aLineBreakType == LINE_BREAK_TYPE_NATIVE) ?
       CountNewlinesInXPLength(aContent, aMaxLength) : 0;
@@ -820,17 +820,17 @@ ContentEventHandler::GenerateFlatTextCon
   }
 
   nsINode* startNode = aRawRange.GetStartContainer();
   nsINode* endNode = aRawRange.GetEndContainer();
   if (NS_WARN_IF(!startNode) || NS_WARN_IF(!endNode)) {
     return NS_ERROR_FAILURE;
   }
 
-  if (startNode == endNode && startNode->IsNodeOfType(nsINode::eTEXT)) {
+  if (startNode == endNode && startNode->IsText()) {
     nsIContent* content = startNode->AsContent();
     AppendSubString(aString, content, aRawRange.StartOffset(),
                     aRawRange.EndOffset() - aRawRange.StartOffset());
     ConvertToNativeNewlines(aString);
     return NS_OK;
   }
 
   nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
@@ -844,17 +844,17 @@ ContentEventHandler::GenerateFlatTextCon
     if (NS_WARN_IF(!node)) {
       break;
     }
     if (!node->IsContent()) {
       continue;
     }
     nsIContent* content = node->AsContent();
 
-    if (content->IsNodeOfType(nsINode::eTEXT)) {
+    if (content->IsText()) {
       if (content == startNode) {
         AppendSubString(aString, content, aRawRange.StartOffset(),
                         content->TextLength() - aRawRange.StartOffset());
       } else if (content == endNode) {
         AppendSubString(aString, content, 0, aRawRange.EndOffset());
       } else {
         AppendString(aString, content);
       }
@@ -877,32 +877,32 @@ AppendFontRange(nsTArray<FontRange>& aFo
 }
 
 /* static */ uint32_t
 ContentEventHandler::GetTextLengthInRange(nsIContent* aContent,
                                           uint32_t aXPStartOffset,
                                           uint32_t aXPEndOffset,
                                           LineBreakType aLineBreakType)
 {
-  MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eTEXT));
+  MOZ_ASSERT(aContent->IsText());
 
   return aLineBreakType == LINE_BREAK_TYPE_NATIVE ?
     GetNativeTextLength(aContent, aXPStartOffset, aXPEndOffset) :
     aXPEndOffset - aXPStartOffset;
 }
 
 /* static */ void
 ContentEventHandler::AppendFontRanges(FontRangeArray& aFontRanges,
                                       nsIContent* aContent,
                                       uint32_t aBaseOffset,
                                       uint32_t aXPStartOffset,
                                       uint32_t aXPEndOffset,
                                       LineBreakType aLineBreakType)
 {
-  MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eTEXT));
+  MOZ_ASSERT(aContent->IsText());
 
   nsIFrame* frame = aContent->GetPrimaryFrame();
   if (!frame) {
     // It is a non-rendered content, create an empty range for it.
     AppendFontRange(aFontRanges, aBaseOffset);
     return;
   }
 
@@ -1016,17 +1016,17 @@ ContentEventHandler::GenerateFlatFontRan
     if (NS_WARN_IF(!node)) {
       break;
     }
     if (!node->IsContent()) {
       continue;
     }
     nsIContent* content = node->AsContent();
 
-    if (content->IsNodeOfType(nsINode::eTEXT)) {
+    if (content->IsText()) {
       uint32_t startOffset = content != startNode ? 0 : aRawRange.StartOffset();
       uint32_t endOffset = content != endNode ?
         content->TextLength() : aRawRange.EndOffset();
       AppendFontRanges(aFontRanges, content, baseOffset,
                        startOffset, endOffset, aLineBreakType);
       baseOffset += GetTextLengthInRange(content, startOffset, endOffset,
                                          aLineBreakType);
     } else if (ShouldBreakLineBefore(content, mRootContent)) {
@@ -1055,17 +1055,17 @@ ContentEventHandler::GenerateFlatFontRan
 
 nsresult
 ContentEventHandler::ExpandToClusterBoundary(nsIContent* aContent,
                                              bool aForward,
                                              uint32_t* aXPOffset)
 {
   // XXX This method assumes that the frame boundaries must be cluster
   // boundaries. It's false, but no problem now, maybe.
-  if (!aContent->IsNodeOfType(nsINode::eTEXT) ||
+  if (!aContent->IsText() ||
       *aXPOffset == 0 || *aXPOffset == aContent->TextLength()) {
     return NS_OK;
   }
 
   NS_ASSERTION(*aXPOffset <= aContent->TextLength(),
                "offset is out of range.");
 
   MOZ_DIAGNOSTIC_ASSERT(mDocument->GetShell());
@@ -1153,36 +1153,36 @@ ContentEventHandler::SetRawRangeFromFlat
       break;
     }
     // FYI: mRootContent shouldn't cause any text. So, we can skip it simply.
     if (node == mRootContent || !node->IsContent()) {
       continue;
     }
     nsIContent* content = node->AsContent();
 
-    if (aLastTextNode && content->IsNodeOfType(nsINode::eTEXT)) {
+    if (aLastTextNode && content->IsText()) {
       NS_IF_RELEASE(*aLastTextNode);
       NS_ADDREF(*aLastTextNode = content);
     }
 
     uint32_t textLength =
-      content->IsNodeOfType(nsINode::eTEXT) ?
+      content->IsText() ?
         GetTextLength(content, aLineBreakType) :
         (ShouldBreakLineBefore(content, mRootContent) ?
            GetBRLength(aLineBreakType) : 0);
     if (!textLength) {
       continue;
     }
 
     // When the start offset is in between accumulated offset and the last
     // offset of the node, the node is the start node of the range.
     if (!startSet && aOffset <= offset + textLength) {
       nsINode* startNode = nullptr;
       int32_t startNodeOffset = -1;
-      if (content->IsNodeOfType(nsINode::eTEXT)) {
+      if (content->IsText()) {
         // Rule #1.1: [textNode or text[Node or textNode[
         uint32_t xpOffset = aOffset - offset;
         if (aLineBreakType == LINE_BREAK_TYPE_NATIVE) {
           xpOffset = ConvertToXPOffset(content, xpOffset);
         }
 
         if (aExpandToClusterBoundaries) {
           uint32_t oldXPOffset = xpOffset;
@@ -1244,17 +1244,17 @@ ContentEventHandler::SetRawRangeFromFlat
       }
     }
 
     // When the end offset is in the content, the node is the end node of the
     // range.
     if (endOffset <= offset + textLength) {
       MOZ_ASSERT(startSet,
         "The start of the range should've been set already");
-      if (content->IsNodeOfType(nsINode::eTEXT)) {
+      if (content->IsText()) {
         // Rule #2.1: ]textNode or text]Node or textNode]
         uint32_t xpOffset = endOffset - offset;
         if (aLineBreakType == LINE_BREAK_TYPE_NATIVE) {
           uint32_t xpOffsetCurrent = ConvertToXPOffset(content, xpOffset);
           if (xpOffset && GetBRLength(aLineBreakType) > 1) {
             MOZ_ASSERT(GetBRLength(aLineBreakType) == 2);
             uint32_t xpOffsetPre = ConvertToXPOffset(content, xpOffset - 1);
             // If previous character's XP offset is same as current character's,
@@ -1318,17 +1318,17 @@ ContentEventHandler::SetRawRangeFromFlat
       }
       return NS_OK;
     }
 
     offset += textLength;
   }
 
   if (!startSet) {
-    MOZ_ASSERT(!mRootContent->IsNodeOfType(nsINode::eTEXT));
+    MOZ_ASSERT(!mRootContent->IsText());
     if (!offset) {
       // Rule #1.5: <root>[</root>
       // When there are no nodes causing text, the start of the DOM range
       // should be start of the root node since clicking on such editor (e.g.,
       // <div contenteditable><span></span></div>) sets caret to the start of
       // the editor (i.e., before <span> in the example).
       rv = aRawRange->SetStart(mRootContent, 0);
       if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -1588,17 +1588,17 @@ ContentEventHandler::GetNodePositionHavi
   return GetNodePositionHavingFlatText(aNodePosition.Container(),
                                        aNodePosition.Offset());
 }
 
 ContentEventHandler::NodePosition
 ContentEventHandler::GetNodePositionHavingFlatText(nsINode* aNode,
                                                    int32_t aNodeOffset)
 {
-  if (aNode->IsNodeOfType(nsINode::eTEXT)) {
+  if (aNode->IsText()) {
     return NodePosition(aNode, aNodeOffset);
   }
 
   int32_t childCount = static_cast<int32_t>(aNode->GetChildCount());
 
   // If it's a empty element node, returns itself.
   if (!childCount) {
     MOZ_ASSERT(!aNodeOffset || aNodeOffset == 1);
@@ -1611,17 +1611,17 @@ ContentEventHandler::GetNodePositionHavi
   }
 
   // If the offset represents "after" the node, we need to return the last
   // child of it.  For example, if a range is |<p>[<br>]</p>|, then, the
   // end point is {<p>, 1}.  In such case, callers need the <br> node.
   if (aNodeOffset == childCount) {
     nsINode* node = aNode->GetChildAt_Deprecated(childCount - 1);
     return NodePosition(node,
-      node->IsNodeOfType(nsINode::eTEXT)
+      node->IsText()
         ? static_cast<int32_t>(node->AsContent()->TextLength())
         : 1);
   }
 
   NS_WARNING("aNodeOffset is invalid value");
   return NodePosition();
 }
 
@@ -1640,17 +1640,17 @@ ContentEventHandler::GetFirstFrameInRang
     if (NS_WARN_IF(!node)) {
       break;
     }
 
     if (!node->IsContent()) {
       continue;
     }
 
-    if (node->IsNodeOfType(nsINode::eTEXT)) {
+    if (node->IsText()) {
       // If the range starts at the end of a text node, we need to find
       // next node which causes text.
       int32_t offsetInNode =
         node == aRawRange.GetStartContainer() ? aRawRange.StartOffset() : 0;
       if (static_cast<uint32_t>(offsetInNode) < node->Length()) {
         nodePosition.Set(node, offsetInNode);
         break;
       }
@@ -1700,17 +1700,17 @@ ContentEventHandler::GetLastFrameInRange
   // |]def|
   // +----+
   // So, if this method includes the 2nd text frame's rect to its result, the
   // caller will return too tall rect which includes 2 lines in this case isn't
   // expected by native IME  (e.g., popup of IME will be positioned at bottom
   // of "d" instead of right-bottom of "c").  Therefore, this method shouldn't
   // include the last frame when its content isn't really in aRawRange.
   nsINode* nextNodeOfRangeEnd = nullptr;
-  if (endNode->IsNodeOfType(nsINode::eTEXT)) {
+  if (endNode->IsText()) {
     // Don't set nextNodeOfRangeEnd to the start node of aRawRange because if
     // endNode is same as start node of the range, the text node shouldn't be
     // next of range end even if the offset is 0.  This could occur with empty
     // text node.
     if (!endOffset && aRawRange.GetStartContainer() != endNode) {
       nextNodeOfRangeEnd = endNode;
     }
   } else if (endOffset < endNode->GetChildCount()) {
@@ -1722,17 +1722,17 @@ ContentEventHandler::GetLastFrameInRange
     if (NS_WARN_IF(!node)) {
       break;
     }
 
     if (!node->IsContent() || node == nextNodeOfRangeEnd) {
       continue;
     }
 
-    if (node->IsNodeOfType(nsINode::eTEXT)) {
+    if (node->IsText()) {
       uint32_t offset;
       if (node == aRawRange.GetEndContainer()) {
         offset = aRawRange.EndOffset();
       } else {
         offset = node->Length();
       }
       nodePosition.Set(node, offset);
 
@@ -1870,17 +1870,17 @@ ContentEventHandler::GetLineBreakerRectB
   }
   return result;
 }
 
 ContentEventHandler::FrameRelativeRect
 ContentEventHandler::GuessLineBreakerRectAfter(nsIContent* aTextContent)
 {
   // aTextContent should be a text node.
-  MOZ_ASSERT(aTextContent->IsNodeOfType(nsINode::eTEXT));
+  MOZ_ASSERT(aTextContent->IsText());
 
   FrameRelativeRect result;
   int32_t length = static_cast<int32_t>(aTextContent->Length());
   if (NS_WARN_IF(length < 0)) {
     return result;
   }
   // Get the last nsTextFrame which is caused by aTextContent.  Note that
   // a text node can cause multiple text frames, e.g., the text is too long
@@ -2956,17 +2956,17 @@ ContentEventHandler::GetFlatTextLengthIn
     if (NS_WARN_IF(!node)) {
       break;
     }
     if (!node->IsContent()) {
       continue;
     }
     nsIContent* content = node->AsContent();
 
-    if (node->IsNodeOfType(nsINode::eTEXT)) {
+    if (node->IsText()) {
       // Note: our range always starts from offset 0
       if (node == endPosition.Container()) {
         // NOTE: We should have an offset here, as endPosition.Container() is a
         // nsINode::eTEXT, which always has an offset.
         *aLength += GetTextLength(content, aLineBreakType,
                                   endPosition.Offset());
       } else {
         *aLength += GetTextLength(content, aLineBreakType);
@@ -3033,17 +3033,17 @@ ContentEventHandler::AdjustCollapsedRang
 
   nsCOMPtr<nsINode> container = aRawRange.GetStartContainer();
   int32_t offsetInParentNode = aRawRange.StartOffset();
   if (NS_WARN_IF(!container) || NS_WARN_IF(offsetInParentNode < 0)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   // If the node is text node, we don't need to modify aRawRange.
-  if (container->IsNodeOfType(nsINode::eTEXT)) {
+  if (container->IsText()) {
     return NS_OK;
   }
 
   // If the container is not a text node but it has a text node at the offset,
   // we should adjust the range into the text node.
   // NOTE: This is emulating similar situation of EditorBase.
   nsINode* childNode = nullptr;
   int32_t offsetInChildNode = -1;
@@ -3056,17 +3056,17 @@ ContentEventHandler::AdjustCollapsedRang
                container->GetChildCount()) {
     // If the range is next to a child node, adjust the range to the end of
     // the previous child.
     childNode = container->GetChildAt_Deprecated(offsetInParentNode - 1);
     offsetInChildNode = childNode->Length();
   }
 
   // But if the found node isn't a text node, we cannot modify the range.
-  if (!childNode || !childNode->IsNodeOfType(nsINode::eTEXT) ||
+  if (!childNode || !childNode->IsText() ||
       NS_WARN_IF(offsetInChildNode < 0)) {
     return NS_OK;
   }
 
   nsresult rv =
     aRawRange.CollapseTo(RawRangeBoundary(childNode, offsetInChildNode));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
@@ -3103,17 +3103,17 @@ ContentEventHandler::ConvertToRootRelati
 
 static void AdjustRangeForSelection(nsIContent* aRoot,
                                     nsINode** aNode,
                                     int32_t* aNodeOffset)
 {
   nsINode* node = *aNode;
   int32_t nodeOffset = *aNodeOffset;
   if (aRoot == node || NS_WARN_IF(!node->GetParent()) ||
-      !node->IsNodeOfType(nsINode::eTEXT)) {
+      !node->IsText()) {
     return;
   }
 
   // When the offset is at the end of the text node, set it to after the
   // text node, to make sure the caret is drawn on a new line when the last
   // character of the text node is '\n' in <textarea>.
   int32_t textLength =
     static_cast<int32_t>(node->AsContent()->TextLength());
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2447,17 +2447,17 @@ EventStateManager::SendLineScrollEvent(n
                                        DeltaDirection aDeltaDirection)
 {
   nsCOMPtr<nsIContent> targetContent = aTargetFrame->GetContent();
   if (!targetContent)
     targetContent = GetFocusedContent();
   if (!targetContent)
     return;
 
-  while (targetContent->IsNodeOfType(nsINode::eTEXT)) {
+  while (targetContent->IsText()) {
     targetContent = targetContent->GetParent();
   }
 
   WidgetMouseScrollEvent event(aEvent->IsTrusted(),
                                eLegacyMouseLineOrPageScroll, aEvent->mWidget);
   event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
   event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
   event.mRefPoint = aEvent->mRefPoint;
@@ -2486,17 +2486,17 @@ EventStateManager::SendPixelScrollEvent(
 {
   nsCOMPtr<nsIContent> targetContent = aTargetFrame->GetContent();
   if (!targetContent) {
     targetContent = GetFocusedContent();
     if (!targetContent)
       return;
   }
 
-  while (targetContent->IsNodeOfType(nsINode::eTEXT)) {
+  while (targetContent->IsText()) {
     targetContent = targetContent->GetParent();
   }
 
   WidgetMouseScrollEvent event(aEvent->IsTrusted(),
                                eLegacyMousePixelScroll, aEvent->mWidget);
   event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
   event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
   event.mRefPoint = aEvent->mRefPoint;
@@ -4819,17 +4819,17 @@ EventStateManager::SetClickCount(WidgetM
                                  nsIContent* aOverrideClickTarget)
 {
   nsCOMPtr<nsIContent> mouseContent = aOverrideClickTarget;
   nsIContent* mouseContentParent = nullptr;
   if (!mouseContent && mCurrentTarget) {
     mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(mouseContent));
   }
   if (mouseContent) {
-    if (mouseContent->IsNodeOfType(nsINode::eTEXT)) {
+    if (mouseContent->IsText()) {
       mouseContent = mouseContent->GetParent();
     }
     if (mouseContent && mouseContent->IsRootOfNativeAnonymousSubtree()) {
       mouseContentParent = mouseContent->GetParent();
     }
   }
 
   switch (aEvent->button) {
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -924,17 +924,17 @@ IMEContentObserver::OnMouseButtonEvent(n
   }
   return consumed;
 }
 
 void
 IMEContentObserver::CharacterDataWillChange(nsIContent* aContent,
                                             const CharacterDataChangeInfo& aInfo)
 {
-  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
+  NS_ASSERTION(aContent->IsText(),
                "character data changed for non-text node");
   MOZ_ASSERT(mPreCharacterDataChangeLength < 0,
              "CharacterDataChanged() should've reset "
              "mPreCharacterDataChangeLength");
 
   if (!NeedsTextChangeNotification() ||
       !nsContentUtils::IsInSameAnonymousTree(mRootContent, aContent)) {
     return;
@@ -956,17 +956,17 @@ IMEContentObserver::CharacterDataWillCha
                aInfo.mChangeEnd - aInfo.mChangeStart,
              "The computed length must be same as or larger than XP length");
 }
 
 void
 IMEContentObserver::CharacterDataChanged(nsIContent* aContent,
                                          const CharacterDataChangeInfo& aInfo)
 {
-  NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
+  NS_ASSERTION(aContent->IsText(),
                "character data changed for non-text node");
 
   if (!NeedsTextChangeNotification() ||
       !nsContentUtils::IsInSameAnonymousTree(mRootContent, aContent)) {
     return;
   }
 
   mEndOfAddedTextCache.Clear();
@@ -1152,17 +1152,17 @@ IMEContentObserver::ContentRemoved(nsICo
     mStartOfRemovingTextRangeCache.Cache(containerNode, aPreviousSibling,
                                          offset);
   } else {
     offset = mStartOfRemovingTextRangeCache.mFlatTextLength;
   }
 
   // get offset at the end of the deleted node
   uint32_t textLength = 0;
-  if (aChild->IsNodeOfType(nsINode::eTEXT)) {
+  if (aChild->IsText()) {
     textLength = ContentEventHandler::GetNativeTextLength(aChild);
   } else {
     uint32_t nodeLength = static_cast<int32_t>(aChild->GetChildCount());
     rv = ContentEventHandler::GetFlatTextLengthInRange(
                                 NodePositionBefore(aChild, 0),
                                 NodePosition(aChild, nodeLength),
                                 mRootContent, &textLength,
                                 LINE_BREAK_TYPE_NATIVE, true);
--- a/dom/svg/SVGTextContentElement.cpp
+++ b/dom/svg/SVGTextContentElement.cpp
@@ -88,17 +88,17 @@ SVGTextContentElement::GetNonLayoutDepen
   if (!frame || frame != GetPrimaryFrame()) {
     // Only support this fast path on <text>, not child <tspan>s, etc.
     return Some(0);
   }
 
   uint32_t num = 0;
 
   for (nsINode* n = Element::GetFirstChild(); n; n = n->GetNextSibling()) {
-    if (!n->IsNodeOfType(nsINode::eTEXT)) {
+    if (!n->IsText()) {
       return Nothing();
     }
 
     const nsTextFragment* text = static_cast<nsTextNode*>(n)->GetText();
     uint32_t length = text->GetLength();
 
     if (text->Is2b()) {
       if (FragmentHasSkippableCharacter(text->Get2b(), length)) {
--- a/dom/xslt/xpath/txXPathTreeWalker.h
+++ b/dom/xslt/xpath/txXPathTreeWalker.h
@@ -249,12 +249,12 @@ txXPathNodeUtils::isComment(const txXPat
            aNode.Content()->IsNodeOfType(nsINode::eCOMMENT);
 }
 
 /* static */
 inline bool
 txXPathNodeUtils::isText(const txXPathNode& aNode)
 {
     return aNode.isContent() &&
-           aNode.Content()->IsNodeOfType(nsINode::eTEXT);
+           aNode.Content()->IsText();
 }
 
 #endif /* txXPathTreeWalker_h__ */
--- a/editor/libeditor/CompositionTransaction.cpp
+++ b/editor/libeditor/CompositionTransaction.cpp
@@ -123,18 +123,17 @@ CompositionTransaction::DoTransaction()
     mEditorBase->RangeUpdaterRef().
                    SelAdjInsertText(*mTextNode, mOffset, mStringToInsert);
 
     // If IME text node is multiple node, ReplaceData doesn't remove all IME
     // text.  So we need remove remained text into other text node.
     if (replaceableLength < mReplaceLength) {
       int32_t remainLength = mReplaceLength - replaceableLength;
       nsCOMPtr<nsINode> node = mTextNode->GetNextSibling();
-      while (node && node->IsNodeOfType(nsINode::eTEXT) &&
-             remainLength > 0) {
+      while (node && node->IsText() && remainLength > 0) {
         Text* text = static_cast<Text*>(node.get());
         uint32_t textLength = text->TextLength();
         text->DeleteData(0, remainLength, IgnoreErrors());
         mEditorBase->RangeUpdaterRef().SelAdjDeleteText(text, 0, remainLength);
         remainLength -= textLength;
         node = node->GetNextSibling();
       }
     }
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2634,40 +2634,40 @@ EditorBase::FindBetterInsertionPoint(con
 
   nsCOMPtr<nsINode> root = GetRoot();
   if (aPoint.GetContainer() == root) {
     // In some cases, aNode is the anonymous DIV, and offset is 0.  To avoid
     // injecting unneeded text nodes, we first look to see if we have one
     // available.  In that case, we'll just adjust node and offset accordingly.
     if (aPoint.IsStartOfContainer() &&
         aPoint.GetContainer()->HasChildren() &&
-        aPoint.GetContainer()->GetFirstChild()->IsNodeOfType(nsINode::eTEXT)) {
+        aPoint.GetContainer()->GetFirstChild()->IsText()) {
       return EditorRawDOMPoint(aPoint.GetContainer()->GetFirstChild(), 0);
     }
 
     // In some other cases, aNode is the anonymous DIV, and offset points to the
     // terminating mozBR.  In that case, we'll adjust aInOutNode and
     // aInOutOffset to the preceding text node, if any.
     if (!aPoint.IsStartOfContainer()) {
       if (AsHTMLEditor()) {
         // Fall back to a slow path that uses GetChildAt_Deprecated() for Thunderbird's
         // plaintext editor.
         nsIContent* child = aPoint.GetPreviousSiblingOfChild();
-        if (child && child->IsNodeOfType(nsINode::eTEXT)) {
+        if (child && child->IsText()) {
           if (NS_WARN_IF(child->Length() > INT32_MAX)) {
             return aPoint;
           }
           return EditorRawDOMPoint(child, child->Length());
         }
       } else {
         // If we're in a real plaintext editor, use a fast path that avoids
         // calling GetChildAt_Deprecated() which may perform a linear search.
         nsIContent* child = aPoint.GetContainer()->GetLastChild();
         while (child) {
-          if (child->IsNodeOfType(nsINode::eTEXT)) {
+          if (child->IsText()) {
             if (NS_WARN_IF(child->Length() > INT32_MAX)) {
               return aPoint;
             }
             return EditorRawDOMPoint(child, child->Length());
           }
           child = child->GetPreviousSibling();
         }
       }
@@ -2675,17 +2675,17 @@ EditorBase::FindBetterInsertionPoint(con
   }
 
   // Sometimes, aNode is the mozBR element itself.  In that case, we'll adjust
   // the insertion point to the previous text node, if one exists, or to the
   // parent anonymous DIV.
   if (TextEditUtils::IsMozBR(aPoint.GetContainer()) &&
       aPoint.IsStartOfContainer()) {
     nsIContent* previousSibling = aPoint.GetContainer()->GetPreviousSibling();
-    if (previousSibling && previousSibling->IsNodeOfType(nsINode::eTEXT)) {
+    if (previousSibling && previousSibling->IsText()) {
       if (NS_WARN_IF(previousSibling->Length() > INT32_MAX)) {
         return aPoint;
       }
       return EditorRawDOMPoint(previousSibling, previousSibling->Length());
     }
 
     nsINode* parentOfContainer = aPoint.GetContainer()->GetParentNode();
     if (parentOfContainer && parentOfContainer == root) {
@@ -2732,21 +2732,21 @@ EditorBase::InsertTextImpl(nsIDocument& 
   // text node if there is.
   EditorRawDOMPoint pointToInsert = FindBetterInsertionPoint(aPointToInsert);
 
   // If a neighboring text node already exists, use that
   if (!pointToInsert.IsInTextNode()) {
     nsIContent* child = nullptr;
     if (!pointToInsert.IsStartOfContainer() &&
         (child = pointToInsert.GetPreviousSiblingOfChild()) &&
-        child->IsNodeOfType(nsINode::eTEXT)) {
+        child->IsText()) {
       pointToInsert.Set(child, child->Length());
     } else if (!pointToInsert.IsEndOfContainer() &&
                (child = pointToInsert.GetChild()) &&
-               child->IsNodeOfType(nsINode::eTEXT)) {
+               child->IsText()) {
       pointToInsert.Set(child, 0);
     }
   }
 
   if (ShouldHandleIMEComposition()) {
     CheckedInt<int32_t> newOffset;
     if (!pointToInsert.IsInTextNode()) {
       // create a text node
--- a/editor/libeditor/EditorDOMPoint.h
+++ b/editor/libeditor/EditorDOMPoint.h
@@ -226,17 +226,17 @@ public:
   }
 
   /**
    * IsInTextNode() returns true if the container node is a text node.
    */
   bool
   IsInTextNode() const
   {
-    return mParent && mParent->IsNodeOfType(nsINode::eTEXT);
+    return mParent && mParent->IsText();
   }
 
   /**
    * IsContainerHTMLElement() returns true if the container node is an HTML
    * element node and its node name is aTag.
    */
   bool
   IsContainerHTMLElement(nsAtom* aTag) const
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -907,17 +907,17 @@ HTMLEditor::IsNextCharInNodeWhitespace(n
   MOZ_ASSERT((outNode && outOffset) || (!outNode && !outOffset));
   *outIsSpace = false;
   *outIsNBSP = false;
   if (outNode && outOffset) {
     *outNode = nullptr;
     *outOffset = -1;
   }
 
-  if (aContent->IsNodeOfType(nsINode::eTEXT) &&
+  if (aContent->IsText() &&
       (uint32_t)aOffset < aContent->Length()) {
     char16_t ch = aContent->GetText()->CharAt(aOffset);
     *outIsSpace = nsCRT::IsAsciiSpace(ch);
     *outIsNBSP = (ch == kNBSP);
     if (outNode && outOffset) {
       NS_IF_ADDREF(*outNode = aContent);
       // yes, this is _past_ the character
       *outOffset = aOffset + 1;
@@ -942,17 +942,17 @@ HTMLEditor::IsPrevCharInNodeWhitespace(n
   MOZ_ASSERT((outNode && outOffset) || (!outNode && !outOffset));
   *outIsSpace = false;
   *outIsNBSP = false;
   if (outNode && outOffset) {
     *outNode = nullptr;
     *outOffset = -1;
   }
 
-  if (aContent->IsNodeOfType(nsINode::eTEXT) && aOffset > 0) {
+  if (aContent->IsText() && aOffset > 0) {
     char16_t ch = aContent->GetText()->CharAt(aOffset - 1);
     *outIsSpace = nsCRT::IsAsciiSpace(ch);
     *outIsNBSP = (ch == kNBSP);
     if (outNode && outOffset) {
       NS_IF_ADDREF(*outNode = aContent);
       *outOffset = aOffset - 1;
     }
   }
@@ -3436,17 +3436,17 @@ HTMLEditor::TagCanContainTag(nsAtom& aPa
 
 bool
 HTMLEditor::IsContainer(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
 
   int32_t tagEnum;
   // XXX Should this handle #cdata-section too?
-  if (aNode->IsNodeOfType(nsINode::eTEXT)) {
+  if (aNode->IsText()) {
     tagEnum = eHTMLTag_text;
   } else {
     tagEnum = nsHTMLTags::StringTagToId(aNode->NodeName());
   }
 
   return HTMLEditUtils::IsContainer(tagEnum);
 }
 
--- a/editor/libeditor/WSRunObject.cpp
+++ b/editor/libeditor/WSRunObject.cpp
@@ -723,18 +723,17 @@ WSRunObject::GetWSNodes()
     // we haven't found the start of ws yet.  Keep looking
     nsCOMPtr<nsIContent> priorNode = GetPreviousWSNode(start, wsBoundingParent);
     if (priorNode) {
       if (IsBlockNode(priorNode)) {
         mStartNode = start.GetContainer();
         mStartOffset = start.Offset();
         mStartReason = WSType::otherBlock;
         mStartReasonNode = priorNode;
-      } else if (priorNode->IsNodeOfType(nsINode::eTEXT) &&
-                 priorNode->IsEditable()) {
+      } else if (priorNode->IsText() && priorNode->IsEditable()) {
         RefPtr<Text> textNode = priorNode->GetAsText();
         mNodeArray.InsertElementAt(0, textNode);
         const nsTextFragment *textFrag;
         if (!textNode || !(textFrag = textNode->GetText())) {
           return NS_ERROR_NULL_POINTER;
         }
         uint32_t len = textNode->TextLength();
 
@@ -832,18 +831,17 @@ WSRunObject::GetWSNodes()
     nsCOMPtr<nsIContent> nextNode = GetNextWSNode(end, wsBoundingParent);
     if (nextNode) {
       if (IsBlockNode(nextNode)) {
         // we encountered a new block.  therefore no more ws.
         mEndNode = end.GetContainer();
         mEndOffset = end.Offset();
         mEndReason = WSType::otherBlock;
         mEndReasonNode = nextNode;
-      } else if (nextNode->IsNodeOfType(nsINode::eTEXT) &&
-                 nextNode->IsEditable()) {
+      } else if (nextNode->IsText() && nextNode->IsEditable()) {
         RefPtr<Text> textNode = nextNode->GetAsText();
         mNodeArray.AppendElement(textNode);
         const nsTextFragment *textFrag;
         if (!textNode || !(textFrag = textNode->GetText())) {
           return NS_ERROR_NULL_POINTER;
         }
         uint32_t len = textNode->TextLength();
 
--- a/editor/spellchecker/TextServicesDocument.cpp
+++ b/editor/spellchecker/TextServicesDocument.cpp
@@ -466,17 +466,17 @@ TextServicesDocument::LastSelectedBlock(
 
     parent = range->GetStartContainer();
     if (!parent) {
       UNLOCK_DOC(this);
       return NS_ERROR_FAILURE;
     }
 
     nsresult rv;
-    if (parent->IsNodeOfType(nsINode::eTEXT)) {
+    if (parent->IsText()) {
       // The caret is in a text node. Find the beginning
       // of the text block containing this text node and
       // return.
 
       rv = mIterator->PositionAt(parent);
 
       if (NS_FAILED(rv)) {
         UNLOCK_DOC(this);
@@ -539,17 +539,17 @@ TextServicesDocument::LastSelectedBlock(
         return rv;
       }
 
       iter->First();
 
       nsIContent* content = nullptr;
       while (!iter->IsDone()) {
         nsINode* currentNode = iter->GetCurrentNode();
-        if (currentNode->IsNodeOfType(nsINode::eTEXT)) {
+        if (currentNode->IsText()) {
           content = currentNode->AsContent();
           break;
         }
         iter->Next();
       }
 
       if (!content) {
         UNLOCK_DOC(this);
@@ -1511,18 +1511,17 @@ TextServicesDocument::DidDeleteNode(nsIN
   UNLOCK_DOC(this);
 }
 
 void
 TextServicesDocument::DidJoinNodes(nsINode& aLeftNode,
                                    nsINode& aRightNode)
 {
   // Make sure that both nodes are text nodes -- otherwise we don't care.
-  if (!aLeftNode.IsNodeOfType(nsINode::eTEXT) ||
-      !aRightNode.IsNodeOfType(nsINode::eTEXT)) {
+  if (!aLeftNode.IsText() || !aRightNode.IsText()) {
     return;
   }
 
   // Note: The editor merges the contents of the left node into the
   //       contents of the right.
 
   int32_t leftIndex = 0;
   int32_t rightIndex = 0;
@@ -2450,23 +2449,23 @@ TextServicesDocument::GetUncollapsedSele
 
   // Find the first text node in the range.
 
   bool found;
   nsCOMPtr<nsIContent> content;
 
   iter->First();
 
-  if (!p1->IsNodeOfType(nsINode::eTEXT)) {
+  if (!p1->IsText()) {
     found = false;
 
     while (!iter->IsDone()) {
       nsINode* node = iter->GetCurrentNode();
 
-      if (node->IsNodeOfType(nsINode::eTEXT)) {
+      if (node->IsText()) {
         p1 = node;
         o1 = 0;
         found = true;
 
         break;
       }
 
       iter->Next();
@@ -2474,21 +2473,21 @@ TextServicesDocument::GetUncollapsedSele
 
     NS_ENSURE_TRUE(found, NS_ERROR_FAILURE);
   }
 
   // Find the last text node in the range.
 
   iter->Last();
 
-  if (!p2->IsNodeOfType(nsINode::eTEXT)) {
+  if (!p2->IsText()) {
     found = false;
     while (!iter->IsDone()) {
       nsINode* node = iter->GetCurrentNode();
-      if (node->IsNodeOfType(nsINode::eTEXT)) {
+      if (node->IsText()) {
         p2 = node;
         o2 = p2->Length();
         found = true;
 
         break;
       }
 
       iter->Prev();
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -74,17 +74,17 @@ mozInlineSpellWordUtil::Init(TextEditor*
 }
 
 static inline bool
 IsSpellCheckingTextNode(nsINode* aNode)
 {
   nsIContent *parent = aNode->GetParent();
   if (parent && parent->IsAnyOfHTMLElements(nsGkAtoms::script, nsGkAtoms::style))
       return false;
-  return aNode->IsNodeOfType(nsINode::eTEXT);
+  return aNode->IsText();
 }
 
 typedef void (* OnLeaveNodeFunPtr)(nsINode* aNode, void* aClosure);
 
 // Find the next node in the DOM tree in preorder.
 // Calls OnLeaveNodeFunPtr when the traversal leaves a node, which is
 // why we can't just use GetNextNode here, sadly.
 static nsINode*
--- a/layout/base/GeometryUtils.cpp
+++ b/layout/base/GeometryUtils.cpp
@@ -91,17 +91,17 @@ static nsIFrame*
 GetFrameForNode(nsINode* aNode)
 {
   if (aNode->IsElement()) {
     return GetFrameForNode(aNode, GEOMETRY_NODE_ELEMENT);
   }
   if (aNode == aNode->OwnerDoc()) {
     return GetFrameForNode(aNode, GEOMETRY_NODE_DOCUMENT);
   }
-  NS_ASSERTION(aNode->IsNodeOfType(nsINode::eTEXT), "Unknown node type");
+  NS_ASSERTION(aNode->IsText(), "Unknown node type");
   return GetFrameForNode(aNode, GEOMETRY_NODE_TEXT);
 }
 
 static nsIFrame*
 GetFirstNonAnonymousFrameForGeometryNode(const Optional<OwningGeometryNode>& aNode,
                                          nsINode* aDefaultNode)
 {
   nsIFrame* f = GetFrameForGeometryNode(aNode, aDefaultNode);
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -504,21 +504,21 @@ IsElementClickableAndReadable(nsIFrame* 
   //    1. text node
   //    2. any element with only one child of type text node
   // All the other cases are currently ignored.
   nsIContent *content = aFrame->GetContent();
   bool testFontSize = false;
   if (content) {
     nsINodeList* childNodes = content->ChildNodes();
     uint32_t childNodeCount = childNodes->Length();
-    if ((content->IsNodeOfType(nsINode::eTEXT)) ||
+    if ((content->IsText()) ||
       // click occurs on the text inside <a></a> or other clickable tags with text inside
 
       (childNodeCount == 1 && childNodes->Item(0) &&
-        childNodes->Item(0)->IsNodeOfType(nsINode::eTEXT))) {
+        childNodes->Item(0)->IsText())) {
       // The click occurs on an element with only one text node child. In this case, the font size
       // can be tested.
       // The number of child nodes is tested to avoid the following cases (See bug 1172488):
       //   Some jscript libraries transform text elements into Canvas elements but keep the text nodes
       //   with a very small size (1px) to handle the selection of text.
       //   With such libraries, the font size of the text elements is not relevant to detect small elements.
 
       testFontSize = true;
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -268,17 +268,17 @@ RestyleManager::CharacterDataChanged(nsI
 
   uint32_t slowSelectorFlags = parent->GetFlags() & NODE_ALL_SELECTOR_FLAGS;
   if (!(slowSelectorFlags & (NODE_HAS_EMPTY_SELECTOR |
                              NODE_HAS_EDGE_CHILD_SELECTOR))) {
     // Nothing to do, no other slow selector can change as a result of this.
     return;
   }
 
-  if (!aContent->IsNodeOfType(nsINode::eTEXT)) {
+  if (!aContent->IsText()) {
     // Doesn't matter to styling (could be a processing instruction or a
     // comment), it can't change whether any selectors match or don't.
     return;
   }
 
 
   if (MOZ_UNLIKELY(!parent->IsElement())) {
     MOZ_ASSERT(parent->IsShadowRoot());
@@ -1248,17 +1248,17 @@ StyleChangeReflow(nsIFrame* aFrame, nsCh
 // that stylo post-traversal looks at, so only elements and text.  In
 // particular, it ignores comments.
 static nsIContent*
 NextSiblingWhichMayHaveFrame(nsIContent* aContent)
 {
   for (nsIContent* next = aContent->GetNextSibling();
        next;
        next = next->GetNextSibling()) {
-    if (next->IsElement() || next->IsNodeOfType(nsINode::eTEXT)) {
+    if (next->IsElement() || next->IsText()) {
       return next;
     }
   }
 
   return nullptr;
 }
 
 void
@@ -2769,17 +2769,17 @@ RestyleManager::ProcessPostTraversal(
                                      isDisplayContents && wasRestyled,
                                      childrenRestyleState);
     for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) {
       if (traverseElementChildren && n->IsElement()) {
         recreatedAnyContext |= ProcessPostTraversal(n->AsElement(),
                                                     upToDateContext,
                                                     childrenRestyleState,
                                                     childrenFlags);
-      } else if (traverseTextChildren && n->IsNodeOfType(nsINode::eTEXT)) {
+      } else if (traverseTextChildren && n->IsText()) {
         recreatedAnyContext |= ProcessPostTraversalForText(n, textState,
                                                            childrenRestyleState,
                                                            childrenFlags);
       }
     }
   }
 
   // We want to update frame pseudo-element styles after we've traversed our
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2366,17 +2366,17 @@ NeedFrameFor(const nsFrameConstructorSta
   // place after we build our frame construction items, but that would involve
   // creating frame construction items for whitespace kids of
   // eExcludesIgnorableWhitespace frames, where we know we'll be dropping them
   // all anyway, and involve an extra walk down the frame construction item
   // list.
   if ((aParentFrame &&
        (!aParentFrame->IsFrameOfType(nsIFrame::eExcludesIgnorableWhitespace) ||
         aParentFrame->IsGeneratedContentFrame())) ||
-      !aChildContent->IsNodeOfType(nsINode::eTEXT)) {
+      !aChildContent->IsText()) {
     return true;
   }
 
   aChildContent->SetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE |
                           NS_REFRAME_IF_WHITESPACE);
   return !aChildContent->TextIsOnlyWhitespace();
 }
 
@@ -4992,17 +4992,17 @@ already_AddRefed<ComputedStyle>
 nsCSSFrameConstructor::ResolveComputedStyle(nsIContent* aContent)
 {
   ServoStyleSet* styleSet = mPresShell->StyleSet();
 
   if (aContent->IsElement()) {
     return styleSet->ResolveServoStyle(aContent->AsElement());
   }
 
-  MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eTEXT),
+  MOZ_ASSERT(aContent->IsText(),
              "shouldn't waste time creating ComputedStyles for "
              "comments and processing instructions");
 
   Element* parent = aContent->GetFlattenedTreeParentElement();
   MOZ_ASSERT(parent, "Text out of the flattened tree?");
 
   // FIXME(emilio): We can't use ResolveServoStyle properly because this text
   // node can come from non-lazy frame construction, in which case the style we
@@ -5616,18 +5616,17 @@ nsCSSFrameConstructor::AddFrameConstruct
                                                          nsIContent* aContent,
                                                          nsContainerFrame* aParentFrame,
                                                          bool aSuppressWhiteSpaceOptimizations,
                                                          ComputedStyle* aComputedStyle,
                                                          uint32_t aFlags,
                                                          nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
                                                          FrameConstructionItemList& aItems)
 {
-  NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT) ||
-                  aContent->IsElement(),
+  NS_PRECONDITION(aContent->IsText() || aContent->IsElement(),
                   "Shouldn't get anything else here!");
   MOZ_ASSERT(aContent->IsInComposedDoc());
   MOZ_ASSERT(!aContent->GetPrimaryFrame() || aState.mCreatingExtraFrames ||
              aContent->NodeInfo()->NameAtom() == nsGkAtoms::area);
 
   // The following code allows the user to specify the base tag
   // of an element using XBL.  XUL and HTML objects (like boxes, menus, etc.)
   // can then be extended arbitrarily.
@@ -6764,34 +6763,34 @@ MaybeGetListBoxBodyFrame(nsIContent* aCh
 
 void
 nsCSSFrameConstructor::AddTextItemIfNeeded(nsFrameConstructorState& aState,
                                            const InsertionPoint& aInsertion,
                                            nsIContent* aPossibleTextContent,
                                            FrameConstructionItemList& aItems)
 {
   NS_PRECONDITION(aPossibleTextContent, "Must have node");
-  if (!aPossibleTextContent->IsNodeOfType(nsINode::eTEXT) ||
+  if (!aPossibleTextContent->IsText() ||
       !aPossibleTextContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) ||
       aPossibleTextContent->HasFlag(NODE_NEEDS_FRAME)) {
     // Not text, or not suppressed due to being all-whitespace (if it were being
     // suppressed, it would have the NS_CREATE_FRAME_IF_NON_WHITESPACE flag), or
     // going to be reframed anyway.
     return;
   }
   MOZ_ASSERT(!aPossibleTextContent->GetPrimaryFrame(),
              "Text node has a frame and NS_CREATE_FRAME_IF_NON_WHITESPACE");
   AddFrameConstructionItems(aState, aPossibleTextContent, false,
                             aInsertion, aItems);
 }
 
 void
 nsCSSFrameConstructor::ReframeTextIfNeeded(nsIContent* aContent)
 {
-  if (!aContent->IsNodeOfType(nsINode::eTEXT) ||
+  if (!aContent->IsText() ||
       !aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) ||
       aContent->HasFlag(NODE_NEEDS_FRAME)) {
     // Not text, or not suppressed due to being all-whitespace (if it were being
     // suppressed, it would have the NS_CREATE_FRAME_IF_NON_WHITESPACE flag), or
     // going to be reframed anyway.
     return;
   }
   MOZ_ASSERT(!aContent->GetPrimaryFrame(),
@@ -10709,18 +10708,17 @@ nsCSSFrameConstructor::CreateFloatingLet
  */
 void
 nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
                                          nsContainerFrame* aBlockContinuation,
                                          nsIContent* aTextContent,
                                          nsContainerFrame* aParentFrame,
                                          nsFrameItems& aResult)
 {
-  NS_PRECONDITION(aTextContent->IsNodeOfType(nsINode::eTEXT),
-                  "aTextContent isn't text");
+  NS_PRECONDITION(aTextContent->IsText(), "aTextContent isn't text");
   NS_ASSERTION(nsLayoutUtils::GetAsBlock(aBlockFrame),
                  "Not a block frame?");
 
   // Get a ComputedStyle for the first-letter-frame.
   //
   // Keep this in sync with nsBlockFrame::UpdatePseudoElementStyles.
   nsIFrame* parentFrame =
     nsFrame::CorrectStyleParentFrame(aParentFrame,
--- a/layout/base/nsStyleChangeList.cpp
+++ b/layout/base/nsStyleChangeList.cpp
@@ -29,17 +29,17 @@ nsStyleChangeList::AppendChange(nsIFrame
   MOZ_ASSERT(aContent || !(aHint & nsChangeHint_ReconstructFrame),
              "must have content");
   // XXXbz we should make this take Element instead of nsIContent
   MOZ_ASSERT(!aContent || aContent->IsElement() ||
              // display:contents elements posts the changes for their children:
              (aFrame && aContent->GetFlattenedTreeParentElementForStyle() &&
               Servo_Element_IsDisplayContents(
                 aContent->GetFlattenedTreeParentElementForStyle())) ||
-             (aContent->IsNodeOfType(nsINode::eTEXT) &&
+             (aContent->IsText() &&
               aContent->HasFlag(NODE_NEEDS_FRAME) &&
               aHint & nsChangeHint_ReconstructFrame),
              "Shouldn't be trying to restyle non-elements directly, "
              "except if it's a display:contents child or a text node "
              "doing lazy frame construction");
   MOZ_ASSERT(!(aHint & nsChangeHint_AllReflowHints) ||
              (aHint & nsChangeHint_NeedReflow),
              "Reflow hint bits set without actually asking for a reflow");
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -957,24 +957,24 @@ nsTextControlFrame::SelectAllOrCollapseT
   if (numChildren > 0) {
     // We never want to place the selection after the last
     // br under the root node!
     nsIContent *child = rootContent->GetLastChild();
     if (child) {
       if (child->IsHTMLElement(nsGkAtoms::br)) {
         child = child->GetPreviousSibling();
         --numChildren;
-      } else if (child->IsNodeOfType(nsINode::eTEXT) && !child->Length()) {
+      } else if (child->IsText() && !child->Length()) {
         // Editor won't remove text node when empty value.
         --numChildren;
       }
     }
     if (!aSelect && numChildren) {
       child = child->GetPreviousSibling();
-      if (child && child->IsNodeOfType(nsINode::eTEXT)) {
+      if (child && child->IsText()) {
         rootNode = child;
         const nsTextFragment* fragment = child->GetText();
         numChildren = fragment ? fragment->GetLength() : 0;
       }
     }
   }
 
   rv = SetSelectionInternal(rootNode, aSelect ? 0 : numChildren,
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -372,17 +372,17 @@ nsFirstLetterFrame::DrainOverflowFrames(
 
   // Now repair our first frames ComputedStyle (since we only reflow
   // one frame there is no point in doing any other ones until they
   // are reflowed)
   nsIFrame* kid = mFrames.FirstChild();
   if (kid) {
     nsIContent* kidContent = kid->GetContent();
     if (kidContent) {
-      NS_ASSERTION(kidContent->IsNodeOfType(nsINode::eTEXT),
+      NS_ASSERTION(kidContent->IsText(),
                    "should contain only text nodes");
       ComputedStyle* parentSC;
       if (prevInFlow) {
         // This is for the rest of the content not in the first-letter.
         nsIFrame* styleParent =
           CorrectStyleParentFrame(GetParent(),
                                   nsCSSPseudoElements::firstLetter);
         parentSC = styleParent->Style();
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -7799,17 +7799,17 @@ nsFrame::GetFrameName(nsAString& aResult
 {
   return MakeFrameName(NS_LITERAL_STRING("Frame"), aResult);
 }
 
 nsresult
 nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
 {
   aResult = aType;
-  if (mContent && !mContent->IsNodeOfType(nsINode::eTEXT)) {
+  if (mContent && !mContent->IsText()) {
     nsAutoString buf;
     mContent->NodeInfo()->NameAtom()->ToString(buf);
     if (IsSubDocumentFrame()) {
       nsAutoString src;
       mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
       buf.AppendLiteral(" src=");
       buf.Append(src);
     }
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -4361,18 +4361,17 @@ nsTextFrame::AccessibleType()
 
 //-----------------------------------------------------------------------------
 void
 nsTextFrame::Init(nsIContent*       aContent,
                   nsContainerFrame* aParent,
                   nsIFrame*         aPrevInFlow)
 {
   NS_ASSERTION(!aPrevInFlow, "Can't be a continuation!");
-  NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT),
-                  "Bogus content!");
+  NS_PRECONDITION(aContent->IsText(), "Bogus content!");
 
   // Remove any NewlineOffsetProperty or InFlowContentLengthProperty since they
   // might be invalid if the content was modified while there was no frame
   if (aContent->HasFlag(NS_HAS_NEWLINE_PROPERTY)) {
     aContent->DeleteProperty(nsGkAtoms::newline);
     aContent->UnsetFlags(NS_HAS_NEWLINE_PROPERTY);
   }
   if (aContent->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -510,17 +510,17 @@ ResolveStyleForTextOrFirstLetterContinua
 
   return style.forget();
 }
 
 already_AddRefed<ComputedStyle>
 ServoStyleSet::ResolveStyleForText(nsIContent* aTextNode,
                                    ComputedStyle* aParentContext)
 {
-  MOZ_ASSERT(aTextNode && aTextNode->IsNodeOfType(nsINode::eTEXT));
+  MOZ_ASSERT(aTextNode && aTextNode->IsText());
   MOZ_ASSERT(aTextNode->GetParent());
   MOZ_ASSERT(aParentContext);
 
   return ResolveStyleForTextOrFirstLetterContinuation(
       mRawSet.get(), *aParentContext, nsCSSAnonBoxes::mozText);
 }
 
 already_AddRefed<ComputedStyle>
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -739,33 +739,33 @@ nsStyleUtil::ColorComponentToFloat(uint8
   }
   return rounded;
 }
 
 /* static */ bool
 nsStyleUtil::IsSignificantChild(nsIContent* aChild,
                                 bool aWhitespaceIsSignificant)
 {
-  bool isText = aChild->IsNodeOfType(nsINode::eTEXT);
+  bool isText = aChild->IsText();
 
   if (!isText && !aChild->IsNodeOfType(nsINode::eCOMMENT) &&
       !aChild->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
     return true;
   }
 
   return isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
           !aChild->TextIsOnlyWhitespace());
 }
 
 /* static */ bool
 nsStyleUtil::ThreadSafeIsSignificantChild(const nsIContent* aChild,
                                           bool aWhitespaceIsSignificant)
 {
-  bool isText = aChild->IsNodeOfType(nsINode::eTEXT);
+  bool isText = aChild->IsText();
 
   if (!isText && !aChild->IsNodeOfType(nsINode::eCOMMENT) &&
       !aChild->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
     return true;
   }
 
   return isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
--- a/layout/svg/SVGObserverUtils.cpp
+++ b/layout/svg/SVGObserverUtils.cpp
@@ -621,17 +621,17 @@ SVGObserverUtils::GetPaintServer(nsIFram
                                  nsStyleSVGPaint nsStyleSVG::* aPaint,
                                  PaintingPropertyDescriptor aType)
 {
   // If we're looking at a frame within SVG text, then we need to look up
   // to find the right frame to get the painting property off.  We should at
   // least look up past a text frame, and if the text frame's parent is the
   // anonymous block frame, then we look up to its parent (the SVGTextFrame).
   nsIFrame* frame = aTargetFrame;
-  if (frame->GetContent()->IsNodeOfType(nsINode::eTEXT)) {
+  if (frame->GetContent()->IsText()) {
     frame = frame->GetParent();
     nsIFrame* grandparent = frame->GetParent();
     if (grandparent && grandparent->IsSVGTextFrame()) {
       frame = grandparent;
     }
   }
 
   const nsStyleSVG* svgStyle = frame->StyleSVG();
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -271,17 +271,17 @@ GetNonEmptyTextFrameAndNode(nsIFrame* aF
                             nsTextFrame*& aTextFrame,
                             nsTextNode*& aTextNode)
 {
   nsTextFrame* text = do_QueryFrame(aFrame);
   bool isNonEmptyTextFrame = text && text->GetContentLength() != 0;
 
   if (isNonEmptyTextFrame) {
     nsIContent* content = text->GetContent();
-    NS_ASSERTION(content && content->IsNodeOfType(nsINode::eTEXT),
+    NS_ASSERTION(content && content->IsText(),
                  "unexpected content type for nsTextFrame");
 
     nsTextNode* node = static_cast<nsTextNode*>(content);
     MOZ_ASSERT(node->TextLength() != 0,
                "frame's GetContentLength() should be 0 if the text node "
                "has no content");
 
     aTextFrame = text;
@@ -1192,17 +1192,17 @@ public:
    */
   explicit TextNodeIterator(nsIContent* aRoot, nsIContent* aSubtree = nullptr)
     : mRoot(aRoot),
       mSubtree(aSubtree == aRoot ? nullptr : aSubtree),
       mCurrent(aRoot),
       mSubtreePosition(mSubtree ? eBeforeSubtree : eWithinSubtree)
   {
     NS_ASSERTION(aRoot, "expected non-null root");
-    if (!aRoot->IsNodeOfType(nsINode::eTEXT)) {
+    if (!aRoot->IsText()) {
       Next();
     }
   }
 
   /**
    * Returns the current nsTextNode, or null if the iterator has finished.
    */
   nsTextNode* Current() const
@@ -1291,17 +1291,17 @@ TextNodeIterator::Next()
             break;
           }
           if (mCurrent == mSubtree) {
             mSubtreePosition = eAfterSubtree;
           }
           mCurrent = mCurrent->GetParent();
         }
       }
-    } while (mCurrent && !mCurrent->IsNodeOfType(nsINode::eTEXT));
+    } while (mCurrent && !mCurrent->IsText());
   }
 
   return static_cast<nsTextNode*>(mCurrent);
 }
 
 // ----------------------------------------------------------------------------
 // TextNodeCorrespondenceRecorder
 
@@ -4532,17 +4532,17 @@ ShouldStartRunAtIndex(const nsTArray<Cha
 
 bool
 SVGTextFrame::ResolvePositionsForNode(nsIContent* aContent,
                                       uint32_t& aIndex,
                                       bool aInTextPath,
                                       bool& aForceStartOfChunk,
                                       nsTArray<gfxPoint>& aDeltas)
 {
-  if (aContent->IsNodeOfType(nsINode::eTEXT)) {
+  if (aContent->IsText()) {
     // We found a text node.
     uint32_t length = static_cast<nsTextNode*>(aContent)->TextLength();
     if (length) {
       uint32_t end = aIndex + length;
       if (MOZ_UNLIKELY(end > mPositions.Length())) {
         MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
                                "found by iterating content");
         return false;
--- a/layout/svg/nsSVGGradientFrame.cpp
+++ b/layout/svg/nsSVGGradientFrame.cpp
@@ -241,17 +241,17 @@ nsSVGGradientFrame::GetPaintServerPatter
 {
   uint16_t gradientUnits = GetGradientUnits();
   MOZ_ASSERT(gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX ||
              gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE);
   if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
     // Set mSource for this consumer.
     // If this gradient is applied to text, our caller will be the glyph, which
     // is not an element, so we need to get the parent
-    mSource = aSource->GetContent()->IsNodeOfType(nsINode::eTEXT) ?
+    mSource = aSource->GetContent()->IsText() ?
                 aSource->GetParent() : aSource;
   }
 
   AutoTArray<nsIFrame*,8> stopFrames;
   GetStopFrames(&stopFrames);
 
   uint32_t nStops = stopFrames.Length();
 
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -1057,17 +1057,17 @@ nsSVGUtils::SetClipRect(gfxContext *aCon
   aContext->Multiply(aCTM);
   aContext->Clip(aRect);
 }
 
 gfxRect
 nsSVGUtils::GetBBox(nsIFrame* aFrame, uint32_t aFlags,
                     const gfxMatrix* aToBoundsSpace)
 {
-  if (aFrame->GetContent()->IsNodeOfType(nsINode::eTEXT)) {
+  if (aFrame->GetContent()->IsText()) {
     aFrame = aFrame->GetParent();
   }
 
   if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
     // It is possible to apply a gradient, pattern, clipping path, mask or
     // filter to text. When one of these facilities is applied to text
     // the bounding box is the entire text element in all
     // cases.
@@ -1333,17 +1333,17 @@ nsSVGUtils::GetFirstNonAAncestorFrame(ns
   }
   return nullptr;
 }
 
 bool
 nsSVGUtils::GetNonScalingStrokeTransform(nsIFrame *aFrame,
                                          gfxMatrix* aUserToOuterSVG)
 {
-  if (aFrame->GetContent()->IsNodeOfType(nsINode::eTEXT)) {
+  if (aFrame->GetContent()->IsText()) {
     aFrame = aFrame->GetParent();
   }
 
   if (!aFrame->StyleSVGReset()->HasNonScalingStroke()) {
     return false;
   }
 
   nsIContent *content = aFrame->GetContent();
@@ -1662,17 +1662,17 @@ float
 nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, SVGContextPaint* aContextPaint)
 {
   const nsStyleSVG *style = aFrame->StyleSVG();
   if (aContextPaint && style->StrokeWidthFromObject()) {
     return aContextPaint->GetStrokeWidth();
   }
 
   nsIContent* content = aFrame->GetContent();
-  if (content->IsNodeOfType(nsINode::eTEXT)) {
+  if (content->IsText()) {
     content = content->GetParent();
   }
 
   nsSVGElement *ctx = static_cast<nsSVGElement*>(content);
 
   return SVGContentUtils::CoordToFloat(ctx, style->mStrokeWidth);
 }
 
--- a/toolkit/components/find/nsFind.cpp
+++ b/toolkit/components/find/nsFind.cpp
@@ -489,17 +489,17 @@ DumpNode(nsIDOMNode* aNode)
 {
   if (!aNode) {
     printf(">>>> Node: NULL\n");
     return;
   }
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   nsString nodeName = node->NodeName();
   nsCOMPtr<nsIContent> textContent(do_QueryInterface(aNode));
-  if (textContent && textContent->IsNodeOfType(nsINode::eTEXT)) {
+  if (textContent && textContent->IsText()) {
     nsAutoString newText;
     textContent->AppendTextTo(newText);
     printf(">>>> Text node (node name %s): '%s'\n",
            NS_LossyConvertUTF16toASCII(nodeName).get(),
            NS_LossyConvertUTF16toASCII(newText).get());
   } else {
     printf(">>>> Node: %s\n", NS_LossyConvertUTF16toASCII(nodeName).get());
   }
@@ -661,17 +661,17 @@ nsFind::NextNode(nsRange* aSearchRange,
     }
 
     content = do_QueryInterface(mIterator->GetCurrentNode());
 #ifdef DEBUG_FIND
     nsCOMPtr<nsIDOMNode> dnode(do_QueryInterface(content));
     printf(":::::: Got the first node ");
     DumpNode(dnode);
 #endif
-    if (content && content->IsNodeOfType(nsINode::eTEXT) &&
+    if (content && content->IsText() &&
         !SkipNode(content)) {
       mIterNode = content;
       // Also set mIterOffset if appropriate:
       nsCOMPtr<nsINode> node;
       if (mFindBackward) {
         node = aStartPoint->GetEndContainer();
         if (mIterNode == node) {
           uint32_t endOffset = aStartPoint->EndOffset();
@@ -722,17 +722,17 @@ nsFind::NextNode(nsRange* aSearchRange,
 
     // Now see if we need to skip this node -- e.g. is it part of a script or
     // other invisible node? Note that we don't ask for CSS information; a node
     // can be invisible due to CSS, and we'd still find it.
     if (SkipNode(content)) {
       continue;
     }
 
-    if (content->IsNodeOfType(nsINode::eTEXT)) {
+    if (content->IsText()) {
       break;
     }
 #ifdef DEBUG_FIND
     dnode = do_QueryInterface(content);
     printf("Not a text node: ");
     DumpNode(dnode);
 #endif
   }