Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 15 Jun 2018 09:13:31 -0700
changeset 807752 844b330d1941f2f975404a5348f942bdbe62c914
parent 807751 7d97ad2bee09911aa66fa697fb1e1fb0e6f5df76
child 807753 54fe9983da36d35b11c8f87223c2dc01f51494a6
push id113196
push userbmo:m_kato@ga2.so-net.ne.jp
push dateFri, 15 Jun 2018 17:12:54 +0000
reviewersmasayuki
bugs1468708
milestone62.0a1
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r?masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT
editor/composer/HTMLEditorCommands.cpp
editor/composer/HTMLEditorCommands.h
editor/composer/HTMLEditorController.cpp
editor/composer/HTMLEditorDocumentCommands.cpp
editor/composer/moz.build
editor/composer/nsComposerCommands.cpp
editor/composer/nsComposerCommands.h
editor/composer/nsComposerDocumentCommands.cpp
rename from editor/composer/nsComposerCommands.cpp
rename to editor/composer/HTMLEditorCommands.cpp
--- a/editor/composer/nsComposerCommands.cpp
+++ b/editor/composer/HTMLEditorCommands.cpp
@@ -5,134 +5,133 @@
 
 
 #include <stdio.h>                      // for printf
 
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/EditorBase.h"         // for EditorBase
 #include "mozilla/ErrorResult.h"
 #include "mozilla/HTMLEditor.h"         // for HTMLEditor
+#include "mozilla/HTMLEditorCommands.h"
 #include "mozilla/dom/Element.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"                   // for nsCOMPtr, do_QueryInterface, etc
 #include "nsComponentManagerUtils.h"    // for do_CreateInstance
-#include "nsComposerCommands.h"
 #include "nsDebug.h"                    // for NS_ENSURE_TRUE, etc
 #include "nsError.h"                    // for NS_OK, NS_ERROR_FAILURE, etc
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::font, etc
 #include "nsAtom.h"                    // for nsAtom, etc
 #include "nsIClipboard.h"               // for nsIClipboard, etc
 #include "nsICommandParams.h"           // for nsICommandParams, etc
 #include "nsID.h"
 #include "nsIEditor.h"                  // for nsIEditor
 #include "nsIHTMLEditor.h"              // for nsIHTMLEditor, etc
 #include "nsLiteralString.h"            // for NS_LITERAL_STRING
 #include "nsReadableUtils.h"            // for EmptyString
 #include "nsString.h"                   // for nsAutoString, nsString, etc
 #include "nsStringFwd.h"                // for nsString
 
 class nsISupports;
-using mozilla::dom::Element;
-using mozilla::ErrorResult;
+
+namespace mozilla {
+using dom::Element;
 
 //prototype
 static nsresult
-GetListState(mozilla::HTMLEditor* aHTMLEditor,
-             bool* aMixed,
-             nsAString& aLocalName);
+GetListState(HTMLEditor* aHTMLEditor, bool* aMixed, nsAString& aLocalName);
 
 //defines
 #define STATE_ENABLED  "state_enabled"
 #define STATE_ALL "state_all"
 #define STATE_ANY "state_any"
 #define STATE_MIXED "state_mixed"
 #define STATE_BEGIN "state_begin"
 #define STATE_END "state_end"
 #define STATE_ATTRIBUTE "state_attribute"
 #define STATE_DATA "state_data"
 
 
-nsBaseComposerCommand::nsBaseComposerCommand()
+HTMLEditorCommandBase::HTMLEditorCommandBase()
 {
 }
 
-NS_IMPL_ISUPPORTS(nsBaseComposerCommand, nsIControllerCommand)
+NS_IMPL_ISUPPORTS(HTMLEditorCommandBase, nsIControllerCommand)
 
 
-nsBaseStateUpdatingCommand::nsBaseStateUpdatingCommand(nsAtom* aTagName)
-: nsBaseComposerCommand()
-, mTagName(aTagName)
+StateUpdatingCommandBase::StateUpdatingCommandBase(nsAtom* aTagName)
+  : HTMLEditorCommandBase()
+  , mTagName(aTagName)
 {
   MOZ_ASSERT(mTagName);
 }
 
-nsBaseStateUpdatingCommand::~nsBaseStateUpdatingCommand()
+StateUpdatingCommandBase::~StateUpdatingCommandBase()
 {
 }
 
 NS_IMETHODIMP
-nsBaseStateUpdatingCommand::IsCommandEnabled(const char *aCommandName,
-                                             nsISupports *refCon,
-                                             bool *outCmdEnabled)
+StateUpdatingCommandBase::IsCommandEnabled(const char* aCommandName,
+                                           nsISupports* refCon,
+                                           bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsBaseStateUpdatingCommand::DoCommand(const char *aCommandName,
-                                      nsISupports *refCon)
+StateUpdatingCommandBase::DoCommand(const char* aCommandName,
+                                    nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return ToggleState(htmlEditor);
 }
 
 NS_IMETHODIMP
-nsBaseStateUpdatingCommand::DoCommandParams(const char *aCommandName,
-                                            nsICommandParams *aParams,
-                                            nsISupports *refCon)
+StateUpdatingCommandBase::DoCommandParams(const char* aCommandName,
+                                          nsICommandParams* aParams,
+                                          nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsBaseStateUpdatingCommand::GetCommandStateParams(const char *aCommandName,
-                                                  nsICommandParams *aParams,
-                                                  nsISupports *refCon)
+StateUpdatingCommandBase::GetCommandStateParams(const char* aCommandName,
+                                                nsICommandParams* aParams,
+                                                nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return GetCurrentState(htmlEditor, aParams);
 }
 
 NS_IMETHODIMP
-nsPasteNoFormattingCommand::IsCommandEnabled(const char * aCommandName,
-                                             nsISupports *refCon,
-                                             bool *outCmdEnabled)
+PasteNoFormattingCommand::IsCommandEnabled(const char* aCommandName,
+                                           nsISupports* refCon,
+                                           bool* outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   *outCmdEnabled = false;
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
@@ -143,60 +142,60 @@ nsPasteNoFormattingCommand::IsCommandEna
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return htmlEditor->CanPaste(nsIClipboard::kGlobalClipboard, outCmdEnabled);
 }
 
 NS_IMETHODIMP
-nsPasteNoFormattingCommand::DoCommand(const char *aCommandName,
-                                      nsISupports *refCon)
+PasteNoFormattingCommand::DoCommand(const char* aCommandName,
+                                    nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return htmlEditor->PasteNoFormatting(nsIClipboard::kGlobalClipboard);
 }
 
 NS_IMETHODIMP
-nsPasteNoFormattingCommand::DoCommandParams(const char *aCommandName,
-                                            nsICommandParams *aParams,
-                                            nsISupports *refCon)
+PasteNoFormattingCommand::DoCommandParams(const char* aCommandName,
+                                          nsICommandParams* aParams,
+                                          nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsPasteNoFormattingCommand::GetCommandStateParams(const char *aCommandName,
-                                                  nsICommandParams *aParams,
-                                                  nsISupports *refCon)
+PasteNoFormattingCommand::GetCommandStateParams(const char* aCommandName,
+                                                nsICommandParams* aParams,
+                                                nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
 
   bool enabled = false;
   nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aParams->SetBooleanValue(STATE_ENABLED, enabled);
 }
 
-nsStyleUpdatingCommand::nsStyleUpdatingCommand(nsAtom* aTagName)
-: nsBaseStateUpdatingCommand(aTagName)
+StyleUpdatingCommand::StyleUpdatingCommand(nsAtom* aTagName)
+  : StateUpdatingCommandBase(aTagName)
 {
 }
 
 nsresult
-nsStyleUpdatingCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                        nsICommandParams *aParams)
+StyleUpdatingCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                      nsICommandParams *aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool firstOfSelectionHasProp = false;
   bool anyOfSelectionHasProp = false;
   bool allOfSelectionHasProp = false;
@@ -213,17 +212,17 @@ nsStyleUpdatingCommand::GetCurrentState(
   aParams->SetBooleanValue(STATE_MIXED, anyOfSelectionHasProp
            && !allOfSelectionHasProp);
   aParams->SetBooleanValue(STATE_BEGIN, firstOfSelectionHasProp);
   aParams->SetBooleanValue(STATE_END, allOfSelectionHasProp);//not completely accurate
   return NS_OK;
 }
 
 nsresult
-nsStyleUpdatingCommand::ToggleState(mozilla::HTMLEditor* aHTMLEditor)
+StyleUpdatingCommand::ToggleState(HTMLEditor* aHTMLEditor)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   //create some params now...
   nsresult rv;
   nsCOMPtr<nsICommandParams> params =
@@ -280,24 +279,24 @@ nsStyleUpdatingCommand::ToggleState(mozi
     rv = aHTMLEditor->SetInlineProperty(mTagName, nullptr, EmptyString());
   }
 
   aHTMLEditor->EndTransaction();
 
   return rv;
 }
 
-nsListCommand::nsListCommand(nsAtom* aTagName)
-: nsBaseStateUpdatingCommand(aTagName)
+ListCommand::ListCommand(nsAtom* aTagName)
+  : StateUpdatingCommandBase(aTagName)
 {
 }
 
 nsresult
-nsListCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                               nsICommandParams* aParams)
+ListCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                             nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool bMixed;
   nsAutoString localName;
   nsresult rv = GetListState(aHTMLEditor, &bMixed, localName);
@@ -306,17 +305,17 @@ nsListCommand::GetCurrentState(mozilla::
   bool inList = mTagName->Equals(localName);
   aParams->SetBooleanValue(STATE_ALL, !bMixed && inList);
   aParams->SetBooleanValue(STATE_MIXED, bMixed);
   aParams->SetBooleanValue(STATE_ENABLED, true);
   return NS_OK;
 }
 
 nsresult
-nsListCommand::ToggleState(mozilla::HTMLEditor* aHTMLEditor)
+ListCommand::ToggleState(HTMLEditor* aHTMLEditor)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsresult rv;
   nsCOMPtr<nsICommandParams> params =
       do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
@@ -335,24 +334,24 @@ nsListCommand::ToggleState(mozilla::HTML
     rv = aHTMLEditor->RemoveList(listType);
   } else {
     rv = aHTMLEditor->MakeOrChangeList(listType, false, EmptyString());
   }
 
   return rv;
 }
 
-nsListItemCommand::nsListItemCommand(nsAtom* aTagName)
-: nsBaseStateUpdatingCommand(aTagName)
+ListItemCommand::ListItemCommand(nsAtom* aTagName)
+  : StateUpdatingCommandBase(aTagName)
 {
 }
 
 nsresult
-nsListItemCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                   nsICommandParams *aParams)
+ListItemCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                 nsICommandParams *aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool bMixed, bLI, bDT, bDD;
   nsresult rv = aHTMLEditor->GetListItemState(&bMixed, &bLI, &bDT, &bDD);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -370,17 +369,17 @@ nsListItemCommand::GetCurrentState(mozil
 
   aParams->SetBooleanValue(STATE_ALL, !bMixed && inList);
   aParams->SetBooleanValue(STATE_MIXED, bMixed);
 
   return NS_OK;
 }
 
 nsresult
-nsListItemCommand::ToggleState(mozilla::HTMLEditor* aHTMLEditor)
+ListItemCommand::ToggleState(HTMLEditor* aHTMLEditor)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool inList;
   // Need to use mTagName????
   nsresult rv;
@@ -408,19 +407,19 @@ nsListItemCommand::ToggleState(mozilla::
   // Set to the requested paragraph type
   //XXX Note: This actually doesn't work for "LI",
   //    but we currently don't use this for non DL lists anyway.
   // Problem: won't this replace any current block paragraph style?
   return aHTMLEditor->SetParagraphFormat(nsDependentAtomString(mTagName));
 }
 
 NS_IMETHODIMP
-nsRemoveListCommand::IsCommandEnabled(const char * aCommandName,
-                                      nsISupports *refCon,
-                                      bool *outCmdEnabled)
+RemoveListCommand::IsCommandEnabled(const char* aCommandName,
+                                    nsISupports* refCon,
+                                    bool* outCmdEnabled)
 {
   *outCmdEnabled = false;
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
 
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
@@ -442,187 +441,187 @@ nsRemoveListCommand::IsCommandEnabled(co
   NS_ENSURE_SUCCESS(rv, rv);
 
   *outCmdEnabled = bMixed || !localName.IsEmpty();
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsRemoveListCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
+RemoveListCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (!htmlEditor) {
     return NS_OK;
   }
   // This removes any list type
   return htmlEditor->RemoveList(EmptyString());
 }
 
 NS_IMETHODIMP
-nsRemoveListCommand::DoCommandParams(const char *aCommandName,
-                                     nsICommandParams *aParams,
-                                     nsISupports *refCon)
+RemoveListCommand::DoCommandParams(const char* aCommandName,
+                                   nsICommandParams* aParams,
+                                   nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsRemoveListCommand::GetCommandStateParams(const char *aCommandName,
-                                           nsICommandParams *aParams,
-                                           nsISupports *refCon)
+RemoveListCommand::GetCommandStateParams(const char* aCommandName,
+                                         nsICommandParams* aParams,
+                                         nsISupports* refCon)
 {
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
 }
 
 NS_IMETHODIMP
-nsIndentCommand::IsCommandEnabled(const char * aCommandName,
-                                  nsISupports *refCon, bool *outCmdEnabled)
+IndentCommand::IsCommandEnabled(const char* aCommandName,
+                                nsISupports* refCon, bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsIndentCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
+IndentCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (!htmlEditor) {
     return NS_OK;
   }
   return htmlEditor->Indent(NS_LITERAL_STRING("indent"));
 }
 
 NS_IMETHODIMP
-nsIndentCommand::DoCommandParams(const char *aCommandName,
-                                 nsICommandParams *aParams,
-                                 nsISupports *refCon)
+IndentCommand::DoCommandParams(const char* aCommandName,
+                               nsICommandParams* aParams,
+                               nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsIndentCommand::GetCommandStateParams(const char *aCommandName,
-                                       nsICommandParams *aParams,
-                                       nsISupports *refCon)
+IndentCommand::GetCommandStateParams(const char* aCommandName,
+                                     nsICommandParams* aParams,
+                                     nsISupports* refCon)
 {
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
 }
 
 
 //OUTDENT
 
 NS_IMETHODIMP
-nsOutdentCommand::IsCommandEnabled(const char * aCommandName,
-                                   nsISupports *refCon,
-                                   bool *outCmdEnabled)
+OutdentCommand::IsCommandEnabled(const char* aCommandName,
+                                 nsISupports* refCon,
+                                 bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsOutdentCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
+OutdentCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (!htmlEditor) {
     return NS_OK;
   }
   return htmlEditor->Indent(NS_LITERAL_STRING("outdent"));
 }
 
 NS_IMETHODIMP
-nsOutdentCommand::DoCommandParams(const char *aCommandName,
-                                  nsICommandParams *aParams,
-                                  nsISupports *refCon)
+OutdentCommand::DoCommandParams(const char* aCommandName,
+                                nsICommandParams* aParams,
+                                nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsOutdentCommand::GetCommandStateParams(const char *aCommandName,
-                                        nsICommandParams *aParams,
-                                        nsISupports *refCon)
+OutdentCommand::GetCommandStateParams(const char* aCommandName,
+                                      nsICommandParams* aParams,
+                                      nsISupports* refCon)
 {
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
 }
 
-nsMultiStateCommand::nsMultiStateCommand()
-: nsBaseComposerCommand()
+MultiStateCommandBase::MultiStateCommandBase()
+  : HTMLEditorCommandBase()
 {
 }
 
-nsMultiStateCommand::~nsMultiStateCommand()
+MultiStateCommandBase::~MultiStateCommandBase()
 {
 }
 
 NS_IMETHODIMP
-nsMultiStateCommand::IsCommandEnabled(const char * aCommandName,
-                                      nsISupports *refCon,
-                                      bool *outCmdEnabled)
+MultiStateCommandBase::IsCommandEnabled(const char* aCommandName,
+                                        nsISupports* refCon,
+                                        bool *outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   // should be disabled sometimes, like if the current selection is an image
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMultiStateCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
+MultiStateCommandBase::DoCommand(const char* aCommandName, nsISupports* refCon)
 {
 #ifdef DEBUG
-  printf("who is calling nsMultiStateCommand::DoCommand \
+  printf("who is calling MultiStateCommandBase::DoCommand \
           (no implementation)? %s\n", aCommandName);
 #endif
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMultiStateCommand::DoCommandParams(const char *aCommandName,
-                                     nsICommandParams *aParams,
-                                     nsISupports *refCon)
+MultiStateCommandBase::DoCommandParams(const char* aCommandName,
+                                       nsICommandParams* aParams,
+                                       nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
@@ -636,39 +635,39 @@ nsMultiStateCommand::DoCommandParams(con
       CopyASCIItoUTF16(s, tString);
     else
       aParams->GetStringValue(STATE_ATTRIBUTE, tString);
   }
   return SetState(htmlEditor, tString);
 }
 
 NS_IMETHODIMP
-nsMultiStateCommand::GetCommandStateParams(const char *aCommandName,
-                                           nsICommandParams *aParams,
-                                           nsISupports *refCon)
+MultiStateCommandBase::GetCommandStateParams(const char* aCommandName,
+                                             nsICommandParams* aParams,
+                                             nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return GetCurrentState(htmlEditor, aParams);
 }
 
-nsParagraphStateCommand::nsParagraphStateCommand()
-: nsMultiStateCommand()
+ParagraphStateCommand::ParagraphStateCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsParagraphStateCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                         nsICommandParams* aParams)
+ParagraphStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                       nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool outMixed;
   nsAutoString outStateString;
   nsresult rv = aHTMLEditor->GetParagraphState(&outMixed, outStateString);
@@ -677,51 +676,51 @@ nsParagraphStateCommand::GetCurrentState
     LossyCopyUTF16toASCII(outStateString, tOutStateString);
     aParams->SetBooleanValue(STATE_MIXED,outMixed);
     aParams->SetCStringValue(STATE_ATTRIBUTE, tOutStateString.get());
   }
   return rv;
 }
 
 nsresult
-nsParagraphStateCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                                  nsString& newState)
+ParagraphStateCommand::SetState(HTMLEditor* aHTMLEditor,
+                                const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
   return aHTMLEditor->SetParagraphFormat(newState);
 }
 
-nsFontFaceStateCommand::nsFontFaceStateCommand()
-: nsMultiStateCommand()
+FontFaceStateCommand::FontFaceStateCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsFontFaceStateCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                        nsICommandParams* aParams)
+FontFaceStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                      nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsAutoString outStateString;
   bool outMixed;
   nsresult rv = aHTMLEditor->GetFontFaceState(&outMixed, outStateString);
   if (NS_SUCCEEDED(rv)) {
     aParams->SetBooleanValue(STATE_MIXED,outMixed);
     aParams->SetCStringValue(STATE_ATTRIBUTE, NS_ConvertUTF16toUTF8(outStateString).get());
   }
   return rv;
 }
 
 nsresult
-nsFontFaceStateCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                                 nsString& newState)
+FontFaceStateCommand::SetState(HTMLEditor* aHTMLEditor,
+                               const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (newState.EqualsLiteral("tt")) {
     // The old "teletype" attribute
     nsresult rv = aHTMLEditor->SetInlineProperty(nsGkAtoms::tt, nullptr,
@@ -738,24 +737,24 @@ nsFontFaceStateCommand::SetState(mozilla
   if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
     return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font, nsGkAtoms::face);
   }
 
   return aHTMLEditor->SetInlineProperty(nsGkAtoms::font, nsGkAtoms::face,
                                         newState);
 }
 
-nsFontSizeStateCommand::nsFontSizeStateCommand()
-  : nsMultiStateCommand()
+FontSizeStateCommand::FontSizeStateCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsFontSizeStateCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                        nsICommandParams* aParams)
+FontSizeStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                      nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsAutoString outStateString;
   bool firstHas, anyHas, allHas;
   nsresult rv = aHTMLEditor->GetInlinePropertyWithAttrValue(
@@ -781,18 +780,18 @@ nsFontSizeStateCommand::GetCurrentState(
 //   -1
 //    0
 //   +1
 //   +2
 //   +3
 //   medium
 //   normal
 nsresult
-nsFontSizeStateCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                                 nsString& newState)
+FontSizeStateCommand::SetState(HTMLEditor* aHTMLEditor,
+                               const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (!newState.IsEmpty() &&
       !newState.EqualsLiteral("normal") &&
       !newState.EqualsLiteral("medium")) {
@@ -806,24 +805,24 @@ nsFontSizeStateCommand::SetState(mozilla
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = aHTMLEditor->RemoveInlineProperty(nsGkAtoms::big, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::small, nullptr);
 }
 
-nsFontColorStateCommand::nsFontColorStateCommand()
-: nsMultiStateCommand()
+FontColorStateCommand::FontColorStateCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsFontColorStateCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                         nsICommandParams* aParams)
+FontColorStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                       nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool outMixed;
   nsAutoString outStateString;
   nsresult rv = aHTMLEditor->GetFontColorState(&outMixed, outStateString);
@@ -832,40 +831,40 @@ nsFontColorStateCommand::GetCurrentState
   nsAutoCString tOutStateString;
   LossyCopyUTF16toASCII(outStateString, tOutStateString);
   aParams->SetBooleanValue(STATE_MIXED, outMixed);
   aParams->SetCStringValue(STATE_ATTRIBUTE, tOutStateString.get());
   return NS_OK;
 }
 
 nsresult
-nsFontColorStateCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                                  nsString& newState)
+FontColorStateCommand::SetState(HTMLEditor* aHTMLEditor,
+                                const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
     return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font,
                                              nsGkAtoms::color);
   }
 
   return aHTMLEditor->SetInlineProperty(nsGkAtoms::font, nsGkAtoms::color,
                                         newState);
 }
 
-nsHighlightColorStateCommand::nsHighlightColorStateCommand()
-: nsMultiStateCommand()
+HighlightColorStateCommand::HighlightColorStateCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsHighlightColorStateCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                              nsICommandParams* aParams)
+HighlightColorStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                            nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool outMixed;
   nsAutoString outStateString;
   nsresult rv = aHTMLEditor->GetHighlightColorState(&outMixed, outStateString);
@@ -874,57 +873,57 @@ nsHighlightColorStateCommand::GetCurrent
   nsAutoCString tOutStateString;
   LossyCopyUTF16toASCII(outStateString, tOutStateString);
   aParams->SetBooleanValue(STATE_MIXED, outMixed);
   aParams->SetCStringValue(STATE_ATTRIBUTE, tOutStateString.get());
   return NS_OK;
 }
 
 nsresult
-nsHighlightColorStateCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                                       nsString& newState)
+HighlightColorStateCommand::SetState(HTMLEditor* aHTMLEditor,
+                                     const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
     return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font,
                                              nsGkAtoms::bgcolor);
   }
 
   return aHTMLEditor->SetInlineProperty(nsGkAtoms::font,
                                         nsGkAtoms::bgcolor,
                                         newState);
 }
 
 NS_IMETHODIMP
-nsHighlightColorStateCommand::IsCommandEnabled(const char * aCommandName,
-                                               nsISupports *refCon,
-                                               bool *outCmdEnabled)
+HighlightColorStateCommand::IsCommandEnabled(const char* aCommandName,
+                                             nsISupports* refCon,
+                                             bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
-nsBackgroundColorStateCommand::nsBackgroundColorStateCommand()
-: nsMultiStateCommand()
+BackgroundColorStateCommand::BackgroundColorStateCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsBackgroundColorStateCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                               nsICommandParams* aParams)
+BackgroundColorStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                             nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool outMixed;
   nsAutoString outStateString;
   nsresult rv = aHTMLEditor->GetBackgroundColorState(&outMixed, outStateString);
@@ -933,33 +932,33 @@ nsBackgroundColorStateCommand::GetCurren
   nsAutoCString tOutStateString;
   LossyCopyUTF16toASCII(outStateString, tOutStateString);
   aParams->SetBooleanValue(STATE_MIXED, outMixed);
   aParams->SetCStringValue(STATE_ATTRIBUTE, tOutStateString.get());
   return NS_OK;
 }
 
 nsresult
-nsBackgroundColorStateCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                                        nsString& newState)
+BackgroundColorStateCommand::SetState(HTMLEditor* aHTMLEditor,
+                                      const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
   return aHTMLEditor->SetBackgroundColor(newState);
 }
 
-nsAlignCommand::nsAlignCommand()
-: nsMultiStateCommand()
+AlignCommand::AlignCommand()
+  : MultiStateCommandBase()
 {
 }
 
 nsresult
-nsAlignCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                nsICommandParams* aParams)
+AlignCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                              nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsIHTMLEditor::EAlignment firstAlign;
   bool outMixed;
   nsresult rv = aHTMLEditor->GetAlignment(&outMixed, &firstAlign);
@@ -988,34 +987,34 @@ nsAlignCommand::GetCurrentState(mozilla:
   nsAutoCString tOutStateString;
   LossyCopyUTF16toASCII(outStateString, tOutStateString);
   aParams->SetBooleanValue(STATE_MIXED,outMixed);
   aParams->SetCStringValue(STATE_ATTRIBUTE, tOutStateString.get());
   return NS_OK;
 }
 
 nsresult
-nsAlignCommand::SetState(mozilla::HTMLEditor* aHTMLEditor,
-                         nsString& newState)
+AlignCommand::SetState(HTMLEditor* aHTMLEditor,
+                       const nsString& newState)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
   return aHTMLEditor->Align(newState);
 }
 
-nsAbsolutePositioningCommand::nsAbsolutePositioningCommand()
-: nsBaseStateUpdatingCommand(nsGkAtoms::_empty)
+AbsolutePositioningCommand::AbsolutePositioningCommand()
+  : StateUpdatingCommandBase(nsGkAtoms::_empty)
 {
 }
 
 NS_IMETHODIMP
-nsAbsolutePositioningCommand::IsCommandEnabled(const char * aCommandName,
-                                               nsISupports *aCommandRefCon,
-                                               bool *outCmdEnabled)
+AbsolutePositioningCommand::IsCommandEnabled(const char* aCommandName,
+                                             nsISupports* aCommandRefCon,
+                                             bool* outCmdEnabled)
 {
   *outCmdEnabled = false;
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
@@ -1025,18 +1024,18 @@ nsAbsolutePositioningCommand::IsCommandE
   if (!htmlEditor->IsSelectionEditable()) {
     return NS_OK;
   }
   *outCmdEnabled = htmlEditor->AbsolutePositioningEnabled();
   return NS_OK;
 }
 
 nsresult
-nsAbsolutePositioningCommand::GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
-                                              nsICommandParams* aParams)
+AbsolutePositioningCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
+                                            nsICommandParams* aParams)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   bool isEnabled = aHTMLEditor->AbsolutePositioningEnabled();
   if (!isEnabled) {
     aParams->SetBooleanValue(STATE_MIXED,false);
@@ -1047,32 +1046,32 @@ nsAbsolutePositioningCommand::GetCurrent
   RefPtr<Element> container =
     aHTMLEditor->GetAbsolutelyPositionedSelectionContainer();
   aParams->SetBooleanValue(STATE_MIXED,  false);
   aParams->SetCStringValue(STATE_ATTRIBUTE, container ? "absolute" : "");
   return NS_OK;
 }
 
 nsresult
-nsAbsolutePositioningCommand::ToggleState(mozilla::HTMLEditor* aHTMLEditor)
+AbsolutePositioningCommand::ToggleState(HTMLEditor* aHTMLEditor)
 {
   if (NS_WARN_IF(!aHTMLEditor)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   RefPtr<Element> container =
     aHTMLEditor->GetAbsolutelyPositionedSelectionContainer();
   return aHTMLEditor->SetSelectionToAbsoluteOrStatic(!container);
 }
 
 
 NS_IMETHODIMP
-nsDecreaseZIndexCommand::IsCommandEnabled(const char * aCommandName,
-                                          nsISupports *refCon,
-                                          bool *outCmdEnabled)
+DecreaseZIndexCommand::IsCommandEnabled(const char* aCommandName,
+                                        nsISupports* refCon,
+                                        bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
@@ -1089,56 +1088,56 @@ nsDecreaseZIndexCommand::IsCommandEnable
   }
 
   int32_t z = htmlEditor->GetZIndex(*positionedElement);
   *outCmdEnabled = (z > 0);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDecreaseZIndexCommand::DoCommand(const char *aCommandName,
-                                   nsISupports *refCon)
+DecreaseZIndexCommand::DoCommand(const char* aCommandName,
+                                 nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return htmlEditor->AddZIndex(-1);
 }
 
 NS_IMETHODIMP
-nsDecreaseZIndexCommand::DoCommandParams(const char *aCommandName,
-                                         nsICommandParams *aParams,
-                                         nsISupports *refCon)
+DecreaseZIndexCommand::DoCommandParams(const char* aCommandName,
+                                       nsICommandParams* aParams,
+                                       nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsDecreaseZIndexCommand::GetCommandStateParams(const char *aCommandName,
-                                               nsICommandParams *aParams,
-                                               nsISupports *refCon)
+DecreaseZIndexCommand::GetCommandStateParams(const char* aCommandName,
+                                             nsICommandParams* aParams,
+                                             nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
 
   bool enabled = false;
   nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aParams->SetBooleanValue(STATE_ENABLED, enabled);
 }
 
 NS_IMETHODIMP
-nsIncreaseZIndexCommand::IsCommandEnabled(const char * aCommandName,
-                                          nsISupports *refCon,
-                                          bool *outCmdEnabled)
+IncreaseZIndexCommand::IsCommandEnabled(const char* aCommandName,
+                                        nsISupports* refCon,
+                                        bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
@@ -1149,222 +1148,222 @@ nsIncreaseZIndexCommand::IsCommandEnable
     return NS_OK;
 
   Element* positionedElement = htmlEditor->GetPositionedElement();
   *outCmdEnabled = (nullptr != positionedElement);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsIncreaseZIndexCommand::DoCommand(const char *aCommandName,
-                                   nsISupports *refCon)
+IncreaseZIndexCommand::DoCommand(const char* aCommandName,
+                                 nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   return htmlEditor->AddZIndex(1);
 }
 
 NS_IMETHODIMP
-nsIncreaseZIndexCommand::DoCommandParams(const char *aCommandName,
-                                         nsICommandParams *aParams,
-                                         nsISupports *refCon)
+IncreaseZIndexCommand::DoCommandParams(const char* aCommandName,
+                                       nsICommandParams* aParams,
+                                       nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsIncreaseZIndexCommand::GetCommandStateParams(const char *aCommandName,
-                                               nsICommandParams *aParams,
-                                               nsISupports *refCon)
+IncreaseZIndexCommand::GetCommandStateParams(const char* aCommandName,
+                                             nsICommandParams* aParams,
+                                             nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
 
   bool enabled = false;
   nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aParams->SetBooleanValue(STATE_ENABLED, enabled);
 }
 
 NS_IMETHODIMP
-nsRemoveStylesCommand::IsCommandEnabled(const char * aCommandName,
-                                        nsISupports *refCon,
-                                        bool *outCmdEnabled)
+RemoveStylesCommand::IsCommandEnabled(const char* aCommandName,
+                                      nsISupports* refCon,
+                                      bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   // test if we have any styles?
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsRemoveStylesCommand::DoCommand(const char *aCommandName,
-                                 nsISupports *refCon)
+RemoveStylesCommand::DoCommand(const char* aCommandName,
+                               nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (!htmlEditor) {
     return NS_OK;
   }
   return htmlEditor->RemoveAllInlineProperties();
 }
 
 NS_IMETHODIMP
-nsRemoveStylesCommand::DoCommandParams(const char *aCommandName,
-                                       nsICommandParams *aParams,
-                                       nsISupports *refCon)
+RemoveStylesCommand::DoCommandParams(const char* aCommandName,
+                                     nsICommandParams* aParams,
+                                     nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsRemoveStylesCommand::GetCommandStateParams(const char *aCommandName,
-                                             nsICommandParams *aParams,
-                                             nsISupports *refCon)
+RemoveStylesCommand::GetCommandStateParams(const char* aCommandName,
+                                           nsICommandParams* aParams,
+                                           nsISupports* refCon)
 {
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
 }
 
 NS_IMETHODIMP
-nsIncreaseFontSizeCommand::IsCommandEnabled(const char * aCommandName,
-                                            nsISupports *refCon,
-                                            bool *outCmdEnabled)
+IncreaseFontSizeCommand::IsCommandEnabled(const char* aCommandName,
+                                          nsISupports* refCon,
+                                          bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   // test if we are at max size?
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsIncreaseFontSizeCommand::DoCommand(const char *aCommandName,
-                                     nsISupports *refCon)
+IncreaseFontSizeCommand::DoCommand(const char* aCommandName,
+                                   nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (!htmlEditor) {
     return NS_OK;
   }
   return htmlEditor->IncreaseFontSize();
 }
 
 NS_IMETHODIMP
-nsIncreaseFontSizeCommand::DoCommandParams(const char *aCommandName,
-                                           nsICommandParams *aParams,
-                                           nsISupports *refCon)
+IncreaseFontSizeCommand::DoCommandParams(const char* aCommandName,
+                                         nsICommandParams* aParams,
+                                         nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsIncreaseFontSizeCommand::GetCommandStateParams(const char *aCommandName,
-                                                 nsICommandParams *aParams,
-                                                 nsISupports *refCon)
+IncreaseFontSizeCommand::GetCommandStateParams(const char* aCommandName,
+                                               nsICommandParams* aParams,
+                                               nsISupports* refCon)
 {
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
 }
 
 NS_IMETHODIMP
-nsDecreaseFontSizeCommand::IsCommandEnabled(const char * aCommandName,
-                                            nsISupports *refCon,
-                                            bool *outCmdEnabled)
+DecreaseFontSizeCommand::IsCommandEnabled(const char* aCommandName,
+                                          nsISupports* refCon,
+                                          bool* outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   // test if we are at min size?
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDecreaseFontSizeCommand::DoCommand(const char *aCommandName,
-                                     nsISupports *refCon)
+DecreaseFontSizeCommand::DoCommand(const char* aCommandName,
+                                   nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     return NS_OK;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
   if (!htmlEditor) {
     return NS_OK;
   }
   return htmlEditor->DecreaseFontSize();
 }
 
 NS_IMETHODIMP
-nsDecreaseFontSizeCommand::DoCommandParams(const char *aCommandName,
-                                           nsICommandParams *aParams,
-                                           nsISupports *refCon)
+DecreaseFontSizeCommand::DoCommandParams(const char* aCommandName,
+                                         nsICommandParams* aParams,
+                                         nsISupports* refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
 
 NS_IMETHODIMP
-nsDecreaseFontSizeCommand::GetCommandStateParams(const char *aCommandName,
-                                                 nsICommandParams *aParams,
-                                                 nsISupports *refCon)
+DecreaseFontSizeCommand::GetCommandStateParams(const char* aCommandName,
+                                               nsICommandParams* aParams,
+                                               nsISupports* refCon)
 {
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
 }
 
 NS_IMETHODIMP
-nsInsertHTMLCommand::IsCommandEnabled(const char * aCommandName,
-                                      nsISupports *refCon,
-                                      bool *outCmdEnabled)
+InsertHTMLCommand::IsCommandEnabled(const char* aCommandName,
+                                    nsISupports* refCon,
+                                    bool* outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsInsertHTMLCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
+InsertHTMLCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
 {
   // If nsInsertHTMLCommand is called with no parameters, it was probably called with
   // an empty string parameter ''. In this case, it should act the same as the delete command
   NS_ENSURE_ARG_POINTER(refCon);
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
@@ -1373,19 +1372,19 @@ nsInsertHTMLCommand::DoCommand(const cha
   if (NS_WARN_IF(!htmlEditor)) {
     return NS_ERROR_FAILURE;
   }
   nsAutoString html;
   return htmlEditor->InsertHTML(html);
 }
 
 NS_IMETHODIMP
-nsInsertHTMLCommand::DoCommandParams(const char *aCommandName,
-                                     nsICommandParams *aParams,
-                                     nsISupports *refCon)
+InsertHTMLCommand::DoCommandParams(const char* aCommandName,
+                                   nsICommandParams* aParams,
+                                   nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(refCon);
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
@@ -1398,59 +1397,59 @@ nsInsertHTMLCommand::DoCommandParams(con
   nsAutoString html;
   nsresult rv = aParams->GetStringValue(STATE_DATA, html);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return htmlEditor->InsertHTML(html);
 }
 
 NS_IMETHODIMP
-nsInsertHTMLCommand::GetCommandStateParams(const char *aCommandName,
-                                           nsICommandParams *aParams,
-                                           nsISupports *refCon)
+InsertHTMLCommand::GetCommandStateParams(const char *aCommandName,
+                                         nsICommandParams *aParams,
+                                         nsISupports *refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(refCon);
 
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED, outCmdEnabled);
 }
 
-nsInsertTagCommand::nsInsertTagCommand(nsAtom* aTagName)
-: nsBaseComposerCommand()
-, mTagName(aTagName)
+InsertTagCommand::InsertTagCommand(nsAtom* aTagName)
+  : HTMLEditorCommandBase()
+  , mTagName(aTagName)
 {
   MOZ_ASSERT(mTagName);
 }
 
-nsInsertTagCommand::~nsInsertTagCommand()
+InsertTagCommand::~InsertTagCommand()
 {
 }
 
 NS_IMETHODIMP
-nsInsertTagCommand::IsCommandEnabled(const char * aCommandName,
-                                     nsISupports *refCon,
-                                     bool *outCmdEnabled)
+InsertTagCommand::IsCommandEnabled(const char* aCommandName,
+                                   nsISupports* refCon,
+                                   bool* outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   mozilla::EditorBase* editorBase = editor->AsEditorBase();
   MOZ_ASSERT(editorBase);
   *outCmdEnabled = editorBase->IsSelectionEditable();
   return NS_OK;
 }
 
 // corresponding STATE_ATTRIBUTE is: src (img) and href (a)
 NS_IMETHODIMP
-nsInsertTagCommand::DoCommand(const char *aCmdName, nsISupports *refCon)
+InsertTagCommand::DoCommand(const char* aCmdName, nsISupports* refCon)
 {
   NS_ENSURE_TRUE(mTagName == nsGkAtoms::hr, NS_ERROR_NOT_IMPLEMENTED);
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_FAILURE;
   }
   mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
@@ -1462,19 +1461,19 @@ nsInsertTagCommand::DoCommand(const char
   nsresult rv = htmlEditor->CreateElementWithDefaults(
     nsDependentAtomString(mTagName), getter_AddRefs(newElement));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return htmlEditor->InsertElementAtSelection(newElement, true);
 }
 
 NS_IMETHODIMP
-nsInsertTagCommand::DoCommandParams(const char *aCommandName,
-                                    nsICommandParams *aParams,
-                                    nsISupports *refCon)
+InsertTagCommand::DoCommandParams(const char *aCommandName,
+                                  nsICommandParams *aParams,
+                                  nsISupports *refCon)
 {
   NS_ENSURE_ARG_POINTER(refCon);
 
   // inserting an hr shouldn't have an parameters, just call DoCommand for that
   if (mTagName == nsGkAtoms::hr) {
     return DoCommand(aCommandName, refCon);
   }
 
@@ -1523,37 +1522,35 @@ nsInsertTagCommand::DoCommandParams(cons
   // do actual insertion
   if (mTagName == nsGkAtoms::a) {
     return htmlEditor->InsertLinkAroundSelection(elem);
   }
   return htmlEditor->InsertElementAtSelection(elem, true);
 }
 
 NS_IMETHODIMP
-nsInsertTagCommand::GetCommandStateParams(const char *aCommandName,
-                                          nsICommandParams *aParams,
-                                          nsISupports *refCon)
+InsertTagCommand::GetCommandStateParams(const char *aCommandName,
+                                        nsICommandParams *aParams,
+                                        nsISupports *refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(refCon);
 
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED, outCmdEnabled);
 }
 
 
 /****************************/
 //HELPER METHODS
 /****************************/
 
 static nsresult
-GetListState(mozilla::HTMLEditor* aHTMLEditor,
-             bool* aMixed,
-             nsAString& aLocalName)
+GetListState(HTMLEditor* aHTMLEditor, bool* aMixed, nsAString& aLocalName)
 {
   MOZ_ASSERT(aHTMLEditor);
   MOZ_ASSERT(aMixed);
 
   *aMixed = false;
   aLocalName.Truncate();
 
   bool bOL, bUL, bDL;
@@ -1568,8 +1565,10 @@ GetListState(mozilla::HTMLEditor* aHTMLE
     aLocalName.AssignLiteral("ol");
   } else if (bUL) {
     aLocalName.AssignLiteral("ul");
   } else if (bDL) {
     aLocalName.AssignLiteral("dl");
   }
   return NS_OK;
 }
+
+} // namespace mozilla
rename from editor/composer/nsComposerCommands.h
rename to editor/composer/HTMLEditorCommands.h
--- a/editor/composer/nsComposerCommands.h
+++ b/editor/composer/HTMLEditorCommands.h
@@ -1,303 +1,287 @@
 /* -*- 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 nsComposerCommands_h_
-#define nsComposerCommands_h_
+#ifndef mozilla_HTMLEditorCommands_h_
+#define mozilla_HTMLEditorCommands_h_
 
 #include "nsIControllerCommand.h"
 #include "nsISupportsImpl.h"            // for NS_DECL_ISUPPORTS_INHERITED, etc
 #include "nsStringFwd.h"
 #include "nscore.h"                     // for nsresult, NS_IMETHOD
 
 class nsAtom;
 class nsICommandParams;
 class nsISupports;
 
 namespace mozilla {
 class HTMLEditor;
-} // namespace mozilla
 
 // This is a virtual base class for commands registered with the composer controller.
 // Note that such commands are instantiated once per composer, so can store state.
 // Also note that IsCommandEnabled can be called with an editor that may not
 // have an editor yet (because the document is loading). Most commands will want
 // to return false in this case.
 // Don't hold on to any references to the editor or document from
 // your command. This will cause leaks. Also, be aware that the document the
 // editor is editing can change under you (if the user Reverts the file, for
 // instance).
-class nsBaseComposerCommand : public nsIControllerCommand
+class HTMLEditorCommandBase : public nsIControllerCommand
 {
 protected:
-  virtual ~nsBaseComposerCommand() {}
+  virtual ~HTMLEditorCommandBase() {}
 
 public:
-
-  nsBaseComposerCommand();
+  HTMLEditorCommandBase();
 
   // nsISupports
   NS_DECL_ISUPPORTS
-
-  // nsIControllerCommand. Declared longhand so we can make them pure virtual
-  NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) override = 0;
-  NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandRefCon) override = 0;
-
 };
 
 
 #define NS_DECL_COMPOSER_COMMAND(_cmd)                  \
-class _cmd : public nsBaseComposerCommand               \
+class _cmd final : public HTMLEditorCommandBase         \
 {                                                       \
 public:                                                 \
   NS_DECL_NSICONTROLLERCOMMAND                          \
 };
 
 // virtual base class for commands that need to save and update Boolean state (like styles etc)
-class nsBaseStateUpdatingCommand : public nsBaseComposerCommand
+class StateUpdatingCommandBase : public HTMLEditorCommandBase
 {
 public:
-  explicit nsBaseStateUpdatingCommand(nsAtom* aTagName);
+  explicit StateUpdatingCommandBase(nsAtom* aTagName);
 
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsBaseStateUpdatingCommand,
-                                       nsBaseComposerCommand)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(StateUpdatingCommandBase,
+                                       HTMLEditorCommandBase)
 
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
-  virtual ~nsBaseStateUpdatingCommand();
+  virtual ~StateUpdatingCommandBase();
 
   // get the current state (on or off) for this style or block format
-  virtual nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  virtual nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                                    nsICommandParams* aParams) = 0;
 
   // add/remove the style
-  virtual nsresult ToggleState(mozilla::HTMLEditor* aHTMLEditor) = 0;
+  virtual nsresult ToggleState(HTMLEditor* aHTMLEditor) = 0;
 
 protected:
   nsAtom* mTagName;
 };
 
 
 // Shared class for the various style updating commands like bold, italics etc.
 // Suitable for commands whose state is either 'on' or 'off'.
-class nsStyleUpdatingCommand final : public nsBaseStateUpdatingCommand
+class StyleUpdatingCommand final : public StateUpdatingCommandBase
 {
 public:
-  explicit nsStyleUpdatingCommand(nsAtom* aTagName);
+  explicit StyleUpdatingCommand(nsAtom* aTagName);
 
 protected:
-
   // get the current state (on or off) for this style or block format
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
 
   // add/remove the style
-  nsresult ToggleState(mozilla::HTMLEditor* aHTMLEditor) final;
+  nsresult ToggleState(HTMLEditor* aHTMLEditor) final;
 };
 
 
-class nsInsertTagCommand : public nsBaseComposerCommand
+class InsertTagCommand final : public HTMLEditorCommandBase
 {
 public:
-  explicit nsInsertTagCommand(nsAtom* aTagName);
+  explicit InsertTagCommand(nsAtom* aTagName);
 
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsInsertTagCommand, nsBaseComposerCommand)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(InsertTagCommand, HTMLEditorCommandBase)
 
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
-  virtual ~nsInsertTagCommand();
+  virtual ~InsertTagCommand();
 
   nsAtom* mTagName;
 };
 
 
-class nsListCommand final : public nsBaseStateUpdatingCommand
+class ListCommand final : public StateUpdatingCommandBase
 {
 public:
-  explicit nsListCommand(nsAtom* aTagName);
+  explicit ListCommand(nsAtom* aTagName);
 
 protected:
-
   // get the current state (on or off) for this style or block format
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
 
   // add/remove the style
-  nsresult ToggleState(mozilla::HTMLEditor* aHTMLEditor) final;
+  nsresult ToggleState(HTMLEditor* aHTMLEditor) final;
 };
 
-class nsListItemCommand final : public nsBaseStateUpdatingCommand
+class ListItemCommand final : public StateUpdatingCommandBase
 {
 public:
-  explicit nsListItemCommand(nsAtom* aTagName);
+  explicit ListItemCommand(nsAtom* aTagName);
 
 protected:
-
   // get the current state (on or off) for this style or block format
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
 
   // add/remove the style
-  nsresult ToggleState(mozilla::HTMLEditor* aHTMLEditor) final;
+  nsresult ToggleState(HTMLEditor* aHTMLEditor) final;
 };
 
 // Base class for commands whose state consists of a string (e.g. para format)
-class nsMultiStateCommand : public nsBaseComposerCommand
+class MultiStateCommandBase : public HTMLEditorCommandBase
 {
 public:
+  MultiStateCommandBase();
 
-  nsMultiStateCommand();
-
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsMultiStateCommand, nsBaseComposerCommand)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(MultiStateCommandBase,
+                                       HTMLEditorCommandBase)
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
-  virtual ~nsMultiStateCommand();
+  virtual ~MultiStateCommandBase();
 
-  virtual nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  virtual nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                                    nsICommandParams* aParams) = 0;
-  virtual nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                            nsString& newState) = 0;
+  virtual nsresult SetState(HTMLEditor* aHTMLEditor,
+                            const nsString& newState) = 0;
 
 };
 
 
-class nsParagraphStateCommand final : public nsMultiStateCommand
+class ParagraphStateCommand final : public MultiStateCommandBase
 {
 public:
-                   nsParagraphStateCommand();
+  ParagraphStateCommand();
 
 protected:
-
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsFontFaceStateCommand final : public nsMultiStateCommand
+class FontFaceStateCommand final : public MultiStateCommandBase
 {
 public:
-                   nsFontFaceStateCommand();
+  FontFaceStateCommand();
 
 protected:
-
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsFontSizeStateCommand final : public nsMultiStateCommand
+class FontSizeStateCommand final : public MultiStateCommandBase
 {
 public:
-                   nsFontSizeStateCommand();
+  FontSizeStateCommand();
 
 protected:
-
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsHighlightColorStateCommand final : public nsMultiStateCommand
+class HighlightColorStateCommand final : public MultiStateCommandBase
 {
 public:
-                   nsHighlightColorStateCommand();
+  HighlightColorStateCommand();
 
 protected:
-
   NS_IMETHOD IsCommandEnabled(const char* aCommandName,
                               nsISupports* aCommandRefCon,
                               bool* _retval) final;
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsFontColorStateCommand final : public nsMultiStateCommand
+class FontColorStateCommand final : public MultiStateCommandBase
 {
 public:
-                   nsFontColorStateCommand();
+  FontColorStateCommand();
 
 protected:
-
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsAlignCommand final : public nsMultiStateCommand
+class AlignCommand final : public MultiStateCommandBase
 {
 public:
-                   nsAlignCommand();
+  AlignCommand();
 
 protected:
-
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsBackgroundColorStateCommand final : public nsMultiStateCommand
+class BackgroundColorStateCommand final : public MultiStateCommandBase
 {
 public:
-                   nsBackgroundColorStateCommand();
+  BackgroundColorStateCommand();
 
 protected:
-
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
-                    nsString& newState) final;
+  nsresult SetState(HTMLEditor* aHTMLEditor,
+                    const nsString& newState) final;
 };
 
-class nsAbsolutePositioningCommand final : public nsBaseStateUpdatingCommand
+class AbsolutePositioningCommand final : public StateUpdatingCommandBase
 {
 public:
-  nsAbsolutePositioningCommand();
+  AbsolutePositioningCommand();
 
 protected:
-
   NS_IMETHOD IsCommandEnabled(const char* aCommandName,
                               nsISupports* aCommandRefCon,
                               bool* _retval) final;
-  nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
+  nsresult GetCurrentState(HTMLEditor* aHTMLEditor,
                            nsICommandParams* aParams) final;
-  nsresult ToggleState(mozilla::HTMLEditor* aHTMLEditor) final;
+  nsresult ToggleState(HTMLEditor* aHTMLEditor) final;
 };
 
 // composer commands
 
-NS_DECL_COMPOSER_COMMAND(nsDocumentStateCommand)
-NS_DECL_COMPOSER_COMMAND(nsSetDocumentStateCommand)
-NS_DECL_COMPOSER_COMMAND(nsSetDocumentOptionsCommand)
+NS_DECL_COMPOSER_COMMAND(DocumentStateCommand)
+NS_DECL_COMPOSER_COMMAND(SetDocumentStateCommand)
+NS_DECL_COMPOSER_COMMAND(SetDocumentOptionsCommand)
 
-NS_DECL_COMPOSER_COMMAND(nsDecreaseZIndexCommand)
-NS_DECL_COMPOSER_COMMAND(nsIncreaseZIndexCommand)
+NS_DECL_COMPOSER_COMMAND(DecreaseZIndexCommand)
+NS_DECL_COMPOSER_COMMAND(IncreaseZIndexCommand)
 
 // Generic commands
 
 // Edit menu
-NS_DECL_COMPOSER_COMMAND(nsPasteNoFormattingCommand)
+NS_DECL_COMPOSER_COMMAND(PasteNoFormattingCommand)
 
 // Block transformations
-NS_DECL_COMPOSER_COMMAND(nsIndentCommand)
-NS_DECL_COMPOSER_COMMAND(nsOutdentCommand)
+NS_DECL_COMPOSER_COMMAND(IndentCommand)
+NS_DECL_COMPOSER_COMMAND(OutdentCommand)
 
-NS_DECL_COMPOSER_COMMAND(nsRemoveListCommand)
-NS_DECL_COMPOSER_COMMAND(nsRemoveStylesCommand)
-NS_DECL_COMPOSER_COMMAND(nsIncreaseFontSizeCommand)
-NS_DECL_COMPOSER_COMMAND(nsDecreaseFontSizeCommand)
+NS_DECL_COMPOSER_COMMAND(RemoveListCommand)
+NS_DECL_COMPOSER_COMMAND(RemoveStylesCommand)
+NS_DECL_COMPOSER_COMMAND(IncreaseFontSizeCommand)
+NS_DECL_COMPOSER_COMMAND(DecreaseFontSizeCommand)
 
 // Insert content commands
-NS_DECL_COMPOSER_COMMAND(nsInsertHTMLCommand)
+NS_DECL_COMPOSER_COMMAND(InsertHTMLCommand)
 
-#endif // nsComposerCommands_h_
+} // namespace mozilla
+
+#endif // mozilla_HTMLEditorCommands_h_
--- a/editor/composer/HTMLEditorController.cpp
+++ b/editor/composer/HTMLEditorController.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/HTMLEditorController.h"
 
+#include "mozilla/HTMLEditorCommands.h" // for StyleUpdatingCommand, etc
 #include "mozilla/mozalloc.h"           // for operator new
-#include "nsComposerCommands.h"         // for nsStyleUpdatingCommand, etc
 #include "nsError.h"                    // for NS_OK
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::a, etc
 #include "nsIControllerCommandTable.h"  // for nsIControllerCommandTable
 
 class nsIControllerCommand;
 
 namespace mozilla {
 
@@ -53,94 +53,94 @@ namespace mozilla {
 
 
 // static
 nsresult
 HTMLEditorController::RegisterEditorDocStateCommands(
                         nsIControllerCommandTable *inCommandTable)
 {
   // observer commands for document state
-  NS_REGISTER_FIRST_COMMAND(nsDocumentStateCommand, "obs_documentCreated")
-  NS_REGISTER_NEXT_COMMAND(nsDocumentStateCommand, "obs_documentWillBeDestroyed")
-  NS_REGISTER_LAST_COMMAND(nsDocumentStateCommand, "obs_documentLocationChanged")
+  NS_REGISTER_FIRST_COMMAND(DocumentStateCommand, "obs_documentCreated")
+  NS_REGISTER_NEXT_COMMAND(DocumentStateCommand, "obs_documentWillBeDestroyed")
+  NS_REGISTER_LAST_COMMAND(DocumentStateCommand, "obs_documentLocationChanged")
 
   // commands that may get or change state
-  NS_REGISTER_FIRST_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentModified")
-  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentUseCSS")
-  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentReadOnly")
-  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_insertBrOnReturn")
-  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_defaultParagraphSeparator")
-  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_enableObjectResizing")
-  NS_REGISTER_LAST_COMMAND(nsSetDocumentStateCommand, "cmd_enableInlineTableEditing")
+  NS_REGISTER_FIRST_COMMAND(SetDocumentStateCommand, "cmd_setDocumentModified")
+  NS_REGISTER_NEXT_COMMAND(SetDocumentStateCommand, "cmd_setDocumentUseCSS")
+  NS_REGISTER_NEXT_COMMAND(SetDocumentStateCommand, "cmd_setDocumentReadOnly")
+  NS_REGISTER_NEXT_COMMAND(SetDocumentStateCommand, "cmd_insertBrOnReturn")
+  NS_REGISTER_NEXT_COMMAND(SetDocumentStateCommand, "cmd_defaultParagraphSeparator")
+  NS_REGISTER_NEXT_COMMAND(SetDocumentStateCommand, "cmd_enableObjectResizing")
+  NS_REGISTER_LAST_COMMAND(SetDocumentStateCommand, "cmd_enableInlineTableEditing")
 
-  NS_REGISTER_ONE_COMMAND(nsSetDocumentOptionsCommand, "cmd_setDocumentOptions")
+  NS_REGISTER_ONE_COMMAND(SetDocumentOptionsCommand, "cmd_setDocumentOptions")
 
   return NS_OK;
 }
 
 // static
 nsresult
 HTMLEditorController::RegisterHTMLEditorCommands(
                         nsIControllerCommandTable *inCommandTable)
 {
   // Edit menu
-  NS_REGISTER_ONE_COMMAND(nsPasteNoFormattingCommand, "cmd_pasteNoFormatting");
+  NS_REGISTER_ONE_COMMAND(PasteNoFormattingCommand, "cmd_pasteNoFormatting");
 
   // indent/outdent
-  NS_REGISTER_ONE_COMMAND(nsIndentCommand, "cmd_indent");
-  NS_REGISTER_ONE_COMMAND(nsOutdentCommand, "cmd_outdent");
+  NS_REGISTER_ONE_COMMAND(IndentCommand, "cmd_indent");
+  NS_REGISTER_ONE_COMMAND(OutdentCommand, "cmd_outdent");
 
   // Styles
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_bold", nsGkAtoms::b);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_italic", nsGkAtoms::i);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_underline", nsGkAtoms::u);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_tt", nsGkAtoms::tt);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_bold", nsGkAtoms::b);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_italic", nsGkAtoms::i);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_underline", nsGkAtoms::u);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_tt", nsGkAtoms::tt);
 
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_strikethrough", nsGkAtoms::strike);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_superscript", nsGkAtoms::sup);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_subscript", nsGkAtoms::sub);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_nobreak", nsGkAtoms::nobr);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_strikethrough", nsGkAtoms::strike);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_superscript", nsGkAtoms::sup);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_subscript", nsGkAtoms::sub);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_nobreak", nsGkAtoms::nobr);
 
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_em", nsGkAtoms::em);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_strong", nsGkAtoms::strong);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_cite", nsGkAtoms::cite);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_abbr", nsGkAtoms::abbr);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_acronym", nsGkAtoms::acronym);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_code", nsGkAtoms::code);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_samp", nsGkAtoms::samp);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_var", nsGkAtoms::var);
-  NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_removeLinks", nsGkAtoms::href);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_em", nsGkAtoms::em);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_strong", nsGkAtoms::strong);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_cite", nsGkAtoms::cite);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_abbr", nsGkAtoms::abbr);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_acronym", nsGkAtoms::acronym);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_code", nsGkAtoms::code);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_samp", nsGkAtoms::samp);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_var", nsGkAtoms::var);
+  NS_REGISTER_STYLE_COMMAND(StyleUpdatingCommand, "cmd_removeLinks", nsGkAtoms::href);
 
   // lists
-  NS_REGISTER_STYLE_COMMAND(nsListCommand,     "cmd_ol", nsGkAtoms::ol);
-  NS_REGISTER_STYLE_COMMAND(nsListCommand,     "cmd_ul", nsGkAtoms::ul);
-  NS_REGISTER_STYLE_COMMAND(nsListItemCommand, "cmd_dt", nsGkAtoms::dt);
-  NS_REGISTER_STYLE_COMMAND(nsListItemCommand, "cmd_dd", nsGkAtoms::dd);
-  NS_REGISTER_ONE_COMMAND(nsRemoveListCommand, "cmd_removeList");
+  NS_REGISTER_STYLE_COMMAND(ListCommand,     "cmd_ol", nsGkAtoms::ol);
+  NS_REGISTER_STYLE_COMMAND(ListCommand,     "cmd_ul", nsGkAtoms::ul);
+  NS_REGISTER_STYLE_COMMAND(ListItemCommand, "cmd_dt", nsGkAtoms::dt);
+  NS_REGISTER_STYLE_COMMAND(ListItemCommand, "cmd_dd", nsGkAtoms::dd);
+  NS_REGISTER_ONE_COMMAND(RemoveListCommand, "cmd_removeList");
 
   // format stuff
-  NS_REGISTER_ONE_COMMAND(nsParagraphStateCommand,       "cmd_paragraphState");
-  NS_REGISTER_ONE_COMMAND(nsFontFaceStateCommand,        "cmd_fontFace");
-  NS_REGISTER_ONE_COMMAND(nsFontSizeStateCommand,        "cmd_fontSize");
-  NS_REGISTER_ONE_COMMAND(nsFontColorStateCommand,       "cmd_fontColor");
-  NS_REGISTER_ONE_COMMAND(nsBackgroundColorStateCommand, "cmd_backgroundColor");
-  NS_REGISTER_ONE_COMMAND(nsHighlightColorStateCommand,  "cmd_highlight");
+  NS_REGISTER_ONE_COMMAND(ParagraphStateCommand,       "cmd_paragraphState");
+  NS_REGISTER_ONE_COMMAND(FontFaceStateCommand,        "cmd_fontFace");
+  NS_REGISTER_ONE_COMMAND(FontSizeStateCommand,        "cmd_fontSize");
+  NS_REGISTER_ONE_COMMAND(FontColorStateCommand,       "cmd_fontColor");
+  NS_REGISTER_ONE_COMMAND(BackgroundColorStateCommand, "cmd_backgroundColor");
+  NS_REGISTER_ONE_COMMAND(HighlightColorStateCommand,  "cmd_highlight");
 
-  NS_REGISTER_ONE_COMMAND(nsAlignCommand, "cmd_align");
-  NS_REGISTER_ONE_COMMAND(nsRemoveStylesCommand, "cmd_removeStyles");
+  NS_REGISTER_ONE_COMMAND(AlignCommand, "cmd_align");
+  NS_REGISTER_ONE_COMMAND(RemoveStylesCommand, "cmd_removeStyles");
 
-  NS_REGISTER_ONE_COMMAND(nsIncreaseFontSizeCommand, "cmd_increaseFont");
-  NS_REGISTER_ONE_COMMAND(nsDecreaseFontSizeCommand, "cmd_decreaseFont");
+  NS_REGISTER_ONE_COMMAND(IncreaseFontSizeCommand, "cmd_increaseFont");
+  NS_REGISTER_ONE_COMMAND(DecreaseFontSizeCommand, "cmd_decreaseFont");
 
   // Insert content
-  NS_REGISTER_ONE_COMMAND(nsInsertHTMLCommand, "cmd_insertHTML");
-  NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertLinkNoUI", nsGkAtoms::a);
-  NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertImageNoUI", nsGkAtoms::img);
-  NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertHR", nsGkAtoms::hr);
+  NS_REGISTER_ONE_COMMAND(InsertHTMLCommand, "cmd_insertHTML");
+  NS_REGISTER_TAG_COMMAND(InsertTagCommand, "cmd_insertLinkNoUI", nsGkAtoms::a);
+  NS_REGISTER_TAG_COMMAND(InsertTagCommand, "cmd_insertImageNoUI", nsGkAtoms::img);
+  NS_REGISTER_TAG_COMMAND(InsertTagCommand, "cmd_insertHR", nsGkAtoms::hr);
 
-  NS_REGISTER_ONE_COMMAND(nsAbsolutePositioningCommand, "cmd_absPos");
-  NS_REGISTER_ONE_COMMAND(nsDecreaseZIndexCommand, "cmd_decreaseZIndex");
-  NS_REGISTER_ONE_COMMAND(nsIncreaseZIndexCommand, "cmd_increaseZIndex");
+  NS_REGISTER_ONE_COMMAND(AbsolutePositioningCommand, "cmd_absPos");
+  NS_REGISTER_ONE_COMMAND(DecreaseZIndexCommand, "cmd_decreaseZIndex");
+  NS_REGISTER_ONE_COMMAND(IncreaseZIndexCommand, "cmd_increaseZIndex");
 
   return NS_OK;
 }
 
 } // namespace mozilla
rename from editor/composer/nsComposerDocumentCommands.cpp
rename to editor/composer/HTMLEditorDocumentCommands.cpp
--- a/editor/composer/nsComposerDocumentCommands.cpp
+++ b/editor/composer/HTMLEditorDocumentCommands.cpp
@@ -1,91 +1,90 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "mozilla/HTMLEditor.h"         // for HTMLEditor
+#include "mozilla/HTMLEditorCommands.h" // for SetDocumentOptionsCommand, etc
 #include "mozilla/TextEditor.h"         // for TextEditor
 #include "nsCOMPtr.h"                   // for nsCOMPtr, do_QueryInterface, etc
 #include "nsCRT.h"                      // for nsCRT
-#include "nsComposerCommands.h"         // for nsSetDocumentOptionsCommand, etc
 #include "nsDebug.h"                    // for NS_ENSURE_ARG_POINTER, etc
 #include "nsError.h"                    // for NS_ERROR_INVALID_ARG, etc
 #include "nsICommandParams.h"           // for nsICommandParams
 #include "nsIDocShell.h"                // for nsIDocShell
 #include "nsIDocument.h"                // for nsIDocument
 #include "nsIEditingSession.h"          // for nsIEditingSession, etc
 #include "nsIEditor.h"                  // for nsIEditor
 #include "nsIPlaintextEditor.h"         // for nsIPlaintextEditor, etc
 #include "nsIPresShell.h"               // for nsIPresShell
 #include "nsISelectionController.h"     // for nsISelectionController
 #include "nsISupportsImpl.h"            // for nsPresContext::Release
 #include "nsISupportsUtils.h"           // for NS_IF_ADDREF
 #include "nsIURI.h"                     // for nsIURI
 #include "nsPresContext.h"              // for nsPresContext
 #include "nscore.h"                     // for NS_IMETHODIMP, nsresult, etc
 
-using namespace mozilla;
-
 class nsISupports;
 
 //defines
 #define STATE_ENABLED  "state_enabled"
 #define STATE_ALL "state_all"
 #define STATE_ATTRIBUTE "state_attribute"
 #define STATE_DATA "state_data"
 
+namespace mozilla {
 
 NS_IMETHODIMP
-nsSetDocumentOptionsCommand::IsCommandEnabled(const char * aCommandName,
-                                              nsISupports *refCon,
-                                              bool *outCmdEnabled)
+SetDocumentOptionsCommand::IsCommandEnabled(const char* aCommandName,
+                                            nsISupports* refCon,
+                                            bool* outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
     return NS_OK;
   }
   TextEditor* textEditor = editor->AsTextEditor();
   MOZ_ASSERT(textEditor);
   *outCmdEnabled = textEditor->IsSelectionEditable();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSetDocumentOptionsCommand::DoCommand(const char *aCommandName,
-                                       nsISupports *refCon)
+SetDocumentOptionsCommand::DoCommand(const char* aCommandName,
+                                     nsISupports* refCon)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsSetDocumentOptionsCommand::DoCommandParams(const char *aCommandName,
-                                             nsICommandParams *aParams,
-                                             nsISupports *refCon)
+SetDocumentOptionsCommand::DoCommandParams(const char* aCommandName,
+                                           nsICommandParams* aParams,
+                                           nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_INVALID_ARG;
   }
   TextEditor* textEditor = editor->AsTextEditor();
   MOZ_ASSERT(textEditor);
 
   RefPtr<nsPresContext> presContext = textEditor->GetPresContext();
   if (NS_WARN_IF(!presContext)) {
     return NS_ERROR_FAILURE;
   }
 
   int32_t animationMode;
-  rv = aParams->GetLongValue("imageAnimation", &animationMode);
+  nsresult rv = aParams->GetLongValue("imageAnimation", &animationMode);
   if (NS_SUCCEEDED(rv)) {
     // for possible values of animation mode, see:
     // http://lxr.mozilla.org/seamonkey/source/image/public/imgIContainer.idl
     presContext->SetImageAnimationMode(animationMode);
   }
 
   bool allowPlugins;
   rv = aParams->GetBooleanValue("plugins", &allowPlugins);
@@ -96,19 +95,19 @@ nsSetDocumentOptionsCommand::DoCommandPa
     rv = docShell->SetAllowPlugins(allowPlugins);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSetDocumentOptionsCommand::GetCommandStateParams(const char *aCommandName,
-                                                   nsICommandParams *aParams,
-                                                   nsISupports *refCon)
+SetDocumentOptionsCommand::GetCommandStateParams(const char* aCommandName,
+                                                 nsICommandParams* aParams,
+                                                 nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(refCon);
 
   // The base editor owns most state info
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_INVALID_ARG;
@@ -158,37 +157,37 @@ nsSetDocumentOptionsCommand::GetCommandS
  *  Commands for document state that may be changed via doCommandParams
  *  As of 11/11/02, this is just "cmd_setDocumentModified"
  *  Note that you can use the same command class, nsSetDocumentStateCommand,
  *    for more than one of this type of command
  *    We check the input command param for different behavior
  */
 
 NS_IMETHODIMP
-nsSetDocumentStateCommand::IsCommandEnabled(const char * aCommandName,
-                                            nsISupports *refCon,
-                                            bool *outCmdEnabled)
+SetDocumentStateCommand::IsCommandEnabled(const char* aCommandName,
+                                          nsISupports* refCon,
+                                          bool* outCmdEnabled)
 {
   // These commands are always enabled
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   *outCmdEnabled = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSetDocumentStateCommand::DoCommand(const char *aCommandName,
-                                     nsISupports *refCon)
+SetDocumentStateCommand::DoCommand(const char* aCommandName,
+                                   nsISupports* refCon)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsSetDocumentStateCommand::DoCommandParams(const char *aCommandName,
-                                           nsICommandParams *aParams,
-                                           nsISupports *refCon)
+SetDocumentStateCommand::DoCommandParams(const char* aCommandName,
+                                         nsICommandParams* aParams,
+                                         nsISupports* refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_INVALID_ARG;
   }
   TextEditor* textEditor = editor->AsTextEditor();
   MOZ_ASSERT(textEditor);
 
@@ -310,19 +309,19 @@ nsSetDocumentStateCommand::DoCommandPara
 
     return htmlEditor->SetInlineTableEditingEnabled(enabled);
   }
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
-                                                 nsICommandParams *aParams,
-                                                 nsISupports *refCon)
+SetDocumentStateCommand::GetCommandStateParams(const char* aCommandName,
+                                               nsICommandParams* aParams,
+                                               nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(refCon);
 
   // The base editor owns most state info
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (NS_WARN_IF(!editor)) {
     return NS_ERROR_INVALID_ARG;
@@ -461,45 +460,45 @@ nsSetDocumentStateCommand::GetCommandSta
  *  5. Use GetCommandStateParams() to obtain state information
  *     e.g., any creation state codes when creating an editor are
  *     supplied for "obs_documentCreated" command in the
  *     "state_data" param's value
  *
  */
 
 NS_IMETHODIMP
-nsDocumentStateCommand::IsCommandEnabled(const char* aCommandName,
-                                         nsISupports *refCon,
-                                         bool *outCmdEnabled)
+DocumentStateCommand::IsCommandEnabled(const char* aCommandName,
+                                       nsISupports* refCon,
+                                       bool* outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   // Always return false to discourage callers from using DoCommand()
   *outCmdEnabled = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocumentStateCommand::DoCommand(const char *aCommandName,
-                                  nsISupports *refCon)
+DocumentStateCommand::DoCommand(const char* aCommandName,
+                                nsISupports* refCon)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsDocumentStateCommand::DoCommandParams(const char *aCommandName,
-                                        nsICommandParams *aParams,
-                                        nsISupports *refCon)
+DocumentStateCommand::DoCommandParams(const char* aCommandName,
+                                      nsICommandParams* aParams,
+                                      nsISupports* refCon)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
-                                              nsICommandParams *aParams,
-                                              nsISupports *refCon)
+DocumentStateCommand::GetCommandStateParams(const char* aCommandName,
+                                            nsICommandParams* aParams,
+                                            nsISupports* refCon)
 {
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(aCommandName);
   nsresult rv;
 
   if (!nsCRT::strcmp(aCommandName, "obs_documentCreated")) {
     uint32_t editorStatus = nsIEditingSession::eEditorErrorUnknown;
 
@@ -540,8 +539,10 @@ nsDocumentStateCommand::GetCommandStateP
     nsIURI *uri = doc->GetDocumentURI();
     NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
 
     return aParams->SetISupportsValue(STATE_DATA, (nsISupports*)uri);
   }
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
+
+} // namespace mozilla
--- a/editor/composer/moz.build
+++ b/editor/composer/moz.build
@@ -11,25 +11,26 @@ MOCHITEST_CHROME_MANIFESTS += ['test/chr
 XPIDL_SOURCES += [
     'nsIEditingSession.idl',
 ]
 
 XPIDL_MODULE = 'composer'
 
 UNIFIED_SOURCES += [
     'ComposerCommandsUpdater.cpp',
+    'HTMLEditorCommands.cpp',
     'HTMLEditorController.cpp',
-    'nsComposerCommands.cpp',
-    'nsComposerDocumentCommands.cpp',
+    'HTMLEditorDocumentCommands.cpp',
     'nsComposerRegistration.cpp',
     'nsEditingSession.cpp',
 ]
 
 EXPORTS.mozilla += [
     'ComposerCommandsUpdater.h',
+    'HTMLEditorCommands.h',
     'HTMLEditorController.h',
 ]
 
 # Needed because we include HTMLEditor.h which indirectly includes nsDocument.h
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/html',  # For nsHTMLDocument
     '/editor/spellchecker', # nsComposeTxtSrvFilter.h