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

11596 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano e970224f24 Bug 1881906 - Make `HTMLEditUtils` treat `<br>` elements always inline r=m_kato
As far as I've tested, `<br>` element is always treated as usual even if its
`display` is set to anything except `none`.  Therefore, preceding collapsible
white-spaces and `<br>` element should be treated as visible even if the
following `<br>` element is `display:block` or something.

Note that if `display:none` is specified, we should not treat it as a line
break, but our editor cannot work properly in the case and `HTMLEditUtils`
currently uses the default style of HTML elements if `display:none` is
specified.  Therefore, this patch makes `HTMLEditUtils` always treat `<br>`
as inline.

Differential Revision: https://phabricator.services.mozilla.com/D203403
2024-03-05 11:47:04 +00:00
Gregory Pappas 3ea20569e6 Bug 1881845 - Remove nsContentCID.h r=smaug,media-playback-reviewers,karlt
All of these components have been converted to static registration, making this
file unneeded.

Differential Revision: https://phabricator.services.mozilla.com/D202633
2024-03-04 23:41:05 +00:00
Dave Townsend c4fe5f4e8d Bug 1864896: Autofix unused function arguments (editor). r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D202964
2024-03-01 18:28:33 +00:00
Iulian Moraru 97fd2dad96 Backed out 5 changesets (bug 1864896) for causing newtab failures related to bundles. CLOSED TREE
Backed out changeset 2cd1cc279f99 (bug 1864896)
Backed out changeset e48d6928bdcb (bug 1864896)
Backed out changeset 1abbcaf91693 (bug 1864896)
Backed out changeset 06a05e5257d5 (bug 1864896)
Backed out changeset b1955ae3e9e2 (bug 1864896)
2024-03-01 12:58:03 +02:00
Dave Townsend 92b98769fe Bug 1864896: Autofix unused function arguments (editor). r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D202964
2024-03-01 10:10:09 +00:00
Emilio Cobos Álvarez fb89acd3b5 Bug 1362907 - Make select use nsHTMLButtonControlFrame for layout. r=jfkthame,dholbert
This simplifies our combobox code a bit more:

 * Reflow() is only needed to compute the label isize.
 * Frame construction uses a setup more similar to <input type=file> to
   get the right frame tree, removing a bunch of special code.
 * Lots of special code removed all over the place.

Differential Revision: https://phabricator.services.mozilla.com/D203010
2024-02-29 11:15:52 +00:00
Masayuki Nakano b4501d1622 Bug 1881989 - Make `AutoDeleteRangesHandler::ExtendOrShrinkRangeToDelete` handle it with the closest editable ancestor block or inline editing host r=m_kato
It's currently handling its job with the closest ancestor block which may be
non-editable and editing host which is either inline or block.  However, the
closest block is required for check whether the range won't be extended outside
the closest block of the common ancestor of the range and the range is
guaranteed that they are in an editing host.  Therefore, it's not required if
it's outside the editing host.  So, comparisons which check whether a node is
either/neither editing host or/nor ancestor block can get same result with
comparing with the closest one of the editing host or the closest editable
block.

Differential Revision: https://phabricator.services.mozilla.com/D202697
2024-02-27 23:15:36 +00:00
Makoto Kato 2fddc3b3c8 Bug 1872863 - Part 2. IME focus should be updated when focused element becomes editable. r=masayuki
When focused element becomes editable by `contentedtiable=true`, IME
content observer isn't created on some situations. Then IME focus isn't
set.

At first, when focused element becomes non-editable,
`FocusedElementOrDocumentBecomesNotEditable` will destroy IME content
observer, but editor might not be destroyed completely since HTML content
has multiple `contenteditable` and has focus.

Then, when focused element becomes editable again,
`FocusedElementOrDocumentBecomesEditable` will check selection ancestor
limit, but since editor isn't destroyed by previous `contenteditable`
change, we already have this limit. Then we don't create IME content
observer.

So we should set current IME state and create IME content observer when
becoming editable.

Differential Revision: https://phabricator.services.mozilla.com/D202409
2024-02-27 15:00:33 +00:00
Joel Maher eaf8b887ab Bug 1879538 - cleanup unnecessary and redundant reftest conditions. r=aryx,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D201794
2024-02-22 23:04:45 +00:00
Masayuki Nakano 3719643bde Bug 1880710 - Make `HTMLEditor::IsEmpty` check whether the editing host is empty r=m_kato
It checks whether the document body itself is empty or not.  However, if there
is only a shadow DOM hosts, it considers the content is empty.  Therefore,
`HTMLEditor::HandleDeleteSelection` does nothing.

I think that it should check whether current editing host is empty or not.
That does not work without selection ranges, but I think it's fine in most
cases.

Differential Revision: https://phabricator.services.mozilla.com/D202274
2024-02-22 07:32:18 +00:00
Greg Stoll 6b9e711a99 Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-13 11:26:48 +00:00
Cristian Tuns 2b828fa42e Backed out changeset 9dfe3fe4ccc5 (bug 1871135) for causing mochitest failures in nsClipboardProxy.cpp CLOSED TREE 2024-02-12 12:04:41 -05:00
Greg Stoll cbb35c98d7 Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-12 16:05:06 +00:00
Cristian Tuns ea5dd880a4 Backed out changeset 3caca1d10dcc (bug 1871135) for causing build bustages in nsBaseClipboard.cpp CLOSED TREE 2024-02-12 09:59:09 -05:00
Greg Stoll 5a2f92686a Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-12 00:49:39 +00:00
Tom Schuster d9047629b5 Bug 1876276 - Remove dead nsIDocShell allowPlugins code. r=emilio,sessionstore-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D199491
2024-01-31 13:23:52 +00:00
Iulian Moraru 448769c125 Backed out changeset 4871c819b21e (bug 1876276) for causing multiple bc failures. CLOSED TREE 2024-01-31 14:25:42 +02:00
Tom Schuster ab34543442 Bug 1876276 - Remove dead nsIDocShell allowPlugins code. r=emilio,sessionstore-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D199491
2024-01-31 09:36:36 +00:00
Masayuki Nakano c326234099 Bug 1876913 - part 2: Make `HTMLEditor::FormatBlockContainerWithTransaction` refer the computed style when considering the wrapping part r=m_kato
In bug 1851951, I considered that the method should keep the traditional
behavior for the backward compatibility because of mainly used by handling
a block level command, `formatBlock`, but I think that computing the replacing
part should be considered with the computed style of the elements.  That's
compatible with the other browsers.

Depends on D199844

Differential Revision: https://phabricator.services.mozilla.com/D199845
2024-01-30 13:02:37 +00:00
Tom Marble 3c78905f47 Bug 1868866 - adds ManifestParser TOML linter r=jmaher,linter-reviewers,ahal,webdriver-reviewers,settings-reviewers,search-reviewers,devtools-reviewers,fxview-reviewers,cookie-reviewers,sessionstore-reviewers,places-reviewers,dom-storage-reviewers,translations-reviewers,valentin,whimboo,Standard8,sclements,jesup
Differential Revision: https://phabricator.services.mozilla.com/D199054
2024-01-29 17:30:48 +00:00
Makoto Kato 3f4dbbf027 Bug 1586471 - Part 4. Fix drag threshold for mochitests. r=masayuki
GeckoView's drag threshold is large and mochitest runs on mobile
viewport.

So I would like to adjust this value to run drag and drop tests on
GeckoView.

Differential Revision: https://phabricator.services.mozilla.com/D197332
2024-01-28 07:49:54 +00:00
Sandor Molnar 51bb77759a Backed out changeset 2be67d91cf16 (bug 1868866) for causing Mn failures at toolkit/xre/test/marionette/test_exitcode.py CLOSED TREE 2024-01-27 00:15:22 +02:00
Tom Marble 2434015dc5 Bug 1868866 - adds ManifestParser TOML linter r=jmaher,linter-reviewers,ahal,webdriver-reviewers,settings-reviewers,search-reviewers,devtools-reviewers,fxview-reviewers,cookie-reviewers,sessionstore-reviewers,places-reviewers,dom-storage-reviewers,translations-reviewers,valentin,whimboo,Standard8,sclements,jesup
Differential Revision: https://phabricator.services.mozilla.com/D199054
2024-01-26 20:06:56 +00:00
Jonathan Kew 5741b2b190 Bug 1852478 - Convert CSS `white-space` into a shorthand that expands to `white-space-collapse` and `text-wrap-mode` longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-26 09:40:02 +00:00
Cristian Tuns f0be219b00 Backed out 4 changesets (bug 1758391, bug 1852478) for causing build bustages in UseCounterMetrics.cpp CLOSED TREE
Backed out changeset fe673f87d86a (bug 1852478)
Backed out changeset d466ccbd1aad (bug 1852478)
Backed out changeset c0fa98fec39a (bug 1758391)
Backed out changeset 04d322f23fd0 (bug 1852478)
2024-01-25 18:29:39 -05:00
Jonathan Kew 2cd3b24544 Bug 1852478 - Convert CSS `white-space` into a shorthand that expands to `white-space-collapse` and `text-wrap-mode` longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-25 22:20:05 +00:00
Joel Maher 3ad5072cf1 Bug 1873732 - remove outdated manifest conditions and use consistent conditions. r=aryx,necko-reviewers,jgilbert,settings-reviewers,credential-management-reviewers,devtools-reviewers,sessionstore-reviewers,dom-storage-reviewers,sgalich,kershaw,nchevobbe,janv,dao
Differential Revision: https://phabricator.services.mozilla.com/D198082
2024-01-25 00:27:05 +00:00
Masayuki Nakano 5852493523 Bug 1870958 - Make `TextControlState` notify `IMEContentObserver` of default value change if `TextEditor` is being initialized r=smaug,m_kato
The default value of `<textarea>` may be changed during reframes of the
corresponding `nsTextControlFrame`.  Then, the `TextEditor` and the anonymous
subtree is recreated.  In this moment, `IMEContentObserver` will restart to
observer the anonymous subtree after the editor is completely initialized,
but new default value which is caused by a mutation under `<textarea>` is
copied at recreating the anonymous subtree.  Therefore, `IMEContentObserver`
fails to notify the text change before a further selection change.

For solving this issue, this patch makes `TextControlState` notifies
`IMEContentObserver` of default value change at recreating a new `TextEditor`.
Therefore, this patch may cause redundant text change notifications for IME.
Currently, I have a plan to fix bug 854272 to carry `TextEditor` instance and
the anonymous subtree over to new `nsTextControlFrame`.  So, I believe that
this approach is reasonable for now (It'd be easier if we could add new
`nsString` to `TextControlState` without increasing the instance size, though).

Differential Revision: https://phabricator.services.mozilla.com/D197261
2024-01-24 22:50:27 +00:00
Stanca Serban 221d7acc5b Backed out changeset 54462970f797 (bug 1873732) for causing web platform tests failures. 2024-01-24 21:08:19 +02:00
Joel Maher 807575f8e1 Bug 1873732 - remove outdated manifest conditions and use consistent conditions. r=aryx,necko-reviewers,jgilbert,settings-reviewers,credential-management-reviewers,devtools-reviewers,sessionstore-reviewers,dom-storage-reviewers,sgalich,kershaw,nchevobbe,janv,dao
Differential Revision: https://phabricator.services.mozilla.com/D198082
2024-01-24 16:35:54 +00:00
Masayuki Nakano 0695aa49fe Bug 1781618 - Make `test_bug620906.html` try to click scrollbar multiple times r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D199303
2024-01-23 11:35:22 +00:00
Narcis Beleuzu 3b47d28f1e Backed out 4 changesets (bug 1758391, bug 1852478) for failures on test_animation-type-longhand.html . CLOSED TREE
Backed out changeset d6a8b0b97282 (bug 1852478)
Backed out changeset fef9fcec3afc (bug 1852478)
Backed out changeset 01711557e2bf (bug 1758391)
Backed out changeset 8c8a01dbca12 (bug 1852478)
2024-01-22 16:37:15 +02:00
Jonathan Kew 5f45c5f18d Bug 1852478 - Convert CSS `white-space` into a shorthand that expands to `white-space-collapse` and `text-wrap-mode` longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-22 12:57:54 +00:00
Masayuki Nakano b779eef044 Bug 1874806 - Get rid of `editor.inline_style.range.compatible_with_the_other_browsers` pref r=m_kato
It was added for safer backout of bug 1792386, but it's shipped in 110. So, the
pref is not necessary anymore.

Differential Revision: https://phabricator.services.mozilla.com/D198660
2024-01-18 03:38:18 +00:00
Masayuki Nakano 85697ec93c Bug 1870960 - Make `IMEStateManager` stop using `nsPresContext::GetTextInputHandlingWidget()` as far as possible r=smaug
If given `nsPresContext` is for a lazy loading `<iframe>` and the frame has not
been loaded yet, its `GetTextInputHandlingWidget()` may return `nullptr`.
However, `IMEStateManager::sTextInputHandlingWidget` may have already cache it.
Therefore, `IMEStateManager` should use:
* `sTextInputHandlingWidget` if it's available
* otherwise, `nsPresContext::GetTextInputHandlingWidget()`

Differential Revision: https://phabricator.services.mozilla.com/D197991
2024-01-16 00:09:35 +00:00
Tooru Fujisawa 2e7027b7a9 Bug 1874595 - Use LF in toml file consistently. r=jmaher,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D198505
2024-01-15 15:21:53 +00:00
Masayuki Nakano be9d19a50f Bug 1873794 - Make `HTMLEditor::SplitAncestorStyledInlineElementsAt` stop splitting ancestors of non-splittable elements r=m_kato
The method does not assume that an inline ancestor is not a splittable, but
it may occur in the edge cases.

I tried to make `HTMLEditor` adjust selection range at starting deletion to
stop handling it or select the most distant unmodifiable element, but it
 requires some expectation changes of tentative WPTs. It should be done in
a separate bug instead.

Differential Revision: https://phabricator.services.mozilla.com/D198345
2024-01-14 03:08:22 +00:00
Masayuki Nakano 3cd6a5f9b9 Bug 1871987 - Make `Document::ExecCommand` treat first call by addon as a user input r=smaug
`beforeinput` event shouldn't be fired if it's caused by JS.  However, we
dispatch it when the call is by chrome script or an addon because there is
no user input emulation API for WebExtension and builtin editors make the
change undoable only when JS changes the editor value with
`Document.execCommand`.  Therefore, addons may want to use
`Document.execCommand` for making the change undoable.

On the other hand, nested calls of `Document.execCommand` makes the error
handlings in editor classes too complicated.  Therefore, we don't allow that.
However, this causes that if web apps intercept `beforeinput` events and
prevents the default and calls `document.execCommand`, the first call of
web apps may be first nested call if the `beforeinput` event is caused by
a call of `Document.execCommand` in addon.

Therefore, this patch makes `Document` stores whether `ExecCommand` is called
by content or chrome/addon.  And if the call is improperly nested, keep stopping
handling the command, but allows if and only if the first call is by
chrome/addon.

Differential Revision: https://phabricator.services.mozilla.com/D198357
2024-01-14 03:06:25 +00:00
Masayuki Nakano 42cfc5d0be Bug 1872428 - Make `AutoMoveOneLineHandler::Run` explicitly ignore caret position when the destination is removed r=m_kato
The test case removes entire the `<output>` during deleting its content and
that occurs during it moves the content in `<div>` into the preceding `<ruby>`.
Therefore, the destination becomes not connected to the document so that it
fails to track the range of moved contents in the document.

Then, the code does not explicitly mark the caret position is not necessary.
So, we just need to do it.

Differential Revision: https://phabricator.services.mozilla.com/D198148
2024-01-12 07:13:30 +00:00
Jeff Muizelaar a1ee18724c Bug 1853986. Let "Don't translate new lines for IME" ride to release. r=masayuki
This is a minimal version. The corresponding code cleanup will
be done in a follow up.

Differential Revision: https://phabricator.services.mozilla.com/D198045
2024-01-10 18:53:21 +00:00
Masayuki Nakano 5eb33582df Bug 1872422 - Make `HTMLEditUtils::IsNeverElementContentsEditableByUser` return `false` for `<picture>` r=m_kato
Invalid children of `<picture>` like text may appear as usual.  Therefore,
they should be editable.

Note that this patch does not fix the root cause of the assertion because
if selection range may cross a remaining element boundary listed in the
method, but I couldn't find a way to fix this with a reasonable size patch.

Differential Revision: https://phabricator.services.mozilla.com/D197988
2024-01-10 01:37:54 +00:00
Masayuki Nakano b59eed054b Bug 1870962 - Make `HTMLEditor::SplitAncestorStyledInlineElementsAt` never drop the "did split" state from the result r=m_kato
Oddly, it returns the latest result as split result. However, in the case,
it splits `<kbd>` under `<button>`, but does not split `<button>`, but the
caller expects that whether it did split or not.

Differential Revision: https://phabricator.services.mozilla.com/D197262
2023-12-27 02:53:44 +00:00
Masayuki Nakano 627e1f9aff Bug 1870222 - part 6: Make `AutoEmptyBlockAncestorDeleter::ScanEmptyBlockInclusiveAncestor` treat non-editable content as visible r=m_kato
It treats non-editable content as invisible. Therefore, if you try to
delete backward/forward from first/last block, Gecko deletes the block with
the non-editable content.

Depends on D196817

Differential Revision: https://phabricator.services.mozilla.com/D196819
2023-12-25 12:54:08 +00:00
Masayuki Nakano bc25bfb070 Bug 1870222 - part 5: Make `HTMLEditor::ClearStyleAt` treat non-editable content as visible r=m_kato
Pasting and inserting HTML clears current style to respect the new style.
Therefore, the old ancestors shouldn't be removed when they have only
non-editable content.

Unfortunately, I have no idea how to test all of the paths which are changed
by this patch. However, I believe the method should always treat non-editable
content as visible.

Differential Revision: https://phabricator.services.mozilla.com/D196817
2023-12-25 12:54:08 +00:00
Masayuki Nakano 3a1fc63ab7 Bug 1870222 - part 4: Make `HTMLEditor` treat non-editable content as visible when splitting a paragraph r=m_kato
Depends on D196815

Differential Revision: https://phabricator.services.mozilla.com/D196816
2023-12-25 12:54:07 +00:00
Masayuki Nakano 85945dea72 Bug 1870222 - part 3: Make `HTMLEditor::AdjustCaretPositionAndEnsurePaddingBRElement` treat non-editable content as visible r=m_kato
If the parent block has only non-editable, it treat the block as invisible and
puts `<br>`. Therefore, deleting content may cause inserting new line in some
cases.

Depends on D196814

Differential Revision: https://phabricator.services.mozilla.com/D196815
2023-12-25 12:54:07 +00:00
Masayuki Nakano 811e10d8a9 Bug 1870222 - part 2: Make `HTMLEditor::OnEndHandlingTopLevelEditSubActionInternal` treat non-editable things as visible r=m_kato
When it cleans up unnecessary new empty inline ancestors, it should treat
non-editable elements in the inline containers as visible.

Depends on D196813

Differential Revision: https://phabricator.services.mozilla.com/D196814
2023-12-25 12:54:06 +00:00
Masayuki Nakano fa2b298f1a Bug 1870222 - part 1: Rename `HTMLEditUtils::EmptyCheckOption::IgnoreEditableState` with inverting the meaning r=m_kato
It means that "treat non-editable things as visible" when it's not set.
However, it's odd.  You must assume that if no option is set, `IsEmpty()` etc
should treat non-editable nodes as visible things.  Therefore, this renames it
to `TreatNonEditableContentAsVisible` and changing all callers of
`HTMLEditUtils::IsEmptyNode`, `HTMLEditUtils::IsEmptyInlineContainer`,
`HTMLEditUtils::IsEmptyBlockElement` and
`HTMLEditUtils::CollectEmptyInlineContainerDescendants`.  So, this does not
change any behavior.

Differential Revision: https://phabricator.services.mozilla.com/D196813
2023-12-25 12:54:06 +00:00
Masayuki Nakano 5f6299d456 Bug 1764895 - part 3: Get rid of `nsIEditor.setShouldTxnSetSelection` r=m_kato DONTBUILD
It allows multiple edit action preserves `Selection` when updating the DOM tree.
However, most callers do not use `finally` to reset the state, and this makes
edit action handling complicated in some edge cases.  Therefore, let's stop
supporting this feature.  If Thunderbird requires the feature, the developers
should request additional param for preserving `Selection` like the preceding
patch.

Depends on D196004

Differential Revision: https://phabricator.services.mozilla.com/D196005
2023-12-14 00:41:20 +00:00
Masayuki Nakano 05bce4692d Bug 1764895 - part 1: Make `nsIEditor.insertNode` and `nsIEditor.deleteNode` take an optional parameter to preserve selection r=m_kato
`nsIEditor.setShouldTxnSetSelection` can preserve selection across multiple
editing.  Therefore, we cannot manage the state only in the stack.

It's used only in comm-central, and used only with `insertNode` and
`deleteNode`.  Therefore, adding new param to them to preserve selection
must be enough.

While I'm writing this patch, I realized that `input` event is not fired
by these methods because nobody set a placeholder transaction.  That may
lead Thunderbird only IME crash bugs due to `IMEContentObserver` is not
notified editor properly.  Therefore, this may fix some Thunderbird only
crashes.

Note that `deleteNode` should not update selection.  However, I'm not 100%
sure that.  Therefore, I add new param to `deleteNode` too.  However,
some reviewers think it's unnecessary, I'll remove it before landing.

Finally, `beforeinput` and `input` caused by the method calls start updating
selection.  However, I think that it should be better behavior.  If Thunderbird
needs to guarantee that selection is set to whether the user expected when
it calls these methods with preserving selection.

Differential Revision: https://phabricator.services.mozilla.com/D196004
2023-12-13 07:50:42 +00:00