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

37 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 982ddb7a9a Bug 1859245 - part 3: Make `JoinNodesTransaction` and `SplitNodeTransaction` handle only the new direction mode r=m_kato
Depends on D191606

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

Depends on D158633

Differential Revision: https://phabricator.services.mozilla.com/D158634
2022-10-12 02:44:19 +00:00
Masayuki Nakano 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 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 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 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 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
Masayuki Nakano ccf6a4c660 Bug 1444847 - part 7: Make `EditorSpellCheck` use `StaticRange` instead of `nsRange` to initialize itself r=smaug
`EditorSpellCheck` clones `nsRange` instance only for temporary use during
initialization even though the DOM tree won't be changed during it.  In this
case, using `StaticRange` is better since it does not need to observe the
DOM tree mutation.  I.e., we can save the cost of registering and
unregistering the mutation observer.

Differential Revision: https://phabricator.services.mozilla.com/D35146

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:36 +00:00
Makoto Kato e6c2e7bc87 Bug 1543585 - Clean up finding words for spellchecker. r=masayuki
`mozSpellChecker::Replace` and `mozSpellChecker::NextMisspelledWord` have a loop
to find word from text content. But `mozEnglishWordUtils::FindNextWord` always
returns `NS_OK` and some code doesn't check error even if `nsresult` local
variable is used.

So I would like to clean up this loop.

- `mozEnglishWordUtils::FindNextWord` should return true if word is found
- We should use reference type for some `TextServicesDocument`'s methods.
- Add more check for error

Differential Revision: https://phabricator.services.mozilla.com/D27037

--HG--
extra : moz-landing-system : lando
2019-04-12 03:54:18 +00:00
Masayuki Nakano 0a753c3aac Bug 1533293 - part 3: Make editor and ContentEventHandler not use Selection::Extend() due to too slow r=m_kato
`Selection::Extend()` is too slow but editor and ContentEventHandler use it in
some places.  We should make them use `Selection::SetStartAndEndInLimiter()` or
`Selection::SetBaseAndExtentInLimiter()`.  The former is usable only when caller
guarantees the start point is prior to the end point in the DOM tree.
Otherwise, we need to use the latter even though it's slower than the former.

Differential Revision: https://phabricator.services.mozilla.com/D23462

--HG--
extra : moz-landing-system : lando
2019-03-26 10:09:47 +00:00
Noemi Erli 165f0d8c1c Backed out 3 changesets (bug 1533293) for causing Bug 1536595 a=backout
Backed out changeset d011dfe83683 (bug 1533293)
Backed out changeset e536f6e123d8 (bug 1533293)
Backed out changeset 19cff61f4fed (bug 1533293)
2019-03-20 13:29:17 +02:00
Masayuki Nakano 6dd0ecdd8e Bug 1533293 - part 3: Make editor and ContentEventHandler not use Selection::Extend() due to too slow r=m_kato
`Selection::Extend()` is too slow but editor and ContentEventHandler use it in
some places.  We should make them use `Selection::SetStartAndEndInLimiter()` or
`Selection::SetBaseAndExtentInLimiter()`.  The former is usable only when caller
guarantees the start point is prior to the end point in the DOM tree.
Otherwise, we need to use the latter even though it's slower than the former.

Differential Revision: https://phabricator.services.mozilla.com/D23462

--HG--
extra : moz-landing-system : lando
2019-03-18 01:52:36 +00:00
Sylvestre Ledru 47a5dd1fb8 Bug 1519636 - Reformat everything to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D16388

--HG--
extra : moz-landing-system : lando
2019-01-16 08:50:07 +00:00
Masayuki Nakano a6ef59a998 Bug 181137 - part 6: Make nsFilteredContentIterator not derived from nsIContentIterator r=smaug
nsFilteredContentIterator is used only by TextServicesDocument and there is
no reason that it should be derived from nsIContentIterator except consistency.
Additionally, it's now only class which is derived from nsIContentIterator
except ContentIteratorBase.  So, after this change, we can get rid of
nsIContentIterator completely.

This patch moves nsFilteredContentIterator into mozilla namespace and
makes TextServicesDocument treat FilteredContentIterator directly instead of
nsIContentIterator interface.

Differential Revision: https://phabricator.services.mozilla.com/D15925

--HG--
rename : editor/spellchecker/nsFilteredContentIterator.cpp => editor/spellchecker/FilteredContentIterator.cpp
rename : editor/spellchecker/nsFilteredContentIterator.h => editor/spellchecker/FilteredContentIterator.h
extra : moz-landing-system : lando
2019-01-11 01:51:35 +00:00
Csoregi Natalia 13506c036a Backed out 8 changesets (bug 181137) for bustage on FragmentOrElement.cpp:1751. CLOSED TREE
Backed out changeset 99a977d519a0 (bug 181137)
Backed out changeset 65a4b245e851 (bug 181137)
Backed out changeset 5385d5fd9b8b (bug 181137)
Backed out changeset 83bec02c21d9 (bug 181137)
Backed out changeset b7ab59bf545e (bug 181137)
Backed out changeset b6fc7a332db7 (bug 181137)
Backed out changeset 654fdbad67db (bug 181137)
Backed out changeset 90a1ff49b6b1 (bug 181137)

--HG--
rename : dom/base/ContentIterator.h => dom/base/nsContentIterator.cpp
rename : editor/spellchecker/FilteredContentIterator.cpp => editor/spellchecker/nsFilteredContentIterator.cpp
rename : editor/spellchecker/FilteredContentIterator.h => editor/spellchecker/nsFilteredContentIterator.h
2019-01-10 11:42:27 +02:00
Masayuki Nakano d15a70b2c2 Bug 181137 - part 6: Make nsFilteredContentIterator not derived from nsIContentIterator r=smaug
nsFilteredContentIterator is used only by TextServicesDocument and there is
no reason that it should be derived from nsIContentIterator except consistency.
Additionally, it's now only class which is derived from nsIContentIterator
except ContentIteratorBase.  So, after this change, we can get rid of
nsIContentIterator completely.

This patch moves nsFilteredContentIterator into mozilla namespace and
makes TextServicesDocument treat FilteredContentIterator directly instead of
nsIContentIterator interface.

Differential Revision: https://phabricator.services.mozilla.com/D15925

--HG--
rename : editor/spellchecker/nsFilteredContentIterator.cpp => editor/spellchecker/FilteredContentIterator.cpp
rename : editor/spellchecker/nsFilteredContentIterator.h => editor/spellchecker/FilteredContentIterator.h
extra : moz-landing-system : lando
2019-01-10 08:47:11 +00:00
Emilio Cobos Álvarez d2ed260822 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Ehsan Akhgari 7a9998cefe Bug 1489787 - Part 3: Decomtaminate nsComposeTxtSrvFilter; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5355
2018-09-10 08:15:00 -04:00
Ehsan Akhgari d212ff2809 Bug 1489787 - Part 1: Remove nsITextServicesFilter and replace nsIEditorSpellCheck.setFilter() with nsIEditorSpellCheck.setFilterType(); r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5353
2018-09-10 08:14:59 -04:00
Makoto Kato 51e4d2154d Bug 1421510 - Part 2. Use nsComposeTxtSrvFilter directly. r=masayuki
nsITextServicesFilter is builtin class, so we can store nsComposeTxtSrvFilter
instead of nsITextServicesFilter.

MozReview-Commit-ID: ErZQwWC0Wjx

--HG--
extra : rebase_source : 7b327a0dbdf12e2e085d109e66e5140ac6d18773
2018-06-19 16:00:35 +09:00
Boris Zbarsky c73f664888 Bug 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki 2018-05-24 13:18:34 -04:00
Boris Zbarsky 1fb03996f4 Bug 1387143 part 29. Remove nsISelection. r=mats 2018-05-08 13:52:42 -04:00
Makoto Kato 6c2bc77ccf Bug 1451972 - Remove more nsIDOMDocument usages from editor. r=masayuki
We should not use nsIDOMDocument if unnecessary. Because it needs QI to access
nsIDocument.

MozReview-Commit-ID: CMF3tmvBTB9

--HG--
extra : rebase_source : e832023be8d59a2c1e01bd423e6f058b0708dfe9
2018-04-06 14:53:05 +09:00
Boris Zbarsky c4a9eb60ff Bug 1446533 part 10. Remove remaining nsIDOMCharacterData uses in editor. r=mystor
MozReview-Commit-ID: CfZNQRiDs43
2018-03-19 15:45:55 -04:00
Makoto Kato 43ea41434e Bug 1442500 - Part 1. Rename editor/txtsvc to editor/spellchecker. r=masayuki
txtsvc is ambiguous name, so we should use functional name instead.

XPIDL_MODULE still keeps 'txtsvc' because 'spellchecker' is already used by
extensions/spellchek/idl.  And all IDLs for editor may move to /editor since
most IDLs for editor is on /editor.

MozReview-Commit-ID: v9a5ENEs2M

--HG--
rename : editor/txtsvc/TextServicesDocument.cpp => editor/spellchecker/TextServicesDocument.cpp
rename : editor/txtsvc/TextServicesDocument.h => editor/spellchecker/TextServicesDocument.h
rename : editor/txtsvc/moz.build => editor/spellchecker/moz.build
rename : editor/txtsvc/nsFilteredContentIterator.cpp => editor/spellchecker/nsFilteredContentIterator.cpp
rename : editor/txtsvc/nsFilteredContentIterator.h => editor/spellchecker/nsFilteredContentIterator.h
rename : editor/txtsvc/nsIInlineSpellChecker.idl => editor/spellchecker/nsIInlineSpellChecker.idl
rename : editor/txtsvc/nsISpellChecker.h => editor/spellchecker/nsISpellChecker.h
rename : editor/txtsvc/nsITextServicesFilter.idl => editor/spellchecker/nsITextServicesFilter.idl
extra : rebase_source : 38ea55fe974614b7bb829b614f7de1ee649dbbb1
2018-03-02 12:55:26 +09:00