Commit Graph
1055 Commits
Author SHA1 Message Date
Daniel Holbert 648f3a95c5 Bug 2044510: Pass already_AddRefed types by-value instead of by rvalue reference, in dom/html. r=dom-core-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D304360
2026-06-05 21:06:40 +00:00
Henri Sivonen d13776d321 Bug 2038124 - Optimize setting attributes on non-custom HTML elements from parser. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D302276
2026-06-02 09:12:39 +00:00
Alexandru Marc 16e384440d Revert "Bug 2038124 addendum - Simplify the attribute holder in the HTML parser. r=smaug" for causing build bustages @ Element.cpp
This reverts commit 82b2e13b45.

Revert "Bug 2038124 - Optimize setting attributes on non-custom HTML elements from parser. r=smaug"

This reverts commit 2d1ee1cd69.
2026-06-02 07:41:40 +00:00
Henri Sivonen 2d1ee1cd69 Bug 2038124 - Optimize setting attributes on non-custom HTML elements from parser. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D302276
2026-06-02 07:07:26 +00:00
Atila Butkovits d68e85e91d Revert "Bug 2038124 addendum - Simplify the attribute holder in the HTML parser. r=smaug" for causing bustages at Element.cpp.
This reverts commit 9dd3f6b595.

Revert "Bug 2038124 - Optimize setting attributes on non-custom HTML elements from parser. r=smaug"

This reverts commit b1774ce65e.
2026-06-01 21:47:14 +00:00
Henri Sivonen b1774ce65e Bug 2038124 - Optimize setting attributes on non-custom HTML elements from parser. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D302276
2026-06-01 20:50:16 +00:00
Henri Sivonen 63f49b4b9b Bug 2041676 - Use if-else for mutually-exclusive pointer comparisons in HTMLInputElement::AfterSetAttr. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D302280
2026-05-27 08:11:32 +00:00
Masayuki Nakano 52def4ebef Bug 2026022 - Make TextEditor and HTMLEditor initialize Selection before focus event is dispatched r=smaug
Currently, our editor and document viewer manage `Selection` state and
ranges within their `focus`/`blur` event listeners. However, UI Events
defines that the events should be fired after the focus move finished
[1][2]. Therefore, we need to move the handlers to
`EventTarget::PreHandleEvent` or the event listener of the event target
parent of the window (in the capturing phase of the default event group).
Otherwise, a web content's event listener runs before we maintain the
`Selection`. This patch moves the handlers to
`nsGlobalWindowInner::PreHandleEvent`.

Currently, there are 3 event listeners which maintain the `Selection`.

`nsDocViewerFocusListener`:

This maintains the active `nsFrameSelection` and the display of the
last focused selection only when the document node gets focus. This
patch removes this class and move the code into new static methods of
`nsFrameSelection`.

`HTMLEditor::OnFocus`:

This activates the document `nsFrameSelection` and collapses `Selection`
to the focused element if `Selection` ranges are not in the focused
editing host. This does it even if a text control gets focus even though
the focused `TextEditor` will handle the further user inputs.

`TextEditor::OnFocus`:

This activate the independent `nsFrameSelection`.

These handlers run in the following order:
1. `nsDocViewerFocusListener`
2. `HTMLEditor`
3. `TextEditor`

Therefore, `nsGlobalWindowInner::PreHandleEvent` handles all of them
within this order.

Note that `TextEditor::OnFocus` is now called after `HTMLInputElement`
or `HTMLTextAreaElement` prepares the further `change` event
dispatching. After applying this patch, their `PreHandleEvent` will do
that. Then, `nsGlobalWindowInner::PreHandleEvent` will run because
`PreHandleEvent`s are called in the bubbling phase order. Therefore, the
handling order shouldn't be changed.

1. https://w3c.github.io/uievents/#event-type-focus
2. https://w3c.github.io/uievents/#event-type-blur

Differential Revision: https://phabricator.services.mozilla.com/D292335
2026-05-27 03:32:07 +00:00
Sylvestre Ledru d2ee2c8fb9 Bug 2036402 - Apply std::move in dom/html where values can be moved instead of copied r=dom-core,firefox-svg-reviewers,smaug,longsonr
Differential Revision: https://phabricator.services.mozilla.com/D298099
2026-05-04 15:16:20 +00:00
Emilio Cobos Álvarez 1bd0da8bf7 Bug 2033243 - Rename GetOwnerGlobal to GetRelevantGlobal. r=dom-core,media-playback-reviewers,credential-management-reviewers,webrtc-reviewers,dom-storage-reviewers,firefox-style-system-reviewers,dimi,janv,dshin,aosmond,smaug
As per the HTML terminology (https://html.spec.whatwg.org/#relevant)

Automatic rename using sed + lints.

Differential Revision: https://phabricator.services.mozilla.com/D297184
2026-05-02 22:04:17 +00:00
iulian moraru 480fc572da Revert "Bug 2036439, Bug 2033243 - Deal with ownerGlobal -> documentGlobal rename in extensions. r=robwu,home-newtab-reviewers,mconley" for causing newtab failures.
This reverts commit 4f62279d01.

Revert "Bug 2033243 - Other miscellaneous ownerGlobal-related naming removal. r=dom-core,smaug"

This reverts commit 91a4ece356.

Revert "Bug 2033243 - BindToOwner -> BindToGlobal. r=dom-core,smaug"

This reverts commit 5a95a889e1.

Revert "Bug 2033243 - Rename GetOwnerGlobal to GetRelevantGlobal. r=dom-core,media-playback-reviewers,credential-management-reviewers,webrtc-reviewers,dom-storage-reviewers,firefox-style-system-reviewers,dimi,janv,dshin,aosmond,smaug"

This reverts commit 7177a68e67.

Revert "Bug 2033243 - Replace ownerGlobal with documentGlobal, and stop exposing ownerGlobal to JS. r=firefox-desktop-core-reviewers ,webidl,joschmidt,perftest-reviewers,sparky,smaug,mossop ,webidl,joschmidt,perftest-reviewers,sparky,smaug,mossop"

This reverts commit 5263254690.
2026-05-02 16:43:35 +00:00
Emilio Cobos Álvarez 7177a68e67 Bug 2033243 - Rename GetOwnerGlobal to GetRelevantGlobal. r=dom-core,media-playback-reviewers,credential-management-reviewers,webrtc-reviewers,dom-storage-reviewers,firefox-style-system-reviewers,dimi,janv,dshin,aosmond,smaug
As per the HTML terminology (https://html.spec.whatwg.org/#relevant)

Automatic rename using sed + lints.

Differential Revision: https://phabricator.services.mozilla.com/D297184
2026-05-02 15:33:23 +00:00
rperta d4cc71008d Revert "Bug 2033243 - Other miscellaneous ownerGlobal-related naming removal. r=dom-core,smaug" on developer request
This reverts commit e58e122135.

This reverts commit 84ca206f3e.

This reverts commit a7945292ed.

This reverts commit 367d83d299.
2026-05-02 06:20:30 +00:00
Emilio Cobos Álvarez a7945292ed Bug 2033243 - Rename GetOwnerGlobal to GetRelevantGlobal. r=dom-core,media-playback-reviewers,credential-management-reviewers,webrtc-reviewers,dom-storage-reviewers,firefox-style-system-reviewers,dimi,janv,dshin,aosmond,smaug
As per the HTML terminology (https://html.spec.whatwg.org/#relevant)

Automatic rename using sed + lints.

Differential Revision: https://phabricator.services.mozilla.com/D297184
2026-05-01 11:58:14 +00:00
agoloman c814da612d Revert "Bug 2033243 - Other miscellaneous ownerGlobal-related naming removal. r=dom-core,smaug" for causing multiple failures.
This reverts commit c7246654bc.

Revert "Bug 2033243 - BindToOwner -> BindToGlobal. r=dom-core,smaug"

This reverts commit 8873ddf33c.

Revert "Bug 2033243 - Rename GetOwnerGlobal to GetRelevantGlobal. r=dom-core,media-playback-reviewers,credential-management-reviewers,webrtc-reviewers,dom-storage-reviewers,firefox-style-system-reviewers,dimi,janv,dshin,aosmond,smaug"

This reverts commit 8bf999e03c.

Revert "Bug 2033243 - Replace ownerGlobal with documentGlobal, and stop exposing ownerGlobal to JS. r=firefox-desktop-core-reviewers ,webidl,joschmidt,perftest-reviewers,sparky,smaug,mossop"

This reverts commit 7dea1af2e0.
2026-04-30 20:13:14 +00:00
Emilio Cobos Álvarez 8bf999e03c Bug 2033243 - Rename GetOwnerGlobal to GetRelevantGlobal. r=dom-core,media-playback-reviewers,credential-management-reviewers,webrtc-reviewers,dom-storage-reviewers,firefox-style-system-reviewers,dimi,janv,dshin,aosmond,smaug
As per the HTML terminology (https://html.spec.whatwg.org/#relevant)

Automatic rename using sed + lints.

Differential Revision: https://phabricator.services.mozilla.com/D297184
2026-04-30 17:47:11 +00:00
Keith Cirkel f502ae4b7a Bug 2012698 - Part 1 - Refactor Element, abstracting Details Shadow tree branches to virtual methods r=dom-core,jjaschke,emilio
Currently Element has the SHADOW_ROOT_IS_DETAILS_SHADOW_TREE flag, which
determines if the element is a Details element and allows branching for specific
shadow root operations, such as getting the slot names, and handlers for slot
changed and unslotted.

This change refactors this to be more generic: switching this branching for
virtual methods instead, while dropping the flag. It also then co-locates the
Details specific shadow root operations into HTMLDetailsElement.cpp.

This will allow us to introduce more element specific Shadow Root behaviours,
such as those for the `<select>` element.

Differential Revision: https://phabricator.services.mozilla.com/D295337
2026-04-29 20:20:27 +00:00
Emilio Cobos Álvarez 1ddad57128 Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug
Make them concrete classes rather than interfaces, and make the
inheritance chain simpler.

Differential Revision: https://phabricator.services.mozilla.com/D296484
2026-04-28 07:38:27 +00:00
Silaghi ce61f876cc Revert "Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug" for causing wpt failures at BaseContentList
This reverts commit cde3e5607b.
2026-04-28 03:43:46 +00:00
Emilio Cobos Álvarez cde3e5607b Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug
Make them concrete classes rather than interfaces, and make the
inheritance chain simpler.

Differential Revision: https://phabricator.services.mozilla.com/D296484
2026-04-28 00:24:11 +00:00
Emilio Cobos Álvarez f097472815 Bug 2022763 - Propagate owner global from input element to DOM files properly. r=dom-core,win-reviewers,smaug,gstoll,devtools-reviewers,jdescottes
This required some refactoring of the MockFilePicker to test somewhat (ugh)
reliably, but hopefully an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D288166
2026-04-18 10:00:15 +00:00
rperta 2b400e7aa3 Revert "Bug 2022763 - Propagate owner global from input element to DOM files properly. r=dom-core,win-reviewers,smaug,gstoll,devtools-reviewers,jdescottes" for causing bc failures at browser_screenshots_test_downloads.js This reverts commit 0f75054261. 2026-04-18 02:20:17 +00:00
Emilio Cobos Álvarez 0f75054261 Bug 2022763 - Propagate owner global from input element to DOM files properly. r=dom-core,win-reviewers,smaug,gstoll,devtools-reviewers,jdescottes
This required some refactoring of the MockFilePicker to test somewhat (ugh)
reliably, but hopefully an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D288166
2026-04-17 22:25:42 +00:00
Atila Butkovits ffcaa992e6 Revert "Bug 2022763 - Clean up existing usages of MockFilePicker.init(). r=dom-core,mtigley,extension-reviewers,credential-management-reviewers,devtools-reviewers,omc-reviewers,migration-reviewers,profiles-reviewers,layout-reviewers,emz,fchasen,nchevobbe,mconley,smaug,mossop,robwu,hanna_a,jwatt" for causing multiple failures.
This reverts commit 85b2d0d3dd.

Revert "Bug 2022763 - Propagate owner global from input element to DOM files properly. r=dom-core,win-reviewers,smaug,gstoll"

This reverts commit ff40c521b2.
2026-04-17 10:52:18 +00:00
Emilio Cobos Álvarez ff40c521b2 Bug 2022763 - Propagate owner global from input element to DOM files properly. r=dom-core,win-reviewers,smaug,gstoll
This required some refactoring of the MockFilePicker to test somewhat (ugh)
reliably, but hopefully an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D288166
2026-04-17 09:07:32 +00:00
Leo Tenenbaum 676c2c091f Bug 2026562 - Still fire change event if value is set while changing non-focused input. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D291312
2026-04-08 14:27:26 +00:00
Olli Pettay 7e86186e65 Bug 2026292 - don't call accessibility service unnecessarily, r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D289978
2026-03-31 10:48:08 +00:00
André Bargull 96d966818f Bug 2027644 - Part 3: Add TimeClip with int64 input. r=iain
This avoids calling `std::trunc` through `JS::ToInteger` in `JS::TimeClip`.

Differential Revision: https://phabricator.services.mozilla.com/D290824
2026-03-31 09:38:39 +00:00
Emilio Cobos Álvarez 5016086e1a Bug 2025089 - Remove some includes from nsINode.h and Element.h. r=dom-core,dom-storage-reviewers,firefox-svg-reviewers,janv,smaug
Differential Revision: https://phabricator.services.mozilla.com/D289049
2026-03-22 23:45:55 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Emilio Cobos Álvarez 83e04fa374 Bug 2021468 - Remove an invalid assert. r=hsivonen
Since bug 2017711, this code is called from frame construction for text
inputs. There's no guarantee that DoneCreatingElement has been called
yet.

Differential Revision: https://phabricator.services.mozilla.com/D286739
2026-03-10 14:04:40 +00:00
Leo Tenenbaum 50cd3dc7b5 Bug 1691435 - Fire change event when value is set to pre-focus value and back. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D282219
2026-03-09 14:03:15 +00:00
tushar sariyaandEmilio Cobos Álvarez 4429f242e5 Bug 928224 - When HandlingTypeChanges from/to Text to Password re-use input state and set or unset the NS_MAYBE_MASKED flag. r=masayuki,layout-reviewers
Co-authored-by: Emilio Cobos Álvarez <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D285372
2026-03-06 09:54:36 +00:00
Leo Tenenbaum d3de671f72 Bug 2019750 - Fix quadratic behavior in HTMLInputElement::RadioSetChecked. r=avandolder
Differential Revision: https://phabricator.services.mozilla.com/D285117
2026-03-04 14:17:25 +00:00
Emilio Cobos Álvarez bdf597210e Bug 2020681 - More clean-ups after bug 2020358. r=masayuki,dom-core
Move more text editor handling to the DOM, and remove more dead layout
code.

We need to move NeedToInitializeEditorForEvent down to
TextControlElement since the eager initialization of textarea was
papering over stuff.

The change needed in test_bug300691-1.html is a progression, I think.
Plain focus() generally puts the caret at the start rather than the end.

Differential Revision: https://phabricator.services.mozilla.com/D285755
2026-03-04 13:35:53 +00:00
Andreea Silaghi 90af8fd3d4 Revert "Bug 2020681 - More clean-ups after bug 2020358. r=masayuki,dom-core" for causing mochitest failures
This reverts commit 5a2bd42ae8.
2026-03-04 10:27:55 +00:00
Emilio Cobos Álvarez 5a2bd42ae8 Bug 2020681 - More clean-ups after bug 2020358. r=masayuki,dom-core
Move more text editor handling to the DOM, and remove more dead layout
code.

We need to move NeedToInitializeEditorForEvent down to
TextControlElement since the eager initialization of textarea was
papering over stuff.

The change needed in test_bug300691-1.html is a progression, I think.
Plain focus() generally puts the caret at the start rather than the end.

Differential Revision: https://phabricator.services.mozilla.com/D285755
2026-03-04 08:32:38 +00:00
Emilio Cobos Álvarez 8654928b61 Bug 2020358 - Untangle TextEditor from nsTextControlFrame a bit. r=masayuki,dom-core
After bug 2016280, there should be no need for TextControlState to
depend so much on layout.

Differential Revision: https://phabricator.services.mozilla.com/D285510
2026-03-03 09:16:10 +00:00
Leo Tenenbaum ca829b4947 Bug 1933351 - Give null valueAsDate for datetime-local inputs, as spec requires. r=dom-core,avandolder
Differential Revision: https://phabricator.services.mozilla.com/D284545
2026-03-02 22:00:49 +00:00
Leo Tenenbaum fb9fe69a69 Bug 2014584 - Don't localize input min/max attributes. r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D283728
2026-02-26 22:12:27 +00:00
Cosmin Sabou dac4949952 Revert "Bug 928224 - Don't always reset input TextControlState when type is changed. r=dom-core,masayuki" for causing crashes @nsPresContext::GetPresShel.
This reverts commit 166a643d18.
2026-02-20 04:36:24 +00:00
Leo Tenenbaum 166a643d18 Bug 928224 - Don't always reset input TextControlState when type is changed. r=dom-core,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D282182
2026-02-20 03:53:12 +00:00
Emilio Cobos Álvarez 51b0a19aaa Bug 2017711 - Create <input> shadow tree lazily from frame construction. r=masayuki,dom-core
Speedometer3's TodoMVC-jQuery hits basically the worst case of my
change, which is creating a hidden text input per row. That causes tons
of extra time spent in BindToTree and so on because we now create the
shadow tree for all of those. It is specially bad because the shadow
tree is particularly expensive (see bug 2017005).

For now, keep creating the <input> shadow tree lazily from layout, but
with a key difference: Once created, we keep it around.

This should still allow us to fix the reframing issues linked from
bug 2016280 and hopefully won't be too painful. It is a bit annoying
that TextControlElement can't rely on the shadow tree existing, but that
seems ok...

Of course preferred outcome is to make shadow trees less costly. Most of
the cost is still allocation of the slots, afaict from the profiles.

Differential Revision: https://phabricator.services.mozilla.com/D284039
2026-02-19 20:40:48 +00:00
Emilio Cobos Álvarez 7094193e48 Bug 2016280 - Defer shadow tree set-up until DoneCreatingElement(). r=dom-core,smaug
Otherwise we eagerly create a shadow root for HTML inputs created by the
parser even if they end up not needing one.

This shows up in speedometer. But also, should we maybe make the parser
bind the element after setting the attributes rather than before?

Differential Revision: https://phabricator.services.mozilla.com/D283423
2026-02-17 09:53:04 +00:00
Emilio Cobos Álvarez 5624defbfd Bug 2016280 - Use shadow DOM for editor. r=masayuki,dom-core,smaug,Jamie
There's still a ton of things that can be cleaned up after this, but
this setup is nicer.

For now, editor keeps getting set-up / torn down on BindToFrame. Seems
all that could be untangled, but step by step.

The preview stuff and placeholder can just be created on demand now,
rather than requiring frame reconstruction.

Also, nsSearchControlFrame and co no longer do anything of interest, so
move the still relevant bits elsewhere and remove them.

test_bug1248459.html is removed because it messes with the editor
selection using SpecialPowers, in a way such that it crosses shadow
boundaries, and messes up the selected state triggering debug asserts.

test_focus_docnav.xhtml now triggers a different code-path because of
the shadow root (rather than the frame tree traversal). Keep it working
for now by replacing it with something that isn't a shadow root.

Differential Revision: https://phabricator.services.mozilla.com/D282953
2026-02-17 09:53:01 +00:00
Emilio Cobos Álvarez cced10961b Bug 2016950 - PrototypeDocumentContentSink should use FROM_PARSER_NETWORK for non-XUL elements too. r=smaug
It uses DoneAddingChildren / DoneCreatingElement, and nsXULElement also
does this.

Otherwise we can get into weird situations because the consumers might
not expect this.

We have some tests for parser-specific behavior like restoration in
test_prototype_document.xhtml

Differential Revision: https://phabricator.services.mozilla.com/D283432
2026-02-15 19:39:49 +00:00
agoloman da8cbbbcbf Revert "Bug 2016950 - PrototypeDocumentContentSink should use FROM_PARSER_NETWORK for non-XUL elements too. r=smaug" for causing multiple failures.
This reverts commit 4ceb7c55a1.
2026-02-15 00:35:03 +00:00
Emilio Cobos Álvarez 4ceb7c55a1 Bug 2016950 - PrototypeDocumentContentSink should use FROM_PARSER_NETWORK for non-XUL elements too. r=smaug
It uses DoneAddingChildren / DoneCreatingElement, and nsXULElement also
does this.

Otherwise we can get into weird situations because the consumers might
not expect this.

We have some tests for parser-specific behavior like restoration in
test_prototype_document.xhtml

Differential Revision: https://phabricator.services.mozilla.com/D283432
2026-02-15 00:09:26 +00:00
serge-sans-paille 314b019211 Bug 2012139 - #undef macro definitions shared across CU when FILES_PER_UNIFIED_FILE increases r=xpcom-reviewers,dom-core,smaug,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D280248
2026-01-27 09:22:50 +00:00
Kagami Sascha Rosylight 187cab0f1d Bug 2011240 - Pass sRGB value to the color picker r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D279544
2026-01-20 18:26:03 +00:00