Closed Bug 1540043 Opened 5 years ago Closed 4 years ago

Get rid of nsIPlaintextEditor interface

Categories

(Core :: DOM: Editor, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Once bug 1540037 is fixed, we can get rid of nsIPlaintextEditor instance which is currently not used by so many places.
https://searchfox.org/comm-central/search?q=nsIPlaintextEditor&case=false&regexp=false&path=
https://github.com/therealglazou/bluegriffon/search?q=nsIPlaintextEditor&type=Code

Even though comm-central and BlueGriffon need some changes, I think that we should move all methods and constants in nsIPlaintextEditor to nsIEditor and get rid of nsIPlaintextEditor.

Fortunately, QI cost from nsIEditorto nsIPlaintextEditor is really cheap in Firefox, Thunderbird and BlueGriffon even now. But we can make it zero cost and avoid maintaining similar interfaces for (always) accessing same instance. I.e., yes, I'd like to reduce the number of interfaces around editor.

Priority: -- → P3

Note that editor/ui is not used by Thunderbird any more. Only these call sites are relevant to TB:
https://searchfox.org/comm-central/search?q=nsIPlaintextEditor&case=false&regexp=false&path=%5Email

First, just move all members of nsIPlaintextEditor to nsIEditor and make it inherits nsIEditor.

After landing it and after a while (comm-central replaces nsIPlaintextEditor for its contents to nsIEditor and fix each QI), get rid of nsIPlaintextEditor completely.

Status: NEW → ASSIGNED
Keywords: leave-open

For preparing to remove nsIPlaintextEditor interface, this patch moves
all of them to nsIEditor, but for avoiding bustage in comm-central, makes
nsIPlaintextEditor inherit nsIEditor for now (i.e., even with this patch,
script can access old nsIPlaintextEditor members with the interface.

In C++ code, this patch moves SetWrapColumn(), InsertTextAsAction(),
InsertTextAsSubAction() and InsertLineBreakAsSubAction() because
they do common things between TextEditor and HTMLEditor. On the other
hand, this does not move TextEditor::GetTextLength() because it's designed
only for TextEditor.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/1160e6ba7a5d
part 1: Move all constants and methods of `nsIPlaintextEditor` to `nsIEditor` and make `nsIPlaintextEditor` inherit `nsIEditor` r=m_kato

I'd like somebody to review the patch for comm-central...

== Change summary for alert #24799 (as of Sat, 25 Jan 2020 04:22:24 GMT) ==

Improvements:

2% raptor-motionmark-htmlsuite-firefox macosx1014-64-shippable opt 50.09 -> 51.25

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=24799

Could you review attachment 9123284 [details] [diff] [review]? Or redirect this review request to somebody who can do it?

(All nsIPlaintextEditor members have been moved to nsIEditor and nsIPlaintextEditor inherits nsIEditor for keeping its users accessible to the moved members via nsIPlaintextEditor interface, but I'd like to remove nsIPlaintextEditor interface completely as soon as possible. So, JS in comm-central should stop QI from nsIEditor to nsIPlaintextEditor and refer nsIEditor interface for accessing its constants.)

Flags: needinfo?(mkmelin+mozilla)
Comment on attachment 9123284 [details] [diff] [review]
Bug 1540043 - part 2: Make comm-central stop using `nsIPlaintextEditor` interface

Review of attachment 9123284 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me, thx! r=mkmelin
Attachment #9123284 - Flags: review+

Thank you!

I'll post new patch which removes nsIPlaintextEditor completely.

Flags: needinfo?(mkmelin+mozilla)

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/857a1d5c4507
part 2: Make comm-central stop using nsIPlaintextEditor interface r=jorgk

(In reply to Pulsebot from comment #11)

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/857a1d5c4507
part 2: Make comm-central stop using nsIPlaintextEditor interface r=jorgk

Oops, I forgot to change the reviewer, sorry for that.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/a489fb692c9f
part 3: Remove `nsIPlaintextEditor` interface r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: