EditorBase::CreateTxnForComposition() just hides what it does. For its caller,
creating a factory method, CompositionTransaction::Create(), is clearer what
it does.
Additionally, capsuling the creation in CompositionTransaction class can make
the text node information in TextComposition updated automatically. So, now,
it might be better to update them in DoTransaction() because there is a lag
between creating the transaction and calling DoTransaction(). However, this
patch doesn't want to change any existing behavior. So, this doesn't fix this
issue.
MozReview-Commit-ID: K8ci7ytwh1u
--HG--
extra : rebase_source : d468a0fc997c99f78f7eb46451082e7f1e052890
Most arguments of the constructor of CompositionTransaction are now stored by
EditorBase::mComposition. So, making it take TextComposition reduces the
number of its arguments.
Note that this patch doesn't make it retrieve TextComposition with
EditorBase::GetComposition() for guaranteeing that the editor has non-nullptr
mComposition.
MozReview-Commit-ID: 3O5wL52UBUy
--HG--
extra : rebase_source : 7f48465ef3f2f040e8c526fb7837060ecb6c9147
Edit transactions should store their editor instance with strong reference and they should be released at destroying the editor.
MozReview-Commit-ID: D67KU8WFxyo
--HG--
extra : rebase_source : 28c8a37498cad9f2e308eb4416cef76cf395bb9c
Although PlaceholderTransaction will use the selection on Merge, it is too late to use UpdateRange. Because RangeUpdater will be used after DoTransaction is finished. So we should update selection on DoTransaction.
Also, part 1 fix doesn't update selection correctly via RangeUpdater when IME composition is multiple node.
MozReview-Commit-ID: 9so9tR8uQ6t
--HG--
extra : rebase_source : 02a8bebe6c89ceb023bd598b77b40c5817cd4007
extra : histedit_source : d114420552779d3352637c5554bf9e90e6e9cd40
Google Keep uses range.insertNode on input event. So, text node will be inserted into current caret position.
Microsoft IME's caret is after composition string, but ATOK's caret is before it. So when using ATOK, this issue occurs. By range.insertNode, text nodes that have IME attribute becomes multiple text nodes. But CompositionTransanction doesn't consider that IME range isn't single text node. Although it replaces current composition string with new string on first text node, it doesn't delete composition string on other text node.
MozReview-Commit-ID: 9uRx0A9mppx
--HG--
extra : rebase_source : fe0754cee2197822ca6ac9ebed13013a8f13b606
This patch also renames:
EditorInputEventDispatcher -> mozilla::EditorInputEventDispatcher
And some variable names are renamed from aEditor or mEditor to aEditorBase or mEditorBase for making their types clearer.
MozReview-Commit-ID: 2FCXWpLMn8e
--HG--
rename : editor/libeditor/nsEditor.cpp => editor/libeditor/EditorBase.cpp
rename : editor/libeditor/nsEditor.h => editor/libeditor/EditorBase.h
This patch renames IMETextTxn to CompositionTransaction. "Composition" is now used in some web standard specs, e.g., CompositionEvent defined by UI Events.
This patch also renames nsEditor::CreateTxnForIMEText() to nsEditor::CreateTxnForComposition().
MozReview-Commit-ID: JN0GgGdpAWG
--HG--
rename : editor/libeditor/IMETextTxn.cpp => editor/libeditor/CompositionTransaction.cpp
rename : editor/libeditor/IMETextTxn.h => editor/libeditor/CompositionTransaction.h