diff --git a/editor/libeditor/EditorBase.h b/editor/libeditor/EditorBase.h index c16352daefac..d590fc4c57a9 100644 --- a/editor/libeditor/EditorBase.h +++ b/editor/libeditor/EditorBase.h @@ -119,6 +119,7 @@ class JoinNodeTransaction; class RemoveStyleSheetTransaction; class SplitNodeTransaction; class TextComposition; +class TextEditor; struct EditorDOMPoint; namespace dom { @@ -164,6 +165,9 @@ public: */ EditorBase(); + virtual TextEditor* AsTextEditor() = 0; + virtual const TextEditor* AsTextEditor() const = 0; + protected: /** * The default destructor. This should suffice. Should this be pure virtual diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index 519c147535c0..843c855c4fa5 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -510,7 +510,7 @@ HTMLEditor::InitRules() // instantiate the rules for the html editor mRules = new HTMLEditRules(); } - return mRules->Init(static_cast(this)); + return mRules->Init(this); } NS_IMETHODIMP diff --git a/editor/libeditor/TextEditor.h b/editor/libeditor/TextEditor.h index 8cc035caa146..bc7f03d9ddd9 100644 --- a/editor/libeditor/TextEditor.h +++ b/editor/libeditor/TextEditor.h @@ -56,6 +56,9 @@ public: TextEditor(); + virtual TextEditor* AsTextEditor() override { return this; } + virtual const TextEditor* AsTextEditor() const override { return this; } + // nsIPlaintextEditor methods NS_DECL_NSIPLAINTEXTEDITOR