Bug 1260651 part.14 Rename nsTextEditUtils to mozilla::TextEditUtils (and their files too) r=mccr8 draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 07 Jul 2016 13:44:32 +0900
changeset 385846 91af161004b9efb4169ec137c9234abec684ea12
parent 385845 3e161dea4676419485984ea913afc12985fe2e1c
child 385847 bb8472cfb4d2b6a9626c66da7d05a7f0121811f4
push id22587
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 06:59:31 +0000
reviewersmccr8
bugs1260651
milestone50.0a1
Bug 1260651 part.14 Rename nsTextEditUtils to mozilla::TextEditUtils (and their files too) r=mccr8 MozReview-Commit-ID: DZ3SAOTNuZx
editor/libeditor/TextEditUtils.cpp
editor/libeditor/TextEditUtils.h
editor/libeditor/moz.build
editor/libeditor/nsEditor.cpp
editor/libeditor/nsHTMLAbsPosition.cpp
editor/libeditor/nsHTMLDataTransfer.cpp
editor/libeditor/nsHTMLEditRules.cpp
editor/libeditor/nsHTMLEditUtils.cpp
editor/libeditor/nsHTMLEditor.cpp
editor/libeditor/nsHTMLEditorStyle.cpp
editor/libeditor/nsPlaintextEditor.cpp
editor/libeditor/nsTextEditRules.cpp
editor/libeditor/nsTextEditUtils.cpp
editor/libeditor/nsTextEditUtils.h
editor/libeditor/nsWSRunObject.cpp
rename from editor/libeditor/nsTextEditUtils.cpp
rename to editor/libeditor/TextEditUtils.cpp
--- a/editor/libeditor/nsTextEditUtils.cpp
+++ b/editor/libeditor/TextEditUtils.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsTextEditUtils.h"
+#include "TextEditUtils.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/dom/Element.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"
 #include "nsCaseTreatment.h"
 #include "nsDebug.h"
 #include "nsEditor.h"
@@ -16,84 +16,82 @@
 #include "nsGkAtoms.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNode.h"
 #include "nsNameSpaceManager.h"
 #include "nsLiteralString.h"
 #include "nsPlaintextEditor.h"
 #include "nsString.h"
 
-using namespace mozilla;
+namespace mozilla {
 
-///////////////////////////////////////////////////////////////////////////
-// IsBody: true if node an html body node
+/**
+ * IsBody() returns true if aNode is an html body node.
+ */
 bool
-nsTextEditUtils::IsBody(nsIDOMNode *node)
+TextEditUtils::IsBody(nsIDOMNode* aNode)
 {
-  return nsEditor::NodeIsType(node, nsGkAtoms::body);
+  return nsEditor::NodeIsType(aNode, nsGkAtoms::body);
 }
 
-
-///////////////////////////////////////////////////////////////////////////
-// IsBreak: true if node an html break node
+/**
+ * IsBreak() returns true if aNode is an html break node.
+ */
 bool
-nsTextEditUtils::IsBreak(nsIDOMNode *node)
+TextEditUtils::IsBreak(nsIDOMNode* aNode)
 {
-  return nsEditor::NodeIsType(node, nsGkAtoms::br);
+  return nsEditor::NodeIsType(aNode, nsGkAtoms::br);
 }
 
 bool
-nsTextEditUtils::IsBreak(nsINode* aNode)
+TextEditUtils::IsBreak(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::br);
 }
 
 
-///////////////////////////////////////////////////////////////////////////
-// IsMozBR: true if node an html br node with type = _moz
-//
+/**
+ * IsMozBR() returns true if aNode is an html br node with |type = _moz|.
+ */
 bool
-nsTextEditUtils::IsMozBR(nsIDOMNode *node)
+TextEditUtils::IsMozBR(nsIDOMNode* aNode)
 {
-  NS_PRECONDITION(node, "null node passed to nsHTMLEditUtils::IsMozBR");
-  return IsBreak(node) && HasMozAttr(node);
+  MOZ_ASSERT(aNode);
+  return IsBreak(aNode) && HasMozAttr(aNode);
 }
 
-
 bool
-nsTextEditUtils::IsMozBR(nsINode* aNode)
+TextEditUtils::IsMozBR(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::br) &&
          aNode->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                          NS_LITERAL_STRING("_moz"),
                                          eIgnoreCase);
 }
 
-///////////////////////////////////////////////////////////////////////////
-// HasMozAttr: true if node has type attribute = _moz
-//             (used to indicate the div's and br's we use in
-//              mail compose rules)
-//
+/**
+ * HasMozAttr() returns true if aNode has type attribute and its value is
+ * |_moz|. (Used to indicate div's and br's we use in mail compose rules)
+ */
 bool
-nsTextEditUtils::HasMozAttr(nsIDOMNode *node)
+TextEditUtils::HasMozAttr(nsIDOMNode* aNode)
 {
-  NS_PRECONDITION(node, "null parent passed to nsHTMLEditUtils::HasMozAttr");
-  nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(node);
-  if (elem)
-  {
-    nsAutoString typeAttrVal;
-    nsresult res = elem->GetAttribute(NS_LITERAL_STRING("type"), typeAttrVal);
-    if (NS_SUCCEEDED(res) && (typeAttrVal.LowerCaseEqualsLiteral("_moz")))
-      return true;
+  MOZ_ASSERT(aNode);
+  nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
+  if (!element) {
+    return false;
   }
-  return false;
+  nsAutoString typeAttrVal;
+  nsresult rv = element->GetAttribute(NS_LITERAL_STRING("type"), typeAttrVal);
+  return NS_SUCCEEDED(rv) && typeAttrVal.LowerCaseEqualsLiteral("_moz");
 }
 
+} // namespace mozilla
 
 ///////////////////////////////////////////////////////////////////////////
 // nsAutoEditInitRulesTrigger methods
 //
 nsAutoEditInitRulesTrigger::nsAutoEditInitRulesTrigger( nsPlaintextEditor *aEd, nsresult &aRes) : mEd(aEd), mRes(aRes)
 {
     if (mEd) mEd->BeginEditorInit();
 }
rename from editor/libeditor/nsTextEditUtils.h
rename to editor/libeditor/TextEditUtils.h
--- a/editor/libeditor/nsTextEditUtils.h
+++ b/editor/libeditor/TextEditUtils.h
@@ -1,41 +1,45 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsTextEditUtils_h__
-#define nsTextEditUtils_h__
+#ifndef TextEditUtils_h
+#define TextEditUtils_h
 
 #include "nscore.h"
 
 class nsIDOMNode;
 class nsINode;
 class nsPlaintextEditor;
 
-class nsTextEditUtils
+namespace mozilla {
+
+class TextEditUtils final
 {
 public:
   // from nsTextEditRules:
   static bool IsBody(nsIDOMNode* aNode);
   static bool IsBreak(nsIDOMNode* aNode);
   static bool IsBreak(nsINode* aNode);
   static bool IsMozBR(nsIDOMNode* aNode);
   static bool IsMozBR(nsINode* aNode);
   static bool HasMozAttr(nsIDOMNode* aNode);
 };
 
+} // naemspace mozilla
+
 /***************************************************************************
  * stack based helper class for detecting end of editor initialization, in
  * order to trigger "end of init" initialization of the edit rules.
  */
 class nsAutoEditInitRulesTrigger
 {
 private:
   nsPlaintextEditor* mEd;
   nsresult& mRes;
 public:
   nsAutoEditInitRulesTrigger(nsPlaintextEditor* aEd, nsresult& aRes);
   ~nsAutoEditInitRulesTrigger();
 };
 
-#endif /* nsTextEditUtils_h__ */
+#endif // #ifndef TextEditUtils_h
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -46,22 +46,22 @@ UNIFIED_SOURCES += [
     'nsInternetCiter.cpp',
     'nsPlaintextDataTransfer.cpp',
     'nsPlaintextEditor.cpp',
     'nsSelectionState.cpp',
     'nsStyleSheetTxns.cpp',
     'nsTableEditor.cpp',
     'nsTextEditRules.cpp',
     'nsTextEditRulesBidi.cpp',
-    'nsTextEditUtils.cpp',
     'nsWSRunObject.cpp',
     'PlaceholderTxn.cpp',
     'SetDocTitleTxn.cpp',
     'SplitNodeTxn.cpp',
     'TextEditorTest.cpp',
+    'TextEditUtils.cpp',
     'TypeInState.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/editor/txmgr',
     '/extensions/spellcheck/src',
     '/layout/generic',
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -19,16 +19,17 @@
 #include "EditorUtils.h"                // for AutoRules, etc
 #include "EditTxn.h"                    // for EditTxn
 #include "IMETextTxn.h"                 // for IMETextTxn
 #include "InsertNodeTxn.h"              // for InsertNodeTxn
 #include "InsertTextTxn.h"              // for InsertTextTxn
 #include "JoinNodeTxn.h"                // for JoinNodeTxn
 #include "PlaceholderTxn.h"             // for PlaceholderTxn
 #include "SplitNodeTxn.h"               // for SplitNodeTxn
+#include "TextEditUtils.h"              // for TextEditUtils
 #include "mozFlushType.h"               // for mozFlushType::Flush_Frames
 #include "mozInlineSpellChecker.h"      // for mozInlineSpellChecker
 #include "mozilla/CheckedInt.h"         // for CheckedInt
 #include "mozilla/IMEStateManager.h"    // for IMEStateManager
 #include "mozilla/Preferences.h"        // for Preferences
 #include "mozilla/dom/Selection.h"      // for Selection, etc
 #include "mozilla/Services.h"           // for GetObserverService
 #include "mozilla/TextComposition.h"    // for TextComposition
@@ -95,17 +96,16 @@
 #include "nsReadableUtils.h"            // for EmptyString, ToNewCString
 #include "nsString.h"                   // for nsAutoString, nsString, etc
 #include "nsStringFwd.h"                // for nsAFlatString
 #include "nsStyleConsts.h"              // for NS_STYLE_DIRECTION_RTL, etc
 #include "nsStyleContext.h"             // for nsStyleContext
 #include "nsStyleSheetTxns.h"           // for AddStyleSheetTxn, etc
 #include "nsStyleStruct.h"              // for nsStyleDisplay, nsStyleText, etc
 #include "nsStyleStructFwd.h"           // for nsIFrame::StyleUIReset, etc
-#include "nsTextEditUtils.h"            // for nsTextEditUtils
 #include "nsTextNode.h"                 // for nsTextNode
 #include "nsThreadUtils.h"              // for nsRunnable
 #include "nsTransactionManager.h"       // for nsTransactionManager
 #include "prtime.h"                     // for PR_Now
 
 class nsIOutputStream;
 class nsIParserService;
 class nsITransferable;
@@ -2301,17 +2301,17 @@ nsEditor::FindBetterInsertionPoint(nsCOM
       aOffset = static_cast<int32_t>(aNode->Length());
       return;
     }
   }
 
   // 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 (nsTextEditUtils::IsMozBR(node) && !offset) {
+  if (TextEditUtils::IsMozBR(node) && !offset) {
     if (node->GetPreviousSibling() &&
         node->GetPreviousSibling()->IsNodeOfType(nsINode::eTEXT)) {
       NS_ENSURE_TRUE_VOID(node->Length() <= INT32_MAX);
       aNode = node->GetPreviousSibling();
       aOffset = static_cast<int32_t>(aNode->Length());
       return;
     }
 
--- a/editor/libeditor/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/nsHTMLAbsPosition.cpp
@@ -1,15 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <math.h>
 
 #include "EditorUtils.h"
+#include "TextEditUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
 #include "nsAlgorithm.h"
 #include "nsCOMPtr.h"
 #include "nsComputedDOMStyle.h"
@@ -39,17 +40,16 @@
 #include "nsIPresShell.h"
 #include "nsISupportsImpl.h"
 #include "nsISupportsUtils.h"
 #include "nsLiteralString.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsTextEditRules.h"
-#include "nsTextEditUtils.h"
 #include "nscore.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #define  BLACK_BG_RGB_TRIGGER 0xd0
 
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -2,16 +2,17 @@
 /* vim: set ts=2 sw=2 et tw=78: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <string.h>
 
 #include "EditorUtils.h"
+#include "TextEditUtils.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Base64.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/Preferences.h"
@@ -74,17 +75,16 @@
 #include "nsSelectionState.h"
 #include "nsServiceManagerUtils.h"
 #include "nsStreamUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsStringIterator.h"
 #include "nsSubstringTuple.h"
 #include "nsTextEditRules.h"
-#include "nsTextEditUtils.h"
 #include "nsTreeSanitizer.h"
 #include "nsWSRunObject.h"
 #include "nsXPCOM.h"
 #include "nscore.h"
 #include "nsContentUtils.h"
 
 class nsIAtom;
 class nsILoadContext;
@@ -386,17 +386,17 @@ nsHTMLEditor::DoInsertHTMLWithContext(co
     NormalizeEOLInsertPosition(nodeList[0], address_of(parentNode),
                                &offsetOfNewNode);
 
     // if there are any invisible br's after our insertion point, remove them.
     // this is because if there is a br at end of what we paste, it will make
     // the invisible br visible.
     nsWSRunObject wsObj(this, parentNode, offsetOfNewNode);
     if (wsObj.mEndReasonNode &&
-        nsTextEditUtils::IsBreak(wsObj.mEndReasonNode) &&
+        TextEditUtils::IsBreak(wsObj.mEndReasonNode) &&
         !IsVisBreak(wsObj.mEndReasonNode)) {
       rv = DeleteNode(wsObj.mEndReasonNode);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // Remember if we are in a link.
     bool bStartedInLink = IsInLink(parentNode);
 
@@ -467,17 +467,17 @@ nsHTMLEditor::DoInsertHTMLWithContext(co
 
     for (j=0; j<listCount; j++)
     {
       bool bDidInsert = false;
       nsCOMPtr<nsIDOMNode> curNode = nodeList[j]->AsDOMNode();
 
       NS_ENSURE_TRUE(curNode, NS_ERROR_FAILURE);
       NS_ENSURE_TRUE(curNode != fragmentAsNode, NS_ERROR_FAILURE);
-      NS_ENSURE_TRUE(!nsTextEditUtils::IsBody(curNode), NS_ERROR_FAILURE);
+      NS_ENSURE_TRUE(!TextEditUtils::IsBody(curNode), NS_ERROR_FAILURE);
 
       if (insertedContextParent)
       {
         // if we had to insert something higher up in the paste hierarchy, we want to
         // skip any further paste nodes that descend from that.  Else we will paste twice.
         if (EditorUtils::IsDescendantOf(curNode, insertedContextParent)) {
           continue;
         }
@@ -580,18 +580,17 @@ nsHTMLEditor::DoInsertHTMLWithContext(co
         }
 
         // Assume failure means no legal parent in the document hierarchy,
         // try again with the parent of curNode in the paste hierarchy.
         nsCOMPtr<nsIDOMNode> parent;
         while (NS_FAILED(rv) && curNode)
         {
           curNode->GetParentNode(getter_AddRefs(parent));
-          if (parent && !nsTextEditUtils::IsBody(parent))
-          {
+          if (parent && !TextEditUtils::IsBody(parent)) {
             rv = InsertNodeAtPoint(parent, address_of(parentNode), &offsetOfNewNode, true);
             if (NS_SUCCEEDED(rv))
             {
               bDidInsert = true;
               insertedContextParent = parent;
               lastInsertNode = GetChildAt(parentNode, offsetOfNewNode);
             }
           }
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsHTMLEditRules.h"
 
 #include <stdlib.h>
 
 #include "EditorUtils.h"
+#include "TextEditUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/mozalloc.h"
 #include "nsAutoPtr.h"
@@ -44,17 +45,16 @@
 #include "nsINode.h"
 #include "nsLiteralString.h"
 #include "nsPlaintextEditor.h"
 #include "nsRange.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsTArray.h"
-#include "nsTextEditUtils.h"
 #include "nsThreadUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsWSRunObject.h"
 #include <algorithm>
 
 // Workaround for windows headers
 #ifdef SetProp
 #undef SetProp
@@ -1212,17 +1212,17 @@ nsHTMLEditRules::WillInsert(Selection& a
   NS_ENSURE_TRUE_VOID(aSelection.GetRangeAt(0) &&
                       aSelection.GetRangeAt(0)->GetStartParent());
   OwningNonNull<nsINode> selNode = *aSelection.GetRangeAt(0)->GetStartParent();
   int32_t selOffset = aSelection.GetRangeAt(0)->StartOffset();
 
   // Get prior node
   nsCOMPtr<nsIContent> priorNode = mHTMLEditor->GetPriorHTMLNode(selNode,
                                                                  selOffset);
-  if (priorNode && nsTextEditUtils::IsMozBR(priorNode)) {
+  if (priorNode && TextEditUtils::IsMozBR(priorNode)) {
     nsCOMPtr<Element> block1 = mHTMLEditor->GetBlock(selNode);
     nsCOMPtr<Element> block2 = mHTMLEditor->GetBlockNodeParent(priorNode);
 
     if (block1 && block1 == block2) {
       // If we are here then the selection is right after a mozBR that is in
       // the same block as the selection.  We need to move the selection start
       // to be before the mozBR.
       selNode = priorNode->GetParentNode();
@@ -3002,17 +3002,17 @@ nsHTMLEditRules::WillMakeList(Selection*
   res = GetListActionNodes(arrayOfNodes,
                            aEntireList ? EntireList::yes : EntireList::no);
   NS_ENSURE_SUCCESS(res, res);
 
   // check if all our nodes are <br>s, or empty inlines
   bool bOnlyBreaks = true;
   for (auto& curNode : arrayOfNodes) {
     // if curNode is not a Break or empty inline, we're done
-    if (!nsTextEditUtils::IsBreak(curNode) &&
+    if (!TextEditUtils::IsBreak(curNode) &&
         !IsEmptyInline(curNode)) {
       bOnlyBreaks = false;
       break;
     }
   }
 
   // if no nodes, we make empty list.  Ditto if the user tried to make a list
   // of some # of breaks.
@@ -3082,17 +3082,17 @@ nsHTMLEditRules::WillMakeList(Selection*
 
     // make sure we don't assemble content that is in different table cells
     // into the same list.  respect table cell boundaries when listifying.
     if (curList && InDifferentTableElements(curList, curNode)) {
       curList = nullptr;
     }
 
     // if curNode is a Break, delete it, and quit remembering prev list item
-    if (nsTextEditUtils::IsBreak(curNode)) {
+    if (TextEditUtils::IsBreak(curNode)) {
       NS_ENSURE_STATE(mHTMLEditor);
       res = mHTMLEditor->DeleteNode(curNode);
       NS_ENSURE_SUCCESS(res, res);
       prevListItem = 0;
       continue;
     } else if (IsEmptyInline(curNode)) {
       // if curNode is an empty inline container, delete it
       NS_ENSURE_STATE(mHTMLEditor);
@@ -4511,17 +4511,17 @@ nsHTMLEditRules::WillAlign(Selection& aS
       // header; in HTML 4, it can directly carry the ALIGN attribute and we
       // don't need to make a div! If we are in CSS mode, all the work is done
       // in AlignBlock
       rv = AlignBlock(*node->AsElement(), aAlignType, ContentsOnly::yes);
       NS_ENSURE_SUCCESS(rv, rv);
       return NS_OK;
     }
 
-    if (nsTextEditUtils::IsBreak(node)) {
+    if (TextEditUtils::IsBreak(node)) {
       // The special case emptyDiv code (below) that consumes BRs can cause
       // tables to split if the start node of the selection is not in a table
       // cell or caption, for example parent is a <tr>.  Avoid this unnecessary
       // splitting if possible by leaving emptyDiv FALSE so that we fall
       // through to the normal case alignment code.
       //
       // XXX: It seems a little error prone for the emptyDiv special case code
       // to assume that the start node of the selection is the parent of the
@@ -4546,17 +4546,17 @@ nsHTMLEditRules::WillAlign(Selection& aS
     int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
 
     rv = SplitAsNeeded(*nsGkAtoms::div, parent, offset);
     NS_ENSURE_SUCCESS(rv, rv);
     // Consume a trailing br, if any.  This is to keep an alignment from
     // creating extra lines, if possible.
     nsCOMPtr<nsIContent> brContent =
       mHTMLEditor->GetNextHTMLNode(parent, offset);
-    if (brContent && nsTextEditUtils::IsBreak(brContent)) {
+    if (brContent && TextEditUtils::IsBreak(brContent)) {
       // Making use of html structure... if next node after where we are
       // putting our div is not a block, then the br we found is in same block
       // we are, so it's safe to consume it.
       nsCOMPtr<nsIContent> sibling = mHTMLEditor->GetNextHTMLSibling(parent,
                                                                      offset);
       if (sibling && !IsBlockNode(*sibling)) {
         rv = mHTMLEditor->DeleteNode(brContent);
         NS_ENSURE_SUCCESS(rv, rv);
@@ -6258,27 +6258,27 @@ nsHTMLEditRules::ReturnInParagraph(Selec
     NS_ENSURE_SUCCESS(res, res);
 
     // at beginning of text node?
     if (!aOffset) {
       // is there a BR prior to it?
       NS_ENSURE_STATE(mHTMLEditor);
       sibling = mHTMLEditor->GetPriorHTMLSibling(node);
       if (!sibling || !mHTMLEditor || !mHTMLEditor->IsVisBreak(sibling) ||
-          nsTextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
+          TextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
         NS_ENSURE_STATE(mHTMLEditor);
         newBRneeded = true;
       }
     } else if (aOffset == (int32_t)strLength) {
       // we're at the end of text node...
       // is there a BR after to it?
       NS_ENSURE_STATE(mHTMLEditor);
       sibling = mHTMLEditor->GetNextHTMLSibling(node);
       if (!sibling || !mHTMLEditor || !mHTMLEditor->IsVisBreak(sibling) ||
-          nsTextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
+          TextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
         NS_ENSURE_STATE(mHTMLEditor);
         newBRneeded = true;
         offset++;
       }
     } else {
       if (doesCRCreateNewP) {
         nsCOMPtr<nsIDOMNode> tmp;
         res = mEditor->SplitNode(aNode, aOffset, getter_AddRefs(tmp));
@@ -6292,23 +6292,23 @@ nsHTMLEditRules::ReturnInParagraph(Selec
   } else {
     // not in a text node.
     // is there a BR prior to it?
     nsCOMPtr<nsIContent> nearNode;
     NS_ENSURE_STATE(mHTMLEditor);
     nearNode = mHTMLEditor->GetPriorHTMLNode(node, aOffset);
     NS_ENSURE_STATE(mHTMLEditor);
     if (!nearNode || !mHTMLEditor->IsVisBreak(nearNode) ||
-        nsTextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
+        TextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
       // is there a BR after it?
       NS_ENSURE_STATE(mHTMLEditor);
       nearNode = mHTMLEditor->GetNextHTMLNode(node, aOffset);
       NS_ENSURE_STATE(mHTMLEditor);
       if (!nearNode || !mHTMLEditor->IsVisBreak(nearNode) ||
-          nsTextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
+          TextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
         newBRneeded = true;
         parent = node;
         offset = aOffset;
         newSelNode = true;
       }
     }
     if (!newBRneeded) {
       sibling = nearNode;
@@ -7329,18 +7329,17 @@ nsHTMLEditRules::AdjustSelection(Selecti
     mHTMLEditor->GetPriorHTMLNode(selNode, selOffset);
   if (nearNode)
   {
     // is nearNode also a descendant of same block?
     NS_ENSURE_STATE(mHTMLEditor);
     nsCOMPtr<Element> block = mHTMLEditor->GetBlock(*selNode);
     nsCOMPtr<Element> nearBlock = mHTMLEditor->GetBlockNodeParent(nearNode);
     if (block && block == nearBlock) {
-      if (nearNode && nsTextEditUtils::IsBreak(nearNode) )
-      {
+      if (nearNode && TextEditUtils::IsBreak(nearNode)) {
         NS_ENSURE_STATE(mHTMLEditor);
         if (!mHTMLEditor->IsVisBreak(nearNode))
         {
           // need to insert special moz BR. Why?  Because if we don't
           // the user will see no new line for the break.  Also, things
           // like table cells won't grow in height.
           nsCOMPtr<nsIDOMNode> brNode;
           res = CreateMozBR(GetAsDOMNode(selNode), selOffset,
@@ -7353,40 +7352,39 @@ nsHTMLEditRules::AdjustSelection(Selecti
           res = aSelection->Collapse(brParent, selOffset);
           NS_ENSURE_SUCCESS(res, res);
         }
         else
         {
           NS_ENSURE_STATE(mHTMLEditor);
           nsCOMPtr<nsIContent> nextNode =
             mHTMLEditor->GetNextHTMLNode(nearNode, true);
-          if (nextNode && nsTextEditUtils::IsMozBR(nextNode))
-          {
+          if (nextNode && TextEditUtils::IsMozBR(nextNode)) {
             // selection between br and mozbr.  make it stick to mozbr
             // so that it will be on blank line.
             aSelection->SetInterlinePosition(true);
           }
         }
       }
     }
   }
 
   // we aren't in a textnode: are we adjacent to text or a break or an image?
   NS_ENSURE_STATE(mHTMLEditor);
   nearNode = mHTMLEditor->GetPriorHTMLNode(selNode, selOffset, true);
-  if (nearNode && (nsTextEditUtils::IsBreak(nearNode) ||
+  if (nearNode && (TextEditUtils::IsBreak(nearNode) ||
                    nsEditor::IsTextNode(nearNode) ||
                    nsHTMLEditUtils::IsImage(nearNode) ||
                    nearNode->IsHTMLElement(nsGkAtoms::hr))) {
     // this is a good place for the caret to be
     return NS_OK;
   }
   NS_ENSURE_STATE(mHTMLEditor);
   nearNode = mHTMLEditor->GetNextHTMLNode(selNode, selOffset, true);
-  if (nearNode && (nsTextEditUtils::IsBreak(nearNode) ||
+  if (nearNode && (TextEditUtils::IsBreak(nearNode) ||
                    nsEditor::IsTextNode(nearNode) ||
                    nearNode->IsAnyOfHTMLElements(nsGkAtoms::img,
                                                  nsGkAtoms::hr))) {
     return NS_OK; // this is a good place for the caret to be
   }
 
   // look for a nearby text node.
   // prefer the correct direction.
@@ -7455,17 +7453,17 @@ nsHTMLEditRules::FindNearSelectableNode(
     }
     NS_ENSURE_SUCCESS(res, res);
   }
 
   // scan in the right direction until we find an eligible text node,
   // but don't cross any breaks, images, or table elements.
   NS_ENSURE_STATE(mHTMLEditor);
   while (nearNode && !(mHTMLEditor->IsTextNode(nearNode)
-                       || nsTextEditUtils::IsBreak(nearNode)
+                       || TextEditUtils::IsBreak(nearNode)
                        || nsHTMLEditUtils::IsImage(nearNode)))
   {
     curNode = nearNode;
     if (aDirection == nsIEditor::ePrevious) {
       NS_ENSURE_STATE(mHTMLEditor);
       res = mHTMLEditor->GetPriorHTMLNode(curNode, address_of(nearNode));
     } else {
       NS_ENSURE_STATE(mHTMLEditor);
@@ -7725,17 +7723,17 @@ nsHTMLEditRules::ListIsEmptyLine(nsTArra
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   int32_t brCount = 0;
 
   for (auto& node : aArrayOfNodes) {
     if (!mHTMLEditor->IsEditable(node)) {
       continue;
     }
-    if (nsTextEditUtils::IsBreak(node)) {
+    if (TextEditUtils::IsBreak(node)) {
       // First break doesn't count
       if (brCount) {
         return false;
       }
       brCount++;
     } else if (IsEmptyInline(node)) {
       // Empty inline, keep looking
     } else {
@@ -7863,18 +7861,17 @@ nsHTMLEditRules::ConfirmSelectionInBody(
                                                     &selOffset);
   if (NS_FAILED(res)) {
     return res;
   }
 
   temp = selNode;
 
   // check that selNode is inside body
-  while (temp && !nsTextEditUtils::IsBody(temp))
-  {
+  while (temp && !TextEditUtils::IsBody(temp)) {
     res = temp->GetParentNode(getter_AddRefs(parent));
     temp = parent;
   }
 
   // if we aren't in the body, force the issue
   if (!temp)
   {
 //    uncomment this to see when we get bad selections
@@ -7884,18 +7881,17 @@ nsHTMLEditRules::ConfirmSelectionInBody(
 
   // get the selection end location
   NS_ENSURE_STATE(mHTMLEditor);
   res = mHTMLEditor->GetEndNodeAndOffset(selection, getter_AddRefs(selNode), &selOffset);
   NS_ENSURE_SUCCESS(res, res);
   temp = selNode;
 
   // check that selNode is inside body
-  while (temp && !nsTextEditUtils::IsBody(temp))
-  {
+  while (temp && !TextEditUtils::IsBody(temp)) {
     res = temp->GetParentNode(getter_AddRefs(parent));
     temp = parent;
   }
 
   // if we aren't in the body, force the issue
   if (!temp)
   {
 //    uncomment this to see when we get bad selections
@@ -8317,22 +8313,19 @@ nsHTMLEditRules::MakeSureElemStartsOrEnd
     child = GetAsDOMNode(mHTMLEditor->GetLastEditableChild(*node));
   }
   NS_ENSURE_TRUE(child, NS_OK);
   bool isChildBlock;
   NS_ENSURE_STATE(mHTMLEditor);
   res = mHTMLEditor->NodeIsBlockStatic(child, &isChildBlock);
   NS_ENSURE_SUCCESS(res, res);
   bool foundCR = false;
-  if (isChildBlock || nsTextEditUtils::IsBreak(child))
-  {
+  if (isChildBlock || TextEditUtils::IsBreak(child)) {
     foundCR = true;
-  }
-  else
-  {
+  } else {
     nsCOMPtr<nsIDOMNode> sibling;
     if (aStarts)
     {
       NS_ENSURE_STATE(mHTMLEditor);
       res = mHTMLEditor->GetPriorHTMLSibling(aNode, address_of(sibling));
     }
     else
     {
@@ -8341,18 +8334,17 @@ nsHTMLEditRules::MakeSureElemStartsOrEnd
     }
     NS_ENSURE_SUCCESS(res, res);
     if (sibling)
     {
       bool isBlock;
       NS_ENSURE_STATE(mHTMLEditor);
       res = mHTMLEditor->NodeIsBlockStatic(sibling, &isBlock);
       NS_ENSURE_SUCCESS(res, res);
-      if (isBlock || nsTextEditUtils::IsBreak(sibling))
-      {
+      if (isBlock || TextEditUtils::IsBreak(sibling)) {
         foundCR = true;
       }
     }
     else
     {
       foundCR = true;
     }
   }
--- a/editor/libeditor/nsHTMLEditUtils.cpp
+++ b/editor/libeditor/nsHTMLEditUtils.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsHTMLEditUtils.h"
 
+#include "TextEditUtils.h"              // for TextEditUtils
 #include "mozilla/ArrayUtils.h"         // for ArrayLength
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/dom/Element.h"        // for Element, nsINode
 #include "nsAString.h"                  // for nsAString_internal::IsEmpty
 #include "nsCOMPtr.h"                   // for nsCOMPtr, operator==, etc
 #include "nsCaseTreatment.h"
 #include "nsDebug.h"                    // for NS_PRECONDITION, etc
 #include "nsEditor.h"                   // for nsEditor
@@ -17,17 +18,16 @@
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::a, etc
 #include "nsHTMLTags.h"
 #include "nsIAtom.h"                    // for nsIAtom
 #include "nsIDOMHTMLAnchorElement.h"    // for nsIDOMHTMLAnchorElement
 #include "nsIDOMNode.h"                 // for nsIDOMNode
 #include "nsNameSpaceManager.h"        // for kNameSpaceID_None
 #include "nsLiteralString.h"            // for NS_LITERAL_STRING
 #include "nsString.h"                   // for nsAutoString
-#include "nsTextEditUtils.h"            // for nsTextEditUtils
 
 using namespace mozilla;
 
 ///////////////////////////////////////////////////////////////////////////
 // IsInlineStyle true if node is an inline style
 //
 bool
 nsHTMLEditUtils::IsInlineStyle(nsIDOMNode* aNode)
@@ -400,26 +400,25 @@ nsHTMLEditUtils::IsDiv(nsIDOMNode* aNode
 
 
 ///////////////////////////////////////////////////////////////////////////
 // IsMozDiv: true if node an html div node with type = _moz
 //
 bool
 nsHTMLEditUtils::IsMozDiv(nsIDOMNode* aNode)
 {
-  if (IsDiv(aNode) && nsTextEditUtils::HasMozAttr(aNode)) return true;
-  return false;
+  return IsDiv(aNode) && TextEditUtils::HasMozAttr(aNode);
 }
 
 bool
 nsHTMLEditUtils::IsMozDiv(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::div) &&
-         nsTextEditUtils::HasMozAttr(GetAsDOMNode(aNode));
+         TextEditUtils::HasMozAttr(GetAsDOMNode(aNode));
 }
 
 
 ///////////////////////////////////////////////////////////////////////////
 // IsMailCite: true if node an html blockquote with type=cite
 //
 bool
 nsHTMLEditUtils::IsMailCite(nsIDOMNode* aNode)
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -8,18 +8,18 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/TextEvents.h"
 
 #include "nsCRT.h"
 
 #include "nsUnicharUtils.h"
 
+#include "TextEditUtils.h"
 #include "nsHTMLEditRules.h"
-#include "nsTextEditUtils.h"
 #include "nsHTMLEditUtils.h"
 
 #include "nsHTMLEditorEventListener.h"
 #include "TypeInState.h"
 
 #include "nsHTMLURIRefObject.h"
 
 #include "nsIDOMText.h"
@@ -951,26 +951,26 @@ nsHTMLEditor::IsPrevCharInNodeWhitespace
 
 /* ------------ End Block methods -------------- */
 
 
 bool
 nsHTMLEditor::IsVisBreak(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
-  if (!nsTextEditUtils::IsBreak(aNode)) {
+  if (!TextEditUtils::IsBreak(aNode)) {
     return false;
   }
   // Check if there is a later node in block after br
   nsCOMPtr<nsINode> priorNode = GetPriorHTMLNode(aNode, true);
-  if (priorNode && nsTextEditUtils::IsBreak(priorNode)) {
+  if (priorNode && TextEditUtils::IsBreak(priorNode)) {
     return true;
   }
   nsCOMPtr<nsINode> nextNode = GetNextHTMLNode(aNode, true);
-  if (nextNode && nsTextEditUtils::IsBreak(nextNode)) {
+  if (nextNode && TextEditUtils::IsBreak(nextNode)) {
     return true;
   }
 
   // If we are right before block boundary, then br not visible
   if (!nextNode) {
     // This break is trailer in block, it's not visible
     return false;
   }
@@ -4723,17 +4723,17 @@ nsHTMLEditor::CopyLastEditableChildStyle
   child = aPreviousBlock;
   tmp = aPreviousBlock;
   while (tmp) {
     child = tmp;
     nsCOMPtr<nsINode> child_ = do_QueryInterface(child);
     NS_ENSURE_STATE(child_ || !child);
     tmp = GetAsDOMNode(GetLastEditableChild(*child_));
   }
-  while (child && nsTextEditUtils::IsBreak(child)) {
+  while (child && TextEditUtils::IsBreak(child)) {
     nsCOMPtr<nsIDOMNode> priorNode;
     res = GetPriorHTMLNode(child, address_of(priorNode));
     NS_ENSURE_SUCCESS(res, res);
     child = priorNode;
   }
   nsCOMPtr<Element> newStyles, deepestStyle;
   nsCOMPtr<nsINode> childNode = do_QueryInterface(child);
   nsCOMPtr<Element> childElement;
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -1,13 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "EditorUtils.h"
+#include "TextEditUtils.h"
 #include "TypeInState.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
 #include "nsAttrName.h"
 #include "nsCOMPtr.h"
@@ -33,17 +34,16 @@
 #include "nsLiteralString.h"
 #include "nsRange.h"
 #include "nsReadableUtils.h"
 #include "nsSelectionState.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsTArray.h"
 #include "nsTextEditRules.h"
-#include "nsTextEditUtils.h"
 #include "nsUnicharUtils.h"
 #include "nscore.h"
 
 class nsISupports;
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -624,17 +624,17 @@ nsHTMLEditor::ClearStyle(nsCOMPtr<nsINod
   if (rightNode) {
     nsCOMPtr<nsINode> secondSplitParent = GetLeftmostChild(rightNode);
     // don't try to split non-containers (br's, images, hr's, etc)
     if (!secondSplitParent) {
       secondSplitParent = rightNode;
     }
     nsCOMPtr<Element> savedBR;
     if (!IsContainer(secondSplitParent)) {
-      if (nsTextEditUtils::IsBreak(secondSplitParent)) {
+      if (TextEditUtils::IsBreak(secondSplitParent)) {
         savedBR = do_QueryInterface(secondSplitParent);
         NS_ENSURE_STATE(savedBR);
       }
 
       secondSplitParent = secondSplitParent->GetParentNode();
     }
     *aOffset = 0;
     res = SplitStyleAbovePoint(address_of(secondSplitParent),
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsPlaintextEditor.h"
 
 #include "EditorUtils.h"  // AutoEditBatch, AutoRules
+#include "TextEditUtils.h"
 #include "gfxFontUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/TextComposition.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
@@ -49,17 +50,16 @@
 #include "nsInternetCiter.h"
 #include "nsLiteralString.h"
 #include "nsReadableUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsSubstringTuple.h"
 #include "nsTextEditRules.h"
-#include "nsTextEditUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsXPCOM.h"
 
 class nsIOutputStream;
 class nsISupports;
 class nsISupportsArray;
 
 using namespace mozilla;
@@ -1600,17 +1600,17 @@ nsPlaintextEditor::SelectEntireDocument(
   // Don't select the trailing BR node if we have one
   int32_t selOffset;
   nsCOMPtr<nsIDOMNode> selNode;
   rv = GetEndNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIDOMNode> childNode = GetChildAt(selNode, selOffset - 1);
 
-  if (childNode && nsTextEditUtils::IsMozBR(childNode)) {
+  if (childNode && TextEditUtils::IsMozBR(childNode)) {
     int32_t parentOffset;
     nsCOMPtr<nsIDOMNode> parentNode = GetNodeLocation(childNode, &parentOffset);
 
     return aSelection->Extend(parentNode, parentOffset);
   }
 
   return NS_OK;
 }
--- a/editor/libeditor/nsTextEditRules.cpp
+++ b/editor/libeditor/nsTextEditRules.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsTextEditRules.h"
 
 #include "EditorUtils.h"
+#include "TextEditUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/TextComposition.h"
 #include "mozilla/dom/Element.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"
@@ -32,17 +33,16 @@
 #include "nsIDOMNodeList.h"
 #include "nsIDOMText.h"
 #include "nsNameSpaceManager.h"
 #include "nsINode.h"
 #include "nsIPlaintextEditor.h"
 #include "nsISupportsBase.h"
 #include "nsLiteralString.h"
 #include "mozilla/dom/NodeIterator.h"
-#include "nsTextEditUtils.h"
 #include "nsUnicharUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #define CANCEL_OPERATION_IF_READONLY_OR_DISABLED \
   if (IsReadonly() || IsDisabled()) \
   {                     \
@@ -470,18 +470,17 @@ nsTextEditRules::CollapseSelectionToTrai
 
   NS_ENSURE_STATE(mEditor);
   nsCOMPtr<nsIDOMNode> root = do_QueryInterface(mEditor->GetRoot());
   NS_ENSURE_TRUE(root, NS_ERROR_NULL_POINTER);
   if (parentNode != root) return NS_OK;
 
   nsCOMPtr<nsIDOMNode> nextNode = mEditor->GetChildAt(parentNode,
                                                       parentOffset + 1);
-  if (nextNode && nsTextEditUtils::IsMozBR(nextNode))
-  {
+  if (nextNode && TextEditUtils::IsMozBR(nextNode)) {
     res = aSelection->Collapse(parentNode, parentOffset + 1);
     NS_ENSURE_SUCCESS(res, res);
   }
   return res;
 }
 
 static inline already_AddRefed<nsIDOMNode>
 GetTextNode(Selection* selection, nsEditor* editor) {
@@ -1102,17 +1101,17 @@ nsTextEditRules::RemoveRedundantTrailing
   }
 
   RefPtr<nsIContent> child = body->GetFirstChild();
   if (!child || !child->IsElement()) {
     return NS_OK;
   }
 
   dom::Element* elem = child->AsElement();
-  if (!nsTextEditUtils::IsMozBR(elem)) {
+  if (!TextEditUtils::IsMozBR(elem)) {
     return NS_OK;
   }
 
   // Rather than deleting this node from the DOM tree we should instead
   // morph this br into the bogus node
   elem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::type, true);
 
   // set mBogusNode to be this <br>
--- a/editor/libeditor/nsWSRunObject.cpp
+++ b/editor/libeditor/nsWSRunObject.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsWSRunObject.h"
 
 #include "EditorUtils.h"
+#include "TextEditUtils.h"
 
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Casting.h"
 #include "mozilla/mozalloc.h"
 
 #include "nsAString.h"
 #include "nsCRT.h"
@@ -20,17 +21,16 @@
 #include "nsHTMLEditor.h"
 #include "nsIContent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMNode.h"
 #include "nsISupportsImpl.h"
 #include "nsRange.h"
 #include "nsSelectionState.h"
 #include "nsString.h"
-#include "nsTextEditUtils.h"
 #include "nsTextFragment.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 const char16_t nbsp = 160;
 
 static bool IsBlockNode(nsINode* node)
@@ -711,17 +711,17 @@ nsWSRunObject::GetWSNodes()
             start.SetPoint(textNode, pos);
           }
         }
       } else {
         // it's a break or a special node, like <img>, that is not a block and not
         // a break but still serves as a terminator to ws runs.
         mStartNode = start.node;
         mStartOffset = start.offset;
-        if (nsTextEditUtils::IsBreak(priorNode)) {
+        if (TextEditUtils::IsBreak(priorNode)) {
           mStartReason = WSType::br;
         } else {
           mStartReason = WSType::special;
         }
         mStartReasonNode = priorNode;
       }
     } else {
       // no prior node means we exhausted wsBoundingParent
@@ -819,17 +819,17 @@ nsWSRunObject::GetWSNodes()
           }
         }
       } else {
         // we encountered a break or a special node, like <img>,
         // that is not a block and not a break but still
         // serves as a terminator to ws runs.
         mEndNode = end.node;
         mEndOffset = end.offset;
-        if (nsTextEditUtils::IsBreak(nextNode)) {
+        if (TextEditUtils::IsBreak(nextNode)) {
           mEndReason = WSType::br;
         } else {
           mEndReason = WSType::special;
         }
         mEndReasonNode = nextNode;
       }
     } else {
       // no next node means we exhausted wsBoundingParent