Commit Graph

774 Commits

Author SHA1 Message Date
Masayuki Nakano
db70f10b72 Bug 1803044 - part 9: Make the style editor use existing inline element in the CSS mode as far as possible r=m_kato
The other browsers use any inline elements to set CSS property for applying
an inline style.  However, Gecko limits it to a `<span>` which does not have
any attributes.  The other browsers' design is better for saving number of
elements and runtime cost of inserting new element (moving all children to the
new element and inserting it to the original position).  Therefore, it's nicer
to follow the other browses.  Then, we can avoid new WPT failures at aligning
other behaviors to the other browsers.

With doing that, removing style code requires complicated changes because
`RemoveStyleInside` assumes that one element has one style, but after taking
the compatible behavior, one element can have multiple styles including the
style represented by the element itself.

Note that the new expected failures are caused by bug 1183844. Gecko returns
closest ancestor element's background color for
`queryCommandValue("backColor")`.  Therefore, it returns "transparent" of the
inner `<span>` element.

Differential Revision: https://phabricator.services.mozilla.com/D164004
2022-12-13 03:37:38 +00:00
Masayuki Nakano
23f84e1ccb Bug 1777054 - part 2: Make test_bug795785.html synthesize key events in each event loop r=m_kato
When keyboard events are fired by auto repeat feature of OS, each event is fired
in each event loop.  However, `repeat` feature of the `synthesizeKey` and
typing multiple characters with `sendString` dispatch keyboard events in an
event loop.  Therefore, asynchronous scrolling is handled differently from
users' scenario.  So we should emulate the users' scenario better with
synthesizing each event with waiting a tick.

Depends on D162527

Differential Revision: https://phabricator.services.mozilla.com/D162528
2022-11-28 03:01:51 +00:00
Masayuki Nakano
a8b90c9538 Bug 1777054 - part 1: Rewrite test_bug795785.html with apz_test_utils.js r=m_kato
It uses legacy `hitEventLoop` hack with `setTimeout`.  Now, we have better
utility methods and can avoid using callbacks with using async/await.

However, waiting only for `waitToClearOutAnyPotentialScrolls` does not fix
the intermittent failure.  Therefore, this patch checks whether the scroll
result in its wrapper to make sure that there is no pending scroll.

Differential Revision: https://phabricator.services.mozilla.com/D162527
2022-11-28 03:01:51 +00:00
Mark Banner
ec76a72706 Bug 1799314 - Convert consumers of testing modules to import ES modules direct (miscellaneous). r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D161917
2022-11-17 12:00:32 +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
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
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
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
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
c82ba52224 Bug 1782911 - part 10: Make HTMLEditor::MoveOneHardLineContentsWithTransaction delete trailing linefeed if it becomes not preformatted r=m_kato
This is a hack for compatibility with the other browsers.  When we move first
line of `<pre>` to left paragraph whose `white-space` style does not make it
preformatted, they drop the last linefeed because of unnecessary.

Differential Revision: https://phabricator.services.mozilla.com/D157419
2022-09-25 12:49:47 +00:00
Masayuki Nakano
351819c1cc Bug 1782911 - part 8: Make HTMLEditor::MoveOneHardLineContentsWithTransaction clean up line break before right block if its first line is moved there r=m_kato
When the first line of right block element is moved before the block element,
unnecessary line break may be moved to immediately before the right block
element.  In the case, it needs to clean it up instead of trying to find
unnecessary line break at end of the left block which is a container of the
right block element.

Differential Revision: https://phabricator.services.mozilla.com/D157417
2022-09-25 12:49:46 +00:00
Masayuki Nakano
4854c49121 Bug 1782911 - part 7: Make HTMLEditor::MoveOneHardLineContentsWithTransaction stop moving empty inline nodes r=m_kato
Empty inline nodes except non-container nodes are not required in the
destination paragraph.  Therefore, it should just remove the node from the
DOM tree.

Differential Revision: https://phabricator.services.mozilla.com/D157416
2022-09-25 12:49:45 +00:00
Masayuki Nakano
94fbe6ab47 Bug 1782911 - part 6: Make HTMLEditor::MoveOneHardLineContentsWithTransaction delete new empty inline parents if deleting unnecessary line break creates them r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D157415
2022-09-25 12:49:45 +00:00
Masayuki Nakano
a7c1b47e8b Bug 1782911 - part 5: Make HTMLEditor::AutoBlockElementsJoiner scan previous (or next) paragraph with ignoring invisible data nodes r=m_kato
We don't ignore invisible data node at joining 2 paragraphs and this is
a different behavior from the other browsers.  When looking for a content
from current block boundary, `AutoBlockElementsJoiner` should keep scanning
visible things with ignoring invisible data nodes.  Then, it should delete
all invisible things after joining the paragraphs.

Differential Revision: https://phabricator.services.mozilla.com/D157414
2022-09-25 12:49:44 +00:00
Masayuki Nakano
7e788541b1 Bug 1782911 - part 4: Make HTMLEditor::MoveNodeOrChildrenWithTransaction preserve white-space style at moving different style node r=m_kato
Chrome and Safari preserve `white-space` with `style` attribute to keep
collapsible or preserved white-spaces as-is.  If an HTML element is moved,
`style` attribute should be set to it.  Otherwise, create `<span>` element
whose `style` attribute has the declaration for `white-space` and move
content into it.

Differential Revision: https://phabricator.services.mozilla.com/D157413
2022-09-25 12:49:44 +00:00
Masayuki Nakano
bb2a35d9d7 Bug 1782911 - part 3: Make HTMLEditor always move first line of right block only when the blocks have different white-space style r=m_kato
Gecko just joins 2 blocks when editable block parents are same element, e.g.,
both are `<div>`.  However, Chrome and Safari moves only first line of the
right block into the left block, and Gecko does it when both blocks are
different elements.

Ideally, we should take same behavior as Chrome and Safari because it's
reasonable for both compatibility with the other browsers and consistency
when both blocks are different but has same style, then we don't need to
maintain different behavior paths.

However, doing it for all elements are too risky because right block will be
merged into left block if right block has no line break.  On the other hand,
without doing it, preserving `white-space` is really hard because we need to
maintain the both paths.

Therefore, I'd like to change the behavior only when both blocks have different
`white-space` styles.  Usually, web apps do not change `white-space` for each
block, so I think that this is safer than doing this in all elements,
additionally, we can revert the behavior easy since this patch is really small.

Differential Revision: https://phabricator.services.mozilla.com/D157412
2022-09-25 12:49:43 +00:00
Masayuki Nakano
d1b5e4a973 Bug 1782911 - part 2: Clean up unnecessary line break at block boundary while moving first line of right paragraph to left paragraph r=m_kato
This fixes bug 503838 partially.  The new utility method scans unnecessary
`<br>` with strict check as far as possible.  Then, we can delete the node or
the preformatted line break at end of the last text node.

Differential Revision: https://phabricator.services.mozilla.com/D157411
2022-09-25 12:49:43 +00:00
Masayuki Nakano
222a330cb6 Bug 1782911 - part 1: Port most tests of test_bug772796.html to WPT r=m_kato
This patch ports most part of `editor/libeditor/tests/test_bug772796.html` to
WPT because this kind of behaviors are not tested by `editing/run/delete.html`
nor `editing/run/forwarddelete.html`. (Not ported tests are invalid HTML
structure cases and list item cases, the reason why not doing this for the
latter is, it needs a lot of cases and not important for most web apps.)

The most expectations are based on Chrome and Safari (they both behave almost
same), but they fail a lot in `join-pre-and-other-block.html` and
`white-space: pre-line` cases in the other tests.

Even though this ports a lot of cases, for making easier to compare the
behavior change in the following patches, we should keep the tests.

Differential Revision: https://phabricator.services.mozilla.com/D157410
2022-09-25 12:49:42 +00:00
Andreea Pavel
c538244252 Bug 1777060 - disable test_caret_move_in_vertical_content.html on android debug r=intermittent-reviewers,MasterWayZ DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D157917
2022-09-22 11:38:35 +00:00
Masayuki Nakano
a353ab7e90 Bug 1789967 - part 3: Make HTMLEditor::CollapseSelectionToEndOfLastLeafNodeOfDocument and HTMLEditor::InitEditorContentAndSelection do nothing if the document is partially editable r=m_kato
They and their callees work with the result of `GetRoot()` which is the document
element or the body element.  If the body is not editable, `Selection` should
not be updated in non-editable region nor `<br>` elements should not be
inserted in both non-focused editable elements and non-editable elements.
Therefore, they should run only when the document element or the `<body>`
element is editable.

To keep testing crashtests as reported, this patch makes tests which have
`contenteditable` except `<html>` and `<body>` initialize `Selection` as
what we've done.  And clean up the tests for helping to port them to WPT
in the future (bug 1725850).

Differential Revision: https://phabricator.services.mozilla.com/D157408
2022-09-22 06:27:37 +00:00
Masayuki Nakano
2d65dbd85c Bug 1789345 - Make editor/libeditor/test_bug1318312.html easier to read r=m_kato
It's hard to know how some tests failed in test_bug1318312.html.  Therefore,
this patch makes the selection range comparison easier to read, and add
description to explain what was doing at the failure.

Differential Revision: https://phabricator.services.mozilla.com/D156526
2022-09-07 01:06:47 +00:00
Mark Banner
4f95e6b415 Bug 1786197 - Turn on ESLint rule for prefer-boolean-length-check for editor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D155169
2022-08-26 13:39:36 +00:00
Masayuki Nakano
94b817dc98 Bug 1785311 - Make EditorBase::InsertTextIntoTextNodeWithTransaction update insertion point after executing the transaction r=m_kato
Before the fix of bug 1758420, `TextComposition`'s text node and offset in it
are updated at creating `CompositionTransaction`.  However, it's now put off
until getting the mutations.  Therefore, it always unsets `pointToInsert` at
first time of the composition and fails to notify the listeners.

This patch makes it retrieve the result after calling `DoTransactionInternal`
and handle the post processing with the new point.

Differential Revision: https://phabricator.services.mozilla.com/D155052
2022-08-22 23:56:36 +00:00
Masayuki Nakano
8b7fb928d3 Bug 1782628 - Make HTMLEditor::HandleInsertBRElement create caret position before moving its container r=m_kato
The test oddly passes without the fix in `HandleInsertBRElement`.  I guess that
post-processing in `HTMLEditor::OnEndHandlingTopLevelEditSubActionInternal()`
handles `Selection`, and anyway the insertion point of the following
`insertText` is wrong.  It seems that we don't need to uplift this.

Differential Revision: https://phabricator.services.mozilla.com/D153832
2022-08-08 01:54:47 +00:00
Masayuki Nakano
bea9bf4233 Bug 1782852 - part 1: Get rid of unused editor commands in the wild r=smaug
`increaseFontSize`, `decreaseFontSize`, `gethtml`, `heading` and `readonly`
commands were disabled for a year in all channels, but no regression reports
have been filed.  Therefore, we can delete the commands and the telemetry
probes.

Note that `cmd_getContents` command which is the internal command of `gethtml`
is not used in comm-central too.  Therefore, this patch deletes the command
handler, `nsClipboardGetContentsCommand`, and `Command::GetHTML` too.

Differential Revision: https://phabricator.services.mozilla.com/D153720
2022-08-05 02:55:22 +00:00
Masayuki Nakano
7f6f9cf71c Bug 1774704 - part 0: Add automated tests of preserving selection while handling some commands r=m_kato
The following patches touch the logic to restore selection after handling
commands.  However, it seems that they are not tested because I found some
regressions by manual testing, but didn't cause orange on tryserver.

`outdent-preserving-selection.tentative.html` causes a crash due to the
`MOZ_ASSERTION` in `HTMLEditor::HandleOutdentAtSelectionInternal`.  It means
that I misunderstand the logic and had put the assertion.  I should fix it
later with reading the complicated code again.  For now, I just change it
to `NS_WARNING_ASSERTION` instead.

And also `test_cmd_absPos.html` is the first test to check toggling `position`
between `static` and `absolute`.  Therefore, it detects wrong `MOZ_ASSERT`s
which test whether `EditActionData` or `TopLevelEditSubActionData` is created
or not **before** they create them by themselves.  So, this patch removes the
wrong assertions.

Differential Revision: https://phabricator.services.mozilla.com/D152962
2022-08-04 00:21:53 +00:00
Mark Banner
1c23a90c8e Bug 1782008 - Remove now unnecessary ESLint test definitions from other .eslintrc.js files. r=mossop,media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D153216
2022-08-03 11:16:20 +00:00
Tooru Fujisawa
a032f53a63 Bug 1780543 - Part 5: Add mozilla/chrome-script environment. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D152430
2022-07-26 02:46:30 +00:00
Masayuki Nakano
a45b6d1e16 Bug 1773848 - Make the for-loop in the lambda in HTMLEditor::InsertTableRowsWithTransaction refer only cellDataInLastRow r=m_kato
It's renamed from `CellData`, but `cellData` still exists in the wider scope.
https://searchfox.org/mozilla-central/rev/f6a2ef2f028b8f1eb82fa5dc5cb1e39a3baa8feb/editor/libeditor/HTMLTableEditor.cpp#923-924

Therefore, these lines are wrong:
https://searchfox.org/mozilla-central/rev/f6a2ef2f028b8f1eb82fa5dc5cb1e39a3baa8feb/editor/libeditor/HTMLTableEditor.cpp#1049,1053

because `cellData` was in the for-loop:
https://searchfox.org/mozilla-central/rev/bc4493c72442ad55aecf6b575edb0df4ed18b113/editor/libeditor/HTMLTableEditor.cpp#1008-1009,1020,1022,1026

Differential Revision: https://phabricator.services.mozilla.com/D152144
2022-07-20 04:24:52 +00:00
Magnus Melin
2fec2a1929 Bug 1779343 - Don't crash rewrapping "> ". r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D151682
2022-07-14 13:12:29 +00:00
Neil Deakin
ef2a63d6b6 Bug 1779042, fix test_paste_no_formatting.html to handle headless clipboard, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D151548
2022-07-14 12:53:06 +00:00
Tooru Fujisawa
52c95734e7 Bug 1667455 - Part 9: Stop importing Services.jsm from chrome-priv HTML code, single-line cases. r=kmag,necko-reviewers,geckoview-reviewers,extension-reviewers,m_kato,dragana
Differential Revision: https://phabricator.services.mozilla.com/D150898
2022-07-11 12:41:52 +00:00
Neil Deakin
00acc7206b Bug 968104, paste unformatted shortcut (shift+ctrl/cmd+v) should work in plain text contexts, such as input and textarea, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D150806
2022-07-11 08:58:35 +00:00
Masayuki Nakano
92c1ac04ef Bug 1778091 - Make HTMLEditor move invisible <br> element into the empty inline element after splitting a paragraph at end r=m_kato
In Yahoo! Mail, the paragraph has `<br>` after `<span>` element which has
`background-color`.  In this case, Gecko creates the following DOM tree after
splitting the paragraph:
```
<div><span>foo</span></div><div><span></span><br></div>
```
Then, the empty `<span>` in the right paragraph will be removed by the
post-processing.  However, in this case, the inline element is required for
preserving the style continued from the previous paragraph.

In this case, we should move the `<br>` element into the `<span>` to make
it non-empty and avoid it to be removed.  This is compatible with Chrome.

Differential Revision: https://phabricator.services.mozilla.com/D151345
2022-07-11 05:36:29 +00:00
Joel Maher
537a5a0dc8 Bug 1777549 - remove remaining e10s conditions in manifest files. r=gbrown,extension-reviewers,zombie
Differential Revision: https://phabricator.services.mozilla.com/D150820
2022-07-01 13:49:42 +00:00
Mark Banner
eadf832cfb Bug 1770727 - Fix failures of ESLint rule mozilla/use-includes-instead-of-indexOf in sjs files. r=Gijs
Depends on D147081

Differential Revision: https://phabricator.services.mozilla.com/D147082
2022-06-07 19:14:08 +00:00
Molnar Sandor
05e3775a6c Backed out 4 changesets (bug 1770727) for causing mochitest failures in test_bug1180105/test_access_control. CLOSED TREE
Backed out changeset 6323b526b0ac (bug 1770727)
Backed out changeset fc7ea80aa2ff (bug 1770727)
Backed out changeset 2a358ba86652 (bug 1770727)
Backed out changeset 464d1af6523b (bug 1770727)
2022-05-24 17:24:40 +03:00
Mark Banner
18b014551e Bug 1770727 - Fix failures of ESLint rule mozilla/use-includes-instead-of-indexOf in sjs files. r=Gijs
Depends on D147081

Differential Revision: https://phabricator.services.mozilla.com/D147082
2022-05-24 12:59:09 +00:00
Masayuki Nakano
5a6a9a0045 Bug 1730442 - part 7: Rewrite HTMLEditor::InsertTableRowsWithTransaction() to collect any cell information before touching the DOM tree r=m_kato
This patch also makes it inserts table rows immediately after the previous
row element of the found reference row element to make it insert new table
rows immediately after there when inserting position is "after".  Typically,
it's the parent `<tr>` element of `aCellElement`.  Therefore, this approach
can preserve text nodes immediately after it which was intentionally inserted
by the web apps.

Differential Revision: https://phabricator.services.mozilla.com/D146365
2022-05-20 07:39:53 +00:00
Masayuki Nakano
bc4493c724 Bug 1730442 - part 6: Make HTMLEditor::InsertTableColumnsWithTransaction() collect all necessary data before touching the DOM tree r=m_kato
It needs to work with the latest layout information to consider which cell
element is the insertion point due to rowspan and colspan.  Therefore,
this patch makes it collects all cell data before touching the DOM except
the case that it needs to normalize the table to make it rectanble.

Note that the case requiring the normalizer should be fixed in a later patch.

This method is corresponding to an XPCOM method.  Therefore, this is tested
by `test_nsITableEditor_insertTableColumn.html`.

And also it's used by the inline table editor, but we don't have automated tests
for this because of no API to get the buttons.  Therefore, I tested it by my
hand.

Note that the old code fails to put caret to newly inserted cell at the reftest
situation.  This fixes the bug too.  Therefore, this changes the reftest's
reference.

Differential Revision: https://phabricator.services.mozilla.com/D146364
2022-05-20 07:39:53 +00:00
Masayuki Nakano
88c3133a0b Bug 1730442 - part 3: Make HTMLEditor::InsertTableCellsWithTransaction() work without layout information r=m_kato
It refers the layout information for getting row/column index of selected cell
element or a cell element which contains selection.  However, it can stop
referring it if all callers can specify insertion point of new cells, and it's
possible.  Therefore, we can make it free from layout information.

Note that this blocks legacy mutation events during inserting table cell
elements, but perhaps this does not cause problems in the wild.
`DOMNodeInserted` will be fired after all cell elements are inserted, so
from point of view of the event listeners, editor content is different from
traditional behavior, but this works only when user uses inline table editor
which is disabled by default.  I.e., in the wild, this path is rarely run.

Additionally, this patch makes it return `CreateElementResult` for the latter
changes which want to put caret to first inserted cell element.

Note that the changes are tested by `test_nsITableEditor_insertTableColumn.html`
and `test_nsITableEditor_insertTableCell.html`.

Differential Revision: https://phabricator.services.mozilla.com/D146361
2022-05-20 07:39:52 +00:00
Masayuki Nakano
458bf2e95e Bug 1730442 - part 1: Make all nsITableEditor features flush pending layout at start to handle their jobs r=m_kato
Our table editor depends on layout information for getting raw/column position
of a cell, checking rawspan/colspan information and table size.  Therefore,
they require the latest information, but they don't flush pending layout by
themselves.  Therefore, this patch makes them do it by themselves and deleting
unnecessary hack from their tests.

Differential Revision: https://phabricator.services.mozilla.com/D146359
2022-05-20 07:39:51 +00:00
Molnar Sandor
416e516586 Backed out 7 changesets (bug 1730442) for causing reftest failures in editor/reftests/inline-table-editor-position-after-updating-table-size-from-input-event-listener.html. CLOSED TREE
Backed out changeset f6d7f162e57a (bug 1730442)
Backed out changeset e5d1671b3bbc (bug 1730442)
Backed out changeset e60a5cd69184 (bug 1730442)
Backed out changeset 943d4e4b0770 (bug 1730442)
Backed out changeset bd3324b635f4 (bug 1730442)
Backed out changeset ada0dda5bcde (bug 1730442)
Backed out changeset b67c4035c12f (bug 1730442)
2022-05-17 04:23:36 +03:00
Masayuki Nakano
757378b453 Bug 1730442 - part 3: Make HTMLEditor::InsertTableCellsWithTransaction() work without layout information r=m_kato
It refers the layout information for getting row/column index of selected cell
element or a cell element which contains selection.  However, it can stop
referring it if all callers can specify insertion point of new cells, and it's
possible.  Therefore, we can make it free from layout information.

Note that this blocks legacy mutation events during inserting table cell
elements, but perhaps this does not cause problems in the wild.
`DOMNodeInserted` will be fired after all cell elements are inserted, so
from point of view of the event listeners, editor content is different from
traditional behavior, but this works only when user uses inline table editor
which is disabled by default.  I.e., in the wild, this path is rarely run.

Note that the changes are tested by `test_nsITableEditor_insertTableColumn.html`
and `test_nsITableEditor_insertTableCell.html`.

Depends on D146360

Differential Revision: https://phabricator.services.mozilla.com/D146361
2022-05-17 00:12:09 +00:00
Masayuki Nakano
216035e16f Bug 1730442 - part 1: Make all nsITableEditor features flush pending layout at start to handle their jobs r=m_kato
Our table editor depends on layout information for getting raw/column position
of a cell, checking rawspan/colspan information and table size.  Therefore,
they require the latest information, but they don't flush pending layout by
themselves.  Therefore, this patch makes them do it by themselves and deleting
unnecessary hack from their tests.

Differential Revision: https://phabricator.services.mozilla.com/D146359
2022-05-17 00:12:08 +00:00