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

10645 Коммитов

Автор SHA1 Сообщение Дата
Makoto Kato a6944a1428 Bug 1719110 - Add nsIEditorSpellCheck.suggest to get rid of PRemoteSpellcheckEngine.CheckAndSuggest. r=masayuki
When getting suggestions from spellchecker's result, we use sync IPC
(`PRemoteSpellcheckEngine.CheckAndSuggest`). This is used by showing context
menu only on Gecko. So I think that we can remove this IPC if we add async API
to get spellchecker suggestions.

And in comm-central's code, `CheckCurrentWord` and `GetSuggestedWord` seems to
use on spellchecker dialog (content/dialogs/EdSpellCheck.js in mail and suite)
that runs on parent process. So c-c won't use this IPC method.

So I would like to add the promise version of getting spellchecker's
suggestion.

Differential Revision: https://phabricator.services.mozilla.com/D119936
2021-08-10 03:55:25 +00:00
Masayuki Nakano 53bef623bf Bug 1717760 - Stop using `KeyEvent.initKeyEvent` in our tests r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D121028
2021-08-10 03:51:37 +00:00
Emilio Cobos Álvarez baf18c5198 Bug 1723921 - Throw on invalid pseudo-elements in getComputedStyle() as per spec. r=dholbert,layout-reviewers
I need to update tests, try incoming.

Depends on D121705

Differential Revision: https://phabricator.services.mozilla.com/D121706
2021-08-07 09:55:55 +00:00
Emilio Cobos Álvarez 2d0a072174 Bug 1723921 - Cleanup nsComputedDOMStyle and related APIs. r=layout-reviewers,jfkthame
This will make implementing the new behavior behind a pref
really straight-forward, and is generally nicer.

Depends on D121858

Differential Revision: https://phabricator.services.mozilla.com/D121705
2021-08-07 09:47:15 +00:00
Kagami Sascha Rosylight 948c17135b Bug 1724225 - Part 1: Replace dragexit with dragleave in editor/libeditor/ r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D121193
2021-08-07 09:29:18 +00:00
Geoff Brown 1bc378075c Bug 1724296 - Remove many skip-if(verify) test annotations (reftest-plain); r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D121920
2021-08-06 13:25:49 +00:00
Masayuki Nakano 1d519835ab Bug 1722748 - Make `TextServicesDocument::OffsetEntryArray::RemoveInvalidElements()` adjust selection indexes when middle of the selection start and end entry is removed r=m_kato
It handles selection indexes really roughly since it does it only when
start index is same or greater then removing index.  So, only end index
may be greater than the removing index, and if the start index is 0, it
sets `-1` to selection start.

I don't find any other issues around setting selection indexes.  However,
for detecting wrong selection index management, this patch adds
`MOZ_DIAGNOSTIC_ASSERT` to every setter.

Differential Revision: https://phabricator.services.mozilla.com/D121592
2021-08-04 04:40:38 +00:00
Masayuki Nakano 6122a660a0 Bug 1723125 - Ignore normal selection when updating composition string r=m_kato
Web apps can modify normal selection even during IME composition and no
browsers stop composition by it.  However, our editor tries to delete
non-collapsed selected range before updating composition.  Therefore,
we need additional state at handling inserting text whether selection
should be deleted or ignored.

Depends on D121371

Differential Revision: https://phabricator.services.mozilla.com/D121372
2021-08-02 08:23:50 +00:00
Masayuki Nakano c177665684 Bug 1722535 - Make `HTMLEditor` call `HTMLEditUtils::GetBetterInsertionPoint()` with an editing host which is not limited in the `<body>` r=m_kato
Previously, `HTMLEditor::GetBetterInsertionPoint()` didn't check whether
given point is in an editing host or not.  However, now
`HTMLEditUtils::GetBetterInsertionPoint()` does it with editing host which
is returned by `HTMLEditor::GetActiveEditingHost(LimitInBodyElement::No)`.
However, the old behavior is exactly same as
`HTMLEditor::GetActiveEditingHost(LimitInBodyElement::Yes)` if editing host
is outside the `<body>` element.

For taking back the original behavior, we should call the method with the
result of the latter.

Differential Revision: https://phabricator.services.mozilla.com/D121370
2021-08-02 08:23:49 +00:00
Andrew Osmond 6f3d06c7cb Bug 1722726 - Move Linux tsan tests to WebRender. r=jmaher
autoland

--- target_task_set@32af9322f9bf
+++ target_task_set@ao_ci_linux_tsan
-test-linux1804-64-tsan/opt-crashtest-e10s
-test-linux1804-64-tsan/opt-mochitest-a11y-1proc
-test-linux1804-64-tsan/opt-mochitest-browser-chrome-e10s
-test-linux1804-64-tsan/opt-mochitest-media-e10s
-test-linux1804-64-tsan/opt-mochitest-media-fis-e10s
-test-linux1804-64-tsan/opt-mochitest-media-fis-gli-e10s
-test-linux1804-64-tsan/opt-mochitest-media-gli-e10s
-test-linux1804-64-tsan/opt-mochitest-media-spi-e10s
-test-linux1804-64-tsan/opt-mochitest-plain-e10s
-test-linux1804-64-tsan/opt-mochitest-plain-fis-e10s
-test-linux1804-64-tsan/opt-reftest-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-fis-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-reftest-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-reftest-fis-e10s
-test-linux1804-64-tsan/opt-xpcshell-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-noqr-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-swr-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-a11y-1proc
+test-linux1804-64-tsan-qr/opt-mochitest-browser-chrome-swr-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-fis-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-fis-gli-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-gli-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-spi-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-plain-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-plain-fis-e10s
+test-linux1804-64-tsan-qr/opt-reftest-e10s
+test-linux1804-64-tsan-qr/opt-reftest-noqr-e10s
+test-linux1804-64-tsan-qr/opt-reftest-swr-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-fis-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-reftest-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-reftest-fis-e10s
+test-linux1804-64-tsan-qr/opt-xpcshell-e10s

mozilla-central

--- target_task_set@32af9322f9bf
+++ target_task_set@ao_ci_linux_tsan
-test-linux1804-64-tsan/opt-crashtest-e10s
-test-linux1804-64-tsan/opt-mochitest-a11y-1proc
-test-linux1804-64-tsan/opt-mochitest-browser-chrome-e10s
-test-linux1804-64-tsan/opt-mochitest-media-e10s
-test-linux1804-64-tsan/opt-mochitest-media-fis-e10s
-test-linux1804-64-tsan/opt-mochitest-media-fis-gli-e10s
-test-linux1804-64-tsan/opt-mochitest-media-gli-e10s
-test-linux1804-64-tsan/opt-mochitest-media-spi-e10s
-test-linux1804-64-tsan/opt-mochitest-plain-e10s
-test-linux1804-64-tsan/opt-mochitest-plain-fis-e10s
-test-linux1804-64-tsan/opt-reftest-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-fis-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-reftest-e10s
-test-linux1804-64-tsan/opt-web-platform-tests-reftest-fis-e10s
-test-linux1804-64-tsan/opt-xpcshell-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-noqr-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-swr-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-a11y-1proc
+test-linux1804-64-tsan-qr/opt-mochitest-browser-chrome-swr-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-fis-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-fis-gli-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-gli-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-media-spi-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-plain-e10s
+test-linux1804-64-tsan-qr/opt-mochitest-plain-fis-e10s
+test-linux1804-64-tsan-qr/opt-reftest-e10s
+test-linux1804-64-tsan-qr/opt-reftest-noqr-e10s
+test-linux1804-64-tsan-qr/opt-reftest-swr-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-fis-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-reftest-e10s
+test-linux1804-64-tsan-qr/opt-web-platform-tests-reftest-fis-e10s
+test-linux1804-64-tsan-qr/opt-xpcshell-e10s

mozilla-release

--- target_task_set@32af9322f9bf
+++ target_task_set@ao_ci_linux_tsan
-test-linux1804-64-tsan/opt-crashtest-e10s
-test-linux1804-64-tsan/opt-reftest-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-noqr-e10s
+test-linux1804-64-tsan-qr/opt-crashtest-swr-e10s
+test-linux1804-64-tsan-qr/opt-reftest-e10s
+test-linux1804-64-tsan-qr/opt-reftest-noqr-e10s
+test-linux1804-64-tsan-qr/opt-reftest-swr-e10s

Differential Revision: https://phabricator.services.mozilla.com/D121099
2021-07-30 12:23:36 +00:00
Masayuki Nakano dbc4e0135e Bug 1721317 - part 2: Make `_pasteToTargetElement()` sync r=m_kato
The function tests whether `input` event whose `inputType` is `insertFromPaste`
or not and it waits the event until timeout.  This sometimes fails in my
environment, and `input` event should be fired synchronously in this case.
Therefore, it should just fail if the event isn't fired.

Depends on D120424

Differential Revision: https://phabricator.services.mozilla.com/D120425
2021-07-21 23:22:04 +00:00
Masayuki Nakano e21daf33c3 Bug 1721317 - part 1: Make `test_pasting_table_rows.html` abort remaining tests if unexpected exception is thrown r=m_kato
Oddly, clipboard related test randomly (and frequently) fails in my environment.
And `test_pasting_table_rows.html` does not handle exception which is thrown
by `SimpleTest.promiseClipboardChange`.  Therefore, I'm always waiting 5 mins
when I run all tests under `editor/libeditor/tests`.

Therefore, I'd like to make it abort remaning tests if it fails due to
an unexpected exception.

Additionally, this fixes a bug in `_copyToClipboard#validatorFn`.  This method
modifies the variable of the parent function, `aExpectedPastedHTML`, with
itself.  Therefore, when the function is called multiple times, the expected
string will be re-wrapped with `kTextHtmlPrefixClipboardDataWindows` and
`kTextHtmlSuffixClipboardDataWindows` again and again...

Differential Revision: https://phabricator.services.mozilla.com/D120424
2021-07-21 23:22:03 +00:00
Masayuki Nakano 7448c66839 Bug 1721323 - Move some tests under `editor/libeditor/tests` which mainly test spellchecker behavior to `editor/spellchecker/tests` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D120421
2021-07-21 05:39:16 +00:00
Masayuki Nakano 45b115a2d0 Bug 1311934 - Replace `TextServicesDocument::IsBlockNode()` with `HTMLEditUtils::IsBlockElement()` r=m_kato
For consistency, between `TextServicesDocument` and `HTMLEditor`,
`TextServicesDocument::IsBlockNode()` should be replaced with
`HTMLEditUtils::IsBlockElement()` for making same consideration for each
element type.

Differential Revision: https://phabricator.services.mozilla.com/D119870
2021-07-19 23:11:25 +00:00
Masayuki Nakano b5ce8cc8c4 Bug 1720436 - Make `test_bug408231.html` specify default `font-familiy` explicitly r=m_kato
It checks default `font-family` with editing commands, but it depends on the
system locale. ("serif" vs. "sans-serif").  So, its `<body>` should be styled
as `font-family: serif` for consistent behavior in any environment.

Differential Revision: https://phabricator.services.mozilla.com/D119871
2021-07-15 10:46:55 +00:00
Masayuki Nakano 04b41051dd Bug 1665550 - part 4: Make `EventStateManager` update `mGestureDownFrameOwner` when anonymous nodes in `<input>` or `<textarea>` are replaced r=smaug
`EventStateManager` gives up to track gesture to start a drag if mouse down
content which is stored in `mGestureDownFrameOwner` gets lost its primary frame.

When user tries to start to drag selected text in `<input>` or `<textarea>`
element, mouse down content is an anonymous node in `TextControlElement`. So,
if a reflow occurs after `mousedown` event, the anonymous `<div>` element
is replaced with new one and `EventStateManager` gives up to track it.

Therefore, this patch makes `EventStateManager` do similar things as
`nsBaseDragService`.  When `nsTextControlFrame` notifies of remove/add
the anonymous nodes, `EventStateManager` tries to keep tracking gesture with
a new anonymous node.

Differential Revision: https://phabricator.services.mozilla.com/D119488
2021-07-14 01:20:20 +00:00
Masayuki Nakano a171e12db6 Bug 1665550 - part 3: Make `nsTextControlFrame` set the source node and selection of drag session to new ones when it's reframed r=smaug
When `nsTextControlFrame` is reframed, `TextEditor`, anonymous `<div>`, its
`Text` and the independent `Selection`s are deleted temporarily and recreated
them.

If users are dragging text in `<input>` or `<textarea>`, the drag session's
source node is set to the anonymous text node in the element and the selection
is set to the independent selection.  So, if the element is reframed during a
drag, the source node is disconnected from the document and `EndDragSession`
failed to dispatch `eDragEnd` event.

Therefore, this patch makes `nsTextControlFrame` replaces the source node and
selection when it's recreated and only when the drag session's original source
node was in the text control element.  For checking which text control had the
anonymous text node, this patch makes `nsTextControlFrame` replaces source
node with the `<input>` or `<textarea>` element when the frame is destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D119487
2021-07-14 01:20:19 +00:00
Masayuki Nakano e577d75b11 Bug 1665550 - part 2: Rewrite `test_dragdrop.html` with IIEF r=m_kato
With IIEF, we can guarantee each test block isolated.  So, without declaring
semi-global variables a lot for all tests, developers can comment out every
tests to debug only one thing.

Differential Revision: https://phabricator.services.mozilla.com/D119486
2021-07-14 01:20:19 +00:00
Masayuki Nakano 0324a4e4ef Bug 1665550 - part 1: Make `test_dragdrop.html` handle exception from synthesizePlainDragAndDrop r=m_kato
When the test is timed out, there is a JS error which is thrown by
`synthesizePlainDragAndDrop`.  So, first, make the test handle exception
with `try-catch` and assert the error.

Differential Revision: https://phabricator.services.mozilla.com/D119485
2021-07-14 01:20:18 +00:00
Masayuki Nakano 886c96059e Bug 1718924 - part 18: Move some blocks which work with `TextServicesDocument::mOffsetTable` into new separated methods r=m_kato
Depends on D119164

Differential Revision: https://phabricator.services.mozilla.com/D119165
2021-07-13 11:19:22 +00:00
Masayuki Nakano 1fbcf183f9 Bug 1718924 - part 17: Move `TextServicesDocument::mSelectionStartOffsetInTexInBlock` and `TextServicesDocument::mSelectionEndOffsetInTextInBlock` into `OffsetEntryTable` r=m_kato
Depends on D119163

Differential Revision: https://phabricator.services.mozilla.com/D119164
2021-07-13 11:09:57 +00:00
Masayuki Nakano abfa8fead9 Bug 1718924 - part 16: Move `TextServicesDocument::RemoveInvalidOffsetEntries()` to `OffsetEntry` r=m_kato
Depends on D119162

Differential Revision: https://phabricator.services.mozilla.com/D119163
2021-07-13 11:03:56 +00:00
Masayuki Nakano d3e59b2f42 Bug 1718924 - part 15: Move `TextServicesDocument::mSelStartIndex` and `TextServicesDocument::mSelEndIndex` into `OffsetEntryArray` r=m_kato
They are indices of `OffsetEntryArray`. Therefore, they should be managed in it.

Depends on D119161

Differential Revision: https://phabricator.services.mozilla.com/D119162
2021-07-13 10:57:48 +00:00
Masayuki Nakano 987147357a Bug 1718924 - part 14: Move `TextServicesDocument::SplitOffsetEntry` to `OffsetEntryArray` r=m_kato
Depends on D119160

Differential Revision: https://phabricator.services.mozilla.com/D119161
2021-07-13 10:51:46 +00:00
Masayuki Nakano f4d6fde8cd Bug 1718924 - part 13: Move `TextServicesDocument::NodeHasOffsetEntry()` into `OffsetEntryArray` r=m_kato
Depends on D119159

Differential Revision: https://phabricator.services.mozilla.com/D119160
2021-07-13 10:46:40 +00:00
Masayuki Nakano 5f44d6166c Bug 1718924 - part 12: Move `TextServicesDocument::FindWordBounds()` to `OffsetEntryArray` r=m_kato
Depends on D119158

Differential Revision: https://phabricator.services.mozilla.com/D119159
2021-07-13 10:19:40 +00:00
Masayuki Nakano e2aec22fef Bug 1718924 - part 11: Create custom class of `nsTArray<UniquePtr<OffsetEntry>>` r=m_kato
There are some methods in `TextServicesDocument` which work only with
`TextServicesDocument::mOffsetTable`.  Once we move such methods to custom
class of `nsTArray<UniquePtr<OffsetEntry>>`, we can make `TextServicesDocument`
simpler.

Depends on D119157

Differential Revision: https://phabricator.services.mozilla.com/D119158
2021-07-13 10:11:06 +00:00
Masayuki Nakano 3169bc5de5 Bug 1720252 - Get rid of "dom.input_events.beforeinput.enabled" from tests r=smaug
`beforeinput` event was shipped and it won't be disabled for avoiding confusion
of web developers. So, we can drop the pref setting of
"dom.input_events.beforeinput.enabled" in our tests.

Depends on D119716

Differential Revision: https://phabricator.services.mozilla.com/D119729
2021-07-13 10:02:12 +00:00
Masayuki Nakano afce03d9c7 Bug 1718924 - part 10: Make all `OffsetEntry` instances unique pointers r=m_kato
Now, it stores `dom::Text` with `OwningNonNull`.  So, once it's leaked, it
wastes a lot of memory spaces.  Therefore, we should make `mOffsetTable`
store `UniquePtr<OffsetEntry>` instead of `OffsetEntry*`.

Depends on D119156

Differential Revision: https://phabricator.services.mozilla.com/D119157
2021-07-13 09:55:59 +00:00
Masayuki Nakano b8ea33dddf Bug 1718924 - part 9: Rename `TextServicesDocument::mSel(Start|End)Offset` r=m_kato
Now, the meaning of `OffsetEntry` is clear.  Therefore, this patch adds comment
explaining the class and its members.

Then, the meaning of `TextServicesDocument::mSelStartOffset` and
`TextServicesDocument::mSelEndOffset` becomes clearer since they are used to
create `OffsetEntry` instances.  Therefore, this patch renames them.

Depends on D119155

Differential Revision: https://phabricator.services.mozilla.com/D119156
2021-07-13 09:42:34 +00:00
Masayuki Nakano 9ccb5fd526 Bug 1718924 - part 8: Add `OffsetEntry::OffsetInTextInBlockIsInRangeOrEndOffset()` r=m_kato
Depends on D119154

Differential Revision: https://phabricator.services.mozilla.com/D119155
2021-07-13 09:06:04 +00:00
Masayuki Nakano 36c6e61f3c Bug 1718924 - part 7: Add `OffsetEntry::EndOffsetInTextInBlock()` r=m_kato
Depends on D119153

Differential Revision: https://phabricator.services.mozilla.com/D119154
2021-07-13 08:49:47 +00:00
Masayuki Nakano 91272b59bb Bug 1718924 - part 6: Rename `OffsetEntry::mStrOffset` to `mOffsetInTextInBlock` r=m_kato
Depends on D119152

Differential Revision: https://phabricator.services.mozilla.com/D119153
2021-07-13 08:42:01 +00:00
Masayuki Nakano d1c80af6c8 Bug 1718924 - part 5: Add `OffsetEntry::OffsetInTextNodeIsInRangeOrEndOffset()` r=m_kato
Depends on D119151

Differential Revision: https://phabricator.services.mozilla.com/D119152
2021-07-13 08:42:00 +00:00
Masayuki Nakano 84f8568e67 Bug 1718924 - part 4: Add `OffsetEntry::EndOffsetInTextNode()` r=m_kato
Depends on D119150

Differential Revision: https://phabricator.services.mozilla.com/D119151
2021-07-13 08:35:32 +00:00
Masayuki Nakano 59ed2fb43b Bug 1718924 - part 3: Rename `OffsetEntry::mNodeOffset` to `mOffsetInTextNode` r=m_kato
Depends on D119149

Differential Revision: https://phabricator.services.mozilla.com/D119150
2021-07-13 08:20:13 +00:00
Masayuki Nakano f7a5d2ebbe Bug 1718924 - part 2: Change `OffsetEntry::mNode` to `OwningNonNull<Text>` r=m_kato
Now, `mNode` is always a text node, and it may store across "can run script"
boundaries.  So, it should be `OwningNonNull<Text>`.

Depends on D119148

Differential Revision: https://phabricator.services.mozilla.com/D119149
2021-07-13 08:20:13 +00:00
Masayuki Nakano bbfaac5e36 Bug 1718924 - part 1: Get rid of `TextServicesDocument::IsTextNode()` and use `AsText()` if it's safe r=m_kato
It seems that it treats mainly a text node in various places, but it's not
guaranteed by any variable declarations.  So, first of all, I'd like to make
it clearer.

`TextServicesDocument::IsTextNode()` isn't necessary because `nsINode::IsText()`
is enough useful.  And `AsText()` should be zero cost at runtime.  So, in blocks
which guarantee specific content node is a text node, this patch appends
`AsText()` for making the code clearer.

Differential Revision: https://phabricator.services.mozilla.com/D119148
2021-07-13 08:13:11 +00:00
Masayuki Nakano b94d2d1076 Bug 1719669 - Fix the reverse loop in `SelectionState::SaveSelection()` r=m_kato
The crash is caused by the infinite loop to delete unnecessary ranges.
The `i` is always equals or larger than `0` due to unsigned.  So, if
`Selection::RangeCount()` is `0`, `i` can be `UINT32_MAX`.

Instead, we can use `nsTArray<RefPtr<RangeItem>>::TruncateLength()`.

Differential Revision: https://phabricator.services.mozilla.com/D119564
2021-07-12 07:52:32 +00:00
Masayuki Nakano a81636618b Bug 1719387 - Make `test_bug795418-2.html` request `text/unicode` flavor in the headless mode r=smaug
Until fixing bug 1686012, clipboard in the headless mode does not support
"text/html" flavor.  Therefore, the `waitForClipboard` in the test does not
get expected value as `aData` in the first callback.

So, it should request `text/unicode` in the headless mode.

Depends on D119483

Differential Revision: https://phabricator.services.mozilla.com/D119484
2021-07-12 03:55:21 +00:00
Masayuki Nakano f9bedeed22 Bug 1719387 - Make `HTMLEditor::HandleInsertText()` allow to insert text outside `<body>` in XHTML document r=m_kato
With the change of bug 1716863, it retrieves editing host, but it's `nullptr`
if there is no `<body>` element in XHTML document.  The root cause should be
fixed in bug 1697989, but for now, we should allow it only in XHTML document
for safer regression fix.

Differential Revision: https://phabricator.services.mozilla.com/D119483
2021-07-12 03:55:21 +00:00
Masayuki Nakano 5dd777bdc1 Bug 1716863 - Make `HTMLEditor::HandleInsertText()` climb up the tree when `Selection` is in elements which cannot have text nodes r=m_kato
In most cases, it's called with selection range which is collapsed in a text
node, but otherwise, the selection may be in an element which cannot have
text nodes.  Therefore, before handling the insertion, it should look for
ancestor element which can have text nodes.

Note that this patch makes inserting text immediately before an inclusive
ancestor element whose parent can have a text node.  However, both Blink and
WebKit ignores if there are invisible/empty inline nodes.  So, even with
this patch, Gecko keeps failing in some tests of the WPT.  It should be handled
in a follow up bug because doing it requires complicated code.

Differential Revision: https://phabricator.services.mozilla.com/D119065
2021-07-06 04:55:28 +00:00
Masayuki Nakano 637a88b524 Bug 1718815 - part 4: Move `EditorBase::AppendNodeToSelectionAsRange()` and `EditorBase::ClearSelection()` to `HTMLEditor` r=m_kato
Depends on D119003

Differential Revision: https://phabricator.services.mozilla.com/D119004
2021-07-02 08:23:46 +00:00
Masayuki Nakano 46d18deed5 Bug 1718815 - part 3: Move `EditorBase::AutoTransactionBatch` to `HTMLEditor` r=m_kato
I guess that this class is replaced with `AutoPlaceholderBatch`, and both of
them are followed by its instances.  However, I don't want to change the
behavior in this bug.  Therefore, this patch just moves it into `HTMLEditor`.

Depends on D119002

Differential Revision: https://phabricator.services.mozilla.com/D119003
2021-07-02 08:23:45 +00:00
Masayuki Nakano a68528b057 Bug 1718815 - part 2: Move `EditorBase::AutoSelectionRestorer` and `EditorBase` methods called only by it to `HTMLEditor` r=m_kato
Unfortunately, marking its constructor and destructor as `MOZ_CAN_RUN_SCRIPT`,
`Maybe<AutoSelectionRestorer>::reset()` and
`Maybe<AutoSelectionRestorer>::emplace()` cause bustage.  Therefore, this patch
just mark them as `MOZ_CAN_RUN_SCRIPT_BOUNDARY`.

Note that `EditorBase::SavedSelectionRef()` cannot be moved to `HTMLEditor`
because `mEditActionData` is a private member of `EditorBase`.

Depends on D119001

Differential Revision: https://phabricator.services.mozilla.com/D119002
2021-07-02 08:23:45 +00:00
Masayuki Nakano 7ac37b46ec Bug 1718815 - part 1: Move `EditorBase::AddTransactionListener()` and `EditorBase::RemoveTransactionListener()` to `HTMLEditor` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D119001
2021-07-02 08:23:44 +00:00
Masayuki Nakano 1fc0882ecc Bug 1718607 - Make `TextServicesDocument` use `uint32_t` for offset in DOM node r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D118955
2021-06-30 09:07:35 +00:00
Masayuki Nakano 347bc5719a Bug 1714914 - Make editor classes treat offset in parent node as uint32_t r=m_kato
It should be treated as `uint32_t` since DOM API does so.  However, there are
some exceptions:

* Result of `nsINode::ComputeIndexOf()`
* Result of `nsAString` methods

They return `-1` as not found, and anyway, they cannot treat large integer
than `INT32_MAX`.  Therefore, this patch does not touch around them.

Differential Revision: https://phabricator.services.mozilla.com/D118933
2021-06-30 07:07:28 +00:00
Masayuki Nakano f8426533d4 Bug 1717178 - part 8: Get rid of `nsIEditor.doTransaction()` because of unused r=m_kato
Depends on D118803

Differential Revision: https://phabricator.services.mozilla.com/D118805
2021-06-28 12:08:51 +00:00
Masayuki Nakano 917dc274f8 Bug 1717178 - part 7: Get rid of `nsIEditor::AddEditorObserver()` and `nsIEditorObserver` interface because of unused r=m_kato
Depends on D118802

Differential Revision: https://phabricator.services.mozilla.com/D118803
2021-06-28 12:08:51 +00:00