Commit Graph

11716 Commits

Author SHA1 Message Date
Masayuki Nakano
43a805714a Bug 1930277 - Make nsHTMLCopyEncoder::RangeNodeContext::IncludeInContext not treat inline editing host as an contextual inline element r=edgar,dom-core
It treats some inline elements as contextual elements.  Then, they will be
preserved in copied HTML fragment.  However, if an inline element is an editing
host, we don't want to contain it to the copied fragment because pasting it
causes duplicating same style into same editing host.  So, if the style includes
relative style like `font-size: 2em`, it will cause bigger text than the
surrounding text.  Additionally, the inline editing host usually has a border
but we don't want to make it appear in editable text.

Unfortunately, with this change, we stop copying the text style specified to
the inline editing host.  However, this is same behavior as when the editing
host is a block element like `<div>`.  Note that pasted text will be merged into
the inline editing host style.  Therefore, if and only if the destination has
different style from the editing host, the result might be different from the
expected one by the user.  However, this is a long standing issue, see
bug 1428046, for example.

Differential Revision: https://phabricator.services.mozilla.com/D228623
2024-11-20 04:35:32 +00:00
Emilio Cobos Álvarez
8f4f441cae Bug 1388910 - Remove -moz-user-modify property. r=dshin
We successfully unshipped it in bug 1920118.

Differential Revision: https://phabricator.services.mozilla.com/D229530
2024-11-19 19:35:35 +00:00
Sebastian Hengst
197fea4f23 Bug 1922355 - macOS 14.70: adjust expectations for mochitests and xpcshell tests. r=jmaher,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D228118
2024-11-19 17:19:24 +00:00
Emilio Cobos Álvarez
8670931276 Bug 1925365 - Make sure editable flag and element state remain in sync. r=masayuki
Some nsEditingSession callers didn't update element state, incorrectly.

No behavior change on Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D229347
2024-11-19 09:09:24 +00:00
Emilio Cobos Álvarez
86a5e86a57 Bug 1914321 - Build view transition pseudo-element tree. r=view-transitions-reviewers,boris
Reuse the editor's manual NAC machinery for now, and hook it into
StyleChildrenIterator and co.

We might need to slightly tweak the setup for selector-matching, not
sure yet, but that should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D228255
2024-11-14 10:17:52 +00:00
Masayuki Nakano
3f730c75ff Bug 1930564 - Make MoveNodeResult inherit EditActionResult r=m_kato
Currently `MoveNodeResult` inherits only `CaretPoint` and has some members which
are same as `EditActionResult`.  I'd like to add `DeleteRangeResult` which will
inherit both `CaretPoint` and `EditActionResult`.  So, for making it work with
`MoveNodeResult`, it's nicer to make `MoveNodeResult` inherits
`EditActionResult`.

Differential Revision: https://phabricator.services.mozilla.com/D228629
2024-11-14 00:56:52 +00:00
Butkovits Atila
4999c0273f Backed out changeset cb8acf4c8893 (bug 1914321) for causing failures at browser_markup_search_01.js. CLOSED TREE 2024-11-14 02:42:39 +02:00
Emilio Cobos Álvarez
20ed2e6af8 Bug 1914321 - Build view transition pseudo-element tree. r=view-transitions-reviewers,boris
Reuse the editor's manual NAC machinery for now, and hook it into
StyleChildrenIterator and co.

We might need to slightly tweak the setup for selector-matching, not
sure yet, but that should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D228255
2024-11-13 22:11:58 +00:00
Butkovits Atila
a8ab9286e2 Backed out changeset 4fc43467210b (bug 1914321) for causing failures at PresShell.cpp. CLOSED TREE 2024-11-13 21:24:29 +02:00
Emilio Cobos Álvarez
189e08a4a0 Bug 1914321 - Build view transition pseudo-element tree. r=view-transitions-reviewers,boris
Reuse the editor's manual NAC machinery for now, and hook it into
StyleChildrenIterator and co.

We might need to slightly tweak the setup for selector-matching, not
sure yet, but that should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D228255
2024-11-13 18:06:34 +00:00
Masayuki Nakano
620039f5b3 Bug 1930050 - Make AutoRangeArray check the container type r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D228624
2024-11-13 08:17:03 +00:00
Stanca Serban
79363f620f Backed out 2 changesets (bug 1862256) for causing mochitests failures in test_native_key_bindings_mac.html. CLOSED TREE
Backed out changeset b23e836dc19b (bug 1862256)
Backed out changeset ccb29705b1d5 (bug 1862256)
2024-11-07 14:31:58 +02:00
longsonr
5dc0704a18 Bug 1929626 - Remove more uses/includes of nsAlgorithm.h r=emilio,win-reviewers,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D228203
2024-11-07 11:09:40 +00:00
Laura Hausmann
cec01faf6c Bug 1862256 - Fix textarea home/end behavior r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D192724
2024-11-07 10:30:46 +00:00
Goloman Adrian
8b9e129a4b Backed out changeset fe24b8ac5257 (bug 1929626) for causing build bustages @StackArena.cpp. CLOSED TREE 2024-11-07 01:28:24 +02:00
longsonr
7b5285c7fa Bug 1929626 - Remove more uses/includes of nsAlgorithm.h r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D228203
2024-11-06 21:15:52 +00:00
Iulian Moraru
3e09eabd4e Backed out 10 changesets (bug 1928672, bug 1922020) for causing mochitest-plain failures on test_different_domain_in_hierarchy.html. CLOSED TREE
Backed out changeset c7c93c34f516 (bug 1928672)
Backed out changeset 4e6a8bea3574 (bug 1922020)
Backed out changeset 11718a55e298 (bug 1922020)
Backed out changeset ff0655d8a6a9 (bug 1922020)
Backed out changeset cabd41ab53e4 (bug 1922020)
Backed out changeset 88eac74dbe86 (bug 1922020)
Backed out changeset ea5096fafb29 (bug 1922020)
Backed out changeset 852d8a2132c8 (bug 1922020)
Backed out changeset e66184701c85 (bug 1922020)
Backed out changeset f52eb9bf4d08 (bug 1922020)
2024-11-05 01:46:32 +02:00
Benjamin VanderSloot
720afb6416 Bug 1922020, part 15 - Remove reliance on window.opener storage access heuristic in user.js from toolkit/components/antitracking - r=timhuang,anti-tracking-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D224820
2024-11-04 20:38:40 +00:00
serge-sans-paille
8a0a0f7524 Bug 1920718 - Annotate all global variable with runtime initialization attributes r=glandium,application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh,geckoview-reviewers,win-reviewers,gstoll,m_kato
MOZ_RUNINIT => initialized at runtime
MOZ_CONSTINIT => initialized at compile time
MOZ_GLOBINIT => initialized either at runtime or compile time, depending on template parameter, macro parameter etc
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-30 11:05:24 +00:00
serge-sans-paille
e54774d573 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Makoto Kato
11017535d8 Bug 1925889 - Get rid of GetPersonalDictionary and GetPersonalDictionaryWord from nsIEdiorSpellCheck. r=masayuki
No one uses GetPersonalDictionary and GetPersonalDictionaryWord in m-c and c-c.
Let's get rid of both.

Differential Revision: https://phabricator.services.mozilla.com/D226583
2024-10-28 07:43:30 +00:00
Alexandru Marc
191ccbe7fe Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
53068cdf31 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
83543f20f2 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
c7a369b29a Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Masayuki Nakano
bccfcce738 Bug 1923251 - Backout almost all of D225038 except WPT part
The backed-out patch is Bug 1923251 (part 1).

This does not backout the changes in `EditorDOMPoint.h`, `WSRunObject.h` and
template method instantiation in `WSRunObject.cpp` to make some other my local
changes keep working.  (They won't affect to any behavior.)

Depends on D226631

Differential Revision: https://phabricator.services.mozilla.com/D226632
2024-10-23 18:07:53 +00:00
Masayuki Nakano
7ec72f1003 Bug 1923251 - Backout D226092 and D225039 except WPT part
For reference, the backed-out revisions are from these bugs:
D226092: Bug 1925331
D225039: Bug 1923251 (part 2)

Differential Revision: https://phabricator.services.mozilla.com/D226631
2024-10-23 18:07:53 +00:00
Emilio Cobos Álvarez
5d90ee025e Bug 1926031 - Add a more c++-friendly nsISelectionController::ScrollSelectionIntoView. r=jjaschke,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D226390
2024-10-22 09:58:03 +00:00
Masayuki Nakano
253f2948ac Bug 1925331 - Make the delete handlers of HTMLEditor guarantee that the point is in content node at calling EnsureNoFollowingUnnecessaryLineBreak r=m_kato
The point may not be set if the selection move is prevented or not suggested.
Therefore, it should check the caret position before calling
`EnsureNoFollowingUnnecessaryLineBreak`.  On the other hand,
`HandleDeleteCollapsedSelectionAtWhiteSpaces` should use `Selection` instead
if caret position is not suggested.  It should be handled in bug 1925424.

Differential Revision: https://phabricator.services.mozilla.com/D226092
2024-10-22 08:35:34 +00:00
Masayuki Nakano
ee4d620e2a Bug 1925165 - Make WSScanResult::PointAfterReachedContent set the template argument explicitly r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D225930
2024-10-17 22:15:11 +00:00
Masayuki Nakano
06ec518131 Bug 1923251 - part 2: Make HTMLEditor clean up unnecessary padding line breaks when deleting something immediately before it r=m_kato
Unfortunately, the code does not work well only in `white-space: pre-line`.
The rending itself is broken, so, it won't work well on Firefox anyway and
this style is not so useful with editable content.  Therefore, this patch
does not fix the issue.

Differential Revision: https://phabricator.services.mozilla.com/D225039
2024-10-16 05:59:51 +00:00
Masayuki Nakano
f6e4fec140 Bug 1923251 - part 1: Make HTMLEditor clean up unnecessary padding line break when inserting something immediately before it r=m_kato
Both Chrome and Safari clean up unnecessary padding line breaks when they become
unnecessary.  Therefore, we should follow that.

Differential Revision: https://phabricator.services.mozilla.com/D225038
2024-10-16 05:59:50 +00:00
Stanca Serban
26411e5352 Backed out 2 changesets (bug 1923251) for causing build bustages in HTMLEditor.cpp. CLOSED TREE
Backed out changeset 526e6dccb137 (bug 1923251)
Backed out changeset b61267a75e51 (bug 1923251)
2024-10-16 02:55:14 +03:00
Masayuki Nakano
6b7b238b07 Bug 1923251 - part 2: Make HTMLEditor clean up unnecessary padding line breaks when deleting something immediately before it r=m_kato
Unfortunately, the code does not work well only in `white-space: pre-line`.
The rending itself is broken, so, it won't work well on Firefox anyway and
this style is not so useful with editable content.  Therefore, this patch
does not fix the issue.

Differential Revision: https://phabricator.services.mozilla.com/D225039
2024-10-15 23:14:59 +00:00
Masayuki Nakano
504c273e00 Bug 1923251 - part 1: Make HTMLEditor clean up unnecessary padding line break when inserting something immediately before it r=m_kato
Both Chrome and Safari clean up unnecessary padding line breaks when they become
unnecessary.  Therefore, we should follow that.

Differential Revision: https://phabricator.services.mozilla.com/D225038
2024-10-15 23:14:58 +00:00
Masayuki Nakano
b3b969af35 Bug 1923250 - Make HTMLEditor::InsertElementAtSelectionAsAction split ancestor inline elements r=m_kato
Chrome and Safari splits ancestors when `document.execCommand("insertImage")`
 inserts an `<img>`, but we insert into the closest inline element. For example,
```html
<b>A[]B</b>
```
Chrome and Safari make it to:
```html
<b>A</b><img><b>B</b>
```
But Firefox makes it to:
```html
<b>A<img>B</b>
```
I think that we should not change the behavior on Thunderbird.  Therefore, the
behavior is controlled with the new `options` argument and the new behavior
runs only when the `HTMLEditor` works for content document and it's not caused
by the XPCOM method.

Differential Revision: https://phabricator.services.mozilla.com/D225037
2024-10-11 22:46:28 +00:00
Tamas Szentpeteri
8be45dd280 Backed out changeset 4b1409597101 (bug 1920718) for causing bp bustages on rapl.cpp. 2024-10-08 23:27:18 +03:00
serge-sans-paille
069a97307f Bug 1920718 - Annotate all global variable with runtime initialization as MOZ_RUNINIT r=application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-08 16:49:51 +00:00
Masayuki Nakano
2fa21bed30 Bug 1921723 - Add automated tests for insertText in contenteditable=plaintext-only and make its handlers compute editing host without limiting in the <body> r=m_kato
This patch makes `HTMLEditor::HandleInsertText` compute the editing host without
limiting in the `<body>` for consistency with the other edit action handlers
which we've changed at implementing `contenteditable=plaintext-only`.
Unfortunately, there are a lot of changes to pass the editing host to
`EnsureCaretNotAfterInvisibleBRElement()`, though.

Note that the tests trying to preserve the style in
`contenteditable=plaintext-only` fails on Chrome too due to `<br>` is put
outside the `<b>` or forgot the `<b>` after caret move.  However, as you know,
`contenteditable=plaintext-only` does not allow to change text style even
for web app developers.  Therefore, loosing the style only in some conditions
must be wrong.  Therefore, I made the expectations.

Differential Revision: https://phabricator.services.mozilla.com/D224188
2024-10-08 07:54:22 +00:00
Masayuki Nakano
ee7a27d122 Bug 1922149 - Make HTMLEditor::ComputeEditingHostInternal use common ancestor of all selection ranges r=m_kato
Selection ranges can cross editing host boundaries if no editing host has focus.
Therefore, `Selection.focusNode` may be in an editing host but there may be
no active/focused editing host.

The computation may be expensive if there are a lot of ranges and selecting
in slotted shadow tree.  However, it's rare case, so, I think it's okay for
now.

Differential Revision: https://phabricator.services.mozilla.com/D224282
2024-10-07 23:06:55 +00:00
Masayuki Nakano
2dc15e652e Bug 1922457 - Get rid of editor.block_inline_check.use_computed_style pref r=m_kato
It was shipped in 123 and now in the ESR.  We don't have regression report in
the wild.  So, it must be fine to get rid of the pref.

Differential Revision: https://phabricator.services.mozilla.com/D224559
2024-10-07 23:05:15 +00:00
Masayuki Nakano
dd16910196 Bug 1921162 - part 1: Make HTMLEditor handle Enter key press as insertLineBreak if it's in contenteditable=plaintext-only r=m_kato
Chrome treats `Enter` key press as `insertLineBreak` instead of
`insertParagraph`.  Additionally, Chrome handles `insertParagraph` command
work as same as when `contenteditable=true`.  Therefore, `HTMLEditor` needs
to change the behavior at handling `eKeyPress` event.

Depends on D224184

Differential Revision: https://phabricator.services.mozilla.com/D224185
2024-10-04 00:08:45 +00:00
Masayuki Nakano
ede8ff25ca Bug 1921701 - Update test_bug430392.html for the new behavior changed in bug 1921705 r=m_kato
Before bug 1921705, the first `ArrowRight` key press moves caret to end of the
non-editable character "A".  Therefore, nothing is changed by pressing `Enter`
nor `Backspace`.  However, `beforeinput` events are fired due to bug 1921700.

In bug 1921705, we fix the caret move issue.  Then, this test starts editing.
Therefore, `input` events should be fired as same as `beforeinput` events.
Additionally, due to the complicated collapsible white-space handling, some
results are not same as original text content.  Therefore, we need to adjust
the expected results.

Depends on D224183

Differential Revision: https://phabricator.services.mozilla.com/D224184
2024-10-03 02:39:22 +00:00
Masayuki Nakano
dc004f95b6 Bug 1920646 - part 2: Make HTMLEditor handle insertHTML as inserting plaintext converted from given source r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D223909
2024-10-02 21:42:10 +00:00
Masayuki Nakano
7e9bbe23c8 Bug 1920646 - part 1: Make HTMLEditor paste/drop things as plaintext when contenteditable=plaintext-only r=m_kato
Chrome sets `beforeinput.data` instead of `beforeinput.dataTransfer`, but
Input Events Level 2 spec defines that browsers should set `dataTransfer` when
**contenteditable** [1].  Therefore, the new WPT expects `dataTransfer`.

However, it's unclear that the `dataTransfer` should have `text/html` or only
`text/plain`.  From web apps point of view, `text/html` data may make them
serialize the rich text format to plaintext without any dependencies of browsers
and OS.  On the other hand, they cannot distinguish whether the user tries to
paste with or without formatting when `contenteditable=true`.  Therefore, I
filed a spec issue for this.  We need to be back later about this issue.

1. https://w3c.github.io/input-events/#overview
2. https://github.com/w3c/input-events/issues/162

Differential Revision: https://phabricator.services.mozilla.com/D223908
2024-10-02 21:42:09 +00:00
Masayuki Nakano
7fe5d3ae1c Bug 1920647 - part 2: Make nsITableEditor methods do not modify the DOM if editing host is plaintext-only r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D223670
2024-10-01 04:21:54 +00:00
Masayuki Nakano
ef73f35608 Bug 1920647 - part 1: Make HTMLEditor won't show Gecko specific editing UI in contenteditable=plaintext-only r=m_kato
Depends on D223277

Differential Revision: https://phabricator.services.mozilla.com/D223669
2024-10-01 04:21:54 +00:00
Masayuki Nakano
20a5213d23 Bug 1920622 - Make the style setter public methods of HTMLEditor stop handling their jobs if the editing host is plaintext-only r=m_kato
Unfortunately, (even tough we're the last implementor of this feature`,) there
are not editing behavior tests in web-platform tests.  Therefore, this patch
creates new `plaintext-only` directory into `editing` and make the feature
enabled in its `__dir__.ini` to check the implementing behavior with new tests.

This patch also changes how to compute the editing host (whether using `<body>`
or not when selection is outside it), but the new behavior (not limited in the
`<body>`) should work fine in the most cases and I believe that it's better
than current implementation in some methods.

Note that Chrome considers whether the style should be updated or not with
the closest inclusive ancestor of the **focus node** of `Selection`.  However,
it's odd and aligning to the behavior requires bigger change.  Therefore, I'd
like to implement this feature only with checking the focused editing host.

Differential Revision: https://phabricator.services.mozilla.com/D223277
2024-09-30 21:35:42 +00:00
Gregory Pappas
73916fe623 Bug 1920268 - Remove unnecessary MochiKit.js includes in tests (editor/libeditor/) r=masayuki
Depends on D223029

Differential Revision: https://phabricator.services.mozilla.com/D223030
2024-09-23 22:35:39 +00:00
Masayuki Nakano
df7aad424e Bug 1916081 - Make HTMLEditor::FocusedElementOrDocumentBecomesNotEditable stop using aHTMLEditor at adjusting IME state r=m_kato
`aHTMLEditor` may be `nullptr` and there may have been an `HTMLEditor` before
it's called.  Therefore, it may need to adjust IME state even if `aHTMLEditor`
is `nullptr`.  So, it should adjust IME state from `aDocument` which should be
same as `aHTMLEditor->GetDocument()` if `aHTMLEditor` is not `nullptr`.

Note that if `IMEStateManager` thinks another `nsPresContext` has focus, it does
not touch IME state.  Therefore, it's safe to skip checking the focus state of
the `Document`.

Differential Revision: https://phabricator.services.mozilla.com/D220772
2024-09-05 00:52:58 +00:00