Move `TextEditor` methods which are used with `HTMLEditor` instances for splitting TextEditor and HTMLEditor classes
Categories
(Core :: DOM: Editor, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox91 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
(Whiteboard: [h2review-noted])
Attachments
(47 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1540037 - part 29: Move `nsIEditor.documentCharacterSet` definitions into `HTMLEditor` r=m_kato!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently, we have 3 editor classes.
EditorBase
class is an abstract class.
TextEditor
class is derived from EditorBase
and represents text editor in <input>
and <textarea>
elements.
HTMLEditor
class is derived from TextEditor
and represents all editable content in a document, e.g., multiple <div contenteditable>
elements or designMode
document.
So, even though EditorBase
is an abstract class, it's always instanced with TextEditor
class.
Therefore, I don't think that we should keep separating them because when we take a look at a handling path, we may need to go EditorBase.cpp and TextEditor.cpp again and again.
If you have some ideas about this issue, let me know.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
They are used only by HTMLEditor
so that we should hide them from
TextEditor
for making it clearer that they are not used by TextEditor
.
Note that there are 2 DeleteNodeWithTransaction()
in HTMLEditor
class.
One is EditorBase
's method and the other is HTMLEditor
's method.
HTMLEditor
's one is check whether the removing node is editable or not,
but in some cases, we need to move non-editable nodes. Therefore, this
patch makes ReplaceContainerWithTransaction()
call EditorBase
's one
for keeping current behavior.
Depends on D72586
Assignee | ||
Comment 2•5 years ago
|
||
Its users are only HTMLEditor
and CSSEditUtils
so that we should move it
into HTMLEditor
.
Depends on D72822
Assignee | ||
Comment 3•5 years ago
|
||
They are not used by TextEditor
so that we should move them into HTMLEditor
.
Depends on D72823
Assignee | ||
Comment 4•5 years ago
|
||
It's only used by HTMLEditor
so that we can move it.
Depends on D72825
Assignee | ||
Comment 5•5 years ago
|
||
It's used only by HTMLEditor
so that we can move it into HTMLEditor
.
Depends on D72826
Assignee | ||
Comment 6•5 years ago
|
||
Both of them are used only by HTMLEditor
so that we can move them to
HTMLEditor
.
Depends on D72829
Assignee | ||
Comment 7•5 years ago
|
||
Although this is called by
EditorBase::InsertPaddingBRElementForEmptyLastLineWithTransaction()
, it's
mainly designed for HTMLEditor
, but used by TextEditor
too only when it
puts <br>
element to the end of its anonymous <div>
element. Therefore,
when TextEditor
calls
InsertPaddingBRElementForEmptyLastLineWithTransaction()
, aPointToInsert
is not in a text node:
https://searchfox.org/mozilla-central/rev/158bac3df3a1890da55bdb6ffdaf9a7ffc0bfb0a/editor/libeditor/TextEditSubActionHandler.cpp#917-918,920
And it means that PrepareToInsertBRElement()
does nothing:
https://searchfox.org/mozilla-central/rev/158bac3df3a1890da55bdb6ffdaf9a7ffc0bfb0a/editor/libeditor/EditorBase.cpp#1561,1569-1570
Therefore, we can move it into HTMLEditor
and makes it possible to move
EditorBase::SplitNodeWithTransaction()
called by PrepareToInsertBRElement()
.
Depends on D72830
Assignee | ||
Comment 8•5 years ago
|
||
Now, it's used only by HTMLEditor
so that we can move it.
Depends on D72831
Assignee | ||
Comment 9•5 years ago
|
||
And then, SplitNodeTransaction
needs to be store HTMLEditor
instead of
EditorBase
.
Depends on D72832
Assignee | ||
Comment 10•5 years ago
|
||
Then, we can make JoinNodeTransaction
store HTMLEditor
instead of
EditorBase
.
Depends on D72833
Assignee | ||
Comment 11•5 years ago
|
||
It's used only by HTMLEditor
so that we can move it.
Depends on D72835
Assignee | ||
Comment 12•5 years ago
|
||
It's used only by HTMLEditor
so that we can move it.
Depends on D72836
Assignee | ||
Comment 13•5 years ago
|
||
And this patch renames it to MoveChildrenBetween()
for avoiding overload.
Depends on D72844
Assignee | ||
Comment 14•5 years ago
|
||
They are used only by HTMLEditor
so that we can move them.
Depends on D72845
Assignee | ||
Comment 15•5 years ago
|
||
The other Move*()
are not move nodes without transactions. For making
developers to distinguish the difference, this patch appends WithTransaction
postfix like other methods which modify DOM tree with transactions.
Depends on D72846
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
Comment 20•5 years ago
|
||
Comment 21•5 years ago
|
||
Comment 22•5 years ago
|
||
Comment 23•5 years ago
|
||
Comment 24•5 years ago
|
||
bugherder |
Comment 25•5 years ago
|
||
Comment 26•5 years ago
|
||
Comment 27•5 years ago
|
||
Comment 28•5 years ago
|
||
Comment 29•5 years ago
|
||
Comment 30•5 years ago
|
||
Comment 31•5 years ago
|
||
Comment 32•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ff18fa29d992
https://hg.mozilla.org/mozilla-central/rev/705c53101ce1
https://hg.mozilla.org/mozilla-central/rev/69e74ec4f750
https://hg.mozilla.org/mozilla-central/rev/eb080a8b68e9
https://hg.mozilla.org/mozilla-central/rev/33c98b169ef2
https://hg.mozilla.org/mozilla-central/rev/004a3f6df7d9
https://hg.mozilla.org/mozilla-central/rev/9ea49a36a809
https://hg.mozilla.org/mozilla-central/rev/3ab6dfbeffce
https://hg.mozilla.org/mozilla-central/rev/5febc73cdbd1
https://hg.mozilla.org/mozilla-central/rev/b68862b930cd
https://hg.mozilla.org/mozilla-central/rev/9be5da1e7893
Updated•4 years ago
|
Comment 33•4 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:jstutte, maybe it's time to close this bug?
Comment 34•4 years ago
|
||
:masayuki, is the leave-open here still meaningful? What is the remaining work to do?
Assignee | ||
Comment 35•4 years ago
|
||
Still there are a lot of methods which should be moved to another class, for example, from TextEditor
to EditorBase
. Such methods block to make HTMLEditor
stop inheriting TextEditor
.
Assignee | ||
Comment 36•4 years ago
|
||
The list of TextEditor
methods.
https://docs.google.com/spreadsheets/d/1QO6FljlIMOaSDxTQrNJuwBHbI8ZToDw0s_328LXEolQ/edit?usp=sharing
Some of them should be moved explicitly, but I'm not sure for some others of them.
Assignee | ||
Comment 37•4 years ago
|
||
IME is available in both TextEditor
and HTMLEditor
, and the handling
code is almost same (they partially do different things with checking
IsHTMLEditor()
). Therefore, we should move them to EditorBase
for
making HTMLEditor
possible to inherit only EditorBase
in the future.
Assignee | ||
Comment 38•4 years ago
|
||
This method is semi-public method, meaning that this is commonly used by
public methods which handle various user input and that causes inputting
text, both in TextEditor
and HTMLEditor
.
Therefore, for making HTMLEditor
stop inheriting TextEditor
class in the
future, we should move it into EditorBase
.
Depends on D115784
Assignee | ||
Comment 39•4 years ago
|
||
They are used by setting text value of TextEditor
or replacing a misspelled
word with a new word in both TextEditor
and HTMLEditor
. Therefore,
they should be in the EditorBase
rather than TextEditor
.
Note that the path of the former case may be in a hot path. Therefore, we need
to keep redirecting to TextEditor
for keeping the performance only in the
case.
Depends on D115785
Assignee | ||
Comment 40•4 years ago
|
||
Currently, EditorBase::GetDocumentIsEmpty()
is implemented by TextEditor
,
and it refers only IsEmpty()
which is implemented both by TextEditor
and
HTMLEditor
. So, IsEmpty()
should be a virtual method of EditorBase
,
then, EditorBase
can implement GetDocumentIsEmpty()
.
Depends on D115786
Assignee | ||
Comment 41•4 years ago
|
||
They just work with a transaction manager and transactions, and they are used
by both TextEditor
and HTMLEditor
. Therefore, they should be in
EditorBase
for making HTMLEditor
stop inheriting TextEditor
in the
future.
Depends on D115787
Assignee | ||
Comment 42•4 years ago
|
||
It calls only its helper method, and the helper method,
IsCopyToClipboardAllowedInternal()
, needs to check complicated things only
when it's a password editor.
This patch makes IsCopyToCLipboardAllowedInternal()
a virtual method. But
this shouldn't cause performance regression because this should be called
only when updating menu items or handling "copy" commands. So, this shouldn't
be in any hot paths.
Depends on D115788
Assignee | ||
Comment 43•4 years ago
|
||
Of course, they are used for HTMLEditor
instances too. Therefore, they
should be in EditorBase
rather than TextEditor
.
Depends on D115789
Assignee | ||
Comment 44•4 years ago
|
||
This is used by HTMLEditor
too. So, this should be a method of EditorBase
.
Depends on D115790
Assignee | ||
Comment 45•4 years ago
|
||
It's used by HTMLEditor
too. So, we should move it into EditorBase
.
Depends on D115791
Assignee | ||
Comment 46•4 years ago
|
||
It's a common method to cut selection. Therefore, it should be in EditorBase
.
Depends on D115792
Assignee | ||
Comment 47•4 years ago
|
||
It's common method of TextEditor
and HTMLEditor
, but implemented by
TextEditor
even though it's an override of nsIEditor
's method.
Therefore, it should be implemented in EditorBase
instead.
Depends on D115793
Assignee | ||
Comment 48•4 years ago
|
||
It's used with both TextEditor
and HTMLEditor
instances. So, it should be
implemented in EditorBase
instead.
Depends on D115794
Assignee | ||
Comment 49•4 years ago
|
||
TextEditor
declares some virtual methods newly. However, for moving some
methods from TextEditor
to EditorBase
, they should be accessible from
EditorBase
. Therefore, this patch adds declarations of abstract virtual
methods of them to EditorBase
.
Depends on D115795
Updated•4 years ago
|
Comment 50•4 years ago
|
||
Comment 51•4 years ago
|
||
Comment 52•4 years ago
|
||
Comment 53•4 years ago
|
||
Comment 54•4 years ago
|
||
Comment 55•4 years ago
|
||
Comment 56•4 years ago
|
||
Comment 57•4 years ago
|
||
bugherder |
Comment 58•4 years ago
|
||
Comment 59•4 years ago
|
||
bugherder |
Assignee | ||
Comment 60•4 years ago
|
||
The attribute is used only with HTMLEditor
, and it does not make sense to
access document's character-set via TextEditor
. Therefore, this patch
makes it implement in HTMLEditor
(EditorBase
will return
NS_ERROR_NOT_AVAILABLE
both getter and setter).
Note that EditorBase::GetDocumentCharsetInternal()
is required by
TextEditor::ComputeValueInternal()
. Therefore, it needs to stay in
EditorBase
.
Depends on D115796
Comment 61•4 years ago
|
||
Comment 62•4 years ago
|
||
Comment 63•4 years ago
|
||
Comment 64•4 years ago
|
||
Comment 65•4 years ago
|
||
Comment 66•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d14c17436d81
https://hg.mozilla.org/mozilla-central/rev/0faf5e8f142b
https://hg.mozilla.org/mozilla-central/rev/2d6956046a4e
https://hg.mozilla.org/mozilla-central/rev/1bf9011c27c2
https://hg.mozilla.org/mozilla-central/rev/16ece4ec2890
https://hg.mozilla.org/mozilla-central/rev/adb0d91643e6
Comment 67•4 years ago
|
||
bugherder |
Assignee | ||
Comment 68•3 years ago
|
||
It's now used only by HTMLEditor::Rewrap()
and it does simple thing with
TextEditor::ComputeValueInternal()
. So, we can make Rewrap()
directly
do it instead.
Assignee | ||
Comment 69•3 years ago
|
||
It's a helper method of TextEditor::ComputeValueInternal()
which is used by
TextEditor
and HTMLEditor::Rewrap()
. So, before we move
ComputeValueInternal()
, we need to move this first.
Depends on D116347
Assignee | ||
Comment 70•3 years ago
|
||
Depends on D116348
Assignee | ||
Comment 71•3 years ago
|
||
It's used both with TextEditor
instance and HTMLEditor
instance. So, it
should be implemented in EditorBase
.
Depends on D116349
Assignee | ||
Comment 72•3 years ago
|
||
In any types of editor, EditorBase
handles if it's in the read-only mode.
For making HandleKeyPressEvent
relation between classes simpler, let's
handle it in an independent method.
Depends on D116350
Assignee | ||
Comment 73•3 years ago
|
||
Such events shouldn't be fired, but for now, we should make them handled in
the overrides. Then, we can avoid the skipping TextEditor
case from
HTMLEditor
.
Depends on D116351
Assignee | ||
Comment 74•3 years ago
|
||
Delete
and Backspace
keys are handled by same code. So, the code should
be in EditorBase
instead of TextEditor
.
If HTMLEditor
is in the plaintext editing mode of mail composer, Tab
key
is also handled by the same code as TextEditor
. So, the code in TextEditor
should be moved to EditorBase
too and HTMLEditor
should call EditorBase
's
method only when it's in the plaintext mode.
Depends on D116352
Comment 75•3 years ago
|
||
Comment 76•3 years ago
|
||
Comment 77•3 years ago
|
||
Comment 78•3 years ago
|
||
bugherder |
Comment 79•3 years ago
|
||
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Comment 80•3 years ago
|
||
Comment 81•3 years ago
|
||
Comment 82•3 years ago
|
||
bugherder |
Comment 83•3 years ago
|
||
bugherder |
Assignee | ||
Comment 84•3 years ago
|
||
Depends on D116541
Assignee | ||
Comment 85•3 years ago
|
||
Depends on D116564
Assignee | ||
Comment 86•3 years ago
|
||
Depends on D116565
Assignee | ||
Comment 87•3 years ago
|
||
It just creates an nsITransferable
instance and add 2 flavors for storing
plain text. Therefore, it can be in EditorUtils
instead.
Depends on D116566
Assignee | ||
Comment 88•3 years ago
|
||
It should be a virtual method derived from EditorBase
, and TextEditor
and HTMLEditor
should override it. Then, nsIEditor::Paste()
requires
referring vtable again if we keep implementing it only in EditorBase
.
Therefore, this patch avoid it with implementing it in both TextEditor
and HTMLEditor
.
Depends on D116567
Assignee | ||
Comment 89•3 years ago
|
||
Depends on D116568
Comment 90•3 years ago
|
||
Comment 91•3 years ago
|
||
Comment 92•3 years ago
|
||
Comment 93•3 years ago
|
||
Comment 94•3 years ago
|
||
Assignee | ||
Comment 95•3 years ago
|
||
TextEditor::OnDrop()
handles both cases, in TextEditor
and in HTMLEditor
because the common part is too complicated to duplicate. However, most
different part is inserting the dropped items part. So, let's make them
into a virtual method.
In this patch, creating a method only in HTMLEditor
and moves the part
into it.
Depends on D116569
Assignee | ||
Comment 96•3 years ago
|
||
This patch makes the previously created handler method to virtual (derived from
EditorBase
), and makes TextEditor
override it.
Depends on D116801
Assignee | ||
Comment 97•3 years ago
|
||
Depends on D116802
Comment 98•3 years ago
|
||
Comment 99•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0e61485ac614
https://hg.mozilla.org/mozilla-central/rev/52b13b5f2c4d
https://hg.mozilla.org/mozilla-central/rev/7beac38583d0
https://hg.mozilla.org/mozilla-central/rev/f9c0c941ca36
https://hg.mozilla.org/mozilla-central/rev/dcac769feba1
https://hg.mozilla.org/mozilla-central/rev/7ada44a617ae
Comment 100•3 years ago
|
||
Comment 101•3 years ago
|
||
Comment 102•3 years ago
|
||
Comment 103•3 years ago
|
||
bugherder |
Assignee | ||
Comment 104•3 years ago
|
||
It's used by TextEditor
and HTMLEditor
in the plaintext mode. Therefore,
it should be moved into EditorBase
.
Assignee | ||
Comment 105•3 years ago
|
||
Depends on D117114
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 106•3 years ago
|
||
The last 2 patches are the final ones for this bug.
Comment 107•3 years ago
|
||
Comment 108•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/446c8ee9a6ba
https://hg.mozilla.org/mozilla-central/rev/4173082d8402
Assignee | ||
Updated•3 years ago
|
Description
•