Commit Graph

133 Commits

Author SHA1 Message Date
Ehsan Akhgari
a930263192 Bug 1484137 - Remove the XPCOM component registration for content iterator classes; r=qdot 2018-08-17 14:51:12 -04:00
Masayuki Nakano
7484cc4573 Bug 1480055 - part 4: Make AutoTransactionsConserveSelection take reference of Editor rather than pointer r=m_kato
It's always created with non-nullptr.  So, making it treat reference of
EditorBase makes its implementation simpler.

Note that this changes comment in EditorBase::InsertTextWithTransaction() to
a MOZ_ASSERT() for detecting bugs.  However, the comment is wrong.  When
the insertion is for updating composition string, callers don't need to create
AutoTransactionsConserveSelection since it'll be ignored by
CompositionTransaction.  So, the new MOZ_ASSERT() checks whether it's
in composition or prevented transaction changing Selection.

MozReview-Commit-ID: 6jZ4LpksyoD

--HG--
extra : rebase_source : 61ca9272ddea165b3691cf1ce42dc6f4df099a36
2018-08-01 21:30:14 +09:00
Masayuki Nakano
0fadf6b9da Bug 1467796 - part 3: Make mozInlineSpellChecker::ReplaceWord() use TextEditor::ReplaceTextAsAction() r=m_kato,smaug
mozInlineSpellChecker::ReplaceWord() is used for replacing misspelled word
with a word.  So, this is necessary to be distinguished from insertText
command when we implement InputEvent.inputType.  So, we should make it
use TextEditor::ReplaceTextAsAction() instead (same as autocomplete).

This patch makes TextEditor::ReplaceTextAsAction() take optional argument
to make callers can specify replace range.  Then, the range is a spellchecker
selection range if the caller is mozInlineSpellChecker::ReplaceWord().
Prior to this patch, it clones the range for normal selection, but it's
expensive and we may be able to reuse cached range of Selection in this case.
So, this patch makes Selection::AddRangeInternal() checks if given range is
in another Selection and use mCachedRange as far as possible.

MozReview-Commit-ID: JIOTTsxlj4Q

--HG--
extra : rebase_source : 7c26b0255f08608ebe8c7045c9bcdca1dc70cadf
2018-07-04 22:51:55 +09:00
Masayuki Nakano
08f4c56c7e Bug 1467796 - part 2: Make autocomplete use new method TextEditor::ReplaceTextAsAction() which replaces all text with specified text r=m_kato
InputEvent.inputType needs to distinguish whether inserting text is caused
by insertText command or replaced by autocomplete or spellchecker.
Therefore, nsTextEditorState::SetValue() cannot use
TextEditor::InsertTextAsAction() nor TextEditor::DeleteSelectionAsAction().

This patch reuses TextEditor::SetText()'s slow path for the new method.

Note that the new method uses EditSubAction::eInsertText as top level edit sub-
action because specifying this improves undo/redo behavior.

And also this patch modifies test_bug1368544.html.  Oddly, only on Android,
we get different result.  After removing all text with setUserInput(""),
TextEditor::DeleteSelectionAsSubAction() removes both text node and non-bogus
<br> element from the anonymous-div element.  However, only on Android, new
<br> element is recreated.  I've not understood where this difference comes
from yet.

MozReview-Commit-ID: GKNksctGik

--HG--
rename : toolkit/content/tests/chrome/file_autocomplete_with_composition.js => toolkit/content/tests/chrome/file_editor_with_autocomplete.js
rename : toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html => toolkit/content/tests/chrome/test_editor_for_input_with_autocomplete.html
rename : toolkit/content/tests/chrome/test_autocomplete_with_composition_on_textbox.xul => toolkit/content/tests/chrome/test_editor_for_textbox_with_autocomplete.xul
extra : rebase_source : b90419d9e5a01e86f6e6418f8df002c91416acae
2018-07-03 22:25:52 +09:00
Masayuki Nakano
efd8891532 Bug 1467796 - part 1: Split TextEditor::InsertTextAsAction() to itself and TextEditor::InsertTextAsSubAction() for internal use r=m_kato
For bug 1465702, we need to split TextEditor::InsertTextAsAction() to 2 methods.
One is for root of handling an edit operation.  The other is for internal use,
e.g., handling as a part of an edit operation.  Therefore, this patch creates
InsertTextAsSubAction() for the internal use.

MozReview-Commit-ID: CIU5zdp0owP

--HG--
extra : rebase_source : 79b58fb01e48d1831bbdea01ed7b1a26dcd1821b
2018-07-02 20:12:22 +09:00
Masayuki Nakano
a9d57dd8a8 Bug 1478564 - part 1: Optimize TextEditRules::HandleNewLines() r=m_kato
TextEditRules::HandleNewLines() is expensive since it may scan all of given
string twice and more.  On the other hand, in most cases, given string does
not contain \n, \r nor \r\n.

First, for avoid using nsTString::FindCharInSet(), HandleNewLine() should
receive string which never contains \r nor \r\n.  Then, it always can use
nsTSubstring::FindChar() instead.

Next, HandleNewLines() should do nothing if given string does not contain \n.

Finally, because of unused, this removes unnecessary HandleNewLines() argument
which can specify the way to handle new lines.

MozReview-Commit-ID: 8WSfxfkuFgN

--HG--
extra : rebase_source : 1c05721162a30288929d030c0a15fe83a50fe9d2
2018-07-24 17:46:12 +09:00
Masayuki Nakano
4619306c40 Bug 1478268 - Fix condition of MOZ_ASSERT() in TextEditor::InsertWithQuotationsAsSubAction() r=jorgk+176914
As explained in the comment of TextEditor::InsertWithQuotationsAsSubAction(),
it excepts that TextEditRules::WillDoAction() won't handle it.  So, the
MOZ_ASSERT() should check |!handled|, not |handled|.

Caused this regression means that we do not have test to paste text into
<textarea>.  Therefore, this patch adds the tests.

MozReview-Commit-ID: 2UUSVrmmNVK

--HG--
extra : rebase_source : 912d5428aeed83a7a46ec7e4a49c73c33dd7b295
2018-07-26 17:01:15 +09:00
Masayuki Nakano
77fdd1508b Bug 1476897 - part 7: Drop nsIEditorMailSupport interface from TextEditor r=m_kato
Nobody uses nsIEditorMailSupport interface with TextEditor instances.
Therefore, stopping nsIEditorMailSupport interface support of TextEditor
saves memory of TextEditor which may be created a lot even in a document.

MozReview-Commit-ID: BJ4ucCaeYHl

--HG--
extra : rebase_source : 2c932df04d00a4453428dc3b7fd64d338c6963eb
2018-07-23 16:45:07 +09:00
Masayuki Nakano
5e98e38c30 Bug 1476897 - part 6: Move implementation of both TextEditor::PasteAsQuotation() and HTMLEditor::PasteAsQuotation() to new virtual methods r=m_kato
Neither TextEditor::PasteAsQuotation() nor HTMLEditor::PasteAsQuotation()
is used via nsIEditorMailSupport.  So, perhaps, we can remove this method
from the interface.  But for now, we should move each implementation to
new virtual methods and make only HTMLEditor::PasteAsQuotation() calls
new method since nobody uses nsIEditorMailSupport with TextEditor instances.

MozReview-Commit-ID: Eilxk74VHwT

--HG--
extra : rebase_source : 15abe305d9f332ecd521d9115a71443665a8c9fe
2018-07-23 16:34:03 +09:00
Masayuki Nakano
a2ecad4a67 Bug 1476897 - part 5: Move implementation of TextEditor::InsertAsQuotation() to new method r=m_kato
TextEditor::InsertAsQuotation() is not used as a method of nsIEditorMailSupport,
however, this is used internally.  So, we need to keep this method's function
as a non-virtual method but we can make the method just return
NS_ERROR_NOT_IMPLEMENTED.

MozReview-Commit-ID: 2CcY4SZGwyr

--HG--
extra : rebase_source : d490145b571bea465be5379872b9ea01daa633cc
2018-07-23 16:05:30 +09:00
Masayuki Nakano
b195745b15 Bug 1476897 - part 4: Make TextEditor::InsertTextWithQuotations() returns NS_ERROR_NOT_IMPLEMENTED since it's never used r=m_kato
InsertTextWithQuotations() is called only by HTMLEditor::Rewrap().  So,
HTMLEditor::InsertTextWithQuotations() is always called.  Therefore, we can
make it just return NS_ERROR_NOT_IMPLEMENTED.

MozReview-Commit-ID: FvmY2x3OOn7

--HG--
extra : rebase_source : be567c3882f81c83d2c07955c07202bb9ce2d797
2018-07-23 15:25:18 +09:00
Masayuki Nakano
69e0b4e72b Bug 1476897 - part 3: Make TextEditor::InsertAsCitedQuotation() return NS_ERROR_NOT_IMPLEMENTED since nobody uses this method with TextEditor instances r=m_kato
MozReview-Commit-ID: 487sf6d2wrt

--HG--
extra : rebase_source : dfacb64768de3eab11b7e11478be4c297641f2a0
2018-07-23 15:17:03 +09:00
Masayuki Nakano
edd6613c92 Bug 1476897 - part 2: Make TextEditor::GetEmbeddedObjects() just return NS_ERROR_NOT_IMPLEMENTED since it's never used r=m_kato
TextEditor::GetEmbeddedObjects() is never called unless
nsIEditorMailSupport::GetEmbeddedObjects() is used with TextEditor instance.
However, nobody uses nsIEditorMailSupport interface with TextEditor instance.

MozReview-Commit-ID: 4HTnL7KsNGf

--HG--
extra : rebase_source : ceb4f895192b9518c02364c8a317d6c941ac9cc2
2018-07-23 15:07:35 +09:00
Masayuki Nakano
ddfc315822 Bug 1476897 - part 1: Implement nsIEditorMailSupport in HTMLEditor since it's never used with TextEditor instance r=m_kato
MozReview-Commit-ID: 5JT4m0IftXY

--HG--
extra : rebase_source : d805fe53c11b01c3aba4578a5b934d6c66490c8e
2018-07-23 14:40:05 +09:00
Masayuki Nakano
8245258aa0 Bug 1264876 - Remove StripCites() from nsIEditorMailSupport r=m_kato
nsIEditorMailSupport::StripCites() is used only by QA addon of Seamonkey.
So, this is not necessary API now.  This patch removes it and removes its
helper classes in InternetCiter.

MozReview-Commit-ID: 4Esl3GXzo0U

--HG--
extra : rebase_source : 8f5fa85b18613726bfa7e21e5a6312cbd42af7c2
2018-07-19 16:55:31 +09:00
Masayuki Nakano
25f3d21b8d Bug 1337247 - Remove PasteAsCitedQuotation() from nsIEditorMailSupport r=m_kato
nsIEditorMailSupport::PasteAsCitedQuotation() is only used by
HTMLEditor::PasteAsQuotation().  So, we can get rid of the method from the
interface and merge current implementation with HTMLEditor::PasteAsQuotation().

MozReview-Commit-ID: II5ExMAIOhP

--HG--
extra : rebase_source : e40b9b676358a09642e16c73e702e04ac192cb18
2018-07-19 16:08:00 +09:00
Masayuki Nakano
3a1344255b Bug 1467802 - part 4: Create TextEditor::ComputeValueInternal() for internal use of nsIPlaintextEditor::OutputToString() r=m_kato
For reducing virtual calls of nsIPlaintextEditor::OutputToString(),
TextEditor should have new non-virtual public method, ComputeTextValue() and
shared code between it and OutputToString() as ComputeValueInternal().

MozReview-Commit-ID: KFeovQ568bf

--HG--
extra : rebase_source : a5cfb24cefe44f7c60e649959ed49350ed00d4d6
2018-07-18 21:27:30 +09:00
Masayuki Nakano
91c0a26b3f Bug 1467802 - part 3: Create EditorBase::GetDocumentCharsetInternal() for internal use of nsIEditor::GetDocumentCharacterSet() r=m_kato
This patch creates non-virtual method, EditorBase::GetDocumentCharsetInternal(),
for internal use of nsIEditor::GetDocumentCharacterSet() since the virtual
call method is redundant and the caller cannot be marked as const.

MozReview-Commit-ID: v6kDo2eKg3

--HG--
extra : rebase_source : 07f6dd8341cb6686835db2ee3ded479323cccca9
2018-07-18 21:11:32 +09:00
Masayuki Nakano
85b94e287c Bug 1467802 - part 2: Mark TextEditor::GetAndInitDocEncoder() as const r=m_kato
TextEditor::GetAndInitDocEncoder() modifies only mCachedDocumentEncoder and
mCachedDocumentEncoderType which are cache of the method to save recreation
cost of document encoder when same type document encoder is requested.

So, with marking them mutable, we can change the method to a const method.

MozReview-Commit-ID: 80W0NtQhJOR

--HG--
extra : rebase_source : 84f4b49fe3a3124c0de99b39a2141a8cee553e54
2018-07-18 20:51:55 +09:00
Masayuki Nakano
9da3ea2d22 Bug 1467802 - part 1: Create TextEditor::WrapWidth() for internal use of nsIPlaintextEditor::GetWrapWidth() r=m_kato
Let's create non-virtual and simple accessor for TextEditor::mWrapColumn.

MozReview-Commit-ID: 97LhhOgkx4A

--HG--
extra : rebase_source : bd57d7fbcc8da5e00fe71b81a6a2a9ef2f92e939
2018-07-18 20:31:17 +09:00
Masayuki Nakano
2fa716ed4d Bug 1467799 - part 2: Stop using nsIEditor::GetDocumentIsEmpty() from C++ code r=m_kato
nsIEditor::GetDocumentIsEmpty() is a virtual code and there is non-virtual
method, TextEditor::IsEmpty().  So, any callers in C++ should use
TextEditor::IsEmpty() instead.

MozReview-Commit-ID: CQE8LP6XI96

--HG--
extra : rebase_source : e0027c3d71856adcd5fa7820bf936a6b405560c5
2018-07-18 17:51:49 +09:00
Masayuki Nakano
0d09e1a26a Bug 1467799 - part 1: Remove implementation of EditorBase::GetDocumentIsEmpty() and rename TextEditor::DocumentIsEmpty() to TextEditor::IsEmpty() r=m_kato
EditorBase::GetDocumentIsEmpty() is never called since it's overridden by
TextEditor::GetDocumentIsEmtpy() and never called directly.  So, we can remove
its implementation.

Additionally, DocumentIsEmpty() is redundant. We can make it just IsEmpty().

MozReview-Commit-ID: CGsNzCHyVf

--HG--
extra : rebase_source : 3a8eeaf108bb387ea559e0643acfa96e26768577
2018-07-18 17:44:14 +09:00
Masayuki Nakano
98a833407e Bug 1467794 - Split TextEditor::DeleteSelectionAsAction() to itself and TextEditor::DeleteSelectionAsSubAction() r=m_kato
TextEditor::DeleteSelectionAsAction() is called even if it's a part of edit
action.  For example, it's called to prepare for inserting text.

For bug 1465702, editor itself and edit rules classes should not call
public DeleteSelectionAsAction() directly.  Therefore, this patch creates
DeleteSelectionAsSubAction() for internal use.

Note that this patch adds NS_ASSERTION() to detect wrong caller.  However,
it cannot distinguish if the call is valid, for example, it's allowed to
call DeleteSelectionAsSelection() even if it's handling an edit action but
the method is called via mutation event listener.  So, we need to allow
some assertions with some tests.  But unfortunately, 1405747.html uses
mutation event listener too many times (about 1,000 times) and the number
of assertion isn't stable.  Therefore, this patch makes the test stop using
the mutation event listener 2nd time since I can reproduce the crash with
ESR 52 at the 2nd time.

MozReview-Commit-ID: 1TWaypmnoCC

--HG--
extra : rebase_source : a6a4fb1cbcaf2ab6f10c5f3e7168a6bc0fcb02ed
2018-06-29 20:16:50 +09:00
Markus Stange
2fa0e26050 Bug 426246 - cmd_deleteToBeginningOfLine should delete to the beginning of the line, not the whole line. r=masayuki
MozReview-Commit-ID: 3OTOSz8u9Co

--HG--
extra : rebase_source : a2f9619c41add013e09cbb10b8ea21206f5709b4
2018-06-14 15:42:16 -04:00
Masayuki Nakano
65a183e7d5 Bug 1467692 - Create EditorBase::SelectAllInternal() for internal use r=m_kato
For preparing to fix bug 1465702, we need to split public methods of editor
which are used by both outside and itself or friends.

SelectAll() is used by both outside and TextEditor.  So, we need to create
SelectAllInternal() and make TextEditor use it instead.

MozReview-Commit-ID: JtIlrfBYBSD

--HG--
extra : rebase_source : 5c29a9c1bb99f457f66f320b873b2c7b0f93fcde
2018-06-07 22:30:14 +09:00
Masayuki Nakano
84aca99c88 Bug 1463985 - part 21: Rename EditSubAction::insertElement to EditSubAction::eInsertElement r=m_kato
MozReview-Commit-ID: 6nrm1zJ968f

--HG--
extra : rebase_source : 633824e9564dddd9d9b80414ab07e7aa960b8fb1
2018-05-28 23:13:41 +09:00
Masayuki Nakano
54321db367 Bug 1463985 - part 14: Rename EditSubAction::insertBreak to EditSubAction::eInsertParagraphSeparator r=m_kato
MozReview-Commit-ID: DhEzqhLxMme

--HG--
extra : rebase_source : 87e482478b881ba9c9fbc99562fce5e5a576e0ab
2018-05-28 22:27:47 +09:00
Masayuki Nakano
f24da5be63 Bug 1463985 - part 13: Rename EditSubAction::setText to EditSubAction::eSetText r=m_kato
MozReview-Commit-ID: A4DF3fX9IV6

--HG--
extra : rebase_source : d89acbacb9f17a599ee5b1c1387fd08f42cac3b6
2018-05-28 22:20:43 +09:00
Masayuki Nakano
b539d189c1 Bug 1463985 - part 12: Rename EditSubAction::outputText to EditSubAction::eComputeTextToOutput r=m_kato
MozReview-Commit-ID: ItJi2rKv6Pw

--HG--
extra : rebase_source : 3c0bea9a8cdfd74b3f65d504d32d63746afe82cd
2018-05-28 22:09:55 +09:00
Masayuki Nakano
cbdd1207ab Bug 1463985 - part 10: Rename EditSubAction::deleteSelection to EditSubAction::eDeleteSelectedContent r=m_kato
MozReview-Commit-ID: 8LNY42KnyDf

--HG--
extra : rebase_source : 7778c0ff7c3da1c5070d0e5acf607665ff8efd4f
2018-05-28 21:49:56 +09:00
Masayuki Nakano
99a921d037 Bug 1463985 - part 9: Rename EditSubAction::insertIMEText to EditSubAction::eInsertTextComingFromIME r=m_kato
MozReview-Commit-ID: 1TmryMStB7H

--HG--
extra : rebase_source : 33dea12fe1ce0d5b9ea9ee13681949f288056d2a
2018-05-28 21:44:39 +09:00
Masayuki Nakano
63f1437458 Bug 1463985 - part 8: Rename EditSubAction::insertText to EditSubAction::eInsertText r=m_kato
MozReview-Commit-ID: Bd7GMng3T1T

--HG--
extra : rebase_source : a7e1774282c69b38add45faa993682d98e976d6b
2018-05-28 21:36:47 +09:00
Masayuki Nakano
5de95ff37e Bug 1463985 - part 3: Rename EditSubAction::undo and EditSubAction::redo to EditSubAction::eUndo and EditSubAction::eRedo r=m_kato
MozReview-Commit-ID: 3eNlmFimFlu

--HG--
extra : rebase_source : 3ed271141f5161ca48cd39882fa6290b1d45946c
2018-05-28 20:36:06 +09:00
Masayuki Nakano
99341a9445 Bug 1463985 - part 1: Rename EditAction to EditSubAction and related stuff r=m_kato
When we implement InputEvent.inputType, we need to set a stack class to record
which edit action is currently handled.  However, currently, we call smaller
jobs as edit action.  For example, when user types a character at selecting
some characters, then, EditAction::deleteSelection is performed first, then,
EditAction::insertText is performed.  However, for the InputEvent.inputType,
we need inserText information.  So, for making new enum EditAction, we need
to rename current EditAction to EditSubAction.

And also this renames related stuff:

EditorBase::mIsInEditAction -> EditorBase::mIsInEditSubAction
EditorBase::IsInEditAction() -> EditorBase::IsInEditSubAction()
EditorBase::mAction -> EditorBase::mTopLevelEditSubAction
TextEditRules::mTheAction -> TextEditRules::mTopLevelEditSubAction
EditorBase::StartOperation() ->
  EditorBase::OnStartToHandleTopLevelEditSubAction()
EditorBase::EndOperation() ->
  EditorBase::OnEndHandlingTopLevelEditSubAction()
AutoRules -> AutoTopLevelEditSubActionNotifier
RulesInfo -> EditSubActionInfo

MozReview-Commit-ID: cvSkPUjFm1

--HG--
extra : rebase_source : baf527a3e353b7a8ebe9a46be2243b059c500234
2018-05-28 20:12:34 +09:00
Boris Zbarsky
931b9e37ad Bug 1455676 part 10. Remove use of nsIDOMNode from remaining xpidl. r=qdot 2018-05-29 22:58:49 -04:00
Boris Zbarsky
c73f664888 Bug 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki 2018-05-24 13:18:34 -04:00
Boris Zbarsky
0f8f7f6fba Bug 1463981 part 2. Remove use of nsIDOMNode in editor xpidl. r=masayuki 2018-05-24 13:18:34 -04:00
Masayuki Nakano
f615160008 Bug 1463327 - part 2: Change scope of some methods of TextEditor which won't be called by non-helper classes of editing to protected r=m_kato
TextEditor has 2 type of public methods.  One is true-public methods.  I.e.,
they should be able to be called by anybody.  E.g., command handlers, event
listeners, or JS via nsIEditor interface.  The other is semi-public methods.
 They are not called by the above examples but called by other classes which
are helper classes to handle edit actions.  E.g., TextEditRules, HTMLEditRules,
HTMLEditUtils, CSSEditUtils and Transaction classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make TextEditor have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in TextEditor.h.

MozReview-Commit-ID: Db3H6d1V8IU

--HG--
extra : rebase_source : d928a6bb378d02944c5a207de83211c33bb63613
2018-05-22 16:40:44 +09:00
Makoto Kato
cac4fa86ed Bug 1463399 - Remove unused local variable in TextEditor::OutputToString. r=masayuki
Now RulesInfo uses nsAString, but old comment is "XXX Struct should store
a nsAReadable*".  We can remove unnecessary local variable of nsString.

MozReview-Commit-ID: C7gnTG7xTjU

--HG--
extra : rebase_source : e141bbcefd75d90b836668f710350d4362d66c76
2018-05-22 21:07:09 +09:00
Masayuki Nakano
30e06e667e Bug 1457083 - part 2: Make all observer methods of HTMLEditRules create AutoSafeEditorData r=m_kato
Except HTMLEditRules::WillJoinNodes(), observer methods of HTMLEditRules
accesses mHTMLEditor.  Therefore, we need to make them create AutoSafeEditorData
instance in the stack.

Note that for reducing EditorBase::GetSelection() calls, this patch adds
Selection& argument to all of them.

MozReview-Commit-ID: 6mjuD2gZwVp

--HG--
extra : rebase_source : 56f16747a80927f0477b9b54f6088be719ed7b01
2018-04-26 23:27:50 +09:00
Masayuki Nakano
5f8ba21730 Bug 1457083 - part 1: Make public methods of TextEditUtils and HTMLEditUtils guarantee that the editor instance and selection instance won't be destroyed while it handles any edit actions r=m_kato
This patch creates a stack class in TextEditRules, its name is
AutoSafeEditorData and make all public methods (except editor observer methods)
which may change DOM tree, fire some DOM events or calling some XPCOM listeners
create its instance in the stack.  Then, it grabs associated editor instance
and its selection instance.

Next patch will make remaining public methods create AutoSafeEditorData.

MozReview-Commit-ID: 8oshdhL3ONQ

--HG--
extra : rebase_source : 591db71e45fe28ca93cbebd9bb7da8c16eae4466
2018-04-26 22:41:34 +09:00
Boris Zbarsky
f992e7ed0d Bug 1387143 part 22. Remove nsISelection isCollapsed/collapsed bits. r=mats 2018-05-08 13:52:39 -04:00
Boris Zbarsky
2abc41a969 Bug 1387143 part 8. Remove nsISelectionPrivate::Get/SetInterlinePosition. r=mats 2018-05-08 13:52:37 -04:00
Chris Peterson
71422dcaa9 Bug 1457813 - Part 2: Replace non-asserting NS_PRECONDITIONs with MOZ_ASSERTs. r=froydnj
s/NS_PRECONDITION/MOZ_ASSERT/ and reindent

MozReview-Commit-ID: KuUsnVe2h8L

--HG--
extra : source : c14655ab3df2c9b1465dd8102b9d25683359a37b
2018-04-28 12:50:58 -07:00
Masayuki Nakano
552423e58f Bug 1456377 - Move composition event handlers from EditorBase to TextEditor r=m_kato
Currently, EditorBase handles most composition events.  However, only
eCompositionChange event handler is in TextEditor and it's the main event
of handling composition.  Therefore, we should make all composition event
handlers in one place for easier to read, and make them non-virtual.

MozReview-Commit-ID: BYDhiPyGKvo

--HG--
extra : rebase_source : ed9db0f49d7ae268c85359e48015e86584f9c999
2018-04-19 00:31:51 +09:00
Makoto Kato
3f513220d0 Bug 1455533 - Part 3. Remove unused nsIEditor.outputToStream. r=masayuki
No one uses outputToStream even if c-c and BlueGriffon.  We should remove this.

MozReview-Commit-ID: LEUtfc89DBe

--HG--
extra : rebase_source : f0c5aa918f577ca8a285afd2414fe3da6545fefc
2018-04-20 16:41:07 +09:00
Masayuki Nakano
043e93a8ba Bug 1451672 - part 21: Refine TextEditor::TypedText() r=m_kato
According to existing comments, TextEditor::TypedText() and
HTMLEditor::TypedText() are intentional bottleneck to debug.  However, only
for that purpose, it and its internal methods are made virtual.  This really
doesn't make sense.

So, this patch creates TextEditor::OnInputText() for callers of TypedText()
with non-empty string, TextEditor::OnInputParagraphSeparator() for callers
of TypedText() with eTypeBreak (Enter key or insertParagraphSeparator),
HTMLEditor::OnInputLineBreak() for callers of TypedText() with eTypeBR
(Shift + Enter or insertLineBreak).  Additionally, this creates internal
non-virtual methods for XPCOM methods which are used as internal methods of
TypedText().  One is InsertTextAsAction() for nsIPlatintextEditor.insertText().
the other is InsertParagraphSeparator() for nsIPlaintextEditor.insertLineBreak().

Although those new methods are not have "WithTransaction" postfix, they must
be clearer they'll use transactions since user input and actions should be
undo-able.

MozReview-Commit-ID: AmOkMqovIKA

--HG--
extra : rebase_source : 9c0f4b25fa2a36ad2f3394f72eb290824c31d82a
2018-04-16 23:43:36 +09:00
Masayuki Nakano
a409fc4d17 Bug 1451672 - part 19: Remove TextEditor::CreateBR() and rename TextEditor::CreateBRImpl() to TextEditor::InsertBrElementWithTransaction() r=m_kato
TextEditor::CreateBR() is just a wrapper of TextEditor::CreateBRImpl() for
automatically retrieving Selection of the editor.

And TextEditor::CreateBRImpl() should be renamed to
TextEditor::InsertBrElementWithTransaction() for making it clearer what
it does.

MozReview-Commit-ID: D8sjVdLrVrd

--HG--
extra : rebase_source : f269f5c3ce598d221d7263c111475dab0dd5f19f
2018-04-16 19:21:29 +09:00
Masayuki Nakano
e31bcb6efe Bug 1451672 - part 13: Rename EditorBase::InsertTextImpl() and EditorBase::InsertTextIntoTextNodeImpl() to EditorBase::InsertTextWithTransaction() and EditorBase::InsertTextIntoTextNodeWithTransaction() r=m_kato
MozReview-Commit-ID: DF3HBVyu4P2

--HG--
extra : rebase_source : 1ce6c2b005c06df340524d2d617673f4ce93df07
2018-04-12 17:58:14 +09:00
Masayuki Nakano
bd0aa50472 Bug 1451672 - part 11: Rename EditorBase::SetAttribute(), EditorBase::RemoveAttribute() and EditorBase::CloneAttribute() with "WithTransaction" postfix r=m_kato
MozReview-Commit-ID: I8T9MNkY8Yq

--HG--
extra : rebase_source : 767e52098233c5f6a2c0e7efca433ddd9f246749
2018-04-12 16:58:33 +09:00