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