Bug 1546578 - part 2: Make all editor command classes derived from `EditorCommand` class r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 26 Apr 2019 03:20:02 +0000
changeset 530495 fa8572b81eaac032bafe2b38028746f7491dbffe
parent 530494 adbd46962f21820f20a236c66fe1f3bdb57e52b4
child 530496 bc7f7e832c4e8635df5b267e3c0a534ccc11424c
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1546578
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546578 - part 2: Make all editor command classes derived from `EditorCommand` class r=m_kato This patch makes all editor command classes derived from `EditorCommand` class. So, this allows `nsHTMLEditor::ExecCommand()` to access them directly in the future. Differential Revision: https://phabricator.services.mozilla.com/D28683
editor/libeditor/EditorCommands.cpp
editor/libeditor/EditorCommands.h
editor/libeditor/HTMLEditorCommands.cpp
--- a/editor/libeditor/EditorCommands.cpp
+++ b/editor/libeditor/EditorCommands.cpp
@@ -27,22 +27,20 @@
 class nsISupports;
 
 #define STATE_ENABLED "state_enabled"
 #define STATE_DATA "state_data"
 
 namespace mozilla {
 
 /******************************************************************************
- * mozilla::EditorCommandBase
+ * mozilla::EditorCommand
  ******************************************************************************/
 
-EditorCommandBase::EditorCommandBase() {}
-
-NS_IMPL_ISUPPORTS(EditorCommandBase, nsIControllerCommand)
+NS_IMPL_ISUPPORTS(EditorCommand, nsIControllerCommand)
 
 /******************************************************************************
  * mozilla::UndoCommand
  ******************************************************************************/
 
 StaticRefPtr<UndoCommand> UndoCommand::sInstance;
 
 NS_IMETHODIMP
--- a/editor/libeditor/EditorCommands.h
+++ b/editor/libeditor/EditorCommands.h
@@ -20,63 +20,63 @@ namespace mozilla {
 class HTMLEditor;
 
 /**
  * This is a base class for commands registered with the editor controller.
  * Note that such commands are designed as singleton classes.  So, MUST be
  * stateless. Any state must be stored via the refCon (an nsIEditor).
  */
 
-class EditorCommandBase : public nsIControllerCommand {
+class EditorCommand : public nsIControllerCommand {
  public:
   NS_DECL_ISUPPORTS
 
-  NS_IMETHOD IsCommandEnabled(const char* aCommandName,
-                              nsISupports* aCommandRefCon,
-                              bool* aIsEnabled) override = 0;
-  MOZ_CAN_RUN_SCRIPT
-  NS_IMETHOD DoCommand(const char* aCommandName,
-                       nsISupports* aCommandRefCon) override = 0;
-
  protected:
-  EditorCommandBase();
-  virtual ~EditorCommandBase() {}
+  EditorCommand() = default;
+  virtual ~EditorCommand() = default;
 };
 
-#define NS_DECL_EDITOR_COMMAND(_cmd)                                        \
-  class _cmd final : public EditorCommandBase {                             \
-   public:                                                                  \
-    NS_IMETHOD IsCommandEnabled(const char* aCommandName,                   \
-                                nsISupports* aCommandRefCon,                \
-                                bool* aIsEnabled) override;                 \
-    MOZ_CAN_RUN_SCRIPT                                                      \
-    NS_IMETHOD DoCommand(const char* aCommandName,                          \
-                         nsISupports* aCommandRefCon) override;             \
-    MOZ_CAN_RUN_SCRIPT                                                      \
-    NS_IMETHOD DoCommandParams(const char* aCommandName,                    \
-                               nsICommandParams* aParams,                   \
-                               nsISupports* aCommandRefCon) override;       \
-    NS_IMETHOD GetCommandStateParams(const char* aCommandName,              \
-                                     nsICommandParams* aParams,             \
-                                     nsISupports* aCommandRefCon) override; \
-    static _cmd* GetInstance() {                                            \
-      if (!sInstance) {                                                     \
-        sInstance = new _cmd();                                             \
-      }                                                                     \
-      return sInstance;                                                     \
-    }                                                                       \
-                                                                            \
-    static void Shutdown() { sInstance = nullptr; }                         \
-                                                                            \
-   protected:                                                               \
-    _cmd() = default;                                                       \
-    virtual ~_cmd() = default;                                              \
-                                                                            \
-   private:                                                                 \
-    static StaticRefPtr<_cmd> sInstance;                                    \
+#define NS_DECL_EDITOR_COMMAND_METHODS(_cmd)                                  \
+ public:                                                                      \
+  NS_IMETHOD IsCommandEnabled(const char* aCommandName,                       \
+                              nsISupports* aCommandRefCon, bool* aIsEnabled)  \
+      override;                                                               \
+  MOZ_CAN_RUN_SCRIPT                                                          \
+  NS_IMETHOD DoCommand(const char* aCommandName, nsISupports* aCommandRefCon) \
+      override;                                                               \
+  MOZ_CAN_RUN_SCRIPT                                                          \
+  NS_IMETHOD DoCommandParams(const char* aCommandName,                        \
+                             nsICommandParams* aParams,                       \
+                             nsISupports* aCommandRefCon) override;           \
+  NS_IMETHOD GetCommandStateParams(const char* aCommandName,                  \
+                                   nsICommandParams* aParams,                 \
+                                   nsISupports* aCommandRefCon) override;
+
+#define NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(_cmd) \
+ public:                                                   \
+  static _cmd* GetInstance() {                             \
+    if (!sInstance) {                                      \
+      sInstance = new _cmd();                              \
+    }                                                      \
+    return sInstance;                                      \
+  }                                                        \
+                                                           \
+  static void Shutdown() { sInstance = nullptr; }          \
+                                                           \
+ private:                                                  \
+  static StaticRefPtr<_cmd> sInstance;
+
+#define NS_DECL_EDITOR_COMMAND(_cmd)                   \
+  class _cmd final : public EditorCommand {            \
+    NS_DECL_EDITOR_COMMAND_METHODS(_cmd)               \
+    NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(_cmd) \
+                                                       \
+   protected:                                          \
+    _cmd() = default;                                  \
+    virtual ~_cmd() = default;                         \
   };
 
 // basic editor commands
 NS_DECL_EDITOR_COMMAND(UndoCommand)
 NS_DECL_EDITOR_COMMAND(RedoCommand)
 
 NS_DECL_EDITOR_COMMAND(CutCommand)
 NS_DECL_EDITOR_COMMAND(CutOrDeleteCommand)
@@ -95,75 +95,23 @@ NS_DECL_EDITOR_COMMAND(InsertPlaintextCo
 NS_DECL_EDITOR_COMMAND(InsertParagraphCommand)
 NS_DECL_EDITOR_COMMAND(InsertLineBreakCommand)
 NS_DECL_EDITOR_COMMAND(PasteQuotationCommand)
 
 /******************************************************************************
  * Commands for HTML editor
  ******************************************************************************/
 
-// This is a base class for commands registered with window which includes
-// HTMLEditor.  Like editor commands, these command classes are also designed
-// as singleton classes.  So, MUST be stateless.  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 HTMLEditorCommandBase : public nsIControllerCommand {
- public:
-  // nsISupports
-  NS_DECL_ISUPPORTS
-
- protected:
-  HTMLEditorCommandBase() = default;
-  virtual ~HTMLEditorCommandBase() = default;
-};
-
-#define NS_DECL_HTML_EDITOR_COMMAND(_cmd)           \
-  class _cmd final : public HTMLEditorCommandBase { \
-   public:                                          \
-    NS_DECL_NSICONTROLLERCOMMAND                    \
-                                                    \
-    static _cmd* GetInstance() {                    \
-      if (!sInstance) {                             \
-        sInstance = new _cmd();                     \
-      }                                             \
-      return sInstance;                             \
-    }                                               \
-                                                    \
-    static void Shutdown() { sInstance = nullptr; } \
-                                                    \
-   private:                                         \
-    static StaticRefPtr<_cmd> sInstance;            \
-  };
-
-#define NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(_cmd) \
- public:                                            \
-  static _cmd* GetInstance() {                      \
-    if (!sInstance) {                               \
-      sInstance = new _cmd();                       \
-    }                                               \
-    return sInstance;                               \
-  }                                                 \
-                                                    \
-  static void Shutdown() { sInstance = nullptr; }   \
-                                                    \
- private:                                           \
-  static StaticRefPtr<_cmd> sInstance;
-
 // virtual base class for commands that need to save and update Boolean state
 // (like styles etc)
-class StateUpdatingCommandBase : public HTMLEditorCommandBase {
+class StateUpdatingCommandBase : public EditorCommand {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(StateUpdatingCommandBase,
-                                       HTMLEditorCommandBase)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(StateUpdatingCommandBase, EditorCommand)
 
-  NS_DECL_NSICONTROLLERCOMMAND
+  NS_DECL_EDITOR_COMMAND_METHODS(StateUpdatingCommandBase)
 
  protected:
   StateUpdatingCommandBase() = default;
   virtual ~StateUpdatingCommandBase() { sTagNameTable.Clear(); }
 
   // get the current state (on or off) for this style or block format
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       virtual nsresult
@@ -210,39 +158,39 @@ class StateUpdatingCommandBase : public 
 
   static nsRefPtrHashtable<nsCharPtrHashKey, nsAtom> sTagNameTable;
 };
 
 // Shared class for the various style updating commands like bold, italics etc.
 // Suitable for commands whose state is either 'on' or 'off'.
 class StyleUpdatingCommand final : public StateUpdatingCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(StyleUpdatingCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(StyleUpdatingCommand)
 
  protected:
   StyleUpdatingCommand() = default;
   virtual ~StyleUpdatingCommand() = default;
 
   // get the current state (on or off) for this style or block format
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(nsAtom* aTagName, HTMLEditor* aHTMLEditor,
                       nsICommandParams* aParams) final;
 
   // add/remove the style
   MOZ_CAN_RUN_SCRIPT
   nsresult ToggleState(nsAtom* aTagName, HTMLEditor* aHTMLEditor) final;
 };
 
-class InsertTagCommand final : public HTMLEditorCommandBase {
+class InsertTagCommand final : public EditorCommand {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(InsertTagCommand, HTMLEditorCommandBase)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(InsertTagCommand, EditorCommand)
 
-  NS_DECL_NSICONTROLLERCOMMAND
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(InsertTagCommand)
+  NS_DECL_EDITOR_COMMAND_METHODS(InsertTagCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(InsertTagCommand)
 
  protected:
   InsertTagCommand() = default;
   virtual ~InsertTagCommand() { sTagNameTable.Clear(); }
 
   static already_AddRefed<nsAtom> TagName(const char* aCommandName) {
     MOZ_DIAGNOSTIC_ASSERT(aCommandName);
     if (NS_WARN_IF(!aCommandName)) {
@@ -258,17 +206,17 @@ class InsertTagCommand final : public HT
     return tagName.forget();
   }
 
   static nsRefPtrHashtable<nsCharPtrHashKey, nsAtom> sTagNameTable;
 };
 
 class ListCommand final : public StateUpdatingCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(ListCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(ListCommand)
 
  protected:
   ListCommand() = default;
   virtual ~ListCommand() = default;
 
   // get the current state (on or off) for this style or block format
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
@@ -277,17 +225,17 @@ class ListCommand final : public StateUp
 
   // add/remove the style
   MOZ_CAN_RUN_SCRIPT
   nsresult ToggleState(nsAtom* aTagName, HTMLEditor* aHTMLEditor) final;
 };
 
 class ListItemCommand final : public StateUpdatingCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(ListItemCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(ListItemCommand)
 
  protected:
   ListItemCommand() = default;
   virtual ~ListItemCommand() = default;
 
   // get the current state (on or off) for this style or block format
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
@@ -295,144 +243,143 @@ class ListItemCommand final : public Sta
                       nsICommandParams* aParams) final;
 
   // add/remove the style
   MOZ_CAN_RUN_SCRIPT
   nsresult ToggleState(nsAtom* aTagName, HTMLEditor* aHTMLEditor) final;
 };
 
 // Base class for commands whose state consists of a string (e.g. para format)
-class MultiStateCommandBase : public HTMLEditorCommandBase {
+class MultiStateCommandBase : public EditorCommand {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(MultiStateCommandBase,
-                                       HTMLEditorCommandBase)
-  NS_DECL_NSICONTROLLERCOMMAND
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(MultiStateCommandBase, EditorCommand)
+  NS_DECL_EDITOR_COMMAND_METHODS(MultiStateCommandBase)
 
  protected:
   MultiStateCommandBase() = default;
   virtual ~MultiStateCommandBase() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       virtual nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) = 0;
   MOZ_CAN_RUN_SCRIPT
   virtual nsresult SetState(HTMLEditor* aHTMLEditor,
                             const nsString& newState) = 0;
 };
 
 class ParagraphStateCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(ParagraphStateCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(ParagraphStateCommand)
 
  protected:
   ParagraphStateCommand() = default;
   virtual ~ParagraphStateCommand() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class FontFaceStateCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(FontFaceStateCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(FontFaceStateCommand)
 
  protected:
   FontFaceStateCommand() = default;
   virtual ~FontFaceStateCommand() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class FontSizeStateCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(FontSizeStateCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(FontSizeStateCommand)
 
  protected:
   FontSizeStateCommand() = default;
   virtual ~FontSizeStateCommand() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class HighlightColorStateCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(HighlightColorStateCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(HighlightColorStateCommand)
 
  protected:
   HighlightColorStateCommand() = default;
   virtual ~HighlightColorStateCommand() = default;
 
   NS_IMETHOD IsCommandEnabled(const char* aCommandName,
                               nsISupports* aCommandRefCon, bool* _retval) final;
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class FontColorStateCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(FontColorStateCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(FontColorStateCommand)
 
  protected:
   FontColorStateCommand() = default;
   virtual ~FontColorStateCommand() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class AlignCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(AlignCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(AlignCommand)
 
  protected:
   AlignCommand() = default;
   virtual ~AlignCommand() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class BackgroundColorStateCommand final : public MultiStateCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(BackgroundColorStateCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(BackgroundColorStateCommand)
 
  protected:
   BackgroundColorStateCommand() = default;
   virtual ~BackgroundColorStateCommand() = default;
 
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
       nsresult
       GetCurrentState(HTMLEditor* aHTMLEditor, nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult SetState(HTMLEditor* aHTMLEditor, const nsString& newState) final;
 };
 
 class AbsolutePositioningCommand final : public StateUpdatingCommandBase {
  public:
-  NS_DECL_HTML_EDITOR_COMMAND_SINGLETON(AbsolutePositioningCommand)
+  NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON(AbsolutePositioningCommand)
 
  protected:
   AbsolutePositioningCommand() = default;
   virtual ~AbsolutePositioningCommand() = default;
 
   NS_IMETHOD IsCommandEnabled(const char* aCommandName,
                               nsISupports* aCommandRefCon, bool* _retval) final;
   MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Needs to change nsIControllerCommand.idl
@@ -440,38 +387,38 @@ class AbsolutePositioningCommand final :
       GetCurrentState(nsAtom* aTagName, HTMLEditor* aHTMLEditor,
                       nsICommandParams* aParams) final;
   MOZ_CAN_RUN_SCRIPT
   nsresult ToggleState(nsAtom* aTagName, HTMLEditor* aHTMLEditor) final;
 };
 
 // composer commands
 
-NS_DECL_HTML_EDITOR_COMMAND(DocumentStateCommand)
-NS_DECL_HTML_EDITOR_COMMAND(SetDocumentStateCommand)
+NS_DECL_EDITOR_COMMAND(DocumentStateCommand)
+NS_DECL_EDITOR_COMMAND(SetDocumentStateCommand)
 
-NS_DECL_HTML_EDITOR_COMMAND(DecreaseZIndexCommand)
-NS_DECL_HTML_EDITOR_COMMAND(IncreaseZIndexCommand)
+NS_DECL_EDITOR_COMMAND(DecreaseZIndexCommand)
+NS_DECL_EDITOR_COMMAND(IncreaseZIndexCommand)
 
 // Generic commands
 
 // Edit menu
-NS_DECL_HTML_EDITOR_COMMAND(PasteNoFormattingCommand)
+NS_DECL_EDITOR_COMMAND(PasteNoFormattingCommand)
 
 // Block transformations
-NS_DECL_HTML_EDITOR_COMMAND(IndentCommand)
-NS_DECL_HTML_EDITOR_COMMAND(OutdentCommand)
+NS_DECL_EDITOR_COMMAND(IndentCommand)
+NS_DECL_EDITOR_COMMAND(OutdentCommand)
 
-NS_DECL_HTML_EDITOR_COMMAND(RemoveListCommand)
-NS_DECL_HTML_EDITOR_COMMAND(RemoveStylesCommand)
-NS_DECL_HTML_EDITOR_COMMAND(IncreaseFontSizeCommand)
-NS_DECL_HTML_EDITOR_COMMAND(DecreaseFontSizeCommand)
+NS_DECL_EDITOR_COMMAND(RemoveListCommand)
+NS_DECL_EDITOR_COMMAND(RemoveStylesCommand)
+NS_DECL_EDITOR_COMMAND(IncreaseFontSizeCommand)
+NS_DECL_EDITOR_COMMAND(DecreaseFontSizeCommand)
 
 // Insert content commands
-NS_DECL_HTML_EDITOR_COMMAND(InsertHTMLCommand)
+NS_DECL_EDITOR_COMMAND(InsertHTMLCommand)
 
 #undef NS_DECL_EDITOR_COMMAND
-#undef NS_DECL_HTML_EDITOR_COMMAND
-#undef NS_DECL_HTML_EDITOR_COMMAND_SINGLETON
+#undef NS_DECL_EDITOR_COMMAND_METHODS
+#undef NS_INLINE_DECL_EDITOR_COMMAND_MAKE_SINGLETON
 
 }  // namespace mozilla
 
 #endif  // #ifndef mozilla_EditorCommands_h
--- a/editor/libeditor/HTMLEditorCommands.cpp
+++ b/editor/libeditor/HTMLEditorCommands.cpp
@@ -43,22 +43,16 @@ MOZ_CAN_RUN_SCRIPT_BOUNDARY  // XXX Need
 #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"
 
 /*****************************************************************************
- * mozilla::HTMLEditorCommandBase
- *****************************************************************************/
-
-NS_IMPL_ISUPPORTS(HTMLEditorCommandBase, nsIControllerCommand)
-
-/*****************************************************************************
  * mozilla::StateUpdatingCommandBase
  *****************************************************************************/
 
 nsRefPtrHashtable<nsCharPtrHashKey, nsAtom>
     StateUpdatingCommandBase::sTagNameTable;
 
 NS_IMETHODIMP
 StateUpdatingCommandBase::IsCommandEnabled(const char* aCommandName,