Commit Graph

11613 Commits

Author SHA1 Message Date
Masayuki Nakano
f8501ee2d8 Bug 1890915 - Make EditorBase::CloneAttributesWithTransaction() collect all attributes before updating the DOM tree r=m_kato
`while (RefPtr<Attr> attr = attributes->Item(0))` causes a warning in
`nsDOMAttributeMap::IndexedGetter()` because of out of bounds.  Additionally,
we should not make a loop with live DOM tree information if the loop updates
the DOM tree.  Therefore, this patch makes it collect all attributes first
before touching the DOM tree.

Depends on D207240

Differential Revision: https://phabricator.services.mozilla.com/D207241
2024-04-15 05:49:02 +00:00
Masayuki Nakano
2e9ae03568 Bug 1890912 - Fix warning spam in HTMLEditor::SplitAncestorStyledInlineElementsAtRangeEdges() r=m_kato
The cause is an expected case.  Therefore, using `NS_WARN_IF` is wrong.

Differential Revision: https://phabricator.services.mozilla.com/D207240
2024-04-15 02:45:42 +00:00
Masayuki Nakano
7cdc773578 Bug 903746 - part 2: Add textInput event and make EditorBase dispatch it as a default action of beforeinput r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D200121
2024-04-08 12:30:00 +00:00
Cosmin Sabou
783470433c Backed out 2 changesets (bug 903746) for causing non-unified build bustages on nsIPrincipal.h. CLOSED TREE
Backed out changeset c80afc8b7c2a (bug 903746)
Backed out changeset 0ac710612d09 (bug 903746)
2024-04-08 09:47:04 +03:00
Masayuki Nakano
c1fc3d961a Bug 903746 - part 2: Add textInput event and make EditorBase dispatch it as a default action of beforeinput r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D200121
2024-04-08 05:23:25 +00:00
Emilio Cobos Álvarez
e4ddf24147 Bug 1887719 - More consistently use UTF8String/nsCString for URLs. r=necko-reviewers,webidl,anti-tracking-reviewers,places-reviewers,jari,kershaw,janv,smaug,hsivonen
Sorry for the massive patch but I found it hard to split without
introducing a bunch of copies around...

This mostly makes necko and DOM agree on which strings to use, which
should result on less copies and conversions.

Differential Revision: https://phabricator.services.mozilla.com/D205601
2024-04-04 11:49:57 +00:00
Gijs Kruitbosch
999878b497 Bug 1705440 - remove old modal prompt implementation, r=mconley,webdriver-reviewers,extension-reviewers,desktop-theme-reviewers,tabbrowser-reviewers,whimboo,rpl
Differential Revision: https://phabricator.services.mozilla.com/D204759
2024-03-20 17:47:47 +00:00
Butkovits Atila
8fd100bae7 Backed out 2 changesets (bug 1883557, bug 1705440) for causing failures at browser_ext_sidebarAction_contextMenu.js. CLOSED TREE
Backed out changeset 89f62e190e69 (bug 1705440)
Backed out changeset 79dfddac72f9 (bug 1883557)
2024-03-20 14:17:11 +02:00
Gijs Kruitbosch
a3568826b0 Bug 1705440 - remove old modal prompt implementation, r=mconley,webdriver-reviewers,extension-reviewers,desktop-theme-reviewers,tabbrowser-reviewers,whimboo,rpl
Differential Revision: https://phabricator.services.mozilla.com/D204759
2024-03-20 10:10:26 +00:00
Masayuki Nakano
900d40dd31 Bug 1883562 - part 2: Make EditorBase::DeleteRangesWithTransaction and the fallback path of AutoDeleteRangesHandler work with single range r=m_kato
Although from the maintenance cost point of view, we should not duplicate
`EditorBase::DeleteRangesWithTransaction`, but let's add a wrapper for it
for making the callers simpler.

Differential Revision: https://phabricator.services.mozilla.com/D203854
2024-03-11 08:01:51 +00:00
Masayuki Nakano
4099ab71e0 Bug 1883562 - part 1: Make AutoBlockElementsJoiner work with one range r=m_kato
It and its helper class, `AutoInclusiveAncestorBlockElementsJoiner` work with
multiple ranges, but they handle special cases only with the first range.
That means that deleting content will be different if same structure is selected
with multiple ranges and that must be not expected by the users.

Differential Revision: https://phabricator.services.mozilla.com/D203853
2024-03-11 08:01:50 +00:00
Natalia Csoregi
2cb7fdd031 Backed out changeset 18dde41563b1 (bug 1882818) for causing Bug 1884613. CLOSED TREE 2024-03-11 09:45:35 +02:00
John Bieling
89637d1080 Bug 1883367 - Disable editor commands for read-only editors. r=masayuki
The purpose of this patch is to prevent users to make changes to
read-only editors.

This patch forces `IsCommandEnabled()` to return false for read-only
editors for "standard" editor commands that could have an associated
icon or menu entry and are therefore user-accessible.

This patch does not modify/test any paste commands or any of the
advanced internal editor commands.

Differential Revision: https://phabricator.services.mozilla.com/D203754
2024-03-08 17:55:57 +00:00
Cristian Tuns
104d7a4015 Backed out changeset dd6b961d3b69 (bug 1883367) for causing mochitest failures in test_command_state_when_readonly_in_chrome.html CLOSED TREE 2024-03-08 05:55:01 -05:00
John Bieling
c7152644f3 Bug 1883367 - Disable editor commands for read-only editors. r=masayuki
The purpose of this patch is to prevent users to make changes to
read-only editors.

This patch forces `IsCommandEnabled()` to return false for read-only
editors for "standard" editor commands that could have an associated
icon or menu entry and are therefore user-accessible.

Advanced internal editor commands are not touched.

Differential Revision: https://phabricator.services.mozilla.com/D203754
2024-03-08 10:24:21 +00:00
Masayuki Nakano
37ef2fd403 Bug 1882818 - Make HTMLEditor paste ancestors under the closest common ancestor in the range r=m_kato
When copying paragraphs in Gecko, some private type data is copied into the
clipboard and our editor refers the private data at pasting such data.  In
this case, `text/_moz_htmlinfo` has 2 integers to specify the range at the
copy.  If selection range ends at end of text followed by an invisible `<br>`
and a block boundary, this is set to the depth of the text node.  Then,
`HTMLWithContextInserter::CollectTopMostChildContentsCompletelyInRange` collects
top most children of the last paragraph in `HTMLWithContextInserter::Run` [1].
Therefore, the last `<div>` in the clipboard is unwrapped at pasting in the
test case.  This patch makes
`FragmentFromPasteCreator::MoveStartAndEndAccordingToHTMLInfo` re-climb up the
tree under the common ancestor of found start/last nodes.

1. https://searchfox.org/mozilla-central/rev/6b1e306175c2284958fb185bab388021e2890ed0/editor/libeditor/HTMLEditorDataTransfer.cpp#646-651

Differential Revision: https://phabricator.services.mozilla.com/D203574
2024-03-07 09:37:50 +00:00
Gregory Pappas
9a182a662f Bug 1878629 - part 4: Use EventTarget.addEventListener to add system group event listeners instead of nsIEventListenerService (editor/) r=masayuki
Depends on D201045

Differential Revision: https://phabricator.services.mozilla.com/D201046
2024-03-06 19:27:11 +00:00
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