Closed Bug 1345763 Opened 7 years ago Closed 7 years ago

Let's create AsTextEditor() and AsHTMLEditor() before bug 1319340

Categories

(Core :: DOM: Editor, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Ideally, we should fix bug 1319340, but there are still some implementation in automated tests which implements nsIEditor and something.

For now, for reducing the runtime query cost, let's create AsTextEditor() and AsHTMLEditor() to EditorBase.
Comment on attachment 8845734 [details]
Bug 1345763 part.1 Implement AsTextEditor() in EditorBase and its subclasses and replace casts with it

https://reviewboard.mozilla.org/r/118880/#review120832

::: editor/libeditor/HTMLEditor.cpp:507
(Diff revision 1)
>  HTMLEditor::InitRules()
>  {
>    if (!mRules) {
>      // instantiate the rules for the html editor
>      mRules = new HTMLEditRules();
>    }
> -  return mRules->Init(static_cast<TextEditor*>(this));
> +  return mRules->Init(AsTextEditor());

Although, this is NOT a risky cast because of referring its superclass. So, if you don't like this, I'll revert here.
Oops, the cast must be redundant. I'll repost the patch after checking in tryserver.
Okay, the cast isn't necessary for any compilers.
Comment on attachment 8845734 [details]
Bug 1345763 part.1 Implement AsTextEditor() in EditorBase and its subclasses and replace casts with it

https://reviewboard.mozilla.org/r/118880/#review121006
Attachment #8845734 - Flags: review?(bugs) → review+
Comment on attachment 8845735 [details]
Bug 1345763 part.2 Implement AsHTMLEditor() in EditorBase and its subclasses and replace casts with it

https://reviewboard.mozilla.org/r/118882/#review121008

::: editor/libeditor/HTMLEditorEventListener.cpp:222
(Diff revision 2)
>  }
>  
>  nsresult
>  HTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
>  {
> +  if (NS_WARN_IF(DetachedFromEditor())) {

Unrelated change, but fine.
Attachment #8845735 - Flags: review?(bugs) → review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/a0a3c9bacb1e
part.1 Implement AsTextEditor() in EditorBase and its subclasses and replace casts with it r=smaug
https://hg.mozilla.org/integration/autoland/rev/743d5c04dc07
part.2 Implement AsHTMLEditor() in EditorBase and its subclasses and replace casts with it r=smaug
https://hg.mozilla.org/mozilla-central/rev/a0a3c9bacb1e
https://hg.mozilla.org/mozilla-central/rev/743d5c04dc07
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: