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

10418 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano cbb83f40f6 Bug 1655988 - Fix assertion in `WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` r=m_kato
This is a bug of the assertion.

When there is 2 text nodes are adjacent, one ends with a visible character and
the other starts with a white-space, and the deleting range ends at end of the
first one, `GetReplaceRangeDataAtEndOfDeletionRange()` returns a range starting
with the start of the second one since it does not need to touch the first one.
Therefore, the white-space range start may be after the deleting range end.

This patch adds new condition to the `MOZ_ASSERT_IF`, and test this specific
case with new `MOZ_ASSERT_IF`.

Differential Revision: https://phabricator.services.mozilla.com/D110068
2021-03-30 06:09:23 +00:00
Masayuki Nakano d68f6fc838 Bug 1220696 - part 6: Support `insertLineBreak` and `insertParagraphSeparator` commands in `<textarea>` r=smaug
Those command handlers just check whether the given editor is an `HTMLEditor`
or not.  Therefore, we should make them check whether the given editor is
a single line editor or not instead.

Differential Revision: https://phabricator.services.mozilla.com/D108572
2021-03-24 01:55:09 +00:00
Masayuki Nakano fad3ed3447 Bug 1220696 - part 5: Support "contentReadOnly" and "getHTML" commands in `<input>` and `<textarea>` r=smaug
Although these commands supported supported only by Gecko, we shouldn't stop
supporting them unless we know the usage in the wild.  Therefore, this patch
adds the handling code for `TextEditor` too.

Differential Revision: https://phabricator.services.mozilla.com/D108571
2021-03-24 01:55:09 +00:00
Masayuki Nakano f956ee81ea Bug 1220696 - part 3: Make `AutoEditorCommandTarget` consider command handling editor with command and focused `TextEditor` or `HTMLEditor` r=smaug
For making `execCommand` and related methods with `<input>` and `<textarea>`
even if they are in `contenteditable` and focused, command should be handled
in active editor (focused editor if in foreground window and tab).

However, some commands should be handled by `HTMLEditor` even if an `TextEditor`
has focus.  Therefore, this patch adds new enum class which have 3 state into
`InternalCommandData` and makes `AutoEditorCommandTarget` consider it with the
enum class.

Note that the new failures about `contentReadOnly` command will be fixed by
a following patch.

Differential Revision: https://phabricator.services.mozilla.com/D108569
2021-03-24 01:55:08 +00:00
Butkovits Atila 3361c11f7d Backed out 7 changesets (bug 1220696) for causing build bustages. CLOSED TREE
Backed out changeset 1ad2d5c0f253 (bug 1220696)
Backed out changeset 5e2f62a11d95 (bug 1220696)
Backed out changeset 07012ed7a30e (bug 1220696)
Backed out changeset a4e90de9355d (bug 1220696)
Backed out changeset 63ec6c3d05fd (bug 1220696)
Backed out changeset f165f45f8e1a (bug 1220696)
Backed out changeset ade95bf58db4 (bug 1220696)
2021-03-24 01:34:56 +02:00
Masayuki Nakano 9892a73421 Bug 1220696 - part 6: Support `insertLineBreak` and `insertParagraphSeparator` commands in `<textarea>` r=smaug
Those command handlers just check whether the given editor is an `HTMLEditor`
or not.  Therefore, we should make them check whether the given editor is
a single line editor or not instead.

Differential Revision: https://phabricator.services.mozilla.com/D108572
2021-03-23 19:29:23 +00:00
Masayuki Nakano 843cdb6b35 Bug 1220696 - part 5: Support "contentReadOnly" and "getHTML" commands in `<input>` and `<textarea>` r=smaug
Although these commands supported supported only by Gecko, we shouldn't stop
supporting them unless we know the usage in the wild.  Therefore, this patch
adds the handling code for `TextEditor` too.

Differential Revision: https://phabricator.services.mozilla.com/D108571
2021-03-23 19:29:23 +00:00
Masayuki Nakano fc94975380 Bug 1220696 - part 3: Make `AutoEditorCommandTarget` consider command handling editor with command and focused `TextEditor` or `HTMLEditor` r=smaug
For making `execCommand` and related methods with `<input>` and `<textarea>`
even if they are in `contenteditable` and focused, command should be handled
in active editor (focused editor if in foreground window and tab).

However, some commands should be handled by `HTMLEditor` even if an `TextEditor`
has focus.  Therefore, this patch adds new enum class which have 3 state into
`InternalCommandData` and makes `AutoEditorCommandTarget` consider it with the
enum class.

Note that the new failures about `contentReadOnly` command will be fixed by
a following patch.

Differential Revision: https://phabricator.services.mozilla.com/D108569
2021-03-23 19:29:22 +00:00
Mirko Brodesser 814b998fc2 Bug 1698786: part 4) Add some logging to `EditorSpellChecker`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D108624
2021-03-18 09:33:22 +00:00
Jonathan Kew 0bf4eb7c5d Bug 1698734 - Don't create an EventListenerManager just to check for existing listeners. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D108612
2021-03-16 12:49:44 +00:00
Makoto Kato 605d5484aa Bug 1692052 - Don't notify IMEContext of widget when IMEStateManger doesn't manage this content. r=masayuki
This test case doesn't generate body element and isn't general case. Actually
since we don't manage current IME focus on IMEStateManager, we shouldn't notify
IMEContext of widget.

Differential Revision: https://phabricator.services.mozilla.com/D108366
2021-03-15 09:31:58 +00:00
Jonathan Kew a9143c6051 Bug 1692673 - Update tests for new Cut/Copy command-enabling behavior. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107481
2021-03-12 16:34:42 +00:00
Jonathan Kew 4fec409fa9 Bug 1692673 - Avoid enabling Cut/Copy menu commands in text editor context when there's no selection, unless a listener is present. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107480
2021-03-12 16:34:42 +00:00
Brindusan Cristian b073741c99 Backed out 3 changesets (bug 1692673) for bc failures in browser_contextmenu_input.js. CLOSED TREE
Backed out changeset 6060fa16bc3e (bug 1692673)
Backed out changeset 0f6717c26ae3 (bug 1692673)
Backed out changeset 8148b9e5dfba (bug 1692673)
2021-03-12 16:07:49 +02:00
Jonathan Kew 5eda87fe7b Bug 1692673 - Update tests for new Cut/Copy command-enabling behavior. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107481
2021-03-12 12:04:08 +00:00
Jonathan Kew 91adcd2694 Bug 1692673 - Avoid enabling Cut/Copy menu commands in text editor context when there's no selection, unless a listener is present. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107480
2021-03-12 12:04:07 +00:00
Csoregi Natalia 46c0e3eebc Backed out 2 changesets (bug 1692673) for failures on browser_contextmenu.js. CLOSED TREE
Backed out changeset dd24e610d956 (bug 1692673)
Backed out changeset b88ab8c6dd39 (bug 1692673)
2021-03-11 23:27:31 +02:00
Jonathan Kew ba5722b476 Bug 1692673 - Update tests for new Cut/Copy command-enabling behavior. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107481
2021-03-11 16:16:34 +00:00
Jonathan Kew e3ad8e8158 Bug 1692673 - Avoid enabling Cut/Copy menu commands in text editor context when there's no selection, unless a listener is present. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107480
2021-03-11 16:16:33 +00:00
Butkovits Atila 479d6f893c Backed out 2 changesets (bug 1692673) for causing build bustages on EditorBase.cpp. CLOSED TREE
Backed out changeset 988b919adc5c (bug 1692673)
Backed out changeset 5b1ba8dbfc8a (bug 1692673)
2021-03-11 12:43:24 +02:00
Jonathan Kew ba23557a7e Bug 1692673 - Update tests for new Cut/Copy command-enabling behavior. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107481
2021-03-11 10:27:04 +00:00
Jonathan Kew 24a5b45445 Bug 1692673 - Avoid enabling Cut/Copy menu commands in text editor context when there's no selection, unless a listener is present. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107480
2021-03-11 10:27:04 +00:00
Masayuki Nakano 18e444a223 Bug 1697249 - Stop creating `<span>` element for keeping same style as the link when the link will be unlinked r=m_kato
When typing at edge of a link, editor splits the link element at the edge (i.e.,
creating an empty link element).  Then, unlink the new link element (i.e.,
clearing the "link style").  At this time, `class` attribute and `style`
attribute are cloned to new `<span>` element for keeping the original style.
However, in this case, other browsers discard the specified style of the link.

On the other hand, when unlinking a link with `execCommand("unlink")`, the
other browsers keep specified style coming from `style` attribute.

Therefore, this patch adds new state to `PropItem`, which indicates whether
the `class` and `style` attribute should be cloned or discarded.  And then,
when preparing for inserting text, this patch makes it pass to the utility
method.

For better compatibility, we should stop cloning `class` attribute, but not
in this bug because this patch should be minimized for requesting uplift to
beta channel.

Differential Revision: https://phabricator.services.mozilla.com/D107801
2021-03-11 07:19:33 +00:00
Jonathan Kew ceb44d34d6 Bug 1664730 - Disable async font fallback when running mochitests, to avoid unpredictable extra reflows that can disrupt event-/timing-sensitive tests. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D107284
2021-03-10 12:26:52 +00:00
Masayuki Nakano 468bffc558 Bug 1429523 - Make IMEContentObserver ignore character data change notifications of invisible data nodes r=smaug
E.g., comment node is an invisible data node, and it's not handled by
`HTMLEditor` nor `ContentEventHandler`.  Therefore, `IMEContentObserver`
should ignore invisible data nodes, which are not derived from `dom::Text`.

Differential Revision: https://phabricator.services.mozilla.com/D107590
2021-03-09 23:57:56 +00:00
Masayuki Nakano eec5dff65e Bug 1655539 - Add crash test (the bug itself is fixed by the patch for bug 1677566) r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D107589
2021-03-09 23:57:55 +00:00
Masayuki Nakano 7af10cee55 Bug 1677566 - part 3: Ignore non-deletable ranges in `HTMLEditor::HandleDeleteSelection()` r=m_kato
For making delete handlers simpler, and set better target ranges to the
corresponding `beforeinput` event, we should ignore non-editable ranges
before handling deletion.

This patch makes editor stop handling deleteion when a range crosses editing
host boundaries.  In this case, Gecko has done nothing, but fired
`beforeinput` event.  Note that Blink deletes editable contents in the range
**until** it meets first non-editable content, but I don't think this is
a good behavior because it makes things complicated.  Therefore, I filed
a spec issue: https://github.com/w3c/editing/issues/283

On the other hand, this behavior change causes different behavior in
https://searchfox.org/mozilla-central/source/editor/libeditor/crashtests/1345015.html

It tries to insert paragraph into `<html>` element, but our editor currently
does not support it.  Therefore, it hits `MOZ_ASSERT`.  Therefore, this patch
added a new check into `HTMLEditor::InsertParagraphSeparatorAsSubAction()`.

Differential Revision: https://phabricator.services.mozilla.com/D107588
2021-03-09 23:57:54 +00:00
Masayuki Nakano 1229430221 Bug 1677566 - part 2: Make `HTMLEditUtils` treat a found non-editable element as a leaf node even if it has children r=m_kato
Blink treats each non-editable node as an atomic object.  E.g., deleting or
forward-deleting from next to a non-editable element, it deletes only one
non-editable element.

Unfortunately, our layout treat adjacent non-editable nodes as a node.
Therefore, the adding WPTs do not work, but they are not new regression of
this patch.

Differential Revision: https://phabricator.services.mozilla.com/D107587
2021-03-09 23:57:54 +00:00
Masayuki Nakano e659ab60ed Bug 1677566 - part 1: `WSRunScanner::TextFragmentData` stop handling non-editable content r=m_kato
It does not make sense `WSRunScanner` handles invisible white-spaces in
non-editable elements.  Therefore, this patch makes it stop handling in the
cases.

Note that this change causes new fail of some WPTs.  That will be fixed by
the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D107586
2021-03-09 23:57:54 +00:00
Emilio Cobos Álvarez 0a34cbc059 Bug 1695650 - Consider selection editable even if the anchor is the empty <br> element. r=masayuki
Otherwise we disable the context menu commands which seems bad. This also
matches the HTML editor.

Differential Revision: https://phabricator.services.mozilla.com/D107513
2021-03-09 01:32:47 +00:00
Emilio Cobos Álvarez 942ec256fe Bug 1695650 - Clean up some checks in EditorUtils. r=masayuki
No behavior change. We were already returning false for HTML editor +
non-editable so we can simplify it a bit.

Depends on D107511

Differential Revision: https://phabricator.services.mozilla.com/D107512
2021-03-09 00:24:27 +00:00
Emilio Cobos Álvarez 60aae1e6b6 Bug 1695650 - Avoid to warn always. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107511
2021-03-09 00:24:27 +00:00
Emilio Cobos Álvarez 4f347077a1 Bug 1696378 - Fuzz other test annotation.
MANUAL PUSH: Sheriffs mentioned this failure afterwards.
2021-03-05 02:41:03 +01:00
Kagami Sascha Rosylight e9a7261412 Bug 1360715 - Part 3: Remove remaining cross-context instanceof from tests r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D106663
2021-03-04 22:03:58 +00:00
Brindusan Cristian b926d96be6 Backed out 3 changesets (bug 1360715) for mochitest failures at test_WebCrypto.html. CLOSED TREE
Backed out changeset b4a14c42313d (bug 1360715)
Backed out changeset 0e4b1b65fcbe (bug 1360715)
Backed out changeset fb8b9841d82b (bug 1360715)
2021-03-04 21:15:16 +02:00
Kagami Sascha Rosylight 7bec866ac5 Bug 1360715 - Part 3: Remove remaining cross-context instanceof from tests r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D106663
2021-03-04 15:05:27 +00:00
Masayuki Nakano 3b20d0d64b Bug 1655508 - Add crashtest (the bug itself was fixed by bug 1517028) r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D106873
2021-03-02 06:38:38 +00:00
Masayuki Nakano 5e6dccb510 Bug 1517028 - Make `HTMLEditor::SplitNodeDeepWithTransaction` not try to split non-splittable node and `HTMLEditor::HandleInsertParagraphInHeadingElement` check its result r=m_kato
There are 2 bugs.  One is that `SplitNodeDeepWithTransaction` tries to split
comment node, but it fails.  The other is, the failure result is not checked
by `HandleInsertParagraphInHeadingElement`.  Therefore, the original head
element's previous node may not be a heading element.

Depends on D106591

Differential Revision: https://phabricator.services.mozilla.com/D106620
2021-03-02 00:51:05 +00:00
Makoto Kato b1cd4c6075 Bug 1675779 - Update browserscope for contenteditable=false case. r=masayuki
browserscope is no longer maintained, so contenteditable=false case is
incorrect now. So I would like to update this tests for non editable case.

Differential Revision: https://phabricator.services.mozilla.com/D96299
2021-02-22 10:18:49 +00:00
Makoto Kato 6d173e8282 Bug 1675779 - HandleDeleteAtomicContent should handle non-editable text node. r=masayuki
Since `WSScanResult` can return non-editable/non-removable text node,
`HandleDeleteAtomicContent` is called with non editable text node, then it cannot
remove atomic content.

This fix doesn't follow other block case such as added newer test.

Differential Revision: https://phabricator.services.mozilla.com/D96298
2021-02-22 10:18:48 +00:00
Kagami Sascha Rosylight 717d5d2aa5 Bug 1671768 - Part 4: Use MOZ_CAN_RUN_SCRIPT for Selection::RemoveAllRanges r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103780
2021-02-03 21:52:48 +00:00
Kagami Sascha Rosylight 0ea5caf27e Bug 1671768 - Part 3: Use MOZ_CAN_RUN_SCRIPT for Selection::SelectAllChildren r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103779
2021-02-03 21:52:22 +00:00
Masayuki Nakano ef60f67cc9 Bug 1103374 - Add simple automoated test for arrow key navigation in vertical editable content r=jfkthame
Now, we can write a test for the situation with synthesized key events.

Differential Revision: https://phabricator.services.mozilla.com/D102882
2021-02-02 03:05:01 +00:00
Masayuki Nakano a25988774a Bug 1685491 - part 5: Move the code remapping arrow keys in vertical content to `NativeKeyBindings` r=smaug,jfkthame
Currently, this feature is implemented only on Linux and macOS (see also
bug 1077515 and bug 1301497), and the code is really similar each other.
Additionally, it always tries to query selection to check whether the caret is
in vertical content or not if arrow keys are pressed.  For avoiding a lot of
query, this patch makes `TextEventDispatcher` cache writing mode at every
selection change notification.  However, unfortunately, it's not available when
non-editable content has focus, but it should be out of scope of this bug since
it requires a lot of changes.

Anyway, with this patch, we can write a mochitest only on Linux and macOS.
The following patch adds a test for this as a fix of bug 1103374.

Differential Revision: https://phabricator.services.mozilla.com/D102881
2021-02-02 03:29:31 +00:00
Masayuki Nakano 9b750e79a1 Bug 1685491 - part 2: Fix all new oranges caused by the previous patch r=smaug
Applying default edit action for some shortcut keys on Linux and macOS
causes some oranges.  The new failure reasons are:
* The keyboard events are consumed in the bubbling phase of the system
group if editor has focus (`EditorEventListener` or `TextInputListener`
does it).
* No key combinations are mapped to per-word move or select on macOS.
* Home/End keys on macOS do not change selection.

Therefore, this adjusts each failure case for the new behavior.

Differential Revision: https://phabricator.services.mozilla.com/D102878
2021-02-02 03:02:53 +00:00
Tom Schuster d0d823f729 Bug 1689827 - Remove length parameter from JS callers of setTransferData. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D103555
2021-02-01 12:05:12 +00:00
Emilio Cobos Álvarez 5f5ca653cb Bug 1689868 - Add a fuzzy annotation for input-text-notheme-onfocus-reframe.html if using the non-native-theme. 2021-02-01 12:32:47 +01:00
Emilio Cobos Álvarez b9b4fc2acc Bug 1689871 - Ensure non-native resizers are loaded in test_bug629172.html r=masayuki
The issue is that the test was depending on the native resizers (or on a
previous test having loaded the non-native ones).

The first snapshot will not have resizers (because we just started the
load of the SVG) and thus following snapshots would fail.

Wait for the load event and pre-show the ltr textarea, so that the
resizer is known loaded.

This doesn't happen without the non-native theme because that uses
native resizers which don't depend on the image load.

Differential Revision: https://phabricator.services.mozilla.com/D103591
2021-02-01 02:36:41 +00:00
Jonathan Kew 8dc5b5c351 Bug 1663816 - Disable async font fallback for spell-checker tests. r=intermittent-reviewers,jmaher
Differential Revision: https://phabricator.services.mozilla.com/D103183
2021-01-27 18:39:34 +00:00
Cameron McCormack b77842bf22 Bug 1687868 - Annotate fuzziness in reftest with the non-native theme enabled. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D102884
2021-01-26 10:38:14 +00:00