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

10788 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 635539b0e5 Bug 1706266 - part 2: Disable some Gecko specific edit commands in release and beta channel, and all of them in nightly channel r=smaug
The telemetry result is written in bug 1706266 comment 1:
https://bugzilla.mozilla.org/show_bug.cgi?id=1706266#c1

`increasefontsize`, `decreasefontsize`, `gethtml`, `heading` and `readonly` are
obviously not used by web apps in the wild.  Therefore, they can be disabled
in all channels.

`contentReadOnly` and `insertBrOnReturn` are odd.  The usage is really low (less
than 1% of beta users).  However, the number of documents which used the command
is about 1k samples.  The result of the commands are not tiny (making the editor
not editable or changing the behavior at typing `Enter` key in `<div>`, `<p>`,
etc).  Therefore, it's hard to use them in web apps which supports not only
Gecko.  So I guess that they are collected the number of used by automated
tests of somebody because of the constant number in other beta versions.
Perhaps, we should disable it only in Nightly channel for now, and after a
couple of releases, we should try to disable those commands too later.

Depends on D130328

Differential Revision: https://phabricator.services.mozilla.com/D130329
2021-11-05 14:29:25 +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
Masayuki Nakano 354375158b Bug 1739315 - part 2: Make `HTMLEditor::JoinNodesWithTransaction()` return error if failed r=m_kato
Now, it does not notify nobody before joining the nodes.  Therefore, it can
return error immediately if it fails to create a transaction to join the given
nodes.

Additionally, this patch makes it return `NS_ERROR_EDITOR_DESTROYED` if the
editor is destroyed while it handles to join nodes.  Therefore, we can get rid
of the check by the callers.

Differential Revision: https://phabricator.services.mozilla.com/D130349
2021-11-05 10:14:35 +00:00
Masayuki Nakano 94cfff6b9a Bug 1739315 - part 1: Make `HTMLEditor::JoinNodesWithTransaction()` directly notify `TopLevelEditSubActionData::DidJoinNodes()` of joined position r=m_kato
`TopLevelEditSubActionData::WillJoinNodes()` and
`TopLevelEditSubActionData::DidJoinNodes()` are called only by
`HTMLEditor::JoinNodesWithTransaction()`.  `WillJoinNodes()` assumes that
all children or text data in `aLeftContent` is moved to head of `aRightContent`.
Therefore, it just stores length of `aLeftContent` and `DidJoinNodes()` lets
`AddPointToChangedRange()` know the joined point.

Same value is stored by `HTMLEditor::JoinNodesWithTransaction()`.  Therefore,
it can create same DOM point at calling `DidJoinNodes()` so that we can get
rid of `WillJoinNodes()`.

Differential Revision: https://phabricator.services.mozilla.com/D130348
2021-11-05 10:14:35 +00:00
Cristian Tuns bdf50d3542 Backed out 2 changesets (bug 1739315) for causing android wpt failures.
Backed out changeset cef70047defb (bug 1739315)
Backed out changeset c50c8ac11ff7 (bug 1739315)
2021-11-05 07:18:22 -04:00
Masayuki Nakano f182946a8b Bug 1739315 - part 2: Make `HTMLEditor::JoinNodesWithTransaction()` return error if failed r=m_kato
Now, it does not notify nobody before joining the nodes.  Therefore, it can
return error immediately if it fails to create a transaction to join the given
nodes.

Additionally, this patch makes it return `NS_ERROR_EDITOR_DESTROYED` if the
editor is destroyed while it handles to join nodes.  Therefore, we can get rid
of the check by the callers.

Differential Revision: https://phabricator.services.mozilla.com/D130349
2021-11-05 10:14:35 +00:00
Masayuki Nakano fdb27c99f9 Bug 1739315 - part 1: Make `HTMLEditor::JoinNodesWithTransaction()` directly notify `TopLevelEditSubActionData::DidJoinNodes()` of joined position r=m_kato
`TopLevelEditSubActionData::WillJoinNodes()` and
`TopLevelEditSubActionData::DidJoinNodes()` are called only by
`HTMLEditor::JoinNodesWithTransaction()`.  `WillJoinNodes()` assumes that
all children or text data in `aLeftContent` is moved to head of `aRightContent`.
Therefore, it just stores length of `aLeftContent` and `DidJoinNodes()` lets
`AddPointToChangedRange()` know the joined point.

Same value is stored by `HTMLEditor::JoinNodesWithTransaction()`.  Therefore,
it can create same DOM point at calling `DidJoinNodes()` so that we can get
rid of `WillJoinNodes()`.

Differential Revision: https://phabricator.services.mozilla.com/D130348
2021-11-05 10:14:35 +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
Masayuki Nakano a04544da9e Bug 1737540 - Make `AutoBlockElementsJoiner::PrepareToDeleteNonCollapsedRanges()` consider to delete given range when there is no editable block parent r=m_kato
Currently, it assumes that first range is always in editable block parent,
but if the range is in an inline editing host, it's not true.

The given ranges should always be in same editing host at this time because of:
* https://searchfox.org/mozilla-central/rev/011ed92913b38e950977ab3fc56ae68a8f3bca12/editor/libeditor/HTMLEditorDeleteHandler.cpp#1031,1064
* https://searchfox.org/mozilla-central/rev/011ed92913b38e950977ab3fc56ae68a8f3bca12/editor/libeditor/HTMLEditorDeleteHandler.cpp#1080,1117

Therefore, it's enough to check whether the range crosses or not editing host
boundaries only with `MOZ_ASSERT(_IF)`.

Differential Revision: https://phabricator.services.mozilla.com/D130153
2021-11-04 08:05:02 +00:00
Masayuki Nakano 4341d6fb0c Bug 1455514 - part 1: Add accessors and static helper methods to retrieve `nsINode` or its concrete classes from `EventTarget` r=smaug
Currently, checking whether an `EventTarget` is `nsINode` (or its concrete
classes) or not requires a QI, but it's expensive and used a lot while we
handle each event.  Therefore, it'd be nicer for creating a virtual method,
`EventTarget::IsNode()` and use it for the check.

If trying to convert `EventTarget` to a concrete class, it may require two
virtual method calls.  I'm not sure whether it's cheaper than a QI, but at
least, it won't depend on the UUID check order of `QueryInterface()` when
multiple interfaces are implemented.

Differential Revision: https://phabricator.services.mozilla.com/D129781
2021-11-02 13:03:43 +00:00
Masayuki Nakano 73429d31ba Bug 1725850 - part 30: Port editor/libeditor/crashtests/716456-1.html to WPT r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D129586
2021-10-29 09:29:24 +00:00
Masayuki Nakano 053ad7574e Bug 1725850 - part 29: Port editor/libeditor/crashtests/713427-1.html to WPT r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D129585
2021-10-29 09:29:23 +00:00
Masayuki Nakano 6b5396e5e0 Bug 1725850 - part 28: Port editor/libeditor/crashtests/682650-1.html to WPT r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D129584
2021-10-29 09:29:23 +00:00
Masayuki Nakano e6bafcbcd5 Bug 1725850 - part 27: Port editor/libeditor/crashtests/667321-1.html to WPT r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D129583
2021-10-29 09:29:23 +00:00
Masayuki Nakano 96028f5105 Bug 1725850 - part 26: Port editor/libeditor/crashtests/650572-1.html to WPT r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D129582
2021-10-29 09:29:22 +00:00
Masayuki Nakano 193c817a99 Bug 1725850 - part 25: Port editor/libeditor/crashtests/643706-1.html to WPT r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D129581
2021-10-29 09:29:22 +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
Masayuki Nakano 65fc730a31 Bug 1737747 - Create automated tests for nsIHTMLEditor.insertElementAtSelection() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D129477
2021-10-26 22:03:51 +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
Ting-Yu Lin 427cc27771 Bug 1736938 Part 2 - Make all LineBreaker's methods static, and adapt the callers. r=jfkthame
LineBreaker has no member variables and acts like "namespaces" with
utility functions. Therefore, its methods can be static and called
directly without needing a LineBreaker instance.

Rename GetJISx4051Breaks() to ComputeBreakPositions() per review
feedbacks.

Differential Revision: https://phabricator.services.mozilla.com/D129107
2021-10-25 19:00:22 +00:00
Greg Tatum ee2694c97d Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-20 14:01:21 +00:00
Masayuki Nakano acf1af36a8 Bug 1736507 - Make `HTMLEditor` updates its specific UI (if there is) after dispatching `input` event r=m_kato
Currently, `EditorBase::EndUpdateViewBatch()` does this, but it's before `input`
event.  Therefore, if an `input` event listener changes the target elements'
position and/or size, user will see broken UI.  Therefore, it should be updated
at editor finishes everything.

Differential Revision: https://phabricator.services.mozilla.com/D128871
2021-10-19 20:45:37 +00:00
Butkovits Atila 01c5e2aed8 Backed out 3 changesets (bug 1719546) for causing SM bustages at Bidi.h. CLOSED TREE
Backed out changeset c4d6ffc7e445 (bug 1719546)
Backed out changeset a1f7ed6c4251 (bug 1719546)
Backed out changeset e69fc596f2c3 (bug 1719546)
2021-10-19 21:09:47 +03:00
Greg Tatum f250d90114 Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-19 16:55:36 +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
Evgenia Kotovich 0d0980ee0d Bug 1576768 - Automatically format .sjs files using prettier. r=Standard8,agi,zombie,extension-reviewers
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D128482
2021-10-18 09:26:33 +00:00
Noemi Erli 2bba3cec69 Backed out changeset 2ab6bb03dcc1 (bug 1576768) for causing failures in test_double_submit.html CLOSED TREE 2021-10-18 02:05:57 +03:00
Evgenia Kotovich 3e3dff109c Bug 1576768 - Automatically format .sjs files using prettier. r=Standard8,agi,zombie,extension-reviewers
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D128482
2021-10-17 14:59:14 +00:00
Ting-Yu Lin 392266a8fd Bug 1733878 - Remove LineBreaker::Prev() in InternetCiter. r=jfkthame,m_kato
This change is a rewrite, and is not expected to change the behavior.
Also, add a testcase exercising wrapping a long line.

Differential Revision: https://phabricator.services.mozilla.com/D128558
2021-10-15 18:10:09 +00:00
Alexandru Michis dac6815201 Backed out changeset 7c08aa027893 (bug 1576768) for causing multiple failures.
CLOSED TREE
2021-10-15 16:52:43 +03:00
Evgenia Kotovich a8b32926fa Bug 1576768 - Automatically format .sjs files using prettier. r=Standard8,agi,zombie,extension-reviewers
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D128482
2021-10-15 12:58:11 +00:00
Masayuki Nakano fc532efa09 Bug 1734771 - part 3: Make `AppendString()` and `AppendSubString()` take `const Text&` instead of `Text*` r=m_kato
Depends on D128139

Differential Revision: https://phabricator.services.mozilla.com/D128140
2021-10-12 15:02:38 +00:00
Masayuki Nakano 1836c00470 Bug 1729170 - Make all methods of `nsTextFragment` take `uint32_t` for the offset and length of text r=smaug
`nsTextFragment` is a storage of data node and DOM offset is `uint32_t`, but
some methods of `nsTextFragment` takes `int32_t` for the offset/length in
its text.  Therefore, callers need to cast from `uint32_t` to `int32_t` if
the offset value is offset in a DOM node.  Therefore, all methods of it should
take `uint32_t` values as offset/length in its text.

Differential Revision: https://phabricator.services.mozilla.com/D127923
2021-10-12 05:05:12 +00:00
Masayuki Nakano d37daf2f82 Bug 1729115 - part 3: Make `IMEStateManager` check whether given focused content matches with null `sContent` in design mode r=m_kato
`nsFocusManager` does not send `focus` event in some cases, e.g., non-editable
root element gets focus.  However, the element may become editable later without
a focus move.  Therefore, even if `IMEStateManager::sContent` is `nullptr`,
`IMEStateManager::UpdateIMEState()` and `IMEStateManager::FocusInEditor()` are
called with focused content when the uncomposed document is in design mode.

With this change, editor does not need to call `IMEStateManager` methods with
`nullptr` when it's in `designMode`.  Therefore, we can get rid of
`GetFocusedContentForIME()` which just returns `nullptr` if focused content is
in design mode.

Differential Revision: https://phabricator.services.mozilla.com/D127612
2021-10-12 04:41:14 +00:00
Masayuki Nakano 25a3c48305 Bug 1732845 - Add `nsINode::IsInDesignMode()` to check whether the node is directly in design mode r=smaug
There are a lot of check of `Document`'s editable state **with** comments. This
means that it's unclear for developers that only `Document` node is editable in
design mode.

Additionally, there are some points which use composed document rather than
uncomposed document even though the raw API uses uncomposed document. Comparing
with the other browsers, checking uncomposed document is compatible behavior,
i.e., nodes in shadow trees are not editable unless `contenteditable`.

Therefore, `nsINode` should have a method to check whether it's in design mode
or not.

Note that it may be called with a node in UA widget.  Therefore, this patch
adds new checks if it's in UA widget subtree or native anonymous subtree,
checking whether it's in design mode with its host.

Differential Revision: https://phabricator.services.mozilla.com/D126764
2021-10-12 03:14:43 +00:00
Sam Foster 37de8c9ba9 Bug 1734719 - Fix the editor/application-handler test when the downloads improvements pref is true. r=Gijs
* bug 1266185 was specifically about the how the editor behaves when the application handler dialog pops up, so I've restored this behavior by setting alwaysAskBeforeHandling true for the octet-stream mime-type

Differential Revision: https://phabricator.services.mozilla.com/D127889
2021-10-11 23:13:51 +00:00
Jonathan Kew fff2fa76a6 Bug 1734590 - Both the static InternetCiter methods are now infallible, so no need to return/check an nsresult. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D127865
2021-10-11 12:20:42 +00:00
Jonathan Kew 71472fbcf2 Bug 1734590 - Eliminate use of LineBreaker::DeprecatedNext in InternetCiter.cpp. r=TYLin
If the old DeprecatedNext() returned needs-more-text, we'd just force a break at the EOL position anyhow;
so the new behavior of Next(), always treating end-of-text as a break position, gives us this for free.

Differential Revision: https://phabricator.services.mozilla.com/D127806
2021-10-11 12:20:41 +00:00
Jonathan Kew b74f5de179 No bug - fix spelling of internal constant name: s/Carridge/Carriage/. r=masayuki DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D127972
2021-10-11 07:38:27 +00:00
Geoff Brown 7e36862b61 Bug 1724296 - Remove many skip-if(verify) test annotations (mochitest pt 2); r=jmaher
This completes the review of skip-if(verify) in mochitest.ini.

Differential Revision: https://phabricator.services.mozilla.com/D127992
2021-10-09 16:07:32 +00:00
Csoregi Natalia e92f158606 Backed out 4 changesets (bug 1734590) for failures on test_xmlserializer.js. CLOSED TREE
Backed out changeset e492f8fd3d53 (bug 1734590)
Backed out changeset 0af985bb7569 (bug 1734590)
Backed out changeset 3751b93ae994 (bug 1734590)
Backed out changeset 45059121c015 (bug 1734590)
2021-10-08 14:41:06 +03:00
Jonathan Kew 7daf89e7fe Bug 1734590 - Both the static InternetCiter methods are now infallible, so no need to return/check an nsresult. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D127865
2021-10-08 10:05:52 +00:00
Jonathan Kew b69ca8f047 Bug 1734590 - Eliminate use of LineBreaker::DeprecatedNext in InternetCiter.cpp. r=TYLin
If the old DeprecatedNext() returned needs-more-text, we'd just force a break at the EOL position anyhow;
so the new behavior of Next(), always treating end-of-text as a break position, gives us this for free.

Differential Revision: https://phabricator.services.mozilla.com/D127806
2021-10-08 10:05:51 +00:00
Ting-Yu Lin e558c2cbd9 Bug 1733872 Part 2 - Add a new LineBreaker::Next(), and deprecate the old Next(). r=m_kato
This patch is similar to Bug 1728708 Part 4, but for line breaker. This
should make the future integration of ICU4X line segmenter easier. A
UAX14 compatible line breaker always breaks at the end of text
(rule LB3 [1]), and ICU4X line segmenter has this behavior, too.

Current LineBreaker::Next() doesn't treat the end of text as a line
break opportunity, so this patch deprecates it by renaming it, and add a
new Next() method.

TestASCIILB() has adopted the new Next(). All the other callers of the
DeprecatedNext (nsPlainTextSerializer, nsXMLContentSerializer,
InternetCiter) should be audited later, possibly with the removal of
Prev() because the all the usages are very close to Prev().

[1] https://www.unicode.org/reports/tr14/#LB3

Differential Revision: https://phabricator.services.mozilla.com/D127379
2021-10-07 07:39:13 +00:00
Masayuki Nakano fb82cd4173 Bug 1725850 - part 24: Port editor/libeditor/crashtests/636074-1.html to WPT r=saschanaz
Depends on D127511

Differential Revision: https://phabricator.services.mozilla.com/D127512
2021-10-05 23:44:54 +00:00
Masayuki Nakano 88c6ffc414 Bug 1725850 - part 23: Port editor/libeditor/crashtests/615450-1.html to WPT r=saschanaz
Depends on D127510

Differential Revision: https://phabricator.services.mozilla.com/D127511
2021-10-05 23:44:54 +00:00
Masayuki Nakano 458ac8f180 Bug 1725850 - part 22: Port editor/libeditor/crashtests/615015-1.html to WPT r=saschanaz
Depends on D127509

Differential Revision: https://phabricator.services.mozilla.com/D127510
2021-10-05 23:44:54 +00:00
Masayuki Nakano 2c7cc7087c Bug 1725850 - part 21: Port editor/libeditor/crashtests/612565-1.html to WPT r=saschanaz
Depends on D127508

Differential Revision: https://phabricator.services.mozilla.com/D127509
2021-10-05 23:44:53 +00:00
Masayuki Nakano 61f689566c Bug 1725850 - part 20: Port editor/libeditor/crashtests/499044-1.html to WPT r=saschanaz
Depends on D127507

Differential Revision: https://phabricator.services.mozilla.com/D127508
2021-10-05 23:44:53 +00:00