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

195 Коммитов

Автор SHA1 Сообщение Дата
Dan Minor e12f42285c Bug 1733659 - Clean up naming style in Locale; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D131511
2021-11-23 12:36:41 +00:00
Sandor Molnar 2594d2ac61 Backed out 2 changesets (bug 1733659) for causing build bustages. CLOSED TREE
Backed out changeset 9e23aa79fda9 (bug 1733659)
Backed out changeset e316768591c0 (bug 1733659)
2021-11-22 20:51:20 +02:00
Dan Minor bcbfdb6d73 Bug 1733659 - Clean up naming style in Locale; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D131511
2021-11-22 18:32:41 +00:00
Masayuki Nakano dfa4091f3b Bug 1739545 - part 2: Redesign `TextServicesDocument::DidJoinNodes()` methods r=m_kato
There is 2 overloads.  One is `TextServicesDocument`'s method, and the latter is
for `nsIEditActionListener`.  The latter could occur if `TextServicesDocument`
is added to the editor when there is no inline spellchecker, `EditorSpellCheck`
or `mozSpellChecker`.
https://searchfox.org/mozilla-central/rev/d2f8488b6a704443a5c5bfc6d2878171b5f0d393/editor/libeditor/EditorBase.cpp#2388,2391,2393,2396,2398

I don't know whether this is possible case, but unfortunately,
`nsIEditActionListener::DidJoinNodes()` is not implemented by JS and implemented
only by `TextServicesDocument`.  Therefore, we can make it "noscript" and use
non-scriptable classes as arguments.

This patch makes them get jointed point and removed content node and the joining
direction for fixing bug 1735608.  Unfortunately, there is no test framework
to check the result in `TextServicesDocument` nor the new path.  The latter
should be tested when we fix bug 1735608 later.

Differential Revision: https://phabricator.services.mozilla.com/D130458
2021-11-09 01:09:20 +00:00
Masayuki Nakano 1034b36c49 Bug 1739545 - part 1: Get rid of `mozInlineSpellChecker::DidJoinNodes()` and `mozInlineSpellChecker::DidSplitNode()` r=m_kato
Currently, they do nothing because they specify empty range to
`SpellCheckBetweenNodes()`, and it makes the method does nothing.  This is
filed as bug 1581714.  However, they are not required because `HTMLEditor`
notifies `mozInlineSpellChecker` at ending handling the top level edit sub
action.
https://searchfox.org/mozilla-central/rev/a12c2c2e59c92d8f969d8f3f290ab16919449c9d/editor/libeditor/HTMLEditSubActionHandler.cpp#675

Therefore, these methods are not necessary anymore.

Differential Revision: https://phabricator.services.mozilla.com/D130457
2021-11-09 01:09:20 +00:00
Masayuki Nakano 524a98b4f2 Bug 1739526 - Move some trivial classes defined in `EditorUtils.h` but used only by `HTMEditor` or its helper classes to `HTMLEditHelpers.h" r=m_kato
I'd like to split utilities for all editors and only for `HTMLEditor`.

This moves some trivial classes into new `HTMLEditHelpers.h`.  Perhaps, it's
better if we can move them into `HTMLEditUtils.h`, but it has too many inline
method definitions so that adding new classes into it makes it much bigger.

Depends on D130349

Differential Revision: https://phabricator.services.mozilla.com/D130425
2021-11-05 14:10:49 +00:00
Dan Minor ab5afa4f54 Bug 1736017 - Replace MozLocale with Locale in EditorSpellCheck.cpp; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D129207
2021-11-04 16:36:03 +00:00
Noemi Erli 25dd04d4c5 Backed out 9 changesets (bug 1736017) for causing bustages in nsLineBreaker.cpp
Backed out changeset d7b7427bb29e (bug 1736017)
Backed out changeset 7249dec70600 (bug 1736017)
Backed out changeset f16572806b0c (bug 1736017)
Backed out changeset a78125c71b3e (bug 1736017)
Backed out changeset 84ba2cbd596a (bug 1736017)
Backed out changeset f771265e0930 (bug 1736017)
Backed out changeset c0cef271022d (bug 1736017)
Backed out changeset 19be73147fcc (bug 1736017)
Backed out changeset 11721cc861b0 (bug 1736017)
2021-10-28 00:06:35 +03:00
Dan Minor 726225fbfe Bug 1736017 - Replace MozLocale with Locale in EditorSpellCheck.cpp; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D129207
2021-10-27 20:35:56 +00:00
Ting-Yu Lin c2f6ef7a09 Bug 1736938 Part 3 - Make all WordBreaker's methods static, and adapt the callers. r=jfkthame
The motivation is the same as the previous part.

Differential Revision: https://phabricator.services.mozilla.com/D129109
2021-10-25 19:00:22 +00:00
Dan Minor a9e674d68d Bug 1719746 - Rename Locale to MozLocale; r=platform-i18n-reviewers,zbraniecki
There is also a mozilla::intl::Locale in intl/locale/MozLocale.h. This naming
collision was causing crashes in debug builds where the wrong destructor ended
up being called. This patch renames the intl/locale/MozLocale.h class to
MozLocale.

I've filed Bug 1736017 to move callers of the MozLocale version to the
unified intl/components/Locale version.

Differential Revision: https://phabricator.services.mozilla.com/D128593
2021-10-18 13:38:24 +00:00
Masayuki Nakano d7fa9ea462 Bug 1729653 - Make `mozInlineSpellChecker` handle events in the system group at capturing phase r=m_kato
Currently, `mozInlineSpellChecker` handles events in the default group.  This
means that the listener may not run if web app stops the propagation.  For
keeping the event listener order as far as possible, this patch changes to
listen to the event at capturing phase in the system group (editor handles
the events at bubbling phase in the system group).

Additionally, it listens to `keypress` events for handling caret/selection
changes.  However, they should be handled at `keydown` because those keys
are not printable.  Therefore, this patch changes to listen to `keydown`
events, but this could change the race between running the scheduled spellcheck
and following `keypress` event which is dispatched only for chrome code and
C++ event listeners.  However, this may not change it actually because the
race is changed only when the following `keypress` event delays too much.
https://searchfox.org/mozilla-central/rev/2eebd6e256fa0355e08421265e57ee1307836d92/extensions/spellcheck/src/mozInlineSpellChecker.cpp#503-504

Differential Revision: https://phabricator.services.mozilla.com/D126635
2021-09-28 02:47:15 +00:00
Ting-Yu Lin bd25bca479 Bug 1730084 Part 4 - Clean up and fix an edge case of FindWord(). r=jfkthame
* Rename arguments so that their names are consistent with Next().
* Make the function not assert on an empty string, i.e. aLen == 0, like
Next().
* Fix an undefined behavior when the user passes aTextLen == aOffset.
The methods used to access `aText[aOffset]` that is clearly out of range
because the string may not be null-terminated. After this patch, it
returns a sentinel WordRange when aLen == aPos.
* Add document and gtest TestFindWordWithEmptyString().
* Change the sentinel return value to {aLen,aLen} for FindWord(), and
adapt one caller.

Differential Revision: https://phabricator.services.mozilla.com/D125434
2021-09-13 23:55:33 +00:00
Masayuki Nakano 8af22120f6 Bug 1726532 - part 3: Make `TextServicesDocument` check whether a sibling content is `<br>` or not when checking whether a block or inline r=m_kato
This is a regression of bug 1311934.  The traditional
`TextServicesDocument::IsBlockNode()` was wrong name, the users of the method
intent to check whether a word is not split by the found sibling.  Therefore,
the method returned `true` for `<br>` element.  However, of course,
`HTMLEditUtils::IsBlockElement()` is not so because of an inline element.

For making the callers clearer, this patch adds `<br>` element check into
each place.  Without this patch, the new test fails to replace a misspelled
word immediately after `<br>` element.

Depends on D123283

Differential Revision: https://phabricator.services.mozilla.com/D123284
2021-08-24 03:29:21 +00:00
Masayuki Nakano 922488424d Bug 1726532 - part 1: Make `OffsetEntryArray::WillSetSelection()` use offset in text node when it sets a DOM node point r=m_kato
This is a mistake at replacing the argument value `aOffset` to
`aOffsetInTextInBlock`.
https://searchfox.org/mozilla-central/diff/886c96059ef6408618040356017028621bc574b9/editor/spellchecker/TextServicesDocument.cpp#1662

And also make `mozSpellChecker::Replace()` stop replacing if
`TextServicesDocument` fails to set selection or insert text because if
`TextServicesDocument` succeeded to insert text, but failed to delete text,
the loop becomes an infinite loop.

Differential Revision: https://phabricator.services.mozilla.com/D123282
2021-08-24 03:29:21 +00:00
Masayuki Nakano 593b780331 Bug 1726064 - part 9: Make `TextServicesDocument::HasSameBlockNodeParent()` use `HTMLEditUtils::GetAncestorElement()` r=m_kato
For keeping current behavior, the options should be set to
`HTMLEditUtils::ClosestEditableBlockElement`, but it may cause returning
`nullptr` if the text node is in an inline editing host, and also cause
returning true from the method even when the text nodes are in different
inline editing hosts.  Therefore, this patch uses
`HTMLEditUtils::ClosestEditableBlockElementOrInlineEditingHost` instead.

Differential Revision: https://phabricator.services.mozilla.com/D122947
2021-08-20 11:12:08 +00:00
Masayuki Nakano 60811c73f8 Bug 1726080 - Make `TextServicesDocument` and `OffsetEntryArray` use raw pointer of `OffsetEntry` instead of reference to `UniquePtr` r=m_kato
If array size grows up, the array data may be reallocated.  Therefore, after
getting a reference of an array item, we shouldn't modify array.

This makes them use raw pointer if they need to modify the array.  Otherwise,
keep using the reference, but adds a stack class to detect the bug only in debug
build.

Differential Revision: https://phabricator.services.mozilla.com/D122920
2021-08-18 11:49:50 +00:00
Masayuki Nakano 6a5aa08b3c Bug 1725930 - Make `TextServicesDocument::HasSameBlockNodeParent` refer 2nd text node as expected r=m_kato
This is just a simple mistake, but I'm not sure how this break the callers.
Therefore, I don't have a testcase for this.

Differential Revision: https://phabricator.services.mozilla.com/D122705
2021-08-17 09:39:13 +00:00
Gijs Kruitbosch 3355c934ef Bug 1724718 - forget AddTask.js ever existed as bug 1544051 already removed it, r=bgrins
Differential Revision: https://phabricator.services.mozilla.com/D122166
2021-08-10 22:33:06 +00:00
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 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 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 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 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 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 db1228b24c Bug 1714918 - Sort out editor class accessors of `nsIEditor` r=m_kato
For consistency with the similar internal DOM API, `As*()` should just cast
the type without checking editor type.  Instead, `GetAs*()` should do it.

Differential Revision: https://phabricator.services.mozilla.com/D117381
2021-06-11 03:01:08 +00:00
Masayuki Nakano c0624f4771 Bug 1713757 - Make `mozInlineSpellChecker`, `mozInlineSpellWordUtil` and `TextServicesDocument` use `EditorBase` instead of `TextEditor` r=m_kato
Depends on D117117

Differential Revision: https://phabricator.services.mozilla.com/D117118
2021-06-09 09:02:31 +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 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
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
Mihai Alexandru Michis f2fe4465be Bug 1663816 - Disable test_bug1205983.html and test_bug697981.html on windows and linux. r=intermittent-reviewers,jmaher
Differential Revision: https://phabricator.services.mozilla.com/D102853
2021-01-25 17:59:25 +00:00
Kartik Gautam f7ffcd09fb Bug 1679758 - Remove trailing empty lines r=sylvestre,marionette-reviewers,jgraham
Differential Revision: https://phabricator.services.mozilla.com/D99595
2020-12-15 10:34:54 +00:00