Bug 1260651 part.48 Rename nsHTMLEditRules to mozilla::HTMLEditRules (and also their file names) r=mccr8
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 07 Jul 2016 19:05:51 +0900
changeset 304343 9796a9cfbce6acc6bd9a01ff1454737d66d6c83b
parent 304342 c08d2a341ab9cbe385fd3b689c1687db3bfa438a
child 304344 157268e908256b59493e8074f0b277e54aa09c65
push id79299
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 08:01:22 +0000
treeherdermozilla-inbound@942dac383054 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1260651
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1260651 part.48 Rename nsHTMLEditRules to mozilla::HTMLEditRules (and also their file names) r=mccr8 This patch changes following classes/structs: nsHTMLEditRules -> mozilla::HTMLEditRules StyleCache -> mozilla::StyleCache nsTableCellAndListItemFunctor -> mozilla::TableCellAndListItemFunctor nsBRNodeFunctor -> mozilla::BRNodeFunctor nsEmptyEditableFunctor -> mozilla::EmptyEditableFunctor nsUniqueFunctor -> mozilla::UniqueFunctor MozReview-Commit-ID: KBjfFmnF5p1
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditRules.h
editor/libeditor/TypeInState.h
editor/libeditor/WSRunObject.cpp
editor/libeditor/WSRunObject.h
editor/libeditor/moz.build
editor/libeditor/nsEditor.cpp
editor/libeditor/nsHTMLAbsPosition.cpp
editor/libeditor/nsHTMLEditRules.cpp
editor/libeditor/nsHTMLEditRules.h
editor/libeditor/nsHTMLEditor.cpp
editor/libeditor/nsHTMLEditor.h
editor/libeditor/nsPlaintextEditor.h
rename from editor/libeditor/nsHTMLEditRules.cpp
rename to editor/libeditor/HTMLEditRules.cpp
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=79: */
 /* 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 "nsHTMLEditRules.h"
+#include "HTMLEditRules.h"
 
 #include <stdlib.h>
 
 #include "CSSEditUtils.h"
 #include "EditorUtils.h"
 #include "HTMLEditUtils.h"
 #include "TextEditUtils.h"
 #include "WSRunObject.h"
@@ -59,18 +59,19 @@
 // Workaround for windows headers
 #ifdef SetProp
 #undef SetProp
 #endif
 
 class nsISupports;
 class nsRulesInfo;
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+
+using namespace dom;
 
 //const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
 //const static char* kMOZEditorBogusNodeValue="TRUE";
 
 enum
 {
   kLonely = 0,
   kPrevSib = 1,
@@ -103,95 +104,79 @@ IsStyleCachePreservingAction(EditAction 
          action == EditAction::align ||
          action == EditAction::makeBasicBlock ||
          action == EditAction::removeList ||
          action == EditAction::makeDefListItem ||
          action == EditAction::insertElement ||
          action == EditAction::insertQuotation;
 }
 
-class nsTableCellAndListItemFunctor : public mozilla::BoolDomIterFunctor
+class TableCellAndListItemFunctor final : public BoolDomIterFunctor
 {
 public:
   // Used to build list of all li's, td's & th's iterator covers
   virtual bool operator()(nsINode* aNode) const
   {
     return HTMLEditUtils::IsTableCell(aNode) ||
            HTMLEditUtils::IsListItem(aNode);
   }
 };
 
-class nsBRNodeFunctor : public mozilla::BoolDomIterFunctor
-{
-  public:
-    virtual bool operator()(nsINode* aNode) const
-    {
-      if (aNode->IsHTMLElement(nsGkAtoms::br)) {
-        return true;
-      }
-      return false;
-    }
-};
-
-class nsEmptyEditableFunctor : public mozilla::BoolDomIterFunctor
+class BRNodeFunctor final : public BoolDomIterFunctor
 {
 public:
-  explicit nsEmptyEditableFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {}
+  virtual bool operator()(nsINode* aNode) const
+  {
+    return aNode->IsHTMLElement(nsGkAtoms::br);
+  }
+};
+
+class EmptyEditableFunctor final : public BoolDomIterFunctor
+{
+public:
+  explicit EmptyEditableFunctor(nsHTMLEditor* editor)
+    : mHTMLEditor(editor)
+  {}
+
   virtual bool operator()(nsINode* aNode) const
   {
     if (mHTMLEditor->IsEditable(aNode) &&
         (HTMLEditUtils::IsListItem(aNode) ||
          HTMLEditUtils::IsTableCellOrCaption(*aNode))) {
       bool bIsEmptyNode;
       nsresult res = mHTMLEditor->IsEmptyNode(aNode, &bIsEmptyNode, false, false);
       NS_ENSURE_SUCCESS(res, false);
       if (bIsEmptyNode)
         return true;
     }
     return false;
   }
+
 protected:
   nsHTMLEditor* mHTMLEditor;
 };
 
-class nsEditableTextFunctor : public mozilla::BoolDomIterFunctor
-{
-  public:
-    explicit nsEditableTextFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {}
-    virtual bool operator()(nsINode* aNode) const
-    {
-      if (nsEditor::IsTextNode(aNode) && mHTMLEditor->IsEditable(aNode))
-      {
-        return true;
-      }
-      return false;
-    }
-  protected:
-    nsHTMLEditor* mHTMLEditor;
-};
-
-
 /********************************************************
- *  Constructor/Destructor
+ * mozilla::HTMLEditRules
  ********************************************************/
 
-nsHTMLEditRules::nsHTMLEditRules()
+HTMLEditRules::HTMLEditRules()
   : mHTMLEditor(nullptr)
   , mListenerEnabled(false)
   , mReturnInEmptyLIKillsList(false)
   , mDidDeleteSelection(false)
   , mDidRangedDelete(false)
   , mRestoreContentEditableCount(false)
   , mJoinOffset(0)
 {
   InitFields();
 }
 
 void
-nsHTMLEditRules::InitFields()
+HTMLEditRules::InitFields()
 {
   mHTMLEditor = nullptr;
   mDocChangeRange = nullptr;
   mListenerEnabled = true;
   mReturnInEmptyLIKillsList = true;
   mDidDeleteSelection = false;
   mDidRangedDelete = false;
   mRestoreContentEditableCount = false;
@@ -216,55 +201,47 @@ nsHTMLEditRules::InitFields()
   mCachedStyles[13] = StyleCache(nsGkAtoms::cite, EmptyString(), EmptyString());
   mCachedStyles[14] = StyleCache(nsGkAtoms::abbr, EmptyString(), EmptyString());
   mCachedStyles[15] = StyleCache(nsGkAtoms::acronym, EmptyString(), EmptyString());
   mCachedStyles[16] = StyleCache(nsGkAtoms::backgroundColor, EmptyString(), EmptyString());
   mCachedStyles[17] = StyleCache(nsGkAtoms::sub, EmptyString(), EmptyString());
   mCachedStyles[18] = StyleCache(nsGkAtoms::sup, EmptyString(), EmptyString());
 }
 
-nsHTMLEditRules::~nsHTMLEditRules()
+HTMLEditRules::~HTMLEditRules()
 {
   // remove ourselves as a listener to edit actions
   // In some cases, we have already been removed by
   // ~nsHTMLEditor, in which case we will get a null pointer here
   // which we ignore.  But this allows us to add the ability to
   // switch rule sets on the fly if we want.
   if (mHTMLEditor)
     mHTMLEditor->RemoveEditActionListener(this);
 }
 
-/********************************************************
- *  XPCOM Cruft
- ********************************************************/
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLEditRules, nsTextEditRules)
-NS_IMPL_RELEASE_INHERITED(nsHTMLEditRules, nsTextEditRules)
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLEditRules)
-  NS_INTERFACE_TABLE_INHERITED(nsHTMLEditRules, nsIEditActionListener)
+NS_IMPL_ADDREF_INHERITED(HTMLEditRules, nsTextEditRules)
+NS_IMPL_RELEASE_INHERITED(HTMLEditRules, nsTextEditRules)
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLEditRules)
+  NS_INTERFACE_TABLE_INHERITED(HTMLEditRules, nsIEditActionListener)
 NS_INTERFACE_TABLE_TAIL_INHERITING(nsTextEditRules)
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED(nsHTMLEditRules, nsTextEditRules,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLEditRules, nsTextEditRules,
                                    mDocChangeRange, mUtilRange, mNewBlock,
                                    mRangeItem)
 
-/********************************************************
- *  Public methods
- ********************************************************/
-
 NS_IMETHODIMP
-nsHTMLEditRules::Init(nsPlaintextEditor *aEditor)
+HTMLEditRules::Init(nsPlaintextEditor* aTextEditor)
 {
   InitFields();
 
-  mHTMLEditor = static_cast<nsHTMLEditor*>(aEditor);
+  mHTMLEditor = static_cast<nsHTMLEditor*>(aTextEditor);
   nsresult res;
 
   // call through to base class Init
-  res = nsTextEditRules::Init(aEditor);
+  res = nsTextEditRules::Init(aTextEditor);
   NS_ENSURE_SUCCESS(res, res);
 
   // cache any prefs we care about
   static const char kPrefName[] =
     "editor.html.typing.returnInEmptyListItemClosesList";
   nsAdoptingCString returnInEmptyLIKillsList =
     Preferences::GetCString(kPrefName);
 
@@ -298,28 +275,28 @@ nsHTMLEditRules::Init(nsPlaintextEditor 
 
   // add ourselves as a listener to edit actions
   res = mHTMLEditor->AddEditActionListener(this);
 
   return res;
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::DetachEditor()
+HTMLEditRules::DetachEditor()
 {
   if (mHTMLEditor) {
     mHTMLEditor->RemoveEditActionListener(this);
   }
   mHTMLEditor = nullptr;
   return nsTextEditRules::DetachEditor();
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::BeforeEdit(EditAction action,
-                            nsIEditor::EDirection aDirection)
+HTMLEditRules::BeforeEdit(EditAction action,
+                          nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) {
     return NS_OK;
   }
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
@@ -390,18 +367,18 @@ nsHTMLEditRules::BeforeEdit(EditAction a
     // Let rules remember the top level action
     mTheAction = action;
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsHTMLEditRules::AfterEdit(EditAction action,
-                           nsIEditor::EDirection aDirection)
+HTMLEditRules::AfterEdit(EditAction action,
+                         nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) {
     return NS_OK;
   }
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
@@ -430,20 +407,19 @@ nsHTMLEditRules::AfterEdit(EditAction ac
     }
   }
 
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-
 nsresult
-nsHTMLEditRules::AfterEditInner(EditAction action,
-                                nsIEditor::EDirection aDirection)
+HTMLEditRules::AfterEditInner(EditAction action,
+                              nsIEditor::EDirection aDirection)
 {
   ConfirmSelectionInBody();
   if (action == EditAction::ignore) return NS_OK;
 
   NS_ENSURE_STATE(mHTMLEditor);
   RefPtr<Selection> selection = mHTMLEditor->GetSelection();
   NS_ENSURE_STATE(selection);
 
@@ -575,22 +551,21 @@ nsHTMLEditRules::AfterEditInner(EditActi
   if (!mDidExplicitlySetInterline)
   {
     CheckInterlinePosition(*selection);
   }
 
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillDoAction(Selection* aSelection,
-                              nsRulesInfo* aInfo,
-                              bool* aCancel,
-                              bool* aHandled)
+HTMLEditRules::WillDoAction(Selection* aSelection,
+                            nsRulesInfo* aInfo,
+                            bool* aCancel,
+                            bool* aHandled)
 {
   MOZ_ASSERT(aInfo && aCancel && aHandled);
 
   *aCancel = false;
   *aHandled = false;
 
   // my kingdom for dynamic cast
   nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
@@ -677,20 +652,20 @@ nsHTMLEditRules::WillDoAction(Selection*
     case EditAction::increaseZIndex:
       return WillRelativeChangeZIndex(aSelection, 1, aCancel, aHandled);
     default:
       return nsTextEditRules::WillDoAction(aSelection, aInfo,
                                            aCancel, aHandled);
   }
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidDoAction(Selection* aSelection, nsRulesInfo* aInfo,
-                             nsresult aResult)
+HTMLEditRules::DidDoAction(Selection* aSelection,
+                           nsRulesInfo* aInfo,
+                           nsresult aResult)
 {
   nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
   switch (info->action)
   {
     case EditAction::insertBreak:
       return DidInsertBreak(aSelection, aResult);
     case EditAction::deleteSelection:
       return DidDeleteSelection(aSelection, info->collapsedAction, aResult);
@@ -706,17 +681,20 @@ nsHTMLEditRules::DidDoAction(Selection* 
     }
     default:
       // pass thru to nsTextEditRules
       return nsTextEditRules::DidDoAction(aSelection, aInfo, aResult);
   }
 }
 
 nsresult
-nsHTMLEditRules::GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL)
+HTMLEditRules::GetListState(bool* aMixed,
+                            bool* aOL,
+                            bool* aUL,
+                            bool* aDL)
 {
   NS_ENSURE_TRUE(aMixed && aOL && aUL && aDL, NS_ERROR_NULL_POINTER);
   *aMixed = false;
   *aOL = false;
   *aUL = false;
   *aDL = false;
   bool bNonList = false;
 
@@ -754,17 +732,20 @@ nsHTMLEditRules::GetListState(bool *aMix
   if ((*aUL + *aOL + *aDL + bNonList) > 1) {
     *aMixed = true;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD)
+HTMLEditRules::GetListItemState(bool* aMixed,
+                                bool* aLI,
+                                bool* aDT,
+                                bool* aDD)
 {
   NS_ENSURE_TRUE(aMixed && aLI && aDT && aDD, NS_ERROR_NULL_POINTER);
   *aMixed = false;
   *aLI = false;
   *aDT = false;
   *aDD = false;
   bool bNonList = false;
 
@@ -798,17 +779,18 @@ nsHTMLEditRules::GetListItemState(bool *
 
   // hokey arithmetic with booleans
   if ( (*aDT + *aDD + bNonList) > 1) *aMixed = true;
 
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::GetAlignment(bool* aMixed, nsIHTMLEditor::EAlignment* aAlign)
+HTMLEditRules::GetAlignment(bool* aMixed,
+                            nsIHTMLEditor::EAlignment* aAlign)
 {
   MOZ_ASSERT(aMixed && aAlign);
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // For now, just return first alignment.  We'll lie about if it's mixed.
   // This is for efficiency given that our current ui doesn't care if it's
@@ -934,17 +916,18 @@ static nsIAtom& MarginPropertyAtomForInd
 {
   nsAutoString direction;
   aHTMLCSSUtils.GetComputedProperty(aNode, *nsGkAtoms::direction, direction);
   return direction.EqualsLiteral("rtl") ?
     *nsGkAtoms::marginRight : *nsGkAtoms::marginLeft;
 }
 
 nsresult
-nsHTMLEditRules::GetIndentState(bool *aCanIndent, bool *aCanOutdent)
+HTMLEditRules::GetIndentState(bool* aCanIndent,
+                              bool* aCanOutdent)
 {
   NS_ENSURE_TRUE(aCanIndent && aCanOutdent, NS_ERROR_FAILURE);
   *aCanIndent = true;
   *aCanOutdent = false;
 
   // get selection
   NS_ENSURE_STATE(mHTMLEditor && mHTMLEditor->GetSelection());
   OwningNonNull<Selection> selection = *mHTMLEditor->GetSelection();
@@ -1031,17 +1014,18 @@ nsHTMLEditRules::GetIndentState(bool *aC
       tmp->GetParentNode(getter_AddRefs(parent));
     }
   }
   return res;
 }
 
 
 nsresult
-nsHTMLEditRules::GetParagraphState(bool *aMixed, nsAString &outFormat)
+HTMLEditRules::GetParagraphState(bool* aMixed,
+                                 nsAString& outFormat)
 {
   // This routine is *heavily* tied to our ui choices in the paragraph
   // style popup.  I can't see a way around that.
   NS_ENSURE_TRUE(aMixed, NS_ERROR_NULL_POINTER);
   *aMixed = true;
   outFormat.Truncate(0);
 
   bool bMixed = false;
@@ -1130,18 +1114,18 @@ nsHTMLEditRules::GetParagraphState(bool 
   }
 
   *aMixed = bMixed;
   outFormat = formatStr;
   return res;
 }
 
 nsresult
-nsHTMLEditRules::AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
-                                        nsINode* aNode)
+HTMLEditRules::AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
+                                      nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
 
   // we only need to place any one inline inside this node onto
   // the list.  They are all the same for purposes of determining
   // paragraph style.  We use foundInline to track this as we are
   // going through the children in the loop below.
   bool foundInline = false;
@@ -1160,36 +1144,34 @@ nsHTMLEditRules::AppendInnerFormatNodes(
       foundInline = true;
       aArray.AppendElement(*child);
     }
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::GetFormatString(nsIDOMNode *aNode, nsAString &outFormat)
+HTMLEditRules::GetFormatString(nsIDOMNode* aNode,
+                               nsAString& outFormat)
 {
   NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
 
   if (HTMLEditUtils::IsFormatNode(aNode)) {
     nsCOMPtr<nsIAtom> atom = nsEditor::GetTag(aNode);
     atom->ToString(outFormat);
   }
   else
     outFormat.Truncate();
 
   return NS_OK;
 }
 
-/********************************************************
- *  Protected rules methods
- ********************************************************/
-
 void
-nsHTMLEditRules::WillInsert(Selection& aSelection, bool* aCancel)
+HTMLEditRules::WillInsert(Selection& aSelection,
+                          bool* aCancel)
 {
   MOZ_ASSERT(aCancel);
 
   nsTextEditRules::WillInsert(aSelection, aCancel);
 
   NS_ENSURE_TRUE_VOID(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
@@ -1236,23 +1218,23 @@ nsHTMLEditRules::WillInsert(Selection& a
   // For most actions we want to clear the cached styles, but there are
   // exceptions
   if (!IsStyleCachePreservingAction(mTheAction)) {
     ClearCachedStyles();
   }
 }
 
 nsresult
-nsHTMLEditRules::WillInsertText(EditAction aAction,
-                                Selection*       aSelection,
-                                bool            *aCancel,
-                                bool            *aHandled,
-                                const nsAString *inString,
-                                nsAString       *outString,
-                                int32_t          aMaxLength)
+HTMLEditRules::WillInsertText(EditAction aAction,
+                              Selection* aSelection,
+                              bool* aCancel,
+                              bool* aHandled,
+                              const nsAString* inString,
+                              nsAString* outString,
+                              int32_t aMaxLength)
 {
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
 
   if (inString->IsEmpty() && aAction != EditAction::insertIMEText) {
     // HACK: this is a fix for bug 19395
     // I can't outlaw all empty insertions
     // because IME transaction depend on them
     // There is more work to do to make the
@@ -1466,17 +1448,18 @@ nsHTMLEditRules::WillInsertText(EditActi
     else
       res = mDocChangeRange->SetEnd(selNode, selOffset);
     NS_ENSURE_SUCCESS(res, res);
   }
   return res;
 }
 
 nsresult
-nsHTMLEditRules::WillLoadHTML(Selection* aSelection, bool* aCancel)
+HTMLEditRules::WillLoadHTML(Selection* aSelection,
+                            bool* aCancel)
 {
   NS_ENSURE_TRUE(aSelection && aCancel, NS_ERROR_NULL_POINTER);
 
   *aCancel = false;
 
   // Delete mBogusNode if it exists. If we really need one,
   // it will be added during post-processing in AfterEditInner().
 
@@ -1485,18 +1468,19 @@ nsHTMLEditRules::WillLoadHTML(Selection*
     mEditor->DeleteNode(mBogusNode);
     mBogusNode = nullptr;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::WillInsertBreak(Selection& aSelection, bool* aCancel,
-                                 bool* aHandled)
+HTMLEditRules::WillInsertBreak(Selection& aSelection,
+                               bool* aCancel,
+                               bool* aHandled)
 {
   MOZ_ASSERT(aCancel && aHandled);
   *aCancel = false;
   *aHandled = false;
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
@@ -1583,18 +1567,19 @@ nsHTMLEditRules::WillInsertBreak(Selecti
   if (!(*aHandled)) {
     *aHandled = true;
     return StandardBreakImpl(node, offset, aSelection);
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::StandardBreakImpl(nsINode& aNode, int32_t aOffset,
-                                   Selection& aSelection)
+HTMLEditRules::StandardBreakImpl(nsINode& aNode,
+                                 int32_t aOffset,
+                                 Selection& aSelection)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   nsCOMPtr<Element> brNode;
   bool bAfterBlock = false;
   bool bBeforeBlock = false;
   nsCOMPtr<nsINode> node = &aNode;
@@ -1679,24 +1664,25 @@ nsHTMLEditRules::StandardBreakImpl(nsINo
     }
     res = aSelection.Collapse(node, offset + 1);
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::DidInsertBreak(Selection* aSelection, nsresult aResult)
+HTMLEditRules::DidInsertBreak(Selection* aSelection,
+                              nsresult aResult)
 {
   return NS_OK;
 }
 
-
 nsresult
-nsHTMLEditRules::SplitMailCites(Selection* aSelection, bool* aHandled)
+HTMLEditRules::SplitMailCites(Selection* aSelection,
+                              bool* aHandled)
 {
   NS_ENSURE_TRUE(aSelection && aHandled, NS_ERROR_NULL_POINTER);
   nsCOMPtr<nsIContent> leftCite, rightCite;
   nsCOMPtr<nsINode> selNode;
   nsCOMPtr<Element> citeNode;
   int32_t selOffset;
   NS_ENSURE_STATE(mHTMLEditor);
   nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
@@ -1794,21 +1780,21 @@ nsHTMLEditRules::SplitMailCites(Selectio
     }
     *aHandled = true;
   }
   return NS_OK;
 }
 
 
 nsresult
-nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
-                                     nsIEditor::EDirection aAction,
-                                     nsIEditor::EStripWrappers aStripWrappers,
-                                     bool* aCancel,
-                                     bool* aHandled)
+HTMLEditRules::WillDeleteSelection(Selection* aSelection,
+                                   nsIEditor::EDirection aAction,
+                                   nsIEditor::EStripWrappers aStripWrappers,
+                                   bool* aCancel,
+                                   bool* aHandled)
 {
   MOZ_ASSERT(aStripWrappers == nsIEditor::eStrip ||
              aStripWrappers == nsIEditor::eNoStrip);
 
   if (!aSelection || !aCancel || !aHandled) {
     return NS_ERROR_NULL_POINTER;
   }
   // Initialize out params
@@ -2449,37 +2435,39 @@ nsHTMLEditRules::WillDeleteSelection(Sel
  * If aNode is a text node that contains only collapsed whitespace, delete it.
  * It doesn't serve any useful purpose, and we don't want it to confuse code
  * that doesn't correctly skip over it.
  *
  * If deleting the node fails (like if it's not editable), the caller should
  * proceed as usual, so don't return any errors.
  */
 void
-nsHTMLEditRules::DeleteNodeIfCollapsedText(nsINode& aNode)
+HTMLEditRules::DeleteNodeIfCollapsedText(nsINode& aNode)
 {
   if (!aNode.GetAsText()) {
     return;
   }
   bool empty;
   nsresult res = mHTMLEditor->IsVisTextNode(aNode.AsContent(), &empty, false);
   NS_ENSURE_SUCCESS_VOID(res);
   if (empty) {
     mHTMLEditor->DeleteNode(&aNode);
   }
 }
 
 
-/*****************************************************************************************************
-*    InsertBRIfNeeded: determines if a br is needed for current selection to not be spastic.
-*    If so, it inserts one.  Callers responsibility to only call with collapsed selection.
-*         Selection* aSelection      the collapsed selection
-*/
+/**
+ * InsertBRIfNeeded() determines if a br is needed for current selection to not
+ * be spastic.  If so, it inserts one.  Callers responsibility to only call
+ * with collapsed selection.
+ *
+ * @param aSelection        The collapsed selection.
+ */
 nsresult
-nsHTMLEditRules::InsertBRIfNeeded(Selection* aSelection)
+HTMLEditRules::InsertBRIfNeeded(Selection* aSelection)
 {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
 
   // get selection
   nsCOMPtr<nsINode> node;
   int32_t offset;
   nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
   NS_ENSURE_SUCCESS(res, res);
@@ -2505,25 +2493,26 @@ nsHTMLEditRules::InsertBRIfNeeded(Select
         mHTMLEditor->CreateBR(node, offset, nsIEditor::ePrevious);
       return br ? NS_OK : NS_ERROR_FAILURE;
     }
   }
   return NS_OK;
 }
 
 /**
- *  GetGoodSelPointForNode: Finds where at a node you would want to set the
- *  selection if you were trying to have a caret next to it.
- *       nsINode& aNode                   the node
- *       nsIEditor::EDirection aAction    which edge to find: eNext indicates
- *                                        beginning, ePrevious ending
+ * GetGoodSelPointForNode() finds where at a node you would want to set the
+ * selection if you were trying to have a caret next to it.
+ *
+ * @param aNode         The node
+ * @param aAction       Which edge to find: eNext indicates beginning,
+ *                      ePrevious ending.
  */
 EditorDOMPoint
-nsHTMLEditRules::GetGoodSelPointForNode(nsINode& aNode,
-                                        nsIEditor::EDirection aAction)
+HTMLEditRules::GetGoodSelPointForNode(nsINode& aNode,
+                                      nsIEditor::EDirection aAction)
 {
   NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
   if (aNode.GetAsText() || mHTMLEditor->IsContainer(&aNode)) {
     return EditorDOMPoint(&aNode,
                           aAction == nsIEditor::ePrevious ? aNode.Length() : 0);
   }
 
   EditorDOMPoint ret;
@@ -2543,18 +2532,19 @@ nsHTMLEditRules::GetGoodSelPointForNode(
  * This method is used to join two block elements.  The right element is always
  * joined to the left element.  If the elements are the same type and not
  * nested within each other, JoinNodesSmart is called (example, joining two
  * list items together into one).  If the elements are not the same type, or
  * one is a descendant of the other, we instead destroy the right block placing
  * its children into leftblock.  DTD containment rules are followed throughout.
  */
 nsresult
-nsHTMLEditRules::JoinBlocks(nsIContent& aLeftNode, nsIContent& aRightNode,
-                            bool* aCanceled)
+HTMLEditRules::JoinBlocks(nsIContent& aLeftNode,
+                          nsIContent& aRightNode,
+                          bool* aCanceled)
 {
   MOZ_ASSERT(aCanceled);
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   nsCOMPtr<Element> leftBlock = mHTMLEditor->GetBlock(aLeftNode);
   nsCOMPtr<Element> rightBlock = mHTMLEditor->GetBlock(aRightNode);
@@ -2796,18 +2786,20 @@ nsHTMLEditRules::JoinBlocks(nsIContent& 
 
 /**
  * Moves the content from aRightBlock starting from aRightOffset into
  * aLeftBlock at aLeftOffset. Note that the "block" might merely be inline
  * nodes between <br>s, or between blocks, etc.  DTD containment rules are
  * followed throughout.
  */
 nsresult
-nsHTMLEditRules::MoveBlock(Element& aLeftBlock, Element& aRightBlock,
-                           int32_t aLeftOffset, int32_t aRightOffset)
+HTMLEditRules::MoveBlock(Element& aLeftBlock,
+                         Element& aRightBlock,
+                         int32_t aLeftOffset,
+                         int32_t aRightOffset)
 {
   nsTArray<OwningNonNull<nsINode>> arrayOfNodes;
   // GetNodesFromPoint is the workhorse that figures out what we wnat to move.
   nsresult res = GetNodesFromPoint(EditorDOMPoint(&aRightBlock, aRightOffset),
                                    EditAction::makeList, arrayOfNodes,
                                    TouchContent::yes);
   NS_ENSURE_SUCCESS(res, res);
   for (uint32_t i = 0; i < arrayOfNodes.Length(); i++) {
@@ -2832,18 +2824,19 @@ nsHTMLEditRules::MoveBlock(Element& aLef
 }
 
 /**
  * This method is used to move node aNode to (aDestElement, aInOutDestOffset).
  * DTD containment rules are followed throughout.  aInOutDestOffset is updated
  * to point _after_ inserted content.
  */
 nsresult
-nsHTMLEditRules::MoveNodeSmart(nsIContent& aNode, Element& aDestElement,
-                               int32_t* aInOutDestOffset)
+HTMLEditRules::MoveNodeSmart(nsIContent& aNode,
+                             Element& aDestElement,
+                             int32_t* aInOutDestOffset)
 {
   MOZ_ASSERT(aInOutDestOffset);
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
   nsresult res;
 
   // Check if this node can go into the destination node
@@ -2868,52 +2861,53 @@ nsHTMLEditRules::MoveNodeSmart(nsIConten
 }
 
 /**
  * Moves the _contents_ of aElement to (aDestElement, aInOutDestOffset).  DTD
  * containment rules are followed throughout.  aInOutDestOffset is updated to
  * point _after_ inserted content.
  */
 nsresult
-nsHTMLEditRules::MoveContents(Element& aElement, Element& aDestElement,
-                              int32_t* aInOutDestOffset)
+HTMLEditRules::MoveContents(Element& aElement,
+                            Element& aDestElement,
+                            int32_t* aInOutDestOffset)
 {
   MOZ_ASSERT(aInOutDestOffset);
 
   NS_ENSURE_TRUE(&aElement != &aDestElement, NS_ERROR_ILLEGAL_VALUE);
 
   while (aElement.GetFirstChild()) {
     nsresult res = MoveNodeSmart(*aElement.GetFirstChild(), aDestElement,
                                  aInOutDestOffset);
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
 
 nsresult
-nsHTMLEditRules::DeleteNonTableElements(nsINode* aNode)
+HTMLEditRules::DeleteNonTableElements(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   if (!HTMLEditUtils::IsTableElementButNotTable(aNode)) {
     NS_ENSURE_STATE(mHTMLEditor);
     return mHTMLEditor->DeleteNode(aNode->AsDOMNode());
   }
 
   for (int32_t i = aNode->GetChildCount() - 1; i >= 0; --i) {
     nsresult rv = DeleteNonTableElements(aNode->GetChildAt(i));
     NS_ENSURE_SUCCESS(rv, rv);
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::DidDeleteSelection(Selection* aSelection,
-                                    nsIEditor::EDirection aDir,
-                                    nsresult aResult)
+HTMLEditRules::DidDeleteSelection(Selection* aSelection,
+                                  nsIEditor::EDirection aDir,
+                                  nsresult aResult)
 {
   if (!aSelection) { return NS_ERROR_NULL_POINTER; }
 
   // find where we are
   nsCOMPtr<nsINode> startNode;
   int32_t startOffset;
   nsresult res = mEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode), &startOffset);
   NS_ENSURE_SUCCESS(res, res);
@@ -2943,23 +2937,23 @@ nsHTMLEditRules::DidDeleteSelection(Sele
     }
   }
 
   // call through to base class
   return nsTextEditRules::DidDeleteSelection(aSelection, aDir, aResult);
 }
 
 nsresult
-nsHTMLEditRules::WillMakeList(Selection* aSelection,
-                              const nsAString* aListType,
-                              bool aEntireList,
-                              const nsAString* aBulletType,
-                              bool* aCancel,
-                              bool* aHandled,
-                              const nsAString* aItemType)
+HTMLEditRules::WillMakeList(Selection* aSelection,
+                            const nsAString* aListType,
+                            bool aEntireList,
+                            const nsAString* aBulletType,
+                            bool* aCancel,
+                            bool* aHandled,
+                            const nsAString* aItemType)
 {
   if (!aSelection || !aListType || !aCancel || !aHandled) {
     return NS_ERROR_NULL_POINTER;
   }
   OwningNonNull<nsIAtom> listType = NS_Atomize(*aListType);
 
   WillInsert(*aSelection, aCancel);
 
@@ -3251,20 +3245,20 @@ nsHTMLEditRules::WillMakeList(Selection*
     }
   }
 
   return res;
 }
 
 
 nsresult
-nsHTMLEditRules::WillRemoveList(Selection* aSelection,
-                                bool aOrdered,
-                                bool *aCancel,
-                                bool *aHandled)
+HTMLEditRules::WillRemoveList(Selection* aSelection,
+                              bool aOrdered,
+                              bool* aCancel,
+                              bool* aHandled)
 {
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
   // initialize out param
   *aCancel = false;
   *aHandled = true;
 
   nsresult res = NormalizeSelection(aSelection);
   NS_ENSURE_SUCCESS(res, res);
@@ -3312,32 +3306,32 @@ nsHTMLEditRules::WillRemoveList(Selectio
       NS_ENSURE_SUCCESS(res, res);
     }
   }
   return res;
 }
 
 
 nsresult
-nsHTMLEditRules::WillMakeDefListItem(Selection* aSelection,
-                                     const nsAString *aItemType,
-                                     bool aEntireList,
-                                     bool *aCancel,
-                                     bool *aHandled)
+HTMLEditRules::WillMakeDefListItem(Selection* aSelection,
+                                   const nsAString *aItemType,
+                                   bool aEntireList,
+                                   bool* aCancel,
+                                   bool* aHandled)
 {
   // for now we let WillMakeList handle this
   NS_NAMED_LITERAL_STRING(listType, "dl");
   return WillMakeList(aSelection, &listType, aEntireList, nullptr, aCancel, aHandled, aItemType);
 }
 
 nsresult
-nsHTMLEditRules::WillMakeBasicBlock(Selection& aSelection,
-                                    const nsAString& aBlockType,
-                                    bool* aCancel,
-                                    bool* aHandled)
+HTMLEditRules::WillMakeBasicBlock(Selection& aSelection,
+                                  const nsAString& aBlockType,
+                                  bool* aCancel,
+                                  bool* aHandled)
 {
   MOZ_ASSERT(aCancel && aHandled);
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   OwningNonNull<nsIAtom> blockType = NS_Atomize(aBlockType);
 
@@ -3452,51 +3446,54 @@ nsHTMLEditRules::WillMakeBasicBlock(Sele
   } else {
     res = ApplyBlockStyle(arrayOfNodes, blockType);
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::DidMakeBasicBlock(Selection* aSelection,
-                                   nsRulesInfo *aInfo, nsresult aResult)
+HTMLEditRules::DidMakeBasicBlock(Selection* aSelection,
+                                 nsRulesInfo* aInfo,
+                                 nsresult aResult)
 {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
   // check for empty block.  if so, put a moz br in it.
   if (!aSelection->Collapsed()) {
     return NS_OK;
   }
 
   NS_ENSURE_STATE(aSelection->GetRangeAt(0) &&
                   aSelection->GetRangeAt(0)->GetStartParent());
   nsresult res =
     InsertMozBRIfNeeded(*aSelection->GetRangeAt(0)->GetStartParent());
   NS_ENSURE_SUCCESS(res, res);
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::WillIndent(Selection* aSelection,
-                            bool* aCancel, bool* aHandled)
+HTMLEditRules::WillIndent(Selection* aSelection,
+                          bool* aCancel,
+                          bool* aHandled)
 {
   nsresult res;
   NS_ENSURE_STATE(mHTMLEditor);
   if (mHTMLEditor->IsCSSEnabled()) {
     res = WillCSSIndent(aSelection, aCancel, aHandled);
   }
   else {
     res = WillHTMLIndent(aSelection, aCancel, aHandled);
   }
   return res;
 }
 
 nsresult
-nsHTMLEditRules::WillCSSIndent(Selection* aSelection,
-                               bool* aCancel, bool* aHandled)
+HTMLEditRules::WillCSSIndent(Selection* aSelection,
+                             bool* aCancel,
+                             bool* aHandled)
 {
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
 
   WillInsert(*aSelection, aCancel);
 
   // initialize out param
   // we want to ignore result of WillInsert()
   *aCancel = false;
@@ -3688,18 +3685,19 @@ nsHTMLEditRules::WillCSSIndent(Selection
         NS_ENSURE_SUCCESS(res, res);
       }
     }
   }
   return res;
 }
 
 nsresult
-nsHTMLEditRules::WillHTMLIndent(Selection* aSelection,
-                                bool* aCancel, bool* aHandled)
+HTMLEditRules::WillHTMLIndent(Selection* aSelection,
+                              bool* aCancel,
+                              bool* aHandled)
 {
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
   WillInsert(*aSelection, aCancel);
 
   // initialize out param
   // we want to ignore result of WillInsert()
   *aCancel = false;
   *aHandled = true;
@@ -3919,18 +3917,19 @@ nsHTMLEditRules::WillHTMLIndent(Selectio
       }
     }
   }
   return res;
 }
 
 
 nsresult
-nsHTMLEditRules::WillOutdent(Selection& aSelection,
-                             bool* aCancel, bool* aHandled)
+HTMLEditRules::WillOutdent(Selection& aSelection,
+                           bool* aCancel,
+                           bool* aHandled)
 {
   MOZ_ASSERT(aCancel && aHandled);
   *aCancel = false;
   *aHandled = true;
   nsCOMPtr<nsIContent> rememberedLeftBQ, rememberedRightBQ;
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
   bool useCSS = mHTMLEditor->IsCSSEnabled();
@@ -4177,41 +4176,42 @@ nsHTMLEditRules::WillOutdent(Selection& 
       }
     }
     return NS_OK;
   }
   return NS_OK;
 }
 
 
-///////////////////////////////////////////////////////////////////////////////
-// RemovePartOfBlock: Split aBlock and move aStartChild to aEndChild out of
-//                    aBlock.
+/**
+ * RemovePartOfBlock() splits aBlock and move aStartChild to aEndChild out of
+ * aBlock.
+ */
 nsresult
-nsHTMLEditRules::RemovePartOfBlock(Element& aBlock,
-                                   nsIContent& aStartChild,
-                                   nsIContent& aEndChild)
+HTMLEditRules::RemovePartOfBlock(Element& aBlock,
+                                 nsIContent& aStartChild,
+                                 nsIContent& aEndChild)
 {
   SplitBlock(aBlock, aStartChild, aEndChild);
   // Get rid of part of blockquote we are outdenting
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsresult res = mHTMLEditor->RemoveBlockContainer(aBlock);
   NS_ENSURE_SUCCESS(res, res);
 
   return NS_OK;
 }
 
 void
-nsHTMLEditRules::SplitBlock(Element& aBlock,
-                            nsIContent& aStartChild,
-                            nsIContent& aEndChild,
-                            nsIContent** aOutLeftNode,
-                            nsIContent** aOutRightNode,
-                            nsIContent** aOutMiddleNode)
+HTMLEditRules::SplitBlock(Element& aBlock,
+                          nsIContent& aStartChild,
+                          nsIContent& aEndChild,
+                          nsIContent** aOutLeftNode,
+                          nsIContent** aOutRightNode,
+                          nsIContent** aOutMiddleNode)
 {
   // aStartChild and aEndChild must be exclusive descendants of aBlock
   MOZ_ASSERT(EditorUtils::IsDescendantOf(&aStartChild, &aBlock) &&
              EditorUtils::IsDescendantOf(&aEndChild, &aBlock));
   NS_ENSURE_TRUE_VOID(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // Get split point location
@@ -4240,22 +4240,22 @@ nsHTMLEditRules::SplitBlock(Element& aBl
       newMiddleNode2.forget(aOutMiddleNode);
     } else {
       newMiddleNode1.forget(aOutMiddleNode);
     }
   }
 }
 
 nsresult
-nsHTMLEditRules::OutdentPartOfBlock(Element& aBlock,
-                                    nsIContent& aStartChild,
-                                    nsIContent& aEndChild,
-                                    bool aIsBlockIndentedWithCSS,
-                                    nsIContent** aOutLeftNode,
-                                    nsIContent** aOutRightNode)
+HTMLEditRules::OutdentPartOfBlock(Element& aBlock,
+                                  nsIContent& aStartChild,
+                                  nsIContent& aEndChild,
+                                  bool aIsBlockIndentedWithCSS,
+                                  nsIContent** aOutLeftNode,
+                                  nsIContent** aOutRightNode)
 {
   MOZ_ASSERT(aOutLeftNode && aOutRightNode);
 
   nsCOMPtr<nsIContent> middleNode;
   SplitBlock(aBlock, aStartChild, aEndChild, aOutLeftNode, aOutRightNode,
              getter_AddRefs(middleNode));
 
   NS_ENSURE_STATE(middleNode);
@@ -4269,25 +4269,24 @@ nsHTMLEditRules::OutdentPartOfBlock(Elem
     // We do nothing if middleNode isn't an element
     nsresult res = ChangeIndentation(*middleNode->AsElement(), Change::minus);
     NS_ENSURE_SUCCESS(res, res);
   }
 
   return NS_OK;
 }
 
-///////////////////////////////////////////////////////////////////////////
-// ConvertListType:  convert list type and list item type.
-//
-//
+/**
+ * ConvertListType() converts list type and list item type.
+ */
 nsresult
-nsHTMLEditRules::ConvertListType(Element* aList,
-                                 Element** aOutList,
-                                 nsIAtom* aListType,
-                                 nsIAtom* aItemType)
+HTMLEditRules::ConvertListType(Element* aList,
+                               Element** aOutList,
+                               nsIAtom* aListType,
+                               nsIAtom* aItemType)
 {
   MOZ_ASSERT(aList);
   MOZ_ASSERT(aOutList);
   MOZ_ASSERT(aListType);
   MOZ_ASSERT(aItemType);
 
   nsCOMPtr<nsINode> child = aList->GetFirstChild();
   while (child)
@@ -4318,24 +4317,23 @@ nsHTMLEditRules::ConvertListType(Element
 
   *aOutList = mHTMLEditor->ReplaceContainer(aList, aListType).take();
   NS_ENSURE_STATE(aOutList);
 
   return NS_OK;
 }
 
 
-///////////////////////////////////////////////////////////////////////////
-// CreateStyleForInsertText:  take care of clearing and setting appropriate
-//                            style nodes for text insertion.
-//
-//
+/**
+ * CreateStyleForInsertText() takes care of clearing and setting appropriate
+ * style nodes for text insertion.
+ */
 nsresult
-nsHTMLEditRules::CreateStyleForInsertText(Selection& aSelection,
-                                          nsIDocument& aDoc)
+HTMLEditRules::CreateStyleForInsertText(Selection& aSelection,
+                                        nsIDocument& aDoc)
 {
   MOZ_ASSERT(mHTMLEditor->mTypeInState);
 
   nsresult res;
   bool weDidSomething = false;
   NS_ENSURE_STATE(aSelection.GetRangeAt(0));
   nsCOMPtr<nsINode> node = aSelection.GetRangeAt(0)->GetStartParent();
   int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
@@ -4439,36 +4437,36 @@ nsHTMLEditRules::CreateStyleForInsertTex
 
 
 /**
  * Figure out if aNode is (or is inside) an empty block.  A block can have
  * children and still be considered empty, if the children are empty or
  * non-editable.
  */
 nsresult
-nsHTMLEditRules::IsEmptyBlock(Element& aNode,
-                              bool* aOutIsEmptyBlock,
-                              MozBRCounts aMozBRCounts)
+HTMLEditRules::IsEmptyBlock(Element& aNode,
+                            bool* aOutIsEmptyBlock,
+                            MozBRCounts aMozBRCounts)
 {
   MOZ_ASSERT(aOutIsEmptyBlock);
   *aOutIsEmptyBlock = true;
 
   NS_ENSURE_TRUE(IsBlockNode(aNode), NS_ERROR_NULL_POINTER);
 
   return mHTMLEditor->IsEmptyNode(aNode.AsDOMNode(), aOutIsEmptyBlock,
                                   aMozBRCounts == MozBRCounts::yes ? false
                                                                    : true);
 }
 
 
 nsresult
-nsHTMLEditRules::WillAlign(Selection& aSelection,
-                           const nsAString& aAlignType,
-                           bool* aCancel,
-                           bool* aHandled)
+HTMLEditRules::WillAlign(Selection& aSelection,
+                         const nsAString& aAlignType,
+                         bool* aCancel,
+                         bool* aHandled)
 {
   MOZ_ASSERT(aCancel && aHandled);
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   WillInsert(aSelection, aCancel);
 
@@ -4666,45 +4664,47 @@ nsHTMLEditRules::WillAlign(Selection& aS
     rv = mHTMLEditor->MoveNode(curNode->AsContent(), curDiv, -1);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 
-///////////////////////////////////////////////////////////////////////////////
-// AlignInnerBlocks: Align inside table cells or list items
-//
+/**
+ * AlignInnerBlocks() aligns inside table cells or list items.
+ */
 nsresult
-nsHTMLEditRules::AlignInnerBlocks(nsINode& aNode, const nsAString* alignType)
+HTMLEditRules::AlignInnerBlocks(nsINode& aNode,
+                                const nsAString* alignType)
 {
   NS_ENSURE_TRUE(alignType, NS_ERROR_NULL_POINTER);
 
   // Gather list of table cells or list items
   nsTArray<OwningNonNull<nsINode>> nodeArray;
-  nsTableCellAndListItemFunctor functor;
+  TableCellAndListItemFunctor functor;
   DOMIterator iter(aNode);
   iter.AppendList(functor, nodeArray);
 
   // Now that we have the list, align their contents as requested
   for (auto& node : nodeArray) {
     nsresult res = AlignBlockContents(GetAsDOMNode(node), alignType);
     NS_ENSURE_SUCCESS(res, res);
   }
 
   return NS_OK;
 }
 
 
-///////////////////////////////////////////////////////////////////////////
-// AlignBlockContents: align contents of a block element
-//
+/**
+ * AlignBlockContents() aligns contents of a block element.
+ */
 nsresult
-nsHTMLEditRules::AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType)
+HTMLEditRules::AlignBlockContents(nsIDOMNode* aNode,
+                                  const nsAString* alignType)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   NS_ENSURE_TRUE(node && alignType, NS_ERROR_NULL_POINTER);
   nsresult res = NS_OK;
   nsCOMPtr<nsIContent> firstChild, lastChild;
   nsCOMPtr<Element> divNode;
 
   bool useCSS = mHTMLEditor->IsCSSEnabled();
@@ -4757,26 +4757,26 @@ nsHTMLEditRules::AlignBlockContents(nsID
       NS_ENSURE_SUCCESS(res, res);
       NS_ENSURE_STATE(mHTMLEditor);
       lastChild = mHTMLEditor->GetLastEditableChild(*node);
     }
   }
   return res;
 }
 
-///////////////////////////////////////////////////////////////////////////
-// CheckForEmptyBlock: Called by WillDeleteSelection to detect and handle
-//                     case of deleting from inside an empty block.
-//
+/**
+ * CheckForEmptyBlock() is called by WillDeleteSelection() to detect and handle
+ * case of deleting from inside an empty block.
+ */
 nsresult
-nsHTMLEditRules::CheckForEmptyBlock(nsINode* aStartNode,
-                                    Element* aBodyNode,
-                                    Selection* aSelection,
-                                    nsIEditor::EDirection aAction,
-                                    bool* aHandled)
+HTMLEditRules::CheckForEmptyBlock(nsINode* aStartNode,
+                                  Element* aBodyNode,
+                                  Selection* aSelection,
+                                  nsIEditor::EDirection aAction,
+                                  bool* aHandled)
 {
   // If the editing host is an inline element, bail out early.
   if (aBodyNode && IsInlineNode(*aBodyNode)) {
     return NS_OK;
   }
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
@@ -4862,18 +4862,19 @@ nsHTMLEditRules::CheckForEmptyBlock(nsIN
     res = mHTMLEditor->DeleteNode(emptyBlock);
     *aHandled = true;
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
 Element*
-nsHTMLEditRules::CheckForInvisibleBR(Element& aBlock, BRLocation aWhere,
-                                     int32_t aOffset)
+HTMLEditRules::CheckForInvisibleBR(Element& aBlock,
+                                   BRLocation aWhere,
+                                   int32_t aOffset)
 {
   nsCOMPtr<nsINode> testNode;
   int32_t testOffset = 0;
 
   if (aWhere == BRLocation::blockEnd) {
     // No block crossing
     nsCOMPtr<nsIContent> rightmostNode =
       mHTMLEditor->GetRightmostChild(&aBlock, true);
@@ -4896,29 +4897,30 @@ nsHTMLEditRules::CheckForInvisibleBR(Ele
   WSRunObject wsTester(mHTMLEditor, testNode, testOffset);
   if (WSType::br == wsTester.mStartReason) {
     return wsTester.mStartReasonNode->AsElement();
   }
 
   return nullptr;
 }
 
-
-////////////////////////////////////////////////////////////////////////////////
-// GetInnerContent: aLists and aTables allow the caller to specify what kind of
-//                  content to "look inside".  If aTables is Tables::yes, look
-//                  inside any table content, and insert the inner content into
-//                  the supplied issupportsarray at offset aIndex.  Similarly
-//                  with aLists and list content.  aIndex is updated to point
-//                  past inserted elements.
-//
+/**
+ * aLists and aTables allow the caller to specify what kind of content to
+ * "look inside".  If aTables is Tables::yes, look inside any table content,
+ * and insert the inner content into the supplied issupportsarray at offset
+ * aIndex.  Similarly with aLists and list content.  aIndex is updated to
+ * point past inserted elements.
+ */
 void
-nsHTMLEditRules::GetInnerContent(nsINode& aNode,
-                                 nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
-                                 int32_t* aIndex, Lists aLists, Tables aTables)
+HTMLEditRules::GetInnerContent(
+                 nsINode& aNode,
+                 nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
+                 int32_t* aIndex,
+                 Lists aLists,
+                 Tables aTables)
 {
   MOZ_ASSERT(aIndex);
 
   for (nsCOMPtr<nsIContent> node = mHTMLEditor->GetFirstEditableChild(aNode);
        node; node = node->GetNextSibling()) {
     if ((aLists == Lists::yes && (HTMLEditUtils::IsList(node) ||
                                   HTMLEditUtils::IsListItem(node))) ||
         (aTables == Tables::yes && HTMLEditUtils::IsTableElement(node))) {
@@ -4929,17 +4931,17 @@ nsHTMLEditRules::GetInnerContent(nsINode
     }
   }
 }
 
 /**
  * Promotes selection to include blocks that have all their children selected.
  */
 nsresult
-nsHTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
+HTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
 {
   // Don't need to touch collapsed selections
   if (aSelection.Collapsed()) {
     return NS_OK;
   }
 
   // We don't need to mess with cell selections, and we assume multirange
   // selections are those.
@@ -5059,26 +5061,25 @@ nsHTMLEditRules::ExpandSelectionForDelet
     // Only expand to just before br
     res = aSelection.Extend(firstBRParent, firstBROffset);
     NS_ENSURE_SUCCESS(res, res);
   }
 
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////
-// NormalizeSelection:  tweak non-collapsed selections to be more "natural".
-//    Idea here is to adjust selection endpoint so that they do not cross
-//    breaks or block boundaries unless something editable beyond that boundary
-//    is also selected.  This adjustment makes it much easier for the various
-//    block operations to determine what nodes to act on.
-//
+/**
+ * NormalizeSelection() tweaks non-collapsed selections to be more "natural".
+ * Idea here is to adjust selection endpoint so that they do not cross breaks
+ * or block boundaries unless something editable beyond that boundary is also
+ * selected.  This adjustment makes it much easier for the various block
+ * operations to determine what nodes to act on.
+ */
 nsresult
-nsHTMLEditRules::NormalizeSelection(Selection* inSelection)
+HTMLEditRules::NormalizeSelection(Selection* inSelection)
 {
   NS_ENSURE_TRUE(inSelection, NS_ERROR_NULL_POINTER);
 
   // don't need to touch collapsed selections
   if (inSelection->Collapsed()) {
     return NS_OK;
   }
 
@@ -5211,26 +5212,27 @@ nsHTMLEditRules::NormalizeSelection(Sele
   if (comp == 1) return NS_OK;  // new start after old end
 
   // otherwise set selection to new values.
   inSelection->Collapse(newStartNode, newStartOffset);
   inSelection->Extend(newEndNode, newEndOffset);
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////
-// GetPromotedPoint: figure out where a start or end point for a block
-//                   operation really is
+/**
+ * GetPromotedPoint() figures out where a start or end point for a block
+ * operation really is.
+ */
 void
-nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
-                                  int32_t aOffset,
-                                  EditAction actionID,
-                                  nsCOMPtr<nsIDOMNode>* outNode,
-                                  int32_t* outOffset)
+HTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere,
+                                nsIDOMNode* aNode,
+                                int32_t aOffset,
+                                EditAction actionID,
+                                nsCOMPtr<nsIDOMNode>* outNode,
+                                int32_t* outOffset)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   MOZ_ASSERT(node && outNode && outOffset);
 
   // default values
   *outNode = node->AsDOMNode();
   *outOffset = aOffset;
 
@@ -5422,25 +5424,24 @@ nsHTMLEditRules::GetPromotedPoint(RulesE
     offset = parentOffset + 1;
     NS_ENSURE_TRUE(mHTMLEditor, /* void */);
     nearNode = mHTMLEditor->GetNextHTMLNode(node, offset, true);
   }
   *outNode = node->AsDOMNode();
   *outOffset = offset;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// GetPromotedRanges: Run all the selection range endpoint through
-//                    GetPromotedPoint()
-//
+/**
+ * GetPromotedRanges() runs all the selection range endpoint through
+ * GetPromotedPoint().
+ */
 void
-nsHTMLEditRules::GetPromotedRanges(Selection& aSelection,
-                                   nsTArray<RefPtr<nsRange>>& outArrayOfRanges,
-                                   EditAction inOperationType)
+HTMLEditRules::GetPromotedRanges(Selection& aSelection,
+                                 nsTArray<RefPtr<nsRange>>& outArrayOfRanges,
+                                 EditAction inOperationType)
 {
   uint32_t rangeCount = aSelection.RangeCount();
 
   for (uint32_t i = 0; i < rangeCount; i++) {
     RefPtr<nsRange> selectionRange = aSelection.GetRangeAt(i);
     MOZ_ASSERT(selectionRange);
 
     // Clone range so we don't muck with actual selection ranges
@@ -5451,23 +5452,23 @@ nsHTMLEditRules::GetPromotedRanges(Selec
     // blocks that we will affect.  This call alters opRange.
     PromoteRange(*opRange, inOperationType);
 
     // Stuff new opRange into array
     outArrayOfRanges.AppendElement(opRange);
   }
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// PromoteRange: Expand a range to include any parents for which all editable
-//               children are already in range.
-//
+/**
+ * PromoteRange() expands a range to include any parents for which all editable
+ * children are already in range.
+ */
 void
-nsHTMLEditRules::PromoteRange(nsRange& aRange, EditAction aOperationType)
+HTMLEditRules::PromoteRange(nsRange& aRange,
+                            EditAction aOperationType)
 {
   NS_ENSURE_TRUE(mHTMLEditor, );
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   nsCOMPtr<nsINode> startNode = aRange.GetStartParent();
   nsCOMPtr<nsINode> endNode = aRange.GetEndParent();
   int32_t startOffset = aRange.StartOffset();
   int32_t endOffset = aRange.EndOffset();
@@ -5518,41 +5519,44 @@ nsHTMLEditRules::PromoteRange(nsRange& a
   }
 
   DebugOnly<nsresult> res = aRange.SetStart(opStartNode, opStartOffset);
   MOZ_ASSERT(NS_SUCCEEDED(res));
   res = aRange.SetEnd(opEndNode, opEndOffset);
   MOZ_ASSERT(NS_SUCCEEDED(res));
 }
 
-class nsUniqueFunctor : public mozilla::BoolDomIterFunctor
+class UniqueFunctor final : public BoolDomIterFunctor
 {
 public:
-  explicit nsUniqueFunctor(nsTArray<OwningNonNull<nsINode>> &aArray) : mArray(aArray)
+  explicit UniqueFunctor(nsTArray<OwningNonNull<nsINode>>& aArray)
+    : mArray(aArray)
   {
   }
-  // used to build list of all nodes iterator covers
+
+  // Used to build list of all nodes iterator covers.
   virtual bool operator()(nsINode* aNode) const
   {
     return !mArray.Contains(aNode);
   }
 
 private:
   nsTArray<OwningNonNull<nsINode>>& mArray;
 };
 
-///////////////////////////////////////////////////////////////////////////////
-// GetNodesForOperation: Run through the ranges in the array and construct a
-//                       new array of nodes to be acted on.
-//
+/**
+ * GetNodesForOperation() runs through the ranges in the array and construct a
+ * new array of nodes to be acted on.
+ */
 nsresult
-nsHTMLEditRules::GetNodesForOperation(nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
-                                      nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
-                                      EditAction aOperationType,
-                                      TouchContent aTouchContent)
+HTMLEditRules::GetNodesForOperation(
+                 nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
+                 nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
+                 EditAction aOperationType,
+                 TouchContent aTouchContent)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   int32_t rangeCount = aArrayOfRanges.Length();
   nsresult res = NS_OK;
 
   if (aTouchContent == TouchContent::yes) {
@@ -5622,17 +5626,17 @@ nsHTMLEditRules::GetNodesForOperation(ns
     NS_ENSURE_SUCCESS(res, res);
     if (aOutArrayOfNodes.Length() == 0) {
       iter.AppendList(TrivialFunctor(), aOutArrayOfNodes);
     } else {
       // We don't want duplicates in aOutArrayOfNodes, so we use an
       // iterator/functor that only return nodes that are not already in
       // aOutArrayOfNodes.
       nsTArray<OwningNonNull<nsINode>> nodes;
-      iter.AppendList(nsUniqueFunctor(aOutArrayOfNodes), nodes);
+      iter.AppendList(UniqueFunctor(aOutArrayOfNodes), nodes);
       aOutArrayOfNodes.AppendElements(nodes);
     }
   }
 
   // Certain operations should not act on li's and td's, but rather inside
   // them.  Alter the list as needed.
   if (aOperationType == EditAction::makeBasicBlock) {
     for (int32_t i = aOutArrayOfNodes.Length() - 1; i >= 0; i--) {
@@ -5691,32 +5695,32 @@ nsHTMLEditRules::GetNodesForOperation(ns
         aOutArrayOfNodes.RemoveElementAt(i);
         aOutArrayOfNodes.InsertElementsAt(i, arrayOfInlines);
       }
     }
   }
   return NS_OK;
 }
 
-
 void
-nsHTMLEditRules::GetChildNodesForOperation(nsINode& aNode,
-    nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes)
+HTMLEditRules::GetChildNodesForOperation(
+                 nsINode& aNode,
+                 nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes)
 {
   for (nsCOMPtr<nsIContent> child = aNode.GetFirstChild();
        child; child = child->GetNextSibling()) {
     outArrayOfNodes.AppendElement(*child);
   }
 }
 
-
 nsresult
-nsHTMLEditRules::GetListActionNodes(nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
-                                    EntireList aEntireList,
-                                    TouchContent aTouchContent)
+HTMLEditRules::GetListActionNodes(
+                 nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
+                 EntireList aEntireList,
+                 TouchContent aTouchContent)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   RefPtr<Selection> selection = mHTMLEditor->GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
 
   // Added this in so that ui code can ask to change an entire list, even if
@@ -5771,19 +5775,19 @@ nsHTMLEditRules::GetListActionNodes(nsTA
 
   // If there is only one node in the array, and it is a list, div, or
   // blockquote, then look inside of it until we find inner list or content.
   LookInsideDivBQandList(aOutArrayOfNodes);
 
   return NS_OK;
 }
 
-
 void
-nsHTMLEditRules::LookInsideDivBQandList(nsTArray<OwningNonNull<nsINode>>& aNodeArray)
+HTMLEditRules::LookInsideDivBQandList(
+                 nsTArray<OwningNonNull<nsINode>>& aNodeArray)
 {
   NS_ENSURE_TRUE(mHTMLEditor, );
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // If there is only one node in the array, and it is a list, div, or
   // blockquote, then look inside of it until we find inner list or content.
   int32_t listCount = aNodeArray.Length();
   if (listCount != 1) {
@@ -5821,22 +5825,20 @@ nsHTMLEditRules::LookInsideDivBQandList(
     int32_t j = 0;
     GetInnerContent(*curNode, aNodeArray, &j, Lists::no, Tables::no);
     return;
   }
 
   aNodeArray.AppendElement(*curNode);
 }
 
-
-///////////////////////////////////////////////////////////////////////////
-// GetDefinitionListItemTypes:
-//
 void
-nsHTMLEditRules::GetDefinitionListItemTypes(dom::Element* aElement, bool* aDT, bool* aDD)
+HTMLEditRules::GetDefinitionListItemTypes(dom::Element* aElement,
+                                          bool* aDT,
+                                          bool* aDD)
 {
   MOZ_ASSERT(aElement);
   MOZ_ASSERT(aElement->IsHTMLElement(nsGkAtoms::dl));
   MOZ_ASSERT(aDT);
   MOZ_ASSERT(aDD);
 
   *aDT = *aDD = false;
   for (nsIContent* child = aElement->GetFirstChild();
@@ -5846,18 +5848,19 @@ nsHTMLEditRules::GetDefinitionListItemTy
       *aDT = true;
     } else if (child->IsHTMLElement(nsGkAtoms::dd)) {
       *aDD = true;
     }
   }
 }
 
 nsresult
-nsHTMLEditRules::GetParagraphFormatNodes(nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
-                                         TouchContent aTouchContent)
+HTMLEditRules::GetParagraphFormatNodes(
+                 nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
+                 TouchContent aTouchContent)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   RefPtr<Selection> selection = mHTMLEditor->GetSelection();
   NS_ENSURE_STATE(selection);
 
   // Contruct a list of nodes to act on.
@@ -5884,22 +5887,18 @@ nsHTMLEditRules::GetParagraphFormatNodes
       int32_t j = i;
       outArrayOfNodes.RemoveElementAt(i);
       GetInnerContent(testNode, outArrayOfNodes, &j);
     }
   }
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////
-// BustUpInlinesAtRangeEndpoints:
-//
 nsresult
-nsHTMLEditRules::BustUpInlinesAtRangeEndpoints(RangeItem& item)
+HTMLEditRules::BustUpInlinesAtRangeEndpoints(RangeItem& item)
 {
   bool isCollapsed = ((item.startNode == item.endNode) && (item.startOffset == item.endOffset));
 
   nsCOMPtr<nsIContent> endInline = GetHighestInlineParent(*item.endNode);
 
   // if we have inline parents above range endpoints, split them
   if (endInline && !isCollapsed)
   {
@@ -5930,28 +5929,27 @@ nsHTMLEditRules::BustUpInlinesAtRangeEnd
     // reset range
     item.startNode = resultStartNode;
     item.startOffset = resultStartOffset;
   }
 
   return NS_OK;
 }
 
-
-
 nsresult
-nsHTMLEditRules::BustUpInlinesAtBRs(nsIContent& aNode,
-                                    nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes)
+HTMLEditRules::BustUpInlinesAtBRs(
+                 nsIContent& aNode,
+                 nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // First build up a list of all the break nodes inside the inline container.
   nsTArray<OwningNonNull<nsINode>> arrayOfBreaks;
-  nsBRNodeFunctor functor;
+  BRNodeFunctor functor;
   DOMIterator iter(aNode);
   iter.AppendList(functor, arrayOfBreaks);
 
   // If there aren't any breaks, just put inNode itself in the array
   if (!arrayOfBreaks.Length()) {
     aOutArrayOfNodes.AppendElement(aNode);
     return NS_OK;
   }
@@ -5993,41 +5991,40 @@ nsHTMLEditRules::BustUpInlinesAtBRs(nsIC
   }
   // Now tack on remaining rightNode, if any, to the list
   if (rightNode) {
     aOutArrayOfNodes.AppendElement(*rightNode);
   }
   return NS_OK;
 }
 
-
 nsIContent*
-nsHTMLEditRules::GetHighestInlineParent(nsINode& aNode)
+HTMLEditRules::GetHighestInlineParent(nsINode& aNode)
 {
   if (!aNode.IsContent() || IsBlockNode(aNode)) {
     return nullptr;
   }
   OwningNonNull<nsIContent> node = *aNode.AsContent();
 
   while (node->GetParent() && IsInlineNode(*node->GetParent())) {
     node = *node->GetParent();
   }
   return node;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// GetNodesFromPoint: Given a particular operation, construct a list of nodes
-//                    from a point that will be operated on.
-//
+/**
+ * GetNodesFromPoint() constructs a list of nodes from a point that will be
+ * operated on.
+ */
 nsresult
-nsHTMLEditRules::GetNodesFromPoint(EditorDOMPoint aPoint,
-                                   EditAction aOperation,
-                                   nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
-                                   TouchContent aTouchContent)
+HTMLEditRules::GetNodesFromPoint(
+                 EditorDOMPoint aPoint,
+                 EditAction aOperation,
+                 nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
+                 TouchContent aTouchContent)
 {
   NS_ENSURE_STATE(aPoint.node);
   RefPtr<nsRange> range = new nsRange(aPoint.node);
   nsresult res = range->SetStart(aPoint.node, aPoint.offset);
   MOZ_ASSERT(NS_SUCCEEDED(res));
 
   // Expand the range to include adjacent inlines
   PromoteRange(*range, aOperation);
@@ -6041,77 +6038,69 @@ nsHTMLEditRules::GetNodesFromPoint(Edito
   // Use these ranges to contruct a list of nodes to act on
   res = GetNodesForOperation(arrayOfRanges, outArrayOfNodes, aOperation,
                              aTouchContent);
   NS_ENSURE_SUCCESS(res, res);
 
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// GetNodesFromSelection: Given a particular operation, construct a list of
-//                        nodes from the selection that will be operated on.
-//
+/**
+ * GetNodesFromSelection() constructs a list of nodes from the selection that
+ * will be operated on.
+ */
 nsresult
-nsHTMLEditRules::GetNodesFromSelection(Selection& aSelection,
-                                       EditAction aOperation,
-                                       nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
-                                       TouchContent aTouchContent)
+HTMLEditRules::GetNodesFromSelection(
+                 Selection& aSelection,
+                 EditAction aOperation,
+                 nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
+                 TouchContent aTouchContent)
 {
   // Promote selection ranges
   nsTArray<RefPtr<nsRange>> arrayOfRanges;
   GetPromotedRanges(aSelection, arrayOfRanges, aOperation);
 
   // Use these ranges to contruct a list of nodes to act on.
   nsresult res = GetNodesForOperation(arrayOfRanges, outArrayOfNodes,
                                       aOperation, aTouchContent);
   NS_ENSURE_SUCCESS(res, res);
 
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// MakeTransitionList: Detect all the transitions in the array, where a
-//                     transition means that adjacent nodes in the array don't
-//                     have the same parent.
+/**
+ * MakeTransitionList() detects all the transitions in the array, where a
+ * transition means that adjacent nodes in the array don't have the same parent.
+ */
 void
-nsHTMLEditRules::MakeTransitionList(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
-                                    nsTArray<bool>& aTransitionArray)
+HTMLEditRules::MakeTransitionList(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
+                                  nsTArray<bool>& aTransitionArray)
 {
   nsCOMPtr<nsINode> prevParent;
 
   aTransitionArray.EnsureLengthAtLeast(aNodeArray.Length());
   for (uint32_t i = 0; i < aNodeArray.Length(); i++) {
     if (aNodeArray[i]->GetParentNode() != prevParent) {
       // Different parents: transition point
       aTransitionArray[i] = true;
     } else {
       // Same parents: these nodes grew up together
       aTransitionArray[i] = false;
     }
     prevParent = aNodeArray[i]->GetParentNode();
   }
 }
 
-
-
-/********************************************************
- *  main implementation methods
- ********************************************************/
-
-///////////////////////////////////////////////////////////////////////////
-// IsInListItem: if aNode is the descendant of a listitem, return that li.
-//               But table element boundaries are stoppers on the search.
-//               Also stops on the active editor host (contenteditable).
-//               Also test if aNode is an li itself.
-//
+/**
+ * If aNode is the descendant of a listitem, return that li.  But table element
+ * boundaries are stoppers on the search.  Also stops on the active editor host
+ * (contenteditable).  Also test if aNode is an li itself.
+ */
 Element*
-nsHTMLEditRules::IsInListItem(nsINode* aNode)
+HTMLEditRules::IsInListItem(nsINode* aNode)
 {
   NS_ENSURE_TRUE(aNode, nullptr);
   if (HTMLEditUtils::IsListItem(aNode)) {
     return aNode->AsElement();
   }
 
   Element* parent = aNode->GetParentElement();
   while (parent && mHTMLEditor && mHTMLEditor->IsDescendantOfEditorRoot(parent) &&
@@ -6119,25 +6108,24 @@ nsHTMLEditRules::IsInListItem(nsINode* a
     if (HTMLEditUtils::IsListItem(parent)) {
       return parent;
     }
     parent = parent->GetParentElement();
   }
   return nullptr;
 }
 
-
 /**
  * ReturnInHeader: do the right thing for returns pressed in headers
  */
 nsresult
-nsHTMLEditRules::ReturnInHeader(Selection& aSelection,
-                                Element& aHeader,
-                                nsINode& aNode,
-                                int32_t aOffset)
+HTMLEditRules::ReturnInHeader(Selection& aSelection,
+                              Element& aHeader,
+                              nsINode& aNode,
+                              int32_t aOffset)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // Remember where the header is
   nsCOMPtr<nsINode> headerParent = aHeader.GetParentNode();
   int32_t offset = headerParent ? headerParent->IndexOf(&aHeader) : -1;
 
@@ -6201,26 +6189,26 @@ nsHTMLEditRules::ReturnInHeader(Selectio
   } else {
     // Put selection at front of righthand heading
     res = aSelection.Collapse(&aHeader, 0);
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
-///////////////////////////////////////////////////////////////////////////
-// ReturnInParagraph: do the right thing for returns pressed in paragraphs
-//
+/**
+ * ReturnInParagraph() does the right thing for returns pressed in paragraphs.
+ */
 nsresult
-nsHTMLEditRules::ReturnInParagraph(Selection* aSelection,
-                                   nsIDOMNode* aPara,
-                                   nsIDOMNode* aNode,
-                                   int32_t aOffset,
-                                   bool* aCancel,
-                                   bool* aHandled)
+HTMLEditRules::ReturnInParagraph(Selection* aSelection,
+                                 nsIDOMNode* aPara,
+                                 nsIDOMNode* aNode,
+                                 int32_t aOffset,
+                                 bool* aCancel,
+                                 bool* aHandled)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   if (!aSelection || !aPara || !node || !aCancel || !aHandled) {
     return NS_ERROR_NULL_POINTER;
   }
   *aCancel = false;
   *aHandled = false;
   nsresult res;
@@ -6315,25 +6303,26 @@ nsHTMLEditRules::ReturnInParagraph(Selec
       selNode = GetAsDOMNode(parent);
       selOffset = offset + 1;
     }
   }
   *aHandled = true;
   return SplitParagraph(aPara, sibling, aSelection, address_of(selNode), &selOffset);
 }
 
-///////////////////////////////////////////////////////////////////////////
-// SplitParagraph: split a paragraph at selection point, possibly deleting a br
-//
+/**
+ * SplitParagraph() splits a paragraph at selection point, possibly deleting a
+ * br.
+ */
 nsresult
-nsHTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
-                                nsIContent* aBRNode,
-                                Selection* aSelection,
-                                nsCOMPtr<nsIDOMNode> *aSelNode,
-                                int32_t *aOffset)
+HTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
+                              nsIContent* aBRNode,
+                              Selection* aSelection,
+                              nsCOMPtr<nsIDOMNode>* aSelNode,
+                              int32_t* aOffset)
 {
   nsCOMPtr<Element> para = do_QueryInterface(aPara);
   NS_ENSURE_TRUE(para && aBRNode && aSelNode && *aSelNode && aOffset &&
                  aSelection, NS_ERROR_NULL_POINTER);
   nsresult res = NS_OK;
 
   // split para
   // get ws code to adjust any ws
@@ -6387,25 +6376,24 @@ nsHTMLEditRules::SplitParagraph(nsIDOMNo
   {
     int32_t offset;
     nsCOMPtr<nsIDOMNode> parent = nsEditor::GetNodeLocation(child, &offset);
     aSelection->Collapse(parent,offset);
   }
   return res;
 }
 
-
 /**
  * ReturnInListItem: do the right thing for returns pressed in list items
  */
 nsresult
-nsHTMLEditRules::ReturnInListItem(Selection& aSelection,
-                                  Element& aListItem,
-                                  nsINode& aNode,
-                                  int32_t aOffset)
+HTMLEditRules::ReturnInListItem(Selection& aSelection,
+                                Element& aListItem,
+                                nsINode& aNode,
+                                int32_t aOffset)
 {
   MOZ_ASSERT(HTMLEditUtils::IsListItem(&aListItem));
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // Get the item parent and the active editing host.
   nsCOMPtr<Element> root = mHTMLEditor->GetActiveEditingHost();
@@ -6544,22 +6532,21 @@ nsHTMLEditRules::ReturnInListItem(Select
     }
   }
   res = aSelection.Collapse(&aListItem, 0);
   NS_ENSURE_SUCCESS(res, res);
 
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// MakeBlockquote: Put the list of nodes into one or more blockquotes.
-//
+/**
+ * MakeBlockquote() puts the list of nodes into one or more blockquotes.
+ */
 nsresult
-nsHTMLEditRules::MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray)
+HTMLEditRules::MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray)
 {
   // The idea here is to put the nodes into a minimal number of blockquotes.
   // When the user blockquotes something, they expect one blockquote.  That may
   // not be possible (for instance, if they have two table cells selected, you
   // need two blockquotes inside the cells).
   nsresult res;
   nsCOMPtr<Element> curBlock;
   nsCOMPtr<nsINode> prevParent;
@@ -6609,21 +6596,21 @@ nsHTMLEditRules::MakeBlockquote(nsTArray
 
     NS_ENSURE_STATE(mHTMLEditor);
     res = mHTMLEditor->MoveNode(curNode->AsContent(), curBlock, -1);
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// RemoveBlockStyle: Make the nodes have no special block type.
+/**
+ * RemoveBlockStyle() makes the nodes have no special block type.
+ */
 nsresult
-nsHTMLEditRules::RemoveBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray)
+HTMLEditRules::RemoveBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // Intent of this routine is to be used for converting to/from headers,
   // paragraphs, pre, and address.  Those blocks that pretty much just contain
   // inline things...
   nsresult res;
@@ -6697,23 +6684,23 @@ nsHTMLEditRules::RemoveBlockStyle(nsTArr
   if (curBlock) {
     res = RemovePartOfBlock(*curBlock, *firstNode, *lastNode);
     NS_ENSURE_SUCCESS(res, res);
     firstNode = lastNode = curBlock = nullptr;
   }
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// ApplyBlockStyle: Do whatever it takes to make the list of nodes into one or
-//                  more blocks of type aBlockTag.
+/**
+ * ApplyBlockStyle() does whatever it takes to make the list of nodes into one
+ * or more blocks of type aBlockTag.
+ */
 nsresult
-nsHTMLEditRules::ApplyBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
-                                 nsIAtom& aBlockTag)
+HTMLEditRules::ApplyBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
+                               nsIAtom& aBlockTag)
 {
   // Intent of this routine is to be used for converting to/from headers,
   // paragraphs, pre, and address.  Those blocks that pretty much just contain
   // inline things...
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   nsresult res;
@@ -6828,37 +6815,36 @@ nsHTMLEditRules::ApplyBlockStyle(nsTArra
       // the same block item.  Use curBlock.
       res = mHTMLEditor->MoveNode(curNode->AsContent(), curBlock, -1);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
   return NS_OK;
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// SplitAsNeeded: Given a tag name, split inOutParent up to the point where we
-//                can insert the tag.  Adjust inOutParent and inOutOffset to
-//                point to new location for tag.
+/**
+ * Given a tag name, split inOutParent up to the point where we can insert the
+ * tag.  Adjust inOutParent and inOutOffset to point to new location for tag.
+ */
 nsresult
-nsHTMLEditRules::SplitAsNeeded(nsIAtom& aTag,
-                               OwningNonNull<nsINode>& aInOutParent,
-                               int32_t& aInOutOffset)
+HTMLEditRules::SplitAsNeeded(nsIAtom& aTag,
+                             OwningNonNull<nsINode>& aInOutParent,
+                             int32_t& aInOutOffset)
 {
   // XXX Is there a better way to do this?
   nsCOMPtr<nsINode> parent = aInOutParent.forget();
   nsresult res = SplitAsNeeded(aTag, parent, aInOutOffset);
   aInOutParent = parent.forget();
   return res;
 }
 
 nsresult
-nsHTMLEditRules::SplitAsNeeded(nsIAtom& aTag,
-                               nsCOMPtr<nsINode>& inOutParent,
-                               int32_t& inOutOffset)
+HTMLEditRules::SplitAsNeeded(nsIAtom& aTag,
+                             nsCOMPtr<nsINode>& inOutParent,
+                             int32_t& inOutOffset)
 {
   NS_ENSURE_TRUE(inOutParent, NS_ERROR_NULL_POINTER);
 
   // Check that we have a place that can legally contain the tag
   nsCOMPtr<nsINode> tagParent, splitNode;
   for (nsCOMPtr<nsINode> parent = inOutParent; parent;
        parent = parent->GetParentNode()) {
     // Sniffing up the parent tree until we find a legal place for the block
@@ -6901,17 +6887,18 @@ nsHTMLEditRules::SplitAsNeeded(nsIAtom& 
 /**
  * JoinNodesSmart: Join two nodes, doing whatever makes sense for their
  * children (which often means joining them, too).  aNodeLeft & aNodeRight must
  * be same type of node.
  *
  * Returns the point where they're merged, or (nullptr, -1) on failure.
  */
 EditorDOMPoint
-nsHTMLEditRules::JoinNodesSmart(nsIContent& aNodeLeft, nsIContent& aNodeRight)
+HTMLEditRules::JoinNodesSmart(nsIContent& aNodeLeft,
+                              nsIContent& aNodeRight)
 {
   // Caller responsible for left and right node being the same type
   nsCOMPtr<nsINode> parent = aNodeLeft.GetParentNode();
   NS_ENSURE_TRUE(parent, EditorDOMPoint());
   int32_t parOffset = parent->IndexOf(&aNodeLeft);
   nsCOMPtr<nsINode> rightParent = aNodeRight.GetParentNode();
 
   // If they don't have the same parent, first move the right node to after the
@@ -6954,38 +6941,36 @@ nsHTMLEditRules::JoinNodesSmart(nsIConte
         mHTMLEditor->mCSSEditUtils->ElementsSameStyle(lastLeft->AsElement(),
                                                   firstRight->AsElement())))) {
     NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
     return JoinNodesSmart(*lastLeft, *firstRight);
   }
   return ret;
 }
 
-
 Element*
-nsHTMLEditRules::GetTopEnclosingMailCite(nsINode& aNode)
+HTMLEditRules::GetTopEnclosingMailCite(nsINode& aNode)
 {
   nsCOMPtr<Element> ret;
 
   for (nsCOMPtr<nsINode> node = &aNode; node; node = node->GetParentNode()) {
     if ((IsPlaintextEditor() && node->IsHTMLElement(nsGkAtoms::pre)) ||
         HTMLEditUtils::IsMailCite(node)) {
       ret = node->AsElement();
     }
     if (node->IsHTMLElement(nsGkAtoms::body)) {
       break;
     }
   }
 
   return ret;
 }
 
-
 nsresult
-nsHTMLEditRules::CacheInlineStyles(nsIDOMNode *aNode)
+HTMLEditRules::CacheInlineStyles(nsIDOMNode* aNode)
 {
   NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
 
   NS_ENSURE_STATE(mHTMLEditor);
   bool useCSS = mHTMLEditor->IsCSSEnabled();
 
   for (int32_t j = 0; j < SIZE_STYLE_TABLE; ++j)
   {
@@ -7010,19 +6995,18 @@ nsHTMLEditRules::CacheInlineStyles(nsIDO
     {
       mCachedStyles[j].mPresent = true;
       mCachedStyles[j].value.Assign(outValue);
     }
   }
   return NS_OK;
 }
 
-
 nsresult
-nsHTMLEditRules::ReapplyCachedStyles()
+HTMLEditRules::ReapplyCachedStyles()
 {
   // The idea here is to examine our cached list of styles and see if any have
   // been removed.  If so, add typeinstate for them, so that they will be
   // reinserted when new content is added.
 
   // remember if we are in css mode
   NS_ENSURE_STATE(mHTMLEditor);
   bool useCSS = mHTMLEditor->IsCSSEnabled();
@@ -7079,36 +7063,34 @@ nsHTMLEditRules::ReapplyCachedStyles()
                                            mCachedStyles[i].value);
       }
     }
   }
 
   return NS_OK;
 }
 
-
 void
-nsHTMLEditRules::ClearCachedStyles()
+HTMLEditRules::ClearCachedStyles()
 {
   // clear the mPresent bits in mCachedStyles array
   for (uint32_t j = 0; j < SIZE_STYLE_TABLE; j++) {
     mCachedStyles[j].mPresent = false;
     mCachedStyles[j].value.Truncate();
   }
 }
 
-
 void
-nsHTMLEditRules::AdjustSpecialBreaks()
+HTMLEditRules::AdjustSpecialBreaks()
 {
   NS_ENSURE_TRUE(mHTMLEditor, );
 
   // Gather list of empty nodes
   nsTArray<OwningNonNull<nsINode>> nodeArray;
-  nsEmptyEditableFunctor functor(mHTMLEditor);
+  EmptyEditableFunctor functor(mHTMLEditor);
   DOMIterator iter;
   nsresult res = iter.Init(*mDocChangeRange);
   NS_ENSURE_SUCCESS(res, );
   iter.AppendList(functor, nodeArray);
 
   // Put moz-br's into these empty li's and td's
   for (auto& node : nodeArray) {
     // Need to put br at END of node.  It may have empty containers in it and
@@ -7116,32 +7098,32 @@ nsHTMLEditRules::AdjustSpecialBreaks()
     // them.  Also, we want the br to be after the selection if the selection
     // is in this node.
     nsresult res = CreateMozBR(node->AsDOMNode(), (int32_t)node->Length());
     NS_ENSURE_SUCCESS(res, );
   }
 }
 
 nsresult
-nsHTMLEditRules::AdjustWhitespace(Selection* aSelection)
+HTMLEditRules::AdjustWhitespace(Selection* aSelection)
 {
   // get selection point
   nsCOMPtr<nsIDOMNode> selNode;
   int32_t selOffset;
   NS_ENSURE_STATE(mHTMLEditor);
   nsresult res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode), &selOffset);
   NS_ENSURE_SUCCESS(res, res);
 
   // ask whitespace object to tweak nbsp's
   NS_ENSURE_STATE(mHTMLEditor);
   return WSRunObject(mHTMLEditor, selNode, selOffset).AdjustWhitespace();
 }
 
 nsresult
-nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
+HTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
 {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
   if (!aSelection->Collapsed()) {
     return NS_OK;
   }
 
   // get the (collapsed) selection location
   nsCOMPtr<nsIDOMNode> selNode, temp;
@@ -7199,17 +7181,17 @@ nsHTMLEditRules::PinSelectionToNewBlock(
     {
       tmp = nsEditor::GetNodeLocation(tmp, &offset);
     }
     return aSelection->Collapse(tmp, 0);
   }
 }
 
 void
-nsHTMLEditRules::CheckInterlinePosition(Selection& aSelection)
+HTMLEditRules::CheckInterlinePosition(Selection& aSelection)
 {
   // If the selection isn't collapsed, do nothing.
   if (!aSelection.Collapsed()) {
     return;
   }
 
   NS_ENSURE_TRUE_VOID(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
@@ -7240,18 +7222,18 @@ nsHTMLEditRules::CheckInterlinePosition(
   // Are we before a block?  If so try set caret to prior content
   node = mHTMLEditor->GetNextHTMLSibling(selNode, selOffset);
   if (node && IsBlockNode(*node)) {
     aSelection.SetInterlinePosition(false);
   }
 }
 
 nsresult
-nsHTMLEditRules::AdjustSelection(Selection* aSelection,
-                                 nsIEditor::EDirection aAction)
+HTMLEditRules::AdjustSelection(Selection* aSelection,
+                               nsIEditor::EDirection aAction)
 {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
 
   // if the selection isn't collapsed, do nothing.
   // moose: one thing to do instead is check for the case of
   // only a single break selected, and collapse it.  Good thing?  Beats me.
   if (!aSelection->Collapsed()) {
     return NS_OK;
@@ -7404,20 +7386,20 @@ nsHTMLEditRules::AdjustSelection(Selecti
       res = aSelection->Collapse(selNode, selOffset);
     }
   }
   return res;
 }
 
 
 nsresult
-nsHTMLEditRules::FindNearSelectableNode(nsIDOMNode *aSelNode,
-                                        int32_t aSelOffset,
-                                        nsIEditor::EDirection &aDirection,
-                                        nsCOMPtr<nsIDOMNode> *outSelectableNode)
+HTMLEditRules::FindNearSelectableNode(nsIDOMNode* aSelNode,
+                                      int32_t aSelOffset,
+                                      nsIEditor::EDirection& aDirection,
+                                      nsCOMPtr<nsIDOMNode>* outSelectableNode)
 {
   NS_ENSURE_TRUE(aSelNode && outSelectableNode, NS_ERROR_NULL_POINTER);
   *outSelectableNode = nullptr;
   nsresult res = NS_OK;
 
   nsCOMPtr<nsIDOMNode> nearNode, curNode;
   if (aDirection == nsIEditor::ePrevious) {
     NS_ENSURE_STATE(mHTMLEditor);
@@ -7473,43 +7455,45 @@ nsHTMLEditRules::FindNearSelectableNode(
 
     // otherwise, ok, we have found a good spot to put the selection
     *outSelectableNode = do_QueryInterface(nearNode);
   }
   return res;
 }
 
 
-bool nsHTMLEditRules::InDifferentTableElements(nsIDOMNode* aNode1,
-                                               nsIDOMNode* aNode2)
+bool
+HTMLEditRules::InDifferentTableElements(nsIDOMNode* aNode1,
+                                        nsIDOMNode* aNode2)
 {
   nsCOMPtr<nsINode> node1 = do_QueryInterface(aNode1);
   nsCOMPtr<nsINode> node2 = do_QueryInterface(aNode2);
   return InDifferentTableElements(node1, node2);
 }
 
 bool
-nsHTMLEditRules::InDifferentTableElements(nsINode* aNode1, nsINode* aNode2)
+HTMLEditRules::InDifferentTableElements(nsINode* aNode1,
+                                        nsINode* aNode2)
 {
   MOZ_ASSERT(aNode1 && aNode2);
 
   while (aNode1 && !HTMLEditUtils::IsTableElement(aNode1)) {
     aNode1 = aNode1->GetParentNode();
   }
 
   while (aNode2 && !HTMLEditUtils::IsTableElement(aNode2)) {
     aNode2 = aNode2->GetParentNode();
   }
 
   return aNode1 != aNode2;
 }
 
 
 nsresult
-nsHTMLEditRules::RemoveEmptyNodes()
+HTMLEditRules::RemoveEmptyNodes()
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // Some general notes on the algorithm used here: the goal is to examine all
   // the nodes in mDocChangeRange, and remove the empty ones.  We do this by
   // using a content iterator to traverse all the nodes in the range, and
   // placing the empty nodes into an array.  After finishing the iteration, we
@@ -7634,17 +7618,18 @@ nsHTMLEditRules::RemoveEmptyNodes()
     res = mHTMLEditor->DeleteNode(delNode);
     NS_ENSURE_SUCCESS(res, res);
   }
 
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::SelectionEndpointInNode(nsINode* aNode, bool* aResult)
+HTMLEditRules::SelectionEndpointInNode(nsINode* aNode,
+                                       bool* aResult)
 {
   NS_ENSURE_TRUE(aNode && aResult, NS_ERROR_NULL_POINTER);
 
   nsIDOMNode* node = aNode->AsDOMNode();
 
   *aResult = false;
 
   NS_ENSURE_STATE(mHTMLEditor);
@@ -7683,32 +7668,32 @@ nsHTMLEditRules::SelectionEndpointInNode
   }
   return NS_OK;
 }
 
 /**
  * IsEmptyInline: Return true if aNode is an empty inline container
  */
 bool
-nsHTMLEditRules::IsEmptyInline(nsINode& aNode)
+HTMLEditRules::IsEmptyInline(nsINode& aNode)
 {
   NS_ENSURE_TRUE(mHTMLEditor, false);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   if (IsInlineNode(aNode) && mHTMLEditor->IsContainer(&aNode)) {
     bool isEmpty = true;
     mHTMLEditor->IsEmptyNode(&aNode, &isEmpty);
     return isEmpty;
   }
   return false;
 }
 
 
 bool
-nsHTMLEditRules::ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& aArrayOfNodes)
+HTMLEditRules::ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& aArrayOfNodes)
 {
   // We have a list of nodes which we are candidates for being moved into a new
   // block.  Determine if it's anything more than a blank line.  Look for
   // editable content above and beyond one single BR.
   NS_ENSURE_TRUE(aArrayOfNodes.Length(), true);
 
   NS_ENSURE_TRUE(mHTMLEditor, false);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
@@ -7731,17 +7716,18 @@ nsHTMLEditRules::ListIsEmptyLine(nsTArra
       return false;
     }
   }
   return true;
 }
 
 
 nsresult
-nsHTMLEditRules::PopListItem(nsIDOMNode *aListItem, bool *aOutOfList)
+HTMLEditRules::PopListItem(nsIDOMNode* aListItem,
+                           bool* aOutOfList)
 {
   nsCOMPtr<Element> listItem = do_QueryInterface(aListItem);
   // check parms
   NS_ENSURE_TRUE(listItem && aOutOfList, NS_ERROR_NULL_POINTER);
 
   // init out params
   *aOutOfList = false;
 
@@ -7791,17 +7777,17 @@ nsHTMLEditRules::PopListItem(nsIDOMNode 
     res = mHTMLEditor->RemoveBlockContainer(*listItem);
     NS_ENSURE_SUCCESS(res, res);
     *aOutOfList = true;
   }
   return res;
 }
 
 nsresult
-nsHTMLEditRules::RemoveListStructure(Element& aList)
+HTMLEditRules::RemoveListStructure(Element& aList)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
   nsresult res;
 
   while (aList.GetFirstChild()) {
     OwningNonNull<nsIContent> child = *aList.GetFirstChild();
 
@@ -7824,19 +7810,18 @@ nsHTMLEditRules::RemoveListStructure(Ele
 
   // Delete the now-empty list
   res = mHTMLEditor->RemoveBlockContainer(aList);
   NS_ENSURE_SUCCESS(res, res);
 
   return NS_OK;
 }
 
-
 nsresult
-nsHTMLEditRules::ConfirmSelectionInBody()
+HTMLEditRules::ConfirmSelectionInBody()
 {
   // get the body
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIDOMElement> rootElement = do_QueryInterface(mHTMLEditor->GetRoot());
   NS_ENSURE_TRUE(rootElement, NS_ERROR_UNEXPECTED);
 
   // get the selection
   NS_ENSURE_STATE(mHTMLEditor);
@@ -7888,19 +7873,18 @@ nsHTMLEditRules::ConfirmSelectionInBody(
 //    uncomment this to see when we get bad selections
 //    NS_NOTREACHED("selection not in body");
     selection->Collapse(rootElement, 0);
   }
 
   return res;
 }
 
-
 nsresult
-nsHTMLEditRules::UpdateDocChangeRange(nsRange* aRange)
+HTMLEditRules::UpdateDocChangeRange(nsRange* aRange)
 {
   nsresult res = NS_OK;
 
   // first make sure aRange is in the document.  It might not be if
   // portions of our editting action involved manipulating nodes
   // prior to placing them in the document (e.g., populating a list item
   // before placing it in its list)
   nsCOMPtr<nsIDOMNode> startNode;
@@ -7955,17 +7939,17 @@ nsHTMLEditRules::UpdateDocChangeRange(ns
       res = mDocChangeRange->SetEnd(endNode, endOffset);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
   return res;
 }
 
 nsresult
-nsHTMLEditRules::InsertMozBRIfNeeded(nsINode& aNode)
+HTMLEditRules::InsertMozBRIfNeeded(nsINode& aNode)
 {
   if (!IsBlockNode(aNode)) {
     return NS_OK;
   }
 
   bool isEmpty;
   NS_ENSURE_STATE(mHTMLEditor);
   nsresult res = mHTMLEditor->IsEmptyNode(&aNode, &isEmpty);
@@ -7973,192 +7957,192 @@ nsHTMLEditRules::InsertMozBRIfNeeded(nsI
   if (!isEmpty) {
     return NS_OK;
   }
 
   return CreateMozBR(aNode.AsDOMNode(), 0);
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition)
+HTMLEditRules::WillCreateNode(const nsAString& aTag,
+                              nsIDOMNode* aParent,
+                              int32_t aPosition)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::DidCreateNode(const nsAString& aTag,
-                               nsIDOMNode *aNode,
-                               nsIDOMNode *aParent,
-                               int32_t aPosition,
-                               nsresult aResult)
+HTMLEditRules::DidCreateNode(const nsAString& aTag,
+                             nsIDOMNode* aNode,
+                             nsIDOMNode* aParent,
+                             int32_t aPosition,
+                             nsresult aResult)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   // assumption that Join keeps the righthand node
   nsresult res = mUtilRange->SelectNode(aNode);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition)
+HTMLEditRules::WillInsertNode(nsIDOMNode* aNode,
+                              nsIDOMNode* aParent,
+                              int32_t aPosition)
 {
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidInsertNode(nsIDOMNode *aNode,
-                               nsIDOMNode *aParent,
-                               int32_t aPosition,
-                               nsresult aResult)
+HTMLEditRules::DidInsertNode(nsIDOMNode* aNode,
+                             nsIDOMNode* aParent,
+                             int32_t aPosition,
+                             nsresult aResult)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   nsresult res = mUtilRange->SelectNode(aNode);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillDeleteNode(nsIDOMNode *aChild)
+HTMLEditRules::WillDeleteNode(nsIDOMNode* aChild)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   nsresult res = mUtilRange->SelectNode(aChild);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult)
+HTMLEditRules::DidDeleteNode(nsIDOMNode* aChild,
+                             nsresult aResult)
 {
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset)
+HTMLEditRules::WillSplitNode(nsIDOMNode* aExistingRightNode,
+                             int32_t aOffset)
 {
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidSplitNode(nsIDOMNode *aExistingRightNode,
-                              int32_t aOffset,
-                              nsIDOMNode *aNewLeftNode,
-                              nsresult aResult)
+HTMLEditRules::DidSplitNode(nsIDOMNode* aExistingRightNode,
+                            int32_t aOffset,
+                            nsIDOMNode* aNewLeftNode,
+                            nsresult aResult)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   nsresult res = mUtilRange->SetStart(aNewLeftNode, 0);
   NS_ENSURE_SUCCESS(res, res);
   res = mUtilRange->SetEnd(aExistingRightNode, 0);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent)
+HTMLEditRules::WillJoinNodes(nsIDOMNode* aLeftNode,
+                             nsIDOMNode* aRightNode,
+                             nsIDOMNode* aParent)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   // remember split point
   nsresult res = nsEditor::GetLengthOfDOMNode(aLeftNode, mJoinOffset);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidJoinNodes(nsIDOMNode  *aLeftNode,
-                              nsIDOMNode *aRightNode,
-                              nsIDOMNode *aParent,
-                              nsresult aResult)
+HTMLEditRules::DidJoinNodes(nsIDOMNode* aLeftNode,
+                            nsIDOMNode* aRightNode,
+                            nsIDOMNode* aParent,
+                            nsresult aResult)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   // assumption that Join keeps the righthand node
   nsresult res = mUtilRange->SetStart(aRightNode, mJoinOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = mUtilRange->SetEnd(aRightNode, mJoinOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString)
+HTMLEditRules::WillInsertText(nsIDOMCharacterData* aTextNode,
+                              int32_t aOffset,
+                              const nsAString& aString)
 {
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidInsertText(nsIDOMCharacterData *aTextNode,
-                                  int32_t aOffset,
-                                  const nsAString &aString,
-                                  nsresult aResult)
+HTMLEditRules::DidInsertText(nsIDOMCharacterData* aTextNode,
+                             int32_t aOffset,
+                             const nsAString& aString,
+                             nsresult aResult)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   int32_t length = aString.Length();
   nsCOMPtr<nsIDOMNode> theNode = do_QueryInterface(aTextNode);
   nsresult res = mUtilRange->SetStart(theNode, aOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = mUtilRange->SetEnd(theNode, aOffset+length);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength)
+HTMLEditRules::WillDeleteText(nsIDOMCharacterData* aTextNode,
+                              int32_t aOffset,
+                              int32_t aLength)
 {
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsHTMLEditRules::DidDeleteText(nsIDOMCharacterData *aTextNode,
-                                  int32_t aOffset,
-                                  int32_t aLength,
-                                  nsresult aResult)
+HTMLEditRules::DidDeleteText(nsIDOMCharacterData* aTextNode,
+                             int32_t aOffset,
+                             int32_t aLength,
+                             nsresult aResult)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   nsCOMPtr<nsIDOMNode> theNode = do_QueryInterface(aTextNode);
   nsresult res = mUtilRange->SetStart(theNode, aOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = mUtilRange->SetEnd(theNode, aOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection)
+HTMLEditRules::WillDeleteSelection(nsISelection* aSelection)
 {
   if (!mListenerEnabled) {
     return NS_OK;
   }
   if (NS_WARN_IF(!aSelection)) {
     return NS_ERROR_INVALID_ARG;
   }
   RefPtr<Selection> selection = aSelection->AsSelection();
@@ -8179,27 +8163,29 @@ nsHTMLEditRules::WillDeleteSelection(nsI
   NS_ENSURE_SUCCESS(res, res);
   res = mUtilRange->SetEnd(selNode, selOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = UpdateDocChangeRange(mUtilRange);
   return res;
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::DidDeleteSelection(nsISelection *aSelection)
+HTMLEditRules::DidDeleteSelection(nsISelection *aSelection)
 {
   return NS_OK;
 }
 
 // Let's remove all alignment hints in the children of aNode; it can
 // be an ALIGN attribute (in case we just remove it) or a CENTER
 // element (here we have to remove the container and keep its
 // children). We break on tables and don't look at their children.
 nsresult
-nsHTMLEditRules::RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, bool aChildrenOnly)
+HTMLEditRules::RemoveAlignment(nsIDOMNode* aNode,
+                               const nsAString& aAlignType,
+                               bool aChildrenOnly)
 {
   NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
 
   NS_ENSURE_STATE(mHTMLEditor);
   if (mHTMLEditor->IsTextNode(aNode) || HTMLEditUtils::IsTable(aNode)) {
     return NS_OK;
   }
   nsresult res = NS_OK;
@@ -8276,17 +8262,18 @@ nsHTMLEditRules::RemoveAlignment(nsIDOMN
   }
   return NS_OK;
 }
 
 // Let's insert a BR as first (resp. last) child of aNode if its
 // first (resp. last) child is not a block nor a BR, and if the
 // previous (resp. next) sibling is not a block nor a BR
 nsresult
-nsHTMLEditRules::MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts)
+HTMLEditRules::MakeSureElemStartsOrEndsOnCR(nsIDOMNode* aNode,
+                                            bool aStarts)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
 
   nsCOMPtr<nsIDOMNode> child;
   nsresult res;
   if (aStarts)
   {
@@ -8346,27 +8333,28 @@ nsHTMLEditRules::MakeSureElemStartsOrEnd
     NS_ENSURE_STATE(mHTMLEditor);
     res = mHTMLEditor->CreateBR(aNode, offset, address_of(brNode));
     NS_ENSURE_SUCCESS(res, res);
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode)
+HTMLEditRules::MakeSureElemStartsOrEndsOnCR(nsIDOMNode* aNode)
 {
   nsresult res = MakeSureElemStartsOrEndsOnCR(aNode, false);
   NS_ENSURE_SUCCESS(res, res);
   res = MakeSureElemStartsOrEndsOnCR(aNode, true);
   return res;
 }
 
 nsresult
-nsHTMLEditRules::AlignBlock(Element& aElement, const nsAString& aAlignType,
-                            ContentsOnly aContentsOnly)
+HTMLEditRules::AlignBlock(Element& aElement,
+                          const nsAString& aAlignType,
+                          ContentsOnly aContentsOnly)
 {
   if (!IsBlockNode(aElement) && !aElement.IsHTMLElement(nsGkAtoms::hr)) {
     // We deal only with blocks; early way out
     return NS_OK;
   }
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
@@ -8391,17 +8379,18 @@ nsHTMLEditRules::AlignBlock(Element& aEl
                                   attr, aAlignType);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::ChangeIndentation(Element& aElement, Change aChange)
+HTMLEditRules::ChangeIndentation(Element& aElement,
+                                 Change aChange)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   nsIAtom& marginProperty =
     MarginPropertyAtomForIndent(*mHTMLEditor->mCSSEditUtils, aElement);
   nsAutoString value;
   mHTMLEditor->mCSSEditUtils->GetSpecifiedProperty(aElement, marginProperty,
@@ -8456,23 +8445,20 @@ nsHTMLEditRules::ChangeIndentation(Eleme
   }
 
   nsresult res = mHTMLEditor->RemoveContainer(&aElement);
   NS_ENSURE_SUCCESS(res, res);
 
   return NS_OK;
 }
 
-//
-// Support for Absolute Positioning
-//
-
 nsresult
-nsHTMLEditRules::WillAbsolutePosition(Selection& aSelection,
-                                      bool* aCancel, bool* aHandled)
+HTMLEditRules::WillAbsolutePosition(Selection& aSelection,
+                                    bool* aCancel,
+                                    bool* aHandled)
 {
   MOZ_ASSERT(aCancel && aHandled);
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   WillInsert(aSelection, aCancel);
 
   // We want to ignore result of WillInsert()
@@ -8655,28 +8641,29 @@ nsHTMLEditRules::WillAbsolutePosition(Se
         curList = nullptr;
       }
     }
   }
   return NS_OK;
 }
 
 nsresult
-nsHTMLEditRules::DidAbsolutePosition()
+HTMLEditRules::DidAbsolutePosition()
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIHTMLAbsPosEditor> absPosHTMLEditor = mHTMLEditor;
   nsCOMPtr<nsIDOMElement> elt =
     static_cast<nsIDOMElement*>(GetAsDOMNode(mNewBlock));
   return absPosHTMLEditor->AbsolutelyPositionElement(elt, true);
 }
 
 nsresult
-nsHTMLEditRules::WillRemoveAbsolutePosition(Selection* aSelection,
-                                            bool* aCancel, bool* aHandled) {
+HTMLEditRules::WillRemoveAbsolutePosition(Selection* aSelection,
+                                          bool* aCancel,
+                                          bool* aHandled) {
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
   WillInsert(*aSelection, aCancel);
 
   // initialize out param
   // we want to ignore aCancel from WillInsert()
   *aCancel = false;
   *aHandled = true;
 
@@ -8690,20 +8677,20 @@ nsHTMLEditRules::WillRemoveAbsolutePosit
   AutoSelectionRestorer selectionRestorer(aSelection, mHTMLEditor);
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIHTMLAbsPosEditor> absPosHTMLEditor = mHTMLEditor;
   return absPosHTMLEditor->AbsolutelyPositionElement(elt, false);
 }
 
 nsresult
-nsHTMLEditRules::WillRelativeChangeZIndex(Selection* aSelection,
-                                          int32_t aChange,
-                                          bool *aCancel,
-                                          bool * aHandled)
+HTMLEditRules::WillRelativeChangeZIndex(Selection* aSelection,
+                                        int32_t aChange,
+                                        bool* aCancel,
+                                        bool* aHandled)
 {
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
   WillInsert(*aSelection, aCancel);
 
   // initialize out param
   // we want to ignore aCancel from WillInsert()
   *aCancel = false;
   *aHandled = true;
@@ -8719,24 +8706,25 @@ nsHTMLEditRules::WillRelativeChangeZInde
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIHTMLAbsPosEditor> absPosHTMLEditor = mHTMLEditor;
   int32_t zIndex;
   return absPosHTMLEditor->RelativeChangeElementZIndex(elt, aChange, &zIndex);
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::DocumentModified()
-{
-  nsContentUtils::AddScriptRunner(NewRunnableMethod(this, &nsHTMLEditRules::DocumentModifiedWorker));
+HTMLEditRules::DocumentModified()
+{
+  nsContentUtils::AddScriptRunner(
+    NewRunnableMethod(this, &HTMLEditRules::DocumentModifiedWorker));
   return NS_OK;
 }
 
 void
-nsHTMLEditRules::DocumentModifiedWorker()
+HTMLEditRules::DocumentModifiedWorker()
 {
   if (!mHTMLEditor) {
     return;
   }
 
   // DeleteNode below may cause a flush, which could destroy the editor
   nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
 
@@ -8751,8 +8739,10 @@ nsHTMLEditRules::DocumentModifiedWorker(
   if (mBogusNode) {
     mEditor->DeleteNode(mBogusNode);
     mBogusNode = nullptr;
   }
 
   // Try to recreate the bogus node if needed.
   CreateBogusNodeIfNeeded(selection);
 }
+
+} // namespace mozilla
rename from editor/libeditor/nsHTMLEditRules.h
rename to editor/libeditor/HTMLEditRules.h
--- a/editor/libeditor/nsHTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -1,15 +1,15 @@
 /* -*- 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 nsHTMLEditRules_h__
-#define nsHTMLEditRules_h__
+#ifndef HTMLEditRules_h
+#define HTMLEditRules_h
 
 #include "SelectionState.h"
 #include "TypeInState.h"
 #include "nsCOMPtr.h"
 #include "nsEditor.h"
 #include "nsIEditActionListener.h"
 #include "nsIEditor.h"
 #include "nsIHTMLEditor.h"
@@ -24,114 +24,134 @@ class nsIDOMCharacterData;
 class nsIDOMDocument;
 class nsIDOMElement;
 class nsIDOMNode;
 class nsIEditor;
 class nsINode;
 class nsPlaintextEditor;
 class nsRange;
 class nsRulesInfo;
+
 namespace mozilla {
+
 struct EditorDOMPoint;
 namespace dom {
 class Element;
 class Selection;
 } // namespace dom
-} // namespace mozilla
 
-struct StyleCache : public mozilla::PropItem
+struct StyleCache final : public PropItem
 {
   bool mPresent;
 
-  StyleCache() : PropItem(), mPresent(false) {
+  StyleCache()
+    : PropItem()
+    , mPresent(false)
+  {
     MOZ_COUNT_CTOR(StyleCache);
   }
 
-  StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) :
-             PropItem(aTag, aAttr, aValue), mPresent(false) {
+  StyleCache(nsIAtom* aTag,
+             const nsAString& aAttr,
+             const nsAString& aValue)
+    : PropItem(aTag, aAttr, aValue)
+    , mPresent(false)
+  {
     MOZ_COUNT_CTOR(StyleCache);
   }
 
-  ~StyleCache() {
+  ~StyleCache()
+  {
     MOZ_COUNT_DTOR(StyleCache);
   }
 };
 
-
 #define SIZE_STYLE_TABLE 19
 
-class nsHTMLEditRules : public nsTextEditRules, public nsIEditActionListener
+class HTMLEditRules : public nsTextEditRules
+                    , public nsIEditActionListener
 {
 public:
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLEditRules, nsTextEditRules)
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditRules, nsTextEditRules)
-
-  nsHTMLEditRules();
+  HTMLEditRules();
 
   // nsIEditRules methods
-  NS_IMETHOD Init(nsPlaintextEditor *aEditor) override;
+  NS_IMETHOD Init(nsPlaintextEditor* aTextEditor) override;
   NS_IMETHOD DetachEditor() override;
   NS_IMETHOD BeforeEdit(EditAction action,
                         nsIEditor::EDirection aDirection) override;
   NS_IMETHOD AfterEdit(EditAction action,
                        nsIEditor::EDirection aDirection) override;
   NS_IMETHOD WillDoAction(Selection* aSelection, nsRulesInfo* aInfo,
                           bool* aCancel, bool* aHandled) override;
   NS_IMETHOD DidDoAction(Selection* aSelection, nsRulesInfo* aInfo,
                          nsresult aResult) override;
   NS_IMETHOD DocumentModified() override;
 
-  nsresult GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL);
-  nsresult GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD);
-  nsresult GetIndentState(bool *aCanIndent, bool *aCanOutdent);
-  nsresult GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign);
-  nsresult GetParagraphState(bool *aMixed, nsAString &outFormat);
-  nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode);
+  nsresult GetListState(bool* aMixed, bool* aOL, bool* aUL, bool* aDL);
+  nsresult GetListItemState(bool* aMixed, bool* aLI, bool* aDT, bool* aDD);
+  nsresult GetIndentState(bool* aCanIndent, bool* aCanOutdent);
+  nsresult GetAlignment(bool* aMixed, nsIHTMLEditor::EAlignment* aAlign);
+  nsresult GetParagraphState(bool* aMixed, nsAString& outFormat);
+  nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode* aNode);
 
   // nsIEditActionListener methods
 
-  NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition) override;
-  NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) override;
-  NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition) override;
-  NS_IMETHOD DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) override;
-  NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild) override;
-  NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult) override;
-  NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset) override;
-  NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult) override;
-  NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent) override;
-  NS_IMETHOD DidJoinNodes(nsIDOMNode  *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult) override;
-  NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString) override;
-  NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult) override;
-  NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength) override;
-  NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult) override;
-  NS_IMETHOD WillDeleteSelection(nsISelection *aSelection) override;
-  NS_IMETHOD DidDeleteSelection(nsISelection *aSelection) override;
+  NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode* aParent,
+                            int32_t aPosition) override;
+  NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode* aNode,
+                           nsIDOMNode* aParent, int32_t aPosition,
+                           nsresult aResult) override;
+  NS_IMETHOD WillInsertNode(nsIDOMNode* aNode, nsIDOMNode* aParent,
+                            int32_t aPosition) override;
+  NS_IMETHOD DidInsertNode(nsIDOMNode* aNode, nsIDOMNode* aParent,
+                           int32_t aPosition, nsresult aResult) override;
+  NS_IMETHOD WillDeleteNode(nsIDOMNode* aChild) override;
+  NS_IMETHOD DidDeleteNode(nsIDOMNode* aChild, nsresult aResult) override;
+  NS_IMETHOD WillSplitNode(nsIDOMNode* aExistingRightNode,
+                           int32_t aOffset) override;
+  NS_IMETHOD DidSplitNode(nsIDOMNode* aExistingRightNode, int32_t aOffset,
+                          nsIDOMNode* aNewLeftNode, nsresult aResult) override;
+  NS_IMETHOD WillJoinNodes(nsIDOMNode* aLeftNode, nsIDOMNode* aRightNode,
+                           nsIDOMNode* aParent) override;
+  NS_IMETHOD DidJoinNodes(nsIDOMNode* aLeftNode, nsIDOMNode* aRightNode,
+                          nsIDOMNode* aParent, nsresult aResult) override;
+  NS_IMETHOD WillInsertText(nsIDOMCharacterData* aTextNode, int32_t aOffset,
+                            const nsAString &aString) override;
+  NS_IMETHOD DidInsertText(nsIDOMCharacterData* aTextNode, int32_t aOffset,
+                           const nsAString &aString, nsresult aResult) override;
+  NS_IMETHOD WillDeleteText(nsIDOMCharacterData* aTextNode, int32_t aOffset,
+                            int32_t aLength) override;
+  NS_IMETHOD DidDeleteText(nsIDOMCharacterData* aTextNode, int32_t aOffset,
+                           int32_t aLength, nsresult aResult) override;
+  NS_IMETHOD WillDeleteSelection(nsISelection* aSelection) override;
+  NS_IMETHOD DidDeleteSelection(nsISelection* aSelection) override;
   void DeleteNodeIfCollapsedText(nsINode& aNode);
 
 protected:
-  virtual ~nsHTMLEditRules();
+  virtual ~HTMLEditRules();
 
   enum RulesEndpoint
   {
     kStart,
     kEnd
   };
 
   void InitFields();
 
-  // nsHTMLEditRules implementation methods
   void WillInsert(Selection& aSelection, bool* aCancel);
-  nsresult WillInsertText(  EditAction aAction,
-                            Selection* aSelection,
-                            bool            *aCancel,
-                            bool            *aHandled,
-                            const nsAString *inString,
-                            nsAString       *outString,
-                            int32_t          aMaxLength);
+  nsresult WillInsertText(EditAction aAction,
+                          Selection* aSelection,
+                          bool* aCancel,
+                          bool* aHandled,
+                          const nsAString* inString,
+                          nsAString* outString,
+                          int32_t aMaxLength);
   nsresult WillLoadHTML(Selection* aSelection, bool* aCancel);
   nsresult WillInsertBreak(Selection& aSelection, bool* aCancel,
                            bool* aHandled);
   nsresult StandardBreakImpl(nsINode& aNode, int32_t aOffset,
                              Selection& aSelection);
   nsresult DidInsertBreak(Selection* aSelection, nsresult aResult);
   nsresult SplitMailCites(Selection* aSelection, bool* aHandled);
   nsresult WillDeleteSelection(Selection* aSelection,
@@ -179,49 +199,49 @@ protected:
                                bool* aCancel, bool* aHandled);
   nsresult WillMakeBasicBlock(Selection& aSelection,
                               const nsAString& aBlockType,
                               bool* aCancel, bool* aHandled);
   nsresult DidMakeBasicBlock(Selection* aSelection, nsRulesInfo* aInfo,
                              nsresult aResult);
   nsresult DidAbsolutePosition();
   nsresult AlignInnerBlocks(nsINode& aNode, const nsAString* alignType);
-  nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType);
+  nsresult AlignBlockContents(nsIDOMNode* aNode, const nsAString* alignType);
   nsresult AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
                                   nsINode* aNode);
-  nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat);
+  nsresult GetFormatString(nsIDOMNode* aNode, nsAString &outFormat);
   enum class Lists { no, yes };
   enum class Tables { no, yes };
   void GetInnerContent(nsINode& aNode,
                        nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
                        int32_t* aIndex, Lists aLists = Lists::yes,
                        Tables aTables = Tables::yes);
   Element* IsInListItem(nsINode* aNode);
   nsresult ReturnInHeader(Selection& aSelection, Element& aHeader,
                           nsINode& aNode, int32_t aOffset);
   nsresult ReturnInParagraph(Selection* aSelection, nsIDOMNode* aHeader,
                              nsIDOMNode* aTextNode, int32_t aOffset,
                              bool* aCancel, bool* aHandled);
-  nsresult SplitParagraph(nsIDOMNode *aPara,
+  nsresult SplitParagraph(nsIDOMNode* aPara,
                           nsIContent* aBRNode,
                           Selection* aSelection,
-                          nsCOMPtr<nsIDOMNode> *aSelNode,
-                          int32_t *aOffset);
+                          nsCOMPtr<nsIDOMNode>* aSelNode,
+                          int32_t* aOffset);
   nsresult ReturnInListItem(Selection& aSelection, Element& aHeader,
                             nsINode& aNode, int32_t aOffset);
   nsresult AfterEditInner(EditAction action,
                           nsIEditor::EDirection aDirection);
   nsresult RemovePartOfBlock(Element& aBlock, nsIContent& aStartChild,
                              nsIContent& aEndChild);
-  void     SplitBlock(Element& aBlock,
-                      nsIContent& aStartChild,
-                      nsIContent& aEndChild,
-                      nsIContent** aOutLeftNode = nullptr,
-                      nsIContent** aOutRightNode = nullptr,
-                      nsIContent** aOutMiddleNode = nullptr);
+  void SplitBlock(Element& aBlock,
+                  nsIContent& aStartChild,
+                  nsIContent& aEndChild,
+                  nsIContent** aOutLeftNode = nullptr,
+                  nsIContent** aOutRightNode = nullptr,
+                  nsIContent** aOutMiddleNode = nullptr);
   nsresult OutdentPartOfBlock(Element& aBlock,
                               nsIContent& aStartChild,
                               nsIContent& aEndChild,
                               bool aIsBlockIndentedWithCSS,
                               nsIContent** aOutLeftNode,
                               nsIContent** aOutRightNode);
 
   nsresult ConvertListType(Element* aList, Element** aOutList,
@@ -233,118 +253,126 @@ protected:
                         MozBRCounts aMozBRCounts = MozBRCounts::yes);
   nsresult CheckForEmptyBlock(nsINode* aStartNode, Element* aBodyNode,
                               Selection* aSelection,
                               nsIEditor::EDirection aAction, bool* aHandled);
   enum class BRLocation { beforeBlock, blockEnd };
   Element* CheckForInvisibleBR(Element& aBlock, BRLocation aWhere,
                                int32_t aOffset = 0);
   nsresult ExpandSelectionForDeletion(Selection& aSelection);
-  bool IsFirstNode(nsIDOMNode *aNode);
-  bool IsLastNode(nsIDOMNode *aNode);
+  bool IsFirstNode(nsIDOMNode* aNode);
+  bool IsLastNode(nsIDOMNode* aNode);
   nsresult NormalizeSelection(Selection* aSelection);
   void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
                         int32_t aOffset, EditAction actionID,
                         nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset);
   void GetPromotedRanges(Selection& aSelection,
                          nsTArray<RefPtr<nsRange>>& outArrayOfRanges,
                          EditAction inOperationType);
   void PromoteRange(nsRange& aRange, EditAction inOperationType);
   enum class TouchContent { no, yes };
-  nsresult GetNodesForOperation(nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
-                                nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
-                                EditAction aOperationType,
-                                TouchContent aTouchContent = TouchContent::yes);
-  void GetChildNodesForOperation(nsINode& aNode,
-      nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes);
-  nsresult GetNodesFromPoint(mozilla::EditorDOMPoint aPoint,
+  nsresult GetNodesForOperation(
+             nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
+             nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
+             EditAction aOperationType,
+             TouchContent aTouchContent = TouchContent::yes);
+  void GetChildNodesForOperation(
+         nsINode& aNode,
+         nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes);
+  nsresult GetNodesFromPoint(EditorDOMPoint aPoint,
                              EditAction aOperation,
                              nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
                              TouchContent aTouchContent);
-  nsresult GetNodesFromSelection(Selection& aSelection,
-                                 EditAction aOperation,
-                                 nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
-                                 TouchContent aTouchContent = TouchContent::yes);
+  nsresult GetNodesFromSelection(
+             Selection& aSelection,
+             EditAction aOperation,
+             nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
+             TouchContent aTouchContent = TouchContent::yes);
   enum class EntireList { no, yes };
-  nsresult GetListActionNodes(nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
-                              EntireList aEntireList,
-                              TouchContent aTouchContent = TouchContent::yes);
+  nsresult GetListActionNodes(
+             nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
+             EntireList aEntireList,
+             TouchContent aTouchContent = TouchContent::yes);
   void GetDefinitionListItemTypes(Element* aElement, bool* aDT, bool* aDD);
   nsresult GetParagraphFormatNodes(
-      nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
-      TouchContent aTouchContent = TouchContent::yes);
+             nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
+             TouchContent aTouchContent = TouchContent::yes);
   void LookInsideDivBQandList(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
-  nsresult BustUpInlinesAtRangeEndpoints(mozilla::RangeItem& inRange);
-  nsresult BustUpInlinesAtBRs(nsIContent& aNode,
-                              nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes);
+  nsresult BustUpInlinesAtRangeEndpoints(RangeItem& inRange);
+  nsresult BustUpInlinesAtBRs(
+             nsIContent& aNode,
+             nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes);
   nsIContent* GetHighestInlineParent(nsINode& aNode);
   void MakeTransitionList(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
                           nsTArray<bool>& aTransitionArray);
   nsresult RemoveBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
   nsresult ApplyBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
                            nsIAtom& aBlockTag);
   nsresult MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
   nsresult SplitAsNeeded(nsIAtom& aTag, OwningNonNull<nsINode>& inOutParent,
                          int32_t& inOutOffset);
   nsresult SplitAsNeeded(nsIAtom& aTag, nsCOMPtr<nsINode>& inOutParent,
                          int32_t& inOutOffset);
   nsresult AddTerminatingBR(nsIDOMNode *aBlock);
-  mozilla::EditorDOMPoint JoinNodesSmart(nsIContent& aNodeLeft,
-                                         nsIContent& aNodeRight);
+  EditorDOMPoint JoinNodesSmart(nsIContent& aNodeLeft,
+                                nsIContent& aNodeRight);
   Element* GetTopEnclosingMailCite(nsINode& aNode);
-  nsresult PopListItem(nsIDOMNode *aListItem, bool *aOutOfList);
+  nsresult PopListItem(nsIDOMNode* aListItem, bool* aOutOfList);
   nsresult RemoveListStructure(Element& aList);
-  nsresult CacheInlineStyles(nsIDOMNode *aNode);
+  nsresult CacheInlineStyles(nsIDOMNode* aNode);
   nsresult ReapplyCachedStyles();
   void ClearCachedStyles();
   void AdjustSpecialBreaks();
   nsresult AdjustWhitespace(Selection* aSelection);
   nsresult PinSelectionToNewBlock(Selection* aSelection);
   void CheckInterlinePosition(Selection& aSelection);
   nsresult AdjustSelection(Selection* aSelection,
                            nsIEditor::EDirection aAction);
-  nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
+  nsresult FindNearSelectableNode(nsIDOMNode* aSelNode,
                                   int32_t aSelOffset,
-                                  nsIEditor::EDirection &aDirection,
-                                  nsCOMPtr<nsIDOMNode> *outSelectableNode);
+                                  nsIEditor::EDirection& aDirection,
+                                  nsCOMPtr<nsIDOMNode>* outSelectableNode);
   /**
    * Returns true if aNode1 or aNode2 or both is the descendant of some type of
    * table element, but their nearest table element ancestors differ.  "Table
    * element" here includes not just <table> but also <td>, <tbody>, <tr>, etc.
    * The nodes count as being their own descendants for this purpose, so a
    * table element is its own nearest table element ancestor.
    */
-  bool     InDifferentTableElements(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
-  bool     InDifferentTableElements(nsINode* aNode1, nsINode* aNode2);
+  bool InDifferentTableElements(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
+  bool InDifferentTableElements(nsINode* aNode1, nsINode* aNode2);
   nsresult RemoveEmptyNodes();
-  nsresult SelectionEndpointInNode(nsINode *aNode, bool *aResult);
+  nsresult SelectionEndpointInNode(nsINode* aNode, bool* aResult);
   nsresult UpdateDocChangeRange(nsRange* aRange);
   nsresult ConfirmSelectionInBody();
   nsresult InsertMozBRIfNeeded(nsINode& aNode);
-  bool     IsEmptyInline(nsINode& aNode);
-  bool     ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& arrayOfNodes);
-  nsresult RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, bool aChildrenOnly);
-  nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts);
+  bool IsEmptyInline(nsINode& aNode);
+  bool ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& arrayOfNodes);
+  nsresult RemoveAlignment(nsIDOMNode* aNode, const nsAString& aAlignType,
+                           bool aChildrenOnly);
+  nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode* aNode, bool aStarts);
   enum class ContentsOnly { no, yes };
   nsresult AlignBlock(Element& aElement,
                       const nsAString& aAlignType, ContentsOnly aContentsOnly);
   enum class Change { minus, plus };
   nsresult ChangeIndentation(Element& aElement, Change aChange);
   void DocumentModifiedWorker();
 
-// data members
 protected:
-  nsHTMLEditor           *mHTMLEditor;
-  RefPtr<nsRange>       mDocChangeRange;
-  bool                    mListenerEnabled;
-  bool                    mReturnInEmptyLIKillsList;
-  bool                    mDidDeleteSelection;
-  bool                    mDidRangedDelete;
-  bool                    mRestoreContentEditableCount;
-  RefPtr<nsRange>       mUtilRange;
-  uint32_t                mJoinOffset;  // need to remember an int across willJoin/didJoin...
-  nsCOMPtr<Element>       mNewBlock;
-  RefPtr<mozilla::RangeItem> mRangeItem;
-  StyleCache              mCachedStyles[SIZE_STYLE_TABLE];
+  nsHTMLEditor* mHTMLEditor;
+  RefPtr<nsRange> mDocChangeRange;
+  bool mListenerEnabled;
+  bool mReturnInEmptyLIKillsList;
+  bool mDidDeleteSelection;
+  bool mDidRangedDelete;
+  bool mRestoreContentEditableCount;
+  RefPtr<nsRange> mUtilRange;
+  // Need to remember an int across willJoin/didJoin...
+  uint32_t mJoinOffset;
+  nsCOMPtr<Element> mNewBlock;
+  RefPtr<RangeItem> mRangeItem;
+  StyleCache mCachedStyles[SIZE_STYLE_TABLE];
 };
 
-#endif //nsHTMLEditRules_h__
+} // namespace mozilla
 
+#endif // #ifndef HTMLEditRules_h
+
--- a/editor/libeditor/TypeInState.h
+++ b/editor/libeditor/TypeInState.h
@@ -14,22 +14,22 @@
 #include "nsTArray.h"
 #include "nscore.h"
 
 // Workaround for windows headers
 #ifdef SetProp
 #undef SetProp
 #endif
 
-class nsHTMLEditRules;
 class nsIAtom;
 class nsIDOMNode;
 
 namespace mozilla {
 
+class HTMLEditRules;
 namespace dom {
 class Selection;
 } // namespace dom
 
 struct PropItem
 {
   nsIAtom* tag;
   nsString attr;
@@ -97,15 +97,15 @@ protected:
   bool IsPropCleared(nsIAtom* aProp, const nsAString& aAttr, int32_t& outIndex);
 
   nsTArray<PropItem*> mSetArray;
   nsTArray<PropItem*> mClearedArray;
   int32_t mRelativeFontSize;
   nsCOMPtr<nsIDOMNode> mLastSelectionContainer;
   int32_t mLastSelectionOffset;
 
-  friend class nsHTMLEditRules;
+  friend class HTMLEditRules;
 };
 
 } // namespace mozilla
 
 #endif  // #ifndef TypeInState_h
 
--- a/editor/libeditor/WSRunObject.cpp
+++ b/editor/libeditor/WSRunObject.cpp
@@ -168,17 +168,17 @@ WSRunObject::PrepareToSplitAcrossBlocks(
 
 Element*
 WSRunObject::InsertBreak(nsCOMPtr<nsINode>* aInOutParent,
                          int32_t* aInOutOffset,
                          nsIEditor::EDirection aSelect)
 {
   // MOOSE: for now, we always assume non-PRE formatting.  Fix this later.
   // meanwhile, the pre case is handled in WillInsertText in
-  // nsHTMLEditRules.cpp
+  // HTMLEditRules.cpp
   NS_ENSURE_TRUE(aInOutParent && aInOutOffset, nullptr);
 
   nsresult res = NS_OK;
   WSFragment *beforeRun, *afterRun;
   FindRun(*aInOutParent, *aInOutOffset, &beforeRun, false);
   FindRun(*aInOutParent, *aInOutOffset, &afterRun, true);
 
   {
@@ -236,17 +236,17 @@ WSRunObject::InsertBreak(nsCOMPtr<nsINod
 nsresult
 WSRunObject::InsertText(const nsAString& aStringToInsert,
                         nsCOMPtr<nsINode>* aInOutParent,
                         int32_t* aInOutOffset,
                         nsIDocument* aDoc)
 {
   // MOOSE: for now, we always assume non-PRE formatting.  Fix this later.
   // meanwhile, the pre case is handled in WillInsertText in
-  // nsHTMLEditRules.cpp
+  // HTMLEditRules.cpp
 
   // MOOSE: for now, just getting the ws logic straight.  This implementation
   // is very slow.  Will need to replace edit rules impl with a more efficient
   // text sink here that does the minimal amount of searching/replacing/copying
 
   NS_ENSURE_TRUE(aInOutParent && aInOutOffset && aDoc, NS_ERROR_NULL_POINTER);
 
   if (aStringToInsert.IsEmpty()) {
--- a/editor/libeditor/WSRunObject.h
+++ b/editor/libeditor/WSRunObject.h
@@ -9,21 +9,21 @@
 #include "nsCOMPtr.h"
 #include "nsIEditor.h" // for EDirection
 #include "nsINode.h"
 #include "nscore.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Text.h"
 
 class nsHTMLEditor;
-class nsHTMLEditRules;
 class nsIDOMNode;
 
 namespace mozilla {
 
+class HTMLEditRules;
 struct EditorDOMPoint;
 
 // class WSRunObject represents the entire whitespace situation
 // around a given point.  It collects up a list of nodes that contain
 // whitespace and categorizes in up to 3 different WSFragments (detailed
 // below).  Each WSFragment is a collection of whitespace that is
 // either all insignificant, or that is significant.  A WSFragment could
 // consist of insignificant whitespace because it is after a block
@@ -396,16 +396,16 @@ protected:
   WSFragment* mStartRun;
   // The last WSFragment in the run, may be same as first.
   WSFragment* mEndRun;
 
   // Non-owning.
   nsHTMLEditor* mHTMLEditor;
 
   // Opening this class up for pillaging.
-  friend class nsHTMLEditRules;
+  friend class HTMLEditRules;
   // Opening this class up for more pillaging.
   friend class nsHTMLEditor;
 };
 
 } // namespace mozilla
 
 #endif // #ifndef WSRunObject_h
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -26,31 +26,31 @@ UNIFIED_SOURCES += [
     'DeleteNodeTransaction.cpp',
     'DeleteRangeTransaction.cpp',
     'DeleteTextTransaction.cpp',
     'EditAggregateTransaction.cpp',
     'EditorCommands.cpp',
     'EditorController.cpp',
     'EditorUtils.cpp',
     'EditTransactionBase.cpp',
+    'HTMLEditRules.cpp',
     'HTMLEditUtils.cpp',
     'HTMLURIRefObject.cpp',
     'InsertNodeTransaction.cpp',
     'InsertTextTransaction.cpp',
     'InternetCiter.cpp',
     'JoinNodeTransaction.cpp',
     'nsEditor.cpp',
     'nsEditorEventListener.cpp',
     'nsHTMLAbsPosition.cpp',
     'nsHTMLAnonymousUtils.cpp',
     'nsHTMLDataTransfer.cpp',
     'nsHTMLEditor.cpp',
     'nsHTMLEditorEventListener.cpp',
     'nsHTMLEditorStyle.cpp',
-    'nsHTMLEditRules.cpp',
     'nsHTMLInlineTableEditor.cpp',
     'nsHTMLObjectResizer.cpp',
     'nsPlaintextDataTransfer.cpp',
     'nsPlaintextEditor.cpp',
     'nsTableEditor.cpp',
     'nsTextEditRules.cpp',
     'nsTextEditRulesBidi.cpp',
     'PlaceholderTransaction.cpp',
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -2270,17 +2270,17 @@ nsEditor::FindBetterInsertionPoint(nsCOM
     // There is no "better" insertion point.
     return;
   }
 
   if (!IsPlaintextEditor()) {
     // We cannot find "better" insertion point in HTML editor.
     // WARNING: When you add some code to find better node in HTML editor,
     //          you need to call this before calling InsertTextImpl() in
-    //          nsHTMLEditRules.
+    //          HTMLEditRules.
     return;
   }
 
   nsCOMPtr<nsINode> node = aNode;
   int32_t offset = aOffset;
 
   nsCOMPtr<nsINode> root = GetRoot();
   if (aNode == root) {
--- a/editor/libeditor/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/nsHTMLAbsPosition.cpp
@@ -1,31 +1,31 @@
 /* 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 "HTMLEditRules.h"
 #include "HTMLEditUtils.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"
 #include "nsDebug.h"
 #include "nsEditRules.h"
 #include "nsEditor.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
-#include "nsHTMLEditRules.h"
 #include "nsHTMLEditor.h"
 #include "nsHTMLObjectResizer.h"
 #include "nsIContent.h"
 #include "nsROCSSPrimitiveValue.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMEventTarget.h"
@@ -523,17 +523,18 @@ nsHTMLEditor::AbsolutelyPositionElement(
                                        EmptyString());
       mCSSEditUtils->RemoveCSSProperty(*element, *nsGkAtoms::height,
                                        EmptyString());
     }
 
     nsCOMPtr<dom::Element> element = do_QueryInterface(aElement);
     if (element && element->IsHTMLElement(nsGkAtoms::div) &&
         !HasStyleOrIdOrClass(element)) {
-      RefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
+      RefPtr<HTMLEditRules> htmlRules =
+        static_cast<HTMLEditRules*>(mRules.get());
       NS_ENSURE_TRUE(htmlRules, NS_ERROR_FAILURE);
       nsresult res = htmlRules->MakeSureElemStartsOrEndsOnCR(aElement);
       NS_ENSURE_SUCCESS(res, res);
       res = RemoveContainer(element);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
   return NS_OK;
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -8,22 +8,22 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/TextEvents.h"
 
 #include "nsCRT.h"
 
 #include "nsUnicharUtils.h"
 
+#include "HTMLEditRules.h"
 #include "HTMLEditUtils.h"
 #include "HTMLURIRefObject.h"
 #include "SetDocumentTitleTransaction.h"
 #include "StyleSheetTransactions.h"
 #include "TextEditUtils.h"
-#include "nsHTMLEditRules.h"
 
 #include "nsHTMLEditorEventListener.h"
 #include "TypeInState.h"
 
 
 #include "nsIDOMText.h"
 #include "nsIDOMMozNamedAttrMap.h"
 #include "nsIDOMNodeList.h"
@@ -516,17 +516,17 @@ nsHTMLEditor::SetFlags(uint32_t aFlags)
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::InitRules()
 {
   if (!mRules) {
     // instantiate the rules for the html editor
-    mRules = new nsHTMLEditRules();
+    mRules = new HTMLEditRules();
   }
   return mRules->Init(static_cast<nsPlaintextEditor*>(this));
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::BeginningOfDocument()
 {
   if (!mDocWeak) {
@@ -1706,17 +1706,18 @@ nsHTMLEditor::SetParagraphFormat(const n
     return InsertBasicBlock(tag);
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::GetParagraphState(bool *aMixed, nsAString &outFormat)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
   NS_ENSURE_TRUE(aMixed, NS_ERROR_NULL_POINTER);
-  RefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
+  RefPtr<HTMLEditRules> htmlRules =
+    static_cast<HTMLEditRules*>(mRules.get());
 
   return htmlRules->GetParagraphState(aMixed, outFormat);
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::GetBackgroundColorState(bool *aMixed, nsAString &aOutColor)
 {
   nsresult res;
@@ -1875,50 +1876,54 @@ nsHTMLEditor::GetHTMLBackgroundColorStat
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
   NS_ENSURE_TRUE(aMixed && aOL && aUL && aDL, NS_ERROR_NULL_POINTER);
-  RefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
+  RefPtr<HTMLEditRules> htmlRules =
+    static_cast<HTMLEditRules*>(mRules.get());
 
   return htmlRules->GetListState(aMixed, aOL, aUL, aDL);
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
   NS_ENSURE_TRUE(aMixed && aLI && aDT && aDD, NS_ERROR_NULL_POINTER);
 
-  RefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
+  RefPtr<HTMLEditRules> htmlRules =
+    static_cast<HTMLEditRules*>(mRules.get());
 
   return htmlRules->GetListItemState(aMixed, aLI, aDT, aDD);
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
   NS_ENSURE_TRUE(aMixed && aAlign, NS_ERROR_NULL_POINTER);
-  RefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
+  RefPtr<HTMLEditRules> htmlRules =
+    static_cast<HTMLEditRules*>(mRules.get());
 
   return htmlRules->GetAlignment(aMixed, aAlign);
 }
 
 
 NS_IMETHODIMP
 nsHTMLEditor::GetIndentState(bool *aCanIndent, bool *aCanOutdent)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
   NS_ENSURE_TRUE(aCanIndent && aCanOutdent, NS_ERROR_NULL_POINTER);
 
-  RefPtr<nsHTMLEditRules> htmlRules = static_cast<nsHTMLEditRules*>(mRules.get());
+  RefPtr<HTMLEditRules> htmlRules =
+    static_cast<HTMLEditRules*>(mRules.get());
 
   return htmlRules->GetIndentState(aCanIndent, aCanOutdent);
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList, const nsAString& aBulletType)
 {
   nsresult res;
--- a/editor/libeditor/nsHTMLEditor.h
+++ b/editor/libeditor/nsHTMLEditor.h
@@ -49,16 +49,17 @@ class nsIDOMKeyEvent;
 class nsITransferable;
 class nsIClipboard;
 class nsILinkHandler;
 class nsTableWrapperFrame;
 class nsIDOMRange;
 class nsRange;
 
 namespace mozilla {
+class HTMLEditRules;
 class TypeInState;
 class WSRunObject;
 struct PropItem;
 template<class T> class OwningNonNull;
 namespace dom {
 class DocumentFragment;
 } // namespace dom
 namespace widget {
@@ -969,18 +970,18 @@ protected:
   void     AddMouseClickListener(nsIDOMElement * aElement);
   void     RemoveMouseClickListener(nsIDOMElement * aElement);
 
   nsCOMPtr<nsILinkHandler> mLinkHandler;
 
 public:
 
 // friends
+friend class mozilla::HTMLEditRules;
 friend class mozilla::WSRunObject;
-friend class nsHTMLEditRules;
 friend class nsTextEditRules;
 friend class nsHTMLEditorEventListener;
 
 private:
   // Helpers
   bool IsSimpleModifiableNode(nsIContent* aContent,
                               nsIAtom* aProperty,
                               const nsAString* aAttribute,
--- a/editor/libeditor/nsPlaintextEditor.h
+++ b/editor/libeditor/nsPlaintextEditor.h
@@ -24,16 +24,17 @@ class nsIDOMNode;
 class nsIDocumentEncoder;
 class nsIEditRules;
 class nsIOutputStream;
 class nsISelectionController;
 class nsITransferable;
 
 namespace mozilla {
 class AutoEditInitRulesTrigger;
+class HTMLEditRules;
 namespace dom {
 class Selection;
 } // namespace dom
 } // namespace mozilla
 
 /**
  * The text editor implementation.
  * Use to edit text document represented as a DOM tree.
@@ -221,14 +222,14 @@ protected:
   int32_t mWrapColumn;
   int32_t mMaxTextLength;
   int32_t mInitTriggerCounter;
   int32_t mNewlineHandling;
   int32_t mCaretStyle;
 
   // friends
   friend class mozilla::AutoEditInitRulesTrigger;
-  friend class nsHTMLEditRules;
+  friend class mozilla::HTMLEditRules;
   friend class nsTextEditRules;
 };
 
 #endif //nsPlaintextEditor_h__