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
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
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
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
This is remaining part of bug 1450882. I forgot to update
HTMLEditorDocumentCommands.cpp when I work on the bug.
This patch makes HTMLEditorDocumentCommands.cpp use non-virtual methods of
nsCommandParams instead of virtual methods of nsICommandParams.
MozReview-Commit-ID: 12AjXbeYNOa
--HG--
extra : rebase_source : 8d73866b21f6dd1c436244a771fb39bbe2debd40
nsIHTMLEditor::ReplaceHeadContentsWithHTML() is used only by HTMLEditor
internally. So, it shouldn't be an nsIHTMLEditor's method. This patch
changes it as a non-virtual method of HTMLEditor and rename it to
ReplaceHeadContentsWithSourceWithTransaction() for consistency with other
methods.
MozReview-Commit-ID: GT3maKEbZuP
--HG--
extra : rebase_source : 2dc8c682f0dd82d3fc9032fbf5195de121975c32
SelectionState doesn't save and restore current selection's direction. So the
direction of selection is always default after undoing.
So we should restore direction of selection.
Differential Revision: https://phabricator.services.mozilla.com/D2259
--HG--
extra : moz-landing-system : lando
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
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
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
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
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
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
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
TextEditor modifies composition string or selected string when first
eCompositionChange event is received. However, TextComposition dispatches
eCompositionChange event ("text" event of DOM) only when composition string
becomes non-empty if current composition string is empty. So, when IME
dispatches only eCompositionStart and eCompositionCommit events for removing
selected text, TextEditor does nothing. This hacky behavior is used by
MS Pinyin on Windows 10 at least.
For supporting this behavior, we need to make TextComposition dispatch
eCompositionChange event when eCompositionChange(AsIs) event is fired
even before dispatching eCompositionChange event.
Although from point of view of web apps, the hacky composition should be
merged into the previous composition if it's possible but it's out of scope
of this bug.
MozReview-Commit-ID: 7QfeBJamGTU
--HG--
extra : rebase_source : 8de1353021f2961ae9f8bdf17ddded1058175339
nsICommandParams is implemented only by nsCommandParams. So, all C++ users
can treat all instances of nsICommandParams as nsCommandParams. Therefore,
this patch makes all set/get value calls use non-virtual methods and all
constructors directly create nsCommandParams instance.
MozReview-Commit-ID: CscgK0gKp5g
--HG--
extra : rebase_source : 62eb0f60aada795a44cf5496cdafbff6cba80013
nsICommandParams::GetCStringValue() and nsICommandParams::SetCStringValue()
treat char. However, this makes their callers complicated. So, they should
be rewritten as treating nsACString.
MozReview-Commit-ID: DWO9veSyzyG
--HG--
extra : rebase_source : fbea13f6d7116ea1887434c0842b7768a7dc59ec
Spellchecker of <input> element is off by default, however, if it's in a
contenteditable element, spellchecker is on by default.
When turning off contenteditable, we have to update spellcheck status if
focused editor is in this contenteditable.
MozReview-Commit-ID: 6Y9mUWTIWRn
--HG--
extra : rebase_source : 80951a0389d429d781d359b05bfa6b4046d9e641
When setting contenteditable to false, editing session destroys HTMLEditor.
Destroying HTMLEditor means that selection visibility is reset by
FinalizeSelection.
So after calling TearDownEditorOnWindow on nsHTMLDocument, we should initialize
selection visibility if current focus is text control that has editor.
MozReview-Commit-ID: 4V8kZtOtKO3
--HG--
extra : rebase_source : 9d90c12b3c93e4dfd95095ce29a26e5fdd83f952
When setting contenteditable to false, editing session destroys HTMLEditor.
Destroying HTMLEditor means that selection visibility is reset by
FinalizeSelection.
So after calling TearDownEditorOnWindow on nsHTMLDocument, we should initialize
selection visibility if current focus is text control that has editor.
MozReview-Commit-ID: 4V8kZtOtKO3
--HG--
extra : rebase_source : 773c06bb22cf2da24fd11be9be8d7b0376da3e36
Calling EditorBase::EnableUndoRedo() without argument means that editor supports
unlimited undo/redo stack. AutoDisableUndo class calls it without argument
when it needs to restore undo/redo feature.
However, <input type="text"> and <textarea> limits number of maximum
transactions up to 1,000, perhaps for footprint. So, AutoDisableUndo should
store the last number of maximum transactions before disabling undo/redo from
the constructor.
MozReview-Commit-ID: CoI6ZXyTd3X
--HG--
extra : rebase_source : e2b9af17e5857dcc0a6781e254e45fdb790c9a9e
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
This assertion was added by review comment of bug 1487945. Since mutation event
handler of this test case hides resizer, this case hits this assertion.
Although 4th parameter of SetAttr can control mutation event, if this event
isn't fired, another test case (layout/base/tests/test_bug558663.html) becomes
failure.
So we should move the assertion before setting resizer attribute.
Differential Revision: https://phabricator.services.mozilla.com/D1854
--HG--
extra : moz-landing-system : lando
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.
MozReview-Commit-ID: 5UQVHElSpCr
--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
insertHTMLWithContext, getIndentState, setBodyAttribute and
getSelectionContainer are unused from script (inc. c-c and bluegriffon).
Differential Revision: https://phabricator.services.mozilla.com/D1822
These are effectively equivalent to appending a <link> element to the body, are
not unused, and bring in a fair amount of complexity because even though they're
owned by the document and stored in the document's mStyleSheets, they're not
owned by it per se, which causes confusion.
Unless I've missed something, both bluegriffon and common-central use the
*Override APIs, which this patch leaves untouched.
MozReview-Commit-ID: EOSMOHj3A95
nsITextServicesFilter.skip isn't accessed from JavaScript (including c-c and
bluegriffon), so we can remove it from IDL.
Also, skip method should use early return style for clean up.
MozReview-Commit-ID: qjZS54ZeoT
--HG--
extra : rebase_source : 45c302e3f3b893a8b4eec796890c43d5d8894230
nsITextServicesFilter is builtin class, so we can store nsComposeTxtSrvFilter
instead of nsITextServicesFilter.
MozReview-Commit-ID: ErZQwWC0Wjx
--HG--
extra : rebase_source : 7b327a0dbdf12e2e085d109e66e5140ac6d18773
There is no JavaScript implementation (including c-c and bluegriffon) for
nsITextServicesFilter, so we make this builtin to access builtin C++
implementation directly.
MozReview-Commit-ID: BGZlDzsKT6N
--HG--
extra : rebase_source : 1a0e328b84f1a71638425bb4dfba756a211faa74
HTMLEditorController and HTMLEditorCommands is for execCommand, so we should
move from composer to libeditor since HTML editor code is in libeditor.
MozReview-Commit-ID: DEBoTqUsQnw
--HG--
rename : editor/composer/HTMLEditorCommands.cpp => editor/libeditor/HTMLEditorCommands.cpp
rename : editor/composer/HTMLEditorCommands.h => editor/libeditor/HTMLEditorCommands.h
rename : editor/composer/HTMLEditorController.cpp => editor/libeditor/HTMLEditorController.cpp
rename : editor/composer/HTMLEditorController.h => editor/libeditor/HTMLEditorController.h
rename : editor/composer/HTMLEditorDocumentCommands.cpp => editor/libeditor/HTMLEditorDocumentCommands.cpp
extra : rebase_source : 0b9627ac89803212da3377db3dfefedc3b57ce73
nsComposerCommands has unnecessary atom calculation, so we should remove it.
Also, since nsStyleUpdatingCommand doesn't hava "all" tag names, we don't need
to support it.
MozReview-Commit-ID: Q0EBsK2mxr
--HG--
extra : rebase_source : eecf3314f416e0f77cc364eefc008deb81933ddf
Some commands are C++ header only, so we should remove unnecessary headers.
MozReview-Commit-ID: IXP5rLTkW5v
--HG--
extra : rebase_source : 993b90abc00072bb125a066b5fe6d16c4523f2f2
nsComposerController is execCommand's command controller now. So it is better
to use mozilla::HTMLEditorController class name instead of nsComposerController.
MozReview-Commit-ID: 7QNFO2dV5Zd
--HG--
rename : editor/composer/nsComposerController.cpp => editor/composer/HTMLEditorController.cpp
rename : editor/composer/nsComposerController.h => editor/composer/HTMLEditorController.h
extra : rebase_source : 413caf298b8583b5de3c6ac011b96ccebf24341e
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
There are two similar methods, but they are created with copy & paste.
So, the common code should be merged into new method, SetTextDirection().
Additionally, EditorBase::SwitchTextDirection() is a scriptable method but
nobody uses this from JS. So, we can make it from nsIEditor and this
patch renames it to ToggleTextDirection() since current name is too
similar to SwitchTextDirectionTo().
MozReview-Commit-ID: BX3M1OKxiD5
--HG--
extra : rebase_source : 74a5ff65adc96ba69792f2e63daf14828c505270
This moves NotifyEditorObservers() and GetInputEventTargetContent() into
protected member which should not be used by friends.
And also this moves IsModifiableNode() into protected member which can be
used by friends.
MozReview-Commit-ID: AxDBgTVED3V
--HG--
extra : rebase_source : 979c6cb0d075b3fd0106bd1c381aa3ef3b98ba78
HTMLEditor::BeginningOfDocument() is an XPCOM method and it just calls
MaybeCollapseSelectionAtFirstEditableNode(false). So, HTMLEditor can call
MaybeCollapseSelectionAtFirstEditableNode(false) directly.
MozReview-Commit-ID: 8x4j0AwzISl
--HG--
extra : rebase_source : 40a9e9eea95b22c59dc007f6babfc518205702ea
InsertFromDrop is implemented on TextEditor only, so it can do devirtualize
this method. Also, this method is only called by drop event handler of
EditorEventListener, so it should rename to better name (OnDrop).
Differential Revision: https://phabricator.services.mozilla.com/D1592
This crash occurs when start container of range for range updater is nullptr
in GetNodesForOperation.
Splitted node by SplitNodeDeepWithTransaction can return orphan node, so we
should return error when splitted node is orphan node.
MozReview-Commit-ID: 3ySdzc9FAzL
--HG--
extra : rebase_source : 3c6f37e81641751d32b8a9777b8362baad301ecb
Since GetActiveEditingHost is noscript method, we should move this from
nsIHTMLEditor to HTMLEditor.
MozReview-Commit-ID: 3jLHSstixxk
--HG--
extra : rebase_source : 72e992a6c5643e1d0f0f5454f803139716c6309c
We expose the relevant APIs on textarea and input elements anyway
(chromeonly). The QIs will throw on a non-input or non-textarea element, but
none of these consumers expect that to happen.
This was done automatically replacing:
s/mozilla::Move/std::move/
s/ Move(/ std::move(/
s/(Move(/(std::move(/
Removing the 'using mozilla::Move;' lines.
And then with a few manual fixups, see the bug for the split series..
MozReview-Commit-ID: Jxze3adipUh
EditSubAction::ignore is declared for making HTMLEditRules::AfterEditInner()
ignores post-processing of handling edit action. Currently, this is used only
by TextEditRules::CreateBogusNodeIfNeeded() and
HTMLEditor::ReplaceHeadContentsWithHTML(). So, we should make them use
specific EditSubAction values which explain what they do and make
HTMLEditRules::AfterEditInner() ignore both of them.
MozReview-Commit-ID: JSHcgPfTrOE
--HG--
extra : rebase_source : c054c2db257dda7e1e3ace01f8e8831e07268f7e
According to this usage, perhaps, we can remove this from EditSubAction and
this should be moved to new EditAction.
MozReview-Commit-ID: HzfcC051rNB
--HG--
extra : rebase_source : e42cade8436b082b4dc2adfcbbac75e17779cfd7
And the odd number assign does not make sense anymore. So, removes it.
MozReview-Commit-ID: JSyMNcrNhpP
--HG--
extra : rebase_source : efdb31d94d0fcae50cd72b5ee0d27041a454887a
Although, there might be no reason to have those edit sub-actions separately.
MozReview-Commit-ID: BaaNCqfk4V4
--HG--
extra : rebase_source : 061bc85c85489b6b2617e05bd91254667ddedb1a
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
Patch originally developed on bug 1458921 but needs to land with the WR update.
MozReview-Commit-ID: 82BYyNWBAfn
--HG--
extra : rebase_source : e6bca2f446c019fd41a37c2c28db73bbe1cfc216