Including it in `HTMLEditor.h` causes creating static constructors for
the modules which include `HTMLEditor.h`. And the public methods are used
only in the `libeditor`. Therefore, we can make `HTMLEditor.h` stop including
it and stop exposing `JoinSplitNodeDirection.h`.
Differential Revision: https://phabricator.services.mozilla.com/D159363
They are used in public inline methods of `HTMLEditor`. Therefore, they should
be defined in an exposed header file without other internal use things for the
editor module. Then, we can stop exposing `HTMLEditHelpers.h`.
Depends on D158632
Differential Revision: https://phabricator.services.mozilla.com/D158633
The reason why the changes of `SplitNodeTransaction` is smaller than
`JoinNodesTransaction` is, `HTMLEditor::DoSplitNode` does almost all things
instead.
Differential Revision: https://phabricator.services.mozilla.com/D158102
This patch adds new path to adjust selection for the new split node direction.
So this does not change any behavior of the existing path.
Differential Revision: https://phabricator.services.mozilla.com/D158100
This patch add new path to adjust selection for the new join nodes direction.
So this does not change any behavior of the existing path.
Differential Revision: https://phabricator.services.mozilla.com/D158098
Similar to the previous patch, and for consistency between editor helper
classes, we should make result of getter methods of `EditorDOMPointBase` too.
Differential Revision: https://phabricator.services.mozilla.com/D153841
Currently I'm think that the split/join node direction should be managed per
`HTMLEditor` instance because per transaction makes undo/redo handling
complicated and may require additional space to save it in each transaction
instance. However, the direction should be changeable with new Gecko specific
`execCommand` to support both direction until creating first split/join node
transaction or anytime with clearing the transactions.
Differential Revision: https://phabricator.services.mozilla.com/D149192
This patch allows methods which split some nodes to return new candidate
caret position and makes callers of them consider whether applying it to
the selection immediately or not.
Differential Revision: https://phabricator.services.mozilla.com/D144648
First, move methods of `HTMLEditor` which collapse `Selection` to `EditorBase`.
Then, make editor stop accessing `Selection::CollapseInLimiter` directly.
Differential Revision: https://phabricator.services.mozilla.com/D143814
Currently, it's notified by `JoinNodesTransaction::DoTransactionInternal` so
that it's `SplitNodeTransaction::UndoTransaction` cannot track the DOM point
and this might cause odd editing result if `execCommand("undo")` is called
while `HTMLEditor` handles an edit action.
For avoiding to duplicate the code, it should be handled in
`HTMLEditor::DoJoinNodes`.
Differential Revision: https://phabricator.services.mozilla.com/D140463
First, it should not store split point with `EditorDOMPoint` because it has
child node pointer and other flags but they are never used and they make
the footprint worse. Therefore, this patch makes it exactly same structure
as `JoinNodesTransaction`.
Additionally, this patch removes "left" and "right" words especially from
the member names and variable names (preparation of bug 1735608).
Differential Revision: https://phabricator.services.mozilla.com/D140461
Currently, it's notified by `JoinNodesTransaction::DoTransactionInternal` so
that it's `SplitNodeTransaction::UndoTransaction` cannot track the DOM point
and this might cause odd editing result if `execCommand("undo")` is called
while `HTMLEditor` handles an edit action.
For avoiding to duplicate the code, it should be handled in
`HTMLEditor::DoJoinNodes`.
Depends on D140462
Differential Revision: https://phabricator.services.mozilla.com/D140463
First, it should not store split point with `EditorDOMPoint` because it has
child node pointer and other flags but they are never used and they make
the footprint worse. Therefore, this patch makes it exactly same structure
as `JoinNodesTransaction`.
Additionally, this patch removes "left" and "right" words especially from
the member names and variable names (preparation of bug 1735608).
Differential Revision: https://phabricator.services.mozilla.com/D140461
Similarly, `SplitNodeTransaction::RedoTransaction()` has its own code, but it
does not work well. Let's make it use `HTMLEditor::DoSplitNode()` instead.
This fixes bug 1740656.
Differential Revision: https://phabricator.services.mozilla.com/D132123
`JoinNodeTransaction::UndoTransaction()` has its own splitting code. However,
it has some bugs, it does not handle surrogate pairs correctly and it does not
care selections. `HTMLEditor::DoSplitNode()` is used for splitting a DOM node
from `SplitNodeTransaction::DoTransaction()`. So that we should make
`JoinNodeTransaction::UndoTransaction()` should use `HTMLEditor::DoSplitNode()`
for saving the maintenance cost.
Differential Revision: https://phabricator.services.mozilla.com/D132122
On Thunderbird, we still have a bug to delete `<html>` and `<body>` elements
(bug 1727201). However, it's hard to know where deletes the unexpected elements
from warning messages in the log. Additionally, it's really serious bug
because editor and layout code rely on the basic structure of HTML document.
Therefore, we should block the worst scenario before deleting such nodes.
Differential Revision: https://phabricator.services.mozilla.com/D123418
CLOSED TREE
Backed out changeset d3d67293f115 (bug 1623413)
Backed out changeset 75ed1b8a5c67 (bug 1623413)
Backed out changeset 0eef32d6a454 (bug 1623413)
`nsINode::InsertBefore()` removes inserting node from a document if it's in
a document including different document. In this case, `UpdateReflectorGlobal`
in BindingUtils.cpp calls `ErrorResult::MightThrowJSException()`, but editor
never throws exception with `ErrorResult`. Therefore, editor needs to call
`ErrorResult::WouldReportJSException()` explicitly if the inserting node may
be in another document.
As far as I checked, it can happen only when undoing or redoing a transaction.
Therefore, this patch touches only transaction classes.
Depends on D81683
Differential Revision: https://phabricator.services.mozilla.com/D81684
Their users should use `EditorDOMPoint` or something instead.
This patch cleans up `EditorBase::DoJoinNodes()` too because of their heavy
user. It requires only joined nodes because `aParent` is used only for
removing `aContentToJoin`, but we now have `nsINode::Remove()` which does
not require parent node and never fails.
Depends on D70877
Differential Revision: https://phabricator.services.mozilla.com/D70878
* getAttributeValue
* cloneAttribute
* splitNode
* joinNodes
* markNodeDirty
* removeEditorObserver
are not used from script. Therefore, we can get rid of them from `nsIEditor`.
However, `EditorBase::GetAttributeValue()` is referred by
`HTMLEditor::CopyCellBackgroundColor()` and it's just a wrapper of
`Element::GetAttr()`. Therefore, this patch makes
`HTMLEditor::CopyCellBackgroundColor()` use `Element::GetAttr()` directly.
And also `EditorBase::MarkNodeDirty()` is used from some friend classes.
Therefore, this patch redesigns it as `MarkElementDirty()` and make all of
them check whether the method call destroys the editor.
Differential Revision: https://phabricator.services.mozilla.com/D60796
In the next patch, we need to update unmasked range when anonymous text node
in `<input type="password">` is modified. This patch makes editor manage it
easier to update the range.
Note that the next patch also handles text node creation and destruction.
Differential Revision: https://phabricator.services.mozilla.com/D38003
We should stop handling splitting nodes if mutation event listeners move or
remove the split nodes unexpectedly because the post processors may not be
able to keep handling the nodes. For example, if a node is moved to outside
of editing host, we shouldn't touch it anymore due to non-editable.
This patch makes `EditorBase::DoSplitNode()` return new error for making
any parent callers stop their job, but note that the following patch makes
any public methods expose the new error as exception for compatibility with
Chrome.
Differential Revision: https://phabricator.services.mozilla.com/D20810
Oddly, `SplitNodeTransaction::DoTransaction()` checks the result of
`EditorBase::DoSplitNode()` only when it's not allowed to change `Selection`.
We should make it always check the result.
Differential Revision: https://phabricator.services.mozilla.com/D20809