Граф коммитов

11237 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 0b789160c2 Bug 1796732 - Write first shot of douments of the editor module r=m_kato DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D159919
2022-10-27 03:21:13 +00:00
Mark Banner 7f3cba09e8 Bug 1795322 - Update toolkit modules references in remaining places. r=mossop,zeid,geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D160036
2022-10-26 08:06:37 +00:00
Csoregi Natalia 5f9da7b301 Backed out 12 changesets (bug 1795322) for causing multiple failures e.g. test_deletion_request_ping.py. CLOSED TREE
Backed out changeset aba25cbcda51 (bug 1795322)
Backed out changeset a4a35005ada9 (bug 1795322)
Backed out changeset 8e8d790eb0f4 (bug 1795322)
Backed out changeset db8903454bd3 (bug 1795322)
Backed out changeset 60cc71c61cad (bug 1795322)
Backed out changeset bc6a674994ad (bug 1795322)
Backed out changeset 6ac8a611f8c7 (bug 1795322)
Backed out changeset 9fb873ecfb31 (bug 1795322)
Backed out changeset c8a7a40c2a2f (bug 1795322)
Backed out changeset f2c118b6c6ce (bug 1795322)
Backed out changeset 38df43b4a70f (bug 1795322)
Backed out changeset 89aea8373411 (bug 1795322)
2022-10-25 23:47:58 +03:00
Mark Banner fc7befc08d Bug 1795322 - Update toolkit modules references in remaining places. r=mossop,zeid,geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D160036
2022-10-25 19:49:28 +00:00
Jan-Niklas Jaeschke 67840fe563 Bug 1783641: Deleting a selected word deletes surrounding whitespace on MacOS. r=masayuki
Native behaviour on MacOS dictates one whitespace being removed after double-clicking a word and pressing delete.
This behaviour is achieved by saving the information that the selection is created by doubleclick to the `nsFrameSelection`
and using it in the `DeleteRangeTransaction`, where the range is extended by one whitespace character before or after the range.

Differential Revision: https://phabricator.services.mozilla.com/D159613
2022-10-25 07:00:26 +00:00
Olli Pettay f4395f756c Bug 1788321, wait for idle time before trying to paint the -ref page, r=dminor
Spellchecker itself is using idle callback for certain things, so this is just trying to mimic that.
But purely guess work. The test is inherently racy since nothing guarantees the OS gives cpu time for the parent side.
We could add some notification that spellchecking is done, but not sure how a reftest coudl then access that notification -
but that would require some changes to the editor/spellchecker side too.

Differential Revision: https://phabricator.services.mozilla.com/D160022
2022-10-24 11:25:24 +00:00
Masayuki Nakano c9466187eb Bug 1699256 - Make `AutoEmptyBlockAncestorDeleter::GetNewCaretPosition` always return a valid point if succeeded r=m_kato
The testcase is tricky.  It creates 2 `Selection` ranges, one is collapsed at
end of the `<html>`, the other is collapsed in the new `<h3>` element.  The
first one is ignored by delete handler since Gecko does not allow to edit
outside `<body>` for now.

Then, deleting non-collapsed selection ranges tries to delete empty parent
blocks at the remaining collapsed selection range in the `<h3>`.  At this time,
it works with `nsIEditor::eNone`.  Then, its `GetNewCaretPosition` does not
return a valid point.  Then, the `Run` does not remove the `Selection` range
outside the `<body>`.

Therefore, `HTMLEditor::DeleteSelectionAndPrepareToCreateNode()` will see
2 ranges, then, hit the assertion.

Although there are some other cases which meet 2 or more `Selection` ranges
after deletion in `DeleteSelectionAndPrepareToCreateNode`, but for now, we
should make `AutoEmptyBlockAncestorDeleter::Run` collapse `Selection` when
it deletes empty ancestors.

Differential Revision: https://phabricator.services.mozilla.com/D159581
2022-10-21 05:59:34 +00:00
Tom Schuster 4918f62d16 Bug 1778565 - Editor: Handle nsIFile transferable as blob. r=nika,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D155753
2022-10-20 11:11:59 +00:00
Masayuki Nakano fb0bf2eac0 Bug 1777060 - Make the test initialize selection after waiting some ticks r=m_kato
The failure on Android is caused by async initialization of `<textarea>` runs
after initializing selection in it.  Therefore, `ArrowUp` is synthesized when
all text is selected and collapses it to start.

Then, I see another failure on Linux and macOS in `contenteditable` case at
running TV and TV-nonfis.  It seems that it's caused by remaining `Selection`
of the preceding test (`vertical-rl` case) does something wrong.  Once
removing all ranges at `blur`ring, the failures in `vertical-lr` case has
gone.

Differential Revision: https://phabricator.services.mozilla.com/D159566
2022-10-19 23:18:48 +00:00
Masayuki Nakano a2e038d71f Bug 1795061 - Stop exposing `JoinSplitNodeDirection.h` r=m_kato
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
2022-10-19 06:40:30 +00:00
Masayuki Nakano 4a64b9ab3f Bug 1795179 - Make some elements non-splittable r=m_kato
One of the reason of bug 1793873 is, `HTMLEditUtils::IsSplittableNode` returns
`false` for `<textarea>`.  Then, `insertParagraph` etc command with `Selection`
collapsed in `<textarea>` causes splitting the `<textarea>` and it's not split
at same parent.

Then, I found that we need to take care `<button>` specially.  It creates a
block formatting context, and it's a form control so that it should never be
split.  Therefore, `HTMLEditor::GetAncestorElement` requires to take care of
`<button>` element with additional scan option for minimizing the risk.

Differential Revision: https://phabricator.services.mozilla.com/D159229
2022-10-18 22:58:10 +00:00
Masayuki Nakano 6e573a8e54 Bug 1794804 - Make `HTMLEditor::MergeFirstLineOfRightBlockElementIntoLeftBlockElement` stop referring ok type of `Result` when it's error r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D159234
2022-10-18 22:42:54 +00:00
Masayuki Nakano 5f62438afd Bug 1794800 - Make `HTMLEditor::MoveOneHardLineContentsWithTransaction` notify last move node result of ignoring caret point suggestion if new move node fails r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D159233
2022-10-18 22:37:01 +00:00
Masayuki Nakano 2da57e45a2 Bug 1794800 - Make `HTMLEditor::MoveChildrenWithTransaction` notify last move node result of ignoring caret point suggestion if new move node fails r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D159232
2022-10-18 22:37:01 +00:00
Sandor Molnar 8cd82824c1 Backed out 2 changesets (bug 1778565) for causing mochitest plain failures in editor/libeditor/tests/test_bug490879.html CLOSED TREE
Backed out changeset 5f6350cfab61 (bug 1778565)
Backed out changeset 420e02d37505 (bug 1778565)
2022-10-18 22:18:00 +03:00
Tom Schuster 50f59ff179 Bug 1778565 - Editor: Handle nsIFile transferable as blob. r=nika,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D155753
2022-10-18 17:35:33 +00:00
Masayuki Nakano 7b5c93295e Bug 1793865 - Make `HTMLEditor::HandleOutdentAtSelectionInternal` not return caret point suggestion r=m_kato
It restores `Selection` with `AutoSelectionRestorer` instance created first.
Therefore it does not want the callers (currently, only
`HTMLEditor::HandleOutdentAtSelection` only) change `Selection` after doing it
without special reasons.  Therefore, it shouldn't return last caret point
suggestion which is not a good point to put caret actually.  Then, callers
do not need to handle it as they've never done.

Differential Revision: https://phabricator.services.mozilla.com/D159231
2022-10-18 06:48:45 +00:00
Andrew McCreight b1fa3e3b36 Bug 1794811, part 1 - Include nsISupports.h instead of nsISupportsBase.h. r=necko-reviewers,nika,valentin
nsISupports.h includes nsISupportsBase.h, so it should be equivalent.

In the next patch, I'm changing things so that nsISupports is defined in
nsISupports.h instead of nsISupportsBase.h, and deleting the latter, so
this change will be needed anyways. I'm guessing people were using IWYU
or something like that.

Differential Revision: https://phabricator.services.mozilla.com/D159169
2022-10-17 16:09:22 +00:00
Masayuki Nakano 555eef31f3 Bug 1793873 - Make `HTMLEditor::DoSplitNode` stop assuming that joining nodes are in same parent r=m_kato
Between splitting a node and undoing it, web apps can move split nodes anywhere.
Therefore, it shouldn't assume they are always in same parent node, and
`RangeUpdater::SelAdjJoinNodes` needs to handle it correctly.

Unfortunately, `RangeUpdater::SelAdjJoinNodes` cannot handle nested cases
correctly, e.g., right node was in `aRemovedContent` or right node was in
the container of `aStartOfRightContent.GetContainer()`.  However, it's not
a new regression, and such complicated situation breaks undoing anyway.
Therefore, I think that we don't need to care about it for now.

Differential Revision: https://phabricator.services.mozilla.com/D159230
2022-10-14 02:49:13 +00:00
Jan-Niklas Jaeschke 311f68ad19 Bug 1793485: Fixed memory issue in `NodeWillBeDestroyed()` for `MultiMutationObserver` classes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D158671
2022-10-13 14:26:07 +00:00
Cristian Tuns 67ff6520de Backed out changeset 928edafe970f (bug 1793485) for causing leaks CLOSED TREE 2022-10-12 17:09:32 -04:00
Jan-Niklas Jaeschke e71ca074c5 Bug 1793485: Fixed memory issue in `NodeWillBeDestroyed()` for `MultiMutationObserver` classes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D158671
2022-10-12 19:36:46 +00:00
Olli Pettay 3d62e10c4e Bug 1788321, try to wait for spellchecking to be repainted before doing reftest comparison r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D159024
2022-10-12 07:15:03 +00:00
Masayuki Nakano ff05850ef8 Bug 1793694 - part 7: Stop exposting `CSSEditUtils.h` and `ChangeStyleTransaction.h` r=m_kato
Depends on D158636

Differential Revision: https://phabricator.services.mozilla.com/D158637
2022-10-12 02:44:20 +00:00
Masayuki Nakano d54f646831 Bug 1793694 - part 6: Stop exposting `EditorUtils.h` r=m_kato
Depends on D158635

Differential Revision: https://phabricator.services.mozilla.com/D158636
2022-10-12 02:44:20 +00:00
Masayuki Nakano 994759243f Bug 1793694 - part 5: Move `EditorUtils::MaskString` to `TextEditor` r=m_kato
It's the only method which is used outside of the editor module.  Therefore,
we can stop exposing `EditorUtils.h` later.

Depends on D158634

Differential Revision: https://phabricator.services.mozilla.com/D158635
2022-10-12 02:44:19 +00:00
Masayuki Nakano e2b2e03fb4 Bug 1793694 - part 4: Stop exposing `HTMLEditUtils.h` r=m_kato
It's currently referred from outside only by `TextServicesDocument.cpp`.
It's not under `libeditor` but in the editor module.  Therefore, let's allow
it to refer the header files under `libeditor` directly.  Then, we can stop
exposing `HTMLEditUtils.h`.

Depends on D158633

Differential Revision: https://phabricator.services.mozilla.com/D158634
2022-10-12 02:44:19 +00:00
Masayuki Nakano d2b4935d19 Bug 1793694 - part 3: Move definitions of `JoinNodesDirection` and `SplitNodeDirection` into a new exposed header file r=m_kato
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
2022-10-12 02:44:18 +00:00
Masayuki Nakano 020393179b Bug 1793694 - part 2: Move some protected inline method definitions of `HTMLEditor` to non-exposed header r=m_kato
Depends on D158631

Differential Revision: https://phabricator.services.mozilla.com/D158632
2022-10-12 02:44:18 +00:00
Masayuki Nakano fbe8ad2ec8 Bug 1793694 - part 1: Move some static inline methods of `HTMLEditor` to `HTMLEditUtils` r=m_kato
Depends on D158483

Differential Revision: https://phabricator.services.mozilla.com/D158631
2022-10-12 02:44:17 +00:00
Chengyu Sun d4e767473d Bug 1790224 - Convert browser/actors/ClickHandler* JSM modules to ESMs. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D158853
2022-10-11 14:12:33 +00:00
Masayuki Nakano 52fa7d578c Bug 1793381 - part 3: Drop `DeleteSelectedContent` argument from `HTMLEditor::InsertFromTransferable` r=m_kato
It's always called with `DeleteSelectedContent::Yes`.  Therefore, the argument
is not required.  Then, its name can be `InsertFromTransferableAtSelection`.

Differential Revision: https://phabricator.services.mozilla.com/D158483
2022-10-09 01:27:35 +00:00
Masayuki Nakano df28abd410 Bug 1793381 - part 2: Make `HTMLEditor::DoInsertHTMLWithContext` as a sub action handler r=m_kato
It just creates `HTMLWithContextInserter` and calls its `Run()`.  Then, `Run()`
works as a sub action handler.  Therefore, we can make `DoInsertHTMLWithContext`
(which sounds like a helper class of a handler method) a sub action handler.

Then, it can handle the optional insertion point in it and
`HTMLWithContextInserter::Run` does not need to handle it.

Differential Revision: https://phabricator.services.mozilla.com/D158482
2022-10-09 01:27:35 +00:00
Masayuki Nakano f9fd02e705 Bug 1793381 - part 1: Make `HTMLEditor::InsertObject` and related methods use `enum class` instead of `bool` r=m_kato
They use `bool` arguments a lot.  Therefore, some call-sites are hard to read.
They should be replaced with `enum class`es.  Note that this patch does not
make the raw value of new `enum class`es to `bool` unless they are used in the
heap.

Differential Revision: https://phabricator.services.mozilla.com/D158481
2022-10-09 01:27:34 +00:00
Masayuki Nakano 6f006e854a Bug 1792759 - part 4: Make all tests in mozilla-central stop using `nsIEditor.transactionManager` r=m_kato
Now, `nsIEditor` has all alternatives of remaining `nsITransactionManager`
usage in mozilla-central.

Differential Revision: https://phabricator.services.mozilla.com/D158339
2022-10-09 01:13:50 +00:00
Masayuki Nakano 221e6fe540 Bug 1792759 - part 3: Add `nsIEditor.undoAll` r=m_kato,Standard8
`nsIEditor.undo` and `nsIEditor.redo` are called with `1` except by the search
bar, and search bar wants to undo everything to reset the value.  Therefore,
search bar needs an API to undo all, and the others do not need the number of
undoing/redoing transactions.  Therefore, this patch adds `nsIEditor.undoAll`
for search bar, and remove the arguments from `nsIEditor.undo` and
`nsIEditor.redo`.

Differential Revision: https://phabricator.services.mozilla.com/D158338
2022-10-09 01:13:50 +00:00
Masayuki Nakano 85a314b8fd Bug 1792759 - part 2: Redesign `nsIEditor.canUndo` and `nsIEditor.canRedo` r=m_kato,NeilDeakin
They are methods to take 2 out params, and it's not convenient for light use.
I think that there should be 3 attributes, `undoRedoEnabled`, `canUndo` and
`canRedo`.  Then, the findbar does not need to check number of transactions
with `nsITransactionManager`.

Differential Revision: https://phabricator.services.mozilla.com/D158337
2022-10-09 01:13:49 +00:00
Masayuki Nakano 4ba9b4dd1c Bug 1792759 - part 1: Add `nsIEditor.clearUndoRedo()` to get rid of `nsIEditor.transactionManager` r=m_kato,NeilDeakin,Standard8
`nsIEditor.transactionManager` is used only for some simple purposes, however,
`nsIEditor` exposes the rich API.  That makes it harder to maintain internal
code around transactions.  Instead, `nsIEditor` exposes only simple and
necessary APIs.

This patch creates a new API to clear undo/redo history and make the users in
mozilla-central use it instead of using `nsITransactionManager.clear()`.

Differential Revision: https://phabricator.services.mozilla.com/D158336
2022-10-09 01:13:49 +00:00
Masayuki Nakano 4789a16aab Bug 1792654 - Make `CreateNodeResultBase`, `MoveNodeResult`, `SplitNodeResult` and `SplitRangeOffResult` handle caret point with a common base class r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158335
2022-10-04 21:36:57 +00:00
Masayuki Nakano 86bd7e3f58 Bug 1792642 - Make `SplitNodeResult` treated as ok type of `Result` r=m_kato
Depends on D158333

Differential Revision: https://phabricator.services.mozilla.com/D158334
2022-10-04 07:28:10 +00:00
Masayuki Nakano 158095f12c Bug 1792641 - Make `JoinNodesResult` treated as ok type of `Result` r=m_kato
Depends on D158332

Differential Revision: https://phabricator.services.mozilla.com/D158333
2022-10-03 23:17:02 +00:00
Masayuki Nakano e93bfe5b05 Bug 1792639 - Make `SplitRangeOffFromNodeResult` treated as ok type of `Result` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158332
2022-10-03 07:52:45 +00:00
Masayuki Nakano fa59d785e9 Bug 1792624 - Make `SplitRangeOffResult` treated as ok type of `Result` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158243
2022-10-03 01:19:59 +00:00
Masayuki Nakano b56174de6b Bug 1792502 - Correct the emulation in crashtests for bug 1789967 r=m_kato
I misunderstood the traditional behavior before bug 1789967, that is,
`HTMLEditor` collapsed `Selection` to end of the deepest last child container
element **or text node** of the `<body>`, rather than to end of **only** the
deepest last child container element. This misunderstanding caused the backout
of the first landing, but I didn't realize this mistake.

Therefore, this patch makes the crashtests which are touched in bug 1789967 and
the collapsed point is at a text node (or failed to consider the collapsed
point) collapse `Selection` to end of the deepest last text node of their
`<body>` elements.

Differential Revision: https://phabricator.services.mozilla.com/D158177
2022-10-02 00:03:36 +00:00
Masayuki Nakano b671926fa5 Bug 1792387 - part 10: Make `editor/libeditor/tests/test_inline_style_cache.html` be aware of both split node directions r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158108
2022-09-30 22:20:23 +00:00
Masayuki Nakano 405786efd0 Bug 1792387 - part 8: Make `HTMLEditor::InsertParagraphSeparatorAsSubAction` put caret into right paragraph r=m_kato
If splitting element is a list item element,
`HandleInsertParagraphInListItemElement` may just move it into a list element
if it's followed by the list element, or may create new paragraph element if
the list item element is empty and last list item element.

If splitting element is a heading element,
`HandleInsertParagraphInHeadingElement` may create new paragraph element if
splitting at end of the heading element and not followed by `<br>`.

Therefore, neither `SplitNodeResult` nor `CreateElementResult` is proper for
their result type, and the caller `InsertParagraphSeparatorAsSubAction`, just
wants to know the right handle element which should contain caret and a caret
point suggestion.

For solving these issues, this gives an alias to `CreateElementResult`, makes
them return the right paragraph even if it's not newly created nor split
element, and replaces `blockElementToPutCaret` with the returned element.

Differential Revision: https://phabricator.services.mozilla.com/D158106
2022-09-30 22:20:22 +00:00
Masayuki Nakano 6b4bdd204e Bug 1792387 - part 7: Make `editor/libeditor/test_bug449243.html` be aware of both split node directions r=m_kato
The test compares the node name of the split element and its previous sibling
element, so it should switch the scanning direction with the pref to switch
split node direction.

Note that the behavior is different from the other browsers in some cases.
Therefore, we cannot port this to WPT.

Differential Revision: https://phabricator.services.mozilla.com/D158105
2022-09-30 22:20:22 +00:00
Masayuki Nakano 5e5b106cf0 Bug 1792387 - part 6: Make `HTMLEditor::InsertElementWithSplittingAncestorsWithTransaction` check edge case with next node of the split point r=m_kato
The check assumes that the container of `aPointToInsert` is always right node.
However, its child is moved to new node if we switch the direction, so we should
make it check the edge case with `SplitNodeResult::GetNextContent()`.

Differential Revision: https://phabricator.services.mozilla.com/D158104
2022-09-30 22:20:22 +00:00
Masayuki Nakano 5cf34cef27 Bug 1792387 - part 5: Make `HTMLEditor::SplitRangeOffFromBlock` and its caller refer `SplitNodeResult` at their post-processing r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158103
2022-09-30 22:20:21 +00:00
Masayuki Nakano 9301bc763b Bug 1792387 - part 4: Make `JoinNodesTransaction` and `SplitNodeTransaction` support both join/split node directions r=m_kato
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
2022-09-30 22:20:21 +00:00