Commit Graph
142 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
Jan-Niklas Jaeschke 03b7ff43b3 Bug 2038588 - Customizable Select: Implement selectedcontent update machinery. r=emilio
Implements the algorithms that keep <selectedcontent> elements in sync with
the selected <option>: RunSelectednessSettingAlgorithm (replaces
CheckSelectSomething), ScheduleSelectedContentUpdate /
UpdateDescendantSelectedContentElements (microtask-based), per-element
CloneOptionIntoSelectedContent, and HTMLSelectedContentElement BindToTree
disabled computation per PR #12263.

Differential Revision: https://phabricator.services.mozilla.com/D290554
2026-06-03 19:06:11 +00:00
Alexandru Marc 244264d460 Revert (Bug 1974784, Bug 2038588) for causing wpt failures @ options-length-too-large.html
This reverts commit f8f9651896.

Revert "Bug 2038588 - Customizable Select: Implement selectedcontent update machinery. r=emilio"

This reverts commit 0d1eba0a10.
2026-06-02 15:29:25 +00:00
Jan-Niklas Jaeschke 0d1eba0a10 Bug 2038588 - Customizable Select: Implement selectedcontent update machinery. r=emilio
Implements the algorithms that keep <selectedcontent> elements in sync with
the selected <option>: RunSelectednessSettingAlgorithm (replaces
CheckSelectSomething), ScheduleSelectedContentUpdate /
UpdateDescendantSelectedContentElements (microtask-based), per-element
CloneOptionIntoSelectedContent, and HTMLSelectedContentElement BindToTree
disabled computation per PR #12263.

Differential Revision: https://phabricator.services.mozilla.com/D290554
2026-06-01 12:55:50 +00:00
Keith Cirkel cdaa222e55 Bug 2012698 - Part 2 - Introduce <button> slotting logic for <select> r=dom-core,jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D295335
2026-05-19 11:20:38 +00:00
Serban Stanca 7fa5be89eb Revert "Bug 2012698 - Part 3 - Introduce UA styles for button>select r=layout-reviewers,firefox-style-system-reviewers,dshin" for causing wpt failures in select-keyboard-behavior.optional.html.
This reverts commit 156e44f134.

This reverts commit 605aec697f.
2026-05-18 19:09:54 +00:00
Keith Cirkel 605aec697f Bug 2012698 - Part 2 - Introduce <button> slotting logic for <select> r=dom-core,jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D295335
2026-05-18 14:31:22 +00:00
agoloman 26bd847339 Revert "Bug 2012698 - Part 3 - Introduce UA styles for button>select r=layout-reviewers,firefox-style-system-reviewers,dshin" for causing reftest failures @combobox-zoom.html.
This reverts commit e4e3c6dc79.

Revert "Bug 2012698 - Part 2 - Introducing `<button>` slotting logic for `<select>` r=dom-core,jjaschke"

This reverts commit 7350d4683b.
2026-05-05 20:59:12 +00:00
Keith Cirkel 7350d4683b Bug 2012698 - Part 2 - Introducing <button> slotting logic for <select> r=dom-core,jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D295335
2026-05-05 19:31:04 +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
Emilio Cobos Álvarez b9a0d71900 Bug 2034055 - Make HTMLOptionsCollection use nsContentList. r=dom-core,smaug
Make nsIHTMLCollection the first base for nsContentList and co, since
it's needed for WebIDL bindings to work properly and shouldn't change
behavior in practice.

Move the handling of selected option and validity to HTMLSelectElement's
mutation observer.

Differential Revision: https://phabricator.services.mozilla.com/D295818
2026-04-28 07:38:24 +00:00
agoloman 8d40053465 Revert "Bug 2034055 - Make HTMLOptionsCollection use nsContentList. r=dom-core,smaug" for causing failures @nsContentList.cpp.
This reverts commit fd37a5a8cb.
2026-04-28 06:17:53 +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 fd37a5a8cb Bug 2034055 - Make HTMLOptionsCollection use nsContentList. r=dom-core,smaug
Make nsIHTMLCollection the first base for nsContentList and co, since
it's needed for WebIDL bindings to work properly and shouldn't change
behavior in practice.

Move the handling of selected option and validity to HTMLSelectElement's
mutation observer.

Differential Revision: https://phabricator.services.mozilla.com/D295818
2026-04-27 23:07:56 +00:00
Emilio Cobos Álvarez fe182cca64 Bug 2025271 - Simplify DOMString. r=smaug,nika,extension-reviewers,core-sessionstore-reviewers,dom-worker-reviewers,robwu,asuth
Make DOMString a regular nsAutoTString with some special methods for
performance in some hot getters. For that, we need to change a bit
nsTString:

 * Support for unowned buffers: Owned buffers now are represented by
   STRINGBUFFER|OWNED flags, rather than REFCOUNTED.

 * Inlining of the destructor: It showed up in profiles, it's also just
   a few instructions, so probably worth it. We could OOL the owned path
   I guess, if we wanted to.

 * Inlinling and reordering of NonVoidStringToJsval. Old code had
   special DOMString path inline with [buffer, literal, copy] paths,
   then out of line code with [literal, buffer, copy]. Instead,
   consolidate everything in a [buffer, literal, copy] inline path.
   Do the same for UTF8/Latin1 strings too for consistency.

Differential Revision: https://phabricator.services.mozilla.com/D288148
2026-04-13 09:33:54 +00:00
Emilio Cobos Álvarez 9998e4c779 Bug 2023453 - Remove HTMLSelectEventListener. r=dom-core,keithamus
This will allow events to get handled with customizable select.

HasPrimaryAction for listboxes needs to be overridden since before it
was returning true because of the listener:

  https://searchfox.org/firefox-main/rev/7b08fa00f500ed877b16983a6a77d2c852aad1d0/accessible/generic/LocalAccessible.cpp#3433-3435

Without that, we fail
devtools/server/tests/browser/browser_accessibility_keyboard_audit.js

Differential Revision: https://phabricator.services.mozilla.com/D287830
2026-03-26 13:29:14 +00:00
Emilio Cobos Álvarez 540e192403 Bug 2025402. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D289495
2026-03-26 12:28:34 +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 51daf85573 Bug 2018033 - Attach <select> shadow DOM on bind. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D284184
2026-02-25 02:06:55 +00:00
Emilio Cobos Álvarez 3271cb4e57 Bug 2013887 - Remove nsISelectControlFrame. r=layout-reviewers,jfkthame
After bug 2011709, there's only one implementation of this.

Differential Revision: https://phabricator.services.mozilla.com/D281453
2026-02-04 12:00:31 +00:00
Emilio Cobos Álvarez 4021464773 Bug 2011709 - Make combobox select use a shadow tree for its contents. r=jjaschke,layout-reviewers,firefox-style-system-reviewers,accessibility-platform-reviewers,smaug,Jamie,jfkthame,dshin
For now, replicate the label + icon structure.

Use pseudo-elements for them. We could use select.css instead, but we
need a way to to prevent the display fix-up from applying (this is
needed because otherwise <select style=display:flex> starts getting the
label and button on different lines), and pseudo-elements is easier.

Use a <span> for the icon since we basically otherwise have a hidden,
unfocusable button and it simplifies the styling that way.

Use the same for the input file content since it simplifies the logic on
the frame constructor.

nsListControlFrame gets some clean-up as well since I was trying to make
sense of nsISelectFrame, but I could split that out if needed.

Tests for bug 323656 fail now because it tests explicit inheritance from
the <select> to the <option>, and now that goes through a <slot>.

Other elements have the same issue, see
https://github.com/whatwg/html/issues/3748. So for now remove those
tests.

Differential Revision: https://phabricator.services.mozilla.com/D280041
2026-02-03 14:33:36 +00:00
Masayuki Nakano b2e5258254 Bug 769207 - part 5: Make Element::GetAttributeChangeHit() use AttrModType r=smaug,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D263056
2025-09-08 00:27:48 +00:00
Frédéric Wang 1f81a41d25 Bug 1928932 - Part 3 - Transmit proper MutationEffectOnScript to mutation observers. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D253633
2025-09-02 20:04:43 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Olli Pettay 0b460dc40d Bug 1923880, ParentNode.moveBefore(), r=edgar,emilio
iframe tests neeeded tweak because the changes for about:blank haven't landed quite yet.
Render blocking and such aren't supported, so the .ini files are still there.
Selection test seemed to be very chromium specific.

Differential Revision: https://phabricator.services.mozilla.com/D255463
2025-07-21 16:33:44 +00:00
iulian moraru d9d5a440a7 Revert "Bug 1923880, ParentNode.moveBefore(), r=edgar,emilio" for causing non-unified build bustages on nsGenericHTMLFrameElement.cpp.
This reverts commit feac8d52fc.
2025-07-21 10:49:53 +00:00
Olli Pettay feac8d52fc Bug 1923880, ParentNode.moveBefore(), r=edgar,emilio
iframe tests neeeded tweak because the changes for about:blank haven't landed quite yet.
Render blocking and such aren't supported, so the .ini files are still there.
Selection test seemed to be very chromium specific.

Differential Revision: https://phabricator.services.mozilla.com/D255463
2025-07-21 09:37:38 +00:00
Edgar Chen e63758d5b1 Bug 1960003 - Stop including UnionTypes.h from some headers; r=saschanaz,core-sessionstore-reviewers,farre
Differential Revision: https://phabricator.services.mozilla.com/D245261
2025-06-07 21:01:07 +00:00
Jonathan Kew 6d25ae0f09 Bug 1936113 - Hook up :open to details, select, dialog, and input elements. r=webidl,emilio
Most of these elements are simple to support.

One slightly tricky item was <input type=date>, as testing indicates that the
front-end code usually (consistently?) hides the picker using setPickerState(),
which does not end up calling closeDateTimePicker() as might be expected.
So to properly track the open/closed state, I had to add a SetDateTimePickerState
webidl method, rather than just patching into the existing Open/Close calls.

Differential Revision: https://phabricator.services.mozilla.com/D234093
2025-01-17 13:49:56 +00:00
Butkovits Atila 530d9d432d Backed out 5 changesets (bug 1936113) for causing failures at select-inside-top-layer.tentative.html. CLOSED TREE
Backed out changeset 2b07b9e7bf57 (bug 1936113)
Backed out changeset a88e93dff614 (bug 1936113)
Backed out changeset 9cfc0a675a42 (bug 1936113)
Backed out changeset 716bdadbea2a (bug 1936113)
Backed out changeset 4ee0855e448f (bug 1936113)
2025-01-17 12:34:24 +02:00
Jonathan Kew a4d8e36aff Bug 1936113 - Hook up :open to details, select, dialog, and input elements. r=webidl,emilio
Most of these elements are simple to support.

One slightly tricky item was <input type=date>, as testing indicates that the
front-end code usually (consistently?) hides the picker using setPickerState(),
which does not end up calling closeDateTimePicker() as might be expected.
So to properly track the open/closed state, I had to add a SetDateTimePickerState
webidl method, rather than just patching into the existing Open/Close calls.

Differential Revision: https://phabricator.services.mozilla.com/D234093
2025-01-17 09:17:28 +00:00
Emilio Cobos Álvarez 3c1b64acfe Bug 1940412 - Add batch removal information to nsIMutationObserver::ContentWillBeRemoved, and use it in some trivial-ish places. r=dom-core,credential-management-reviewers,sefeng
The idea is to use it on the style (via PresShell->RestyleManager) to do
invalidation faster in cases like bug 1940405.

Differential Revision: https://phabricator.services.mozilla.com/D233547
2025-01-15 20:39:40 +00:00
Neil Deakin e9102d05aa Bug 1849122, allowing getting and modifying the autofill state directly within the input and select elements, and reset this state when its value changes, r=webidl,emilio
Resetting the state when the value is modified is bug 1359355.

Differential Revision: https://phabricator.services.mozilla.com/D210999
2024-05-28 23:39:59 +00:00
Emilio Cobos Álvarez bf22d33f87 Bug 1895208 - Refactor IsFocusable checks to take flags rather than bool arguments. r=smaug
This doesn't change behavior on its own, but it's likely we want to make
the tab focusability more complicated in bug 1895184, and this will make
changes to this area less painful.

Differential Revision: https://phabricator.services.mozilla.com/D209525
2024-05-06 21:54:37 +00:00
Emilio Cobos Álvarez 7506fc5879 Bug 1881011 - Refactor UnbindFromTree to take a context argument. r=smaug
Much like BindToTree.

This will be useful because I need to pass more information through
UnbindFromTree() to speed up dir=auto for bug 1874040.

Differential Revision: https://phabricator.services.mozilla.com/D202215
2024-02-20 15:05:40 +00:00
Emilio Cobos Álvarez b9aedffc24 Bug 1850295 - Update :user-{valid,invalid} to follow the spec. r=smaug
(Modulo open spec issues linked in comments)

Differential Revision: https://phabricator.services.mozilla.com/D196986
2024-01-16 11:09:01 +00:00
Sandor Molnar 0c4309d7be Backed out changeset 4c7dab5cb50c (bug 1864291) for causing multiple failures on test_input_color_picker_popup.html / forms/browser_selectpopup_invoke.js CLOSED TREE 2023-11-15 19:44:05 +02:00
Luke Warlow 66a5b77a67 Bug 1864291 - Implements HandleInvokeInternal for select and input elements. r=smaug
Implements invoketarget defaults for select and input element, as specified in the open-ui "Invokers explainer".

(https://open-ui.org/components/invokers.explainer/)

Differential Revision: https://phabricator.services.mozilla.com/D193363
2023-11-15 14:20:48 +00:00
Tom Schuster eddd9e00c1 Bug 1854112 - Add showPicker method to <select> elements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D189675
2023-10-31 09:36:16 +00:00
Emilio Cobos Álvarez 72f00fc947 Bug 1850293 - Make validity states non-intrinsic. r=smaug
Add a RAII helper to notify of multiple state changes together for
these.

The UpdateState CustomElementInternals calls that are getting removed
are unnecessary (the state should be up-to-date by then, there's nothing
changing there particularly).

Same for the call in nsGenericHTMLFormElement::UnbindFromTree. ClearForm
already does an state update.

Differential Revision: https://phabricator.services.mozilla.com/D187033
2023-08-30 09:18:32 +00:00
Emilio Cobos Álvarez a1007b18c6 Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 17:22:03 +00:00
Cristian Tuns f54a728824 Backed out changeset a3e55d5f9f13 (bug 1839223) for causing multiple failures in Document.cpp CLOSED TREE 2023-06-22 11:34:15 -04:00
Emilio Cobos Álvarez a28183ac0e Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 14:31:16 +00:00
Emilio Cobos Álvarez a64126ae9c Bug 1837382 - Remove nsIContent::IsDoneAddingChildren. r=smaug
It's only called once for a place where it knows it's a select element.

Differential Revision: https://phabricator.services.mozilla.com/D180312
2023-06-08 14:59:31 +00:00
Emilio Cobos Álvarez c1c1e7460b Bug 1829225 - Make BeforeSetAttr take the parsed nsAttrValue. r=smaug
ParseAttribute ideally would be const (see bug 1829138), but the SVG and
SMIL code is rather messy. Still, now that BeforeSetAttr can't really
fail, swapping the order of ParseAttribute and BeforeSetAttr shouldn't
really change behavior.

Sorry for the extra `virtual` keyword removal and such. I had to do this
one by hand unlike the dependent bugs, and I went a bit drive-by, lmk if
you want me to split those changes.

Differential Revision: https://phabricator.services.mozilla.com/D176086
2023-04-21 09:25:17 +00:00
Emilio Cobos Álvarez ded1458b5b Bug 1829189 - Make OnAttrSetButNotChanged and AfterSetAttr infallible. r=smaug
Same rg + sed shenanigans as the first patch.

There were two that could fail, both due to OOM:

 * HTMLInputElement::AfterSetAttr: If we fail (only in the type=range
   case) we end up with an old value without it being clamped by
   min/max/step.

 * HTMLBodyElement::AfterSetAttr: If we fail we won't peek up the
   DocShell's frame margins and styling could be incorrect.

That seems better than having to deal with broken states after we've
already set the attribute.

Depends on D176069

Differential Revision: https://phabricator.services.mozilla.com/D176070
2023-04-21 08:56:27 +00:00
Emilio Cobos Álvarez c881eb2941 Bug 1829189 - Make BeforeSetAttr infallible. r=smaug
rg BeforeSetAttr -l | xargs sed -i 's/nsresult BeforeSetAttr/void BeforeSetAttr/g'
  rg ::BeforeSetAttr -l | xargs sed -i 's/nsresult \(.*\)::BeforeSetAttr/void \1::BeforeSetAttr/g'

Plus trivial fixes, plus clang-format.

The only meaningful changes are in nsXULElement::BeforeSetAttr. Two
things could fail:

chromemargin: I removed it because we don't use the parsed attribute any
other place than here:

  https://searchfox.org/mozilla-central/rev/31f5847a4494b3646edabbdd7ea39cb88509afe2/dom/xul/ChromeObserver.cpp#136

And that deals just fine with it not being parsed.

usercontextid: We have a debug assertion that we don't dynamically change it.
I kept it but I don't think it's worth failing to set the attribute on release for that

Differential Revision: https://phabricator.services.mozilla.com/D176069
2023-04-21 08:56:27 +00:00
Ben Freist a87769d277 Bug 1300405 - Fix insertion of already selected options r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D166955
2023-02-12 20:44:50 +00:00
Adam Vandolder 7e4e06967e Bug 1575154 - Add autofocus attribute to HTMLOrForeignElement. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D163753
2022-12-19 15:09:15 +00:00