Commit Graph

833 Commits

Author SHA1 Message Date
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
keithamus
7f87d7a0b3 Bug 1857887 - Add invoketarget & invoketarget action attributes r=smaug
This adds support for the experimental `invoketarget` and `invokeaction`
attributes, as specified in the open-ui "Invokers" explainer.

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

The `invoketarget` attribute maps to the IDL `invokeTargetElement`,
similar to `popoverTargetElement`, and the `invokeaction` is a freeform
string.

The Button behaviour checks for `invokeTargetElement` in its activation
behaviour, and dispatches an `InvokeEvent` if there is one.

This also adds some basic scaffolding for `handleInvokeInternal` which
will allow elements to provide their own invocation action algorithms.

Differential Revision: https://phabricator.services.mozilla.com/D190449
2023-11-08 13:41:51 +00:00
Vincent Hilla
65acb7d75a Bug 1855633 - Part 2: Activation behavior method for button element. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D183989
2023-10-30 09:39:27 +00:00
Vincent Hilla
52cf75c910 Bug 1855633 - Part 1: Use activation behavior for submit and image input type. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D187185
2023-10-30 09:39:26 +00:00
Emilio Cobos Álvarez
55403532ed Bug 1861346 - Update indeterminate state when getting added or removed from a radio group. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D191949
2023-10-27 15:30:45 +00:00
Emilio Cobos Álvarez
6a490c3721 Bug 1857506 - Localize final value if needed for input value setter. r=edgar
This restores pre-existing behavior, and adds tests.

Differential Revision: https://phabricator.services.mozilla.com/D190581
2023-10-10 15:12:10 +00:00
Jan Varga
272327b326 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Adam Vandolder
a1cf2d6b5d Bug 1685926 - Group disconnected radio buttons together. r=saschanaz,smaug
Differential Revision: https://phabricator.services.mozilla.com/D162349
2023-09-28 15:47:11 +00:00
Natalia Csoregi
51f7d1bb14 Backed out changeset 8f8492410799 (bug 1685926) for causing bustage on SVGAnimatedPathSegList.cpp. CLOSED TREE 2023-09-28 10:40:31 +03:00
Adam Vandolder
aee8834b7a Bug 1685926 - Group disconnected radio buttons together. r=saschanaz,smaug
Differential Revision: https://phabricator.services.mozilla.com/D162349
2023-09-28 06:35:44 +00:00
Cristian Tuns
f84b646496 Backed out changeset 37ade77d181e (bug 1685926) for causing build bustages in PerformanceEventTiming.cpp CLOSED TREE 2023-09-25 12:40:22 -04:00
Adam Vandolder
305c6a88bf Bug 1685926 - Group disconnected radio buttons together. r=saschanaz,smaug
Differential Revision: https://phabricator.services.mozilla.com/D162349
2023-09-25 14:39:08 +00:00
Vincent Hilla
f8db99493d Bug 1658996 - Part 2: Activation behavior method for non-form submission input elements. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D183988
2023-09-07 09:33:51 +00:00
Emilio Cobos Álvarez
6fd5ddc656 Bug 1850238 - Make BROKEN state non-intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D187108
2023-08-31 09:20:40 +00:00
Cristina Horotan
c37791a4a6 Backed out 3 changesets (bug 1850238, bug 1850161) for causing multiple failures at Element.cpp CLOSED TREE
Backed out changeset 30526c800ca7 (bug 1850161)
Backed out changeset ebc81e5e7750 (bug 1850161)
Backed out changeset e66a62c2f8c5 (bug 1850238)
2023-08-31 12:12:05 +03:00
Emilio Cobos Álvarez
01b6773528 Bug 1850238 - Make BROKEN state non-intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D187108
2023-08-31 07:46:24 +00:00
Olli Pettay
e4e84c6564 Bug 1834002 - Avoid InvalidateFrameSubtree in HTMLInputElement::SetCheckedInternal, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D187103
2023-08-30 23:16:51 +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
127accb890 Bug 1850293 - Make indeterminate state non-intrinsic. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D187015
2023-08-30 09:18:32 +00:00
Emilio Cobos Álvarez
ff4402054b Bug 1850293 - Make in-range/out-of-range states non-intrinsic. r=smaug
These only apply to input, so it's rather trivial-ish.

Differential Revision: https://phabricator.services.mozilla.com/D186960
2023-08-30 09:18:32 +00:00
Emilio Cobos Álvarez
76e9b5e83c Bug 1850293 - Make CHECKED/DEFAULT states not intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D186933
2023-08-30 09:18:31 +00:00
Emilio Cobos Álvarez
3e9e56e2c8 Bug 1850293 - Make editable states not intrinsic. r=smaug,masayuki
This one is tricky because form controls, though I think I got it right...

This fixes a pre-existing bug where we're not following the spec for readonly
inside content-editable.

I filed this as bug 1850390 but other browsers match the spec so add a test and
fix it while at it. This allows cheaper checks for readonlyness in a couple
places.

Differential Revision: https://phabricator.services.mozilla.com/D186896
2023-08-30 09:18:31 +00:00
Emilio Cobos Álvarez
a6642d0eb9 Bug 1850293 - Make PLACEHOLDER_SHOWN not an intrinsic state. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D186932
2023-08-29 00:32:41 +00:00
Markus Stange
70bd936589 Bug 1843484 - Use EventTarget* instead of nsISupports* for the event target parameter of the nsContentUtils::Dispatch methods. r=smaug
This saves a few queryInterface calls on the hot path.

Differential Revision: https://phabricator.services.mozilla.com/D186976
2023-08-28 23:38:42 +00:00
serge-sans-paille
1a0259bae5 Bug 1845441 - get rid of global constructors in dom/html/HTMLInputElement.cpp r=mstange,dom-core,mccr8
This requires to make existing Decimal constructor constexpr, which is
incompatible with the weak linkage implied by MFBT_API.

As an alternative, provide a constexpr user-defined-literal that creates
a temporary DecimalLiteral that can be used by a new Decimal constexpr
constructor.

Differential Revision: https://phabricator.services.mozilla.com/D184552
2023-08-23 07:51:44 +00:00
Olli Pettay
22262b6f58 Bug 1843473 - Don't dispatch DOMActivate if there are no listeners for it, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D186473
2023-08-18 06:01:16 +00:00
Masayuki Nakano
33c777c972 Bug 1266437 - Drop "OS" modifier r=smaug,m_kato,karlt,Gijs
On Windows, Windows logo key was mapped to "OS" modifier, and on Linux,
it's same and the key is called "Super" and "Hyper".  That conformed to the
older UI Events spec.

However, UI Events declares that they should be mapped to "Meta" now and Chrome
handles it as the spec in Windows and Linux.  Therefore, we should align the
behavior to them.

Note that we've treated the legacy "Meta" modifier on Linux as DOM "Meta"
modifier state, and we'll keep this as-is because in Sun/Solaris keyboard
layout, they keys are mapped to the legacy "Meta".

Finally, the following check only `IsMeta()` but not `IsOS()`.  I think that
they should've checked `IsOS()` too.  Therefore, they will behave differently
in Windows and Linux.
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/base/Element.cpp#3287-3288
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3762-3764
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3796-3806
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLLabelElement.cpp#127-128
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/widget/gtk/nsGtkKeyUtils.cpp#1461-1462

Note that `KEY_NAME_INDEX_OS` will be removed in the patch for bug 1232918.

Differential Revision: https://phabricator.services.mozilla.com/D183480
2023-08-07 01:03:58 +00:00
Cristian Tuns
02ef83ec78 Backed out 2 changesets (bug 1266437, bug 1232918) for causing mochitest failures in test_autoplay_policy_key_blacklist.html CLOSED TREE
Backed out changeset 33e3c6593d4b (bug 1232918)
Backed out changeset 1b56e99dd221 (bug 1266437)
2023-08-03 23:29:52 -04:00
Masayuki Nakano
861dcd8b88 Bug 1266437 - Drop "OS" modifier r=smaug,m_kato,karlt,Gijs
On Windows, Windows logo key was mapped to "OS" modifier, and on Linux,
it's same and the key is called "Super" and "Hyper".  That conformed to the
older UI Events spec.

However, UI Events declares that they should be mapped to "Meta" now and Chrome
handles it as the spec in Windows and Linux.  Therefore, we should align the
behavior to them.

Note that we've treated the legacy "Meta" modifier on Linux as DOM "Meta"
modifier state, and we'll keep this as-is because in Sun/Solaris keyboard
layout, they keys are mapped to the legacy "Meta".

Finally, the following check only `IsMeta()` but not `IsOS()`.  I think that
they should've checked `IsOS()` too.  Therefore, they will behave differently
in Windows and Linux.
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/base/Element.cpp#3287-3288
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3762-3764
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3796-3806
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLLabelElement.cpp#127-128
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/widget/gtk/nsGtkKeyUtils.cpp#1461-1462

Note that `KEY_NAME_INDEX_OS` will be removed in the patch for bug 1232918.

Differential Revision: https://phabricator.services.mozilla.com/D183480
2023-08-04 00:10:11 +00:00
Peter Van der Beken
c10814e75a Bug 1846277 - Remove nsGlobalWindow.h. r=dom-core,necko-reviewers,jesup,farre
Differential Revision: https://phabricator.services.mozilla.com/D184973
2023-08-02 20:41:48 +00:00
Noemi Erli
4ee6215ff8 Backed out changeset 3eba249fac11 (bug 1845441) for causing build bustages in Decimal.h 2023-07-27 18:08:11 +03:00
serge-sans-paille
6998fd5bb6 Bug 1845441 - get rid of global constructors in dom/html/HTMLInputElement.cpp r=mstange,dom-core,mccr8
This requires to make Decimal constructor constexpr.

Differential Revision: https://phabricator.services.mozilla.com/D184552
2023-07-27 11:40:18 +00:00
avandolder
0e0c518803 Bug 1839572 - Fix number input value sanitization. r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D183055
2023-07-19 14:57:11 +00:00
Cassio Neri
511958415f Bug 1828326 - Tenfold performance improvement of date calculations. r=anba,emilio,smaug
The original implementations contain unnecessary branches and operate on
double values. The new implementations, based on [1], are branch free on
x86_64 and mostly use integer arithmetic.

All tests pass and, in addition, [2] contains an exhaustive test that checks
all required dates, that is, in [-8.64e15 / msPerDay, 8.64e15 / msPerDay]
(as per ES5 15.9.1.1).

[1] Neri C, Schneider L., "Euclidean affine functions and their
application to calendar algorithms."
Softw Pract Exper. 2023;53(4):937-970. doi: 10.1002/spe.3172
https://onlinelibrary.wiley.com/doi/full/10.1002/spe.3172

[2] https://godbolt.org/z/oPvxzY6vx

Differential Revision: https://phabricator.services.mozilla.com/D175569
2023-07-19 09:45:16 +00:00
Gregory Pappas
853e673a0f Bug 1842974 - Remove dom.dialog_element.enabled pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183711
2023-07-17 10:02:53 +00:00
Emilio Cobos Álvarez
e7d711fad5 Bug 1842027 - Don't localize <input type=number>'s default value unless for display. r=masayuki
This avoids a lot of useless time on things like GetValueAsDecimal(),
where we get the default value as a string, parse it as a number for
sanitization reasons, localize it to a string, just to parse it back to
a number.

Differential Revision: https://phabricator.services.mozilla.com/D183284
2023-07-12 16:55:36 +00:00
Emilio Cobos Álvarez
35a7e91f1f Bug 1842027 - Make <input type=number> localization faster. r=masayuki
Using the fast unlocalized parser first exposes a subtle difference
between the ICU parser (which uses `double`), and Decimal::fromString
(which has a larger range).

Check for iee754 finiteness explicitly, matching our previous behavior,
and the expectation of this subtest:

  https://searchfox.org/mozilla-central/rev/a3852ea8db25c759bc8b108aeec870d66c95452c/testing/web-platform/tests/html/semantics/forms/the-input-element/number.html#33

That check matches this Blink code:

  https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:third_party/blink/renderer/core/html/parser/html_parser_idioms.cc;l=103;drc=0d1bbe8de137aaae7c956a33249eb840a0191627

This patch avoids a bunch of number->string->number conversions in the
common case where the value comes from the value attribute and thus
parses fine without localization shenanigans.

Differential Revision: https://phabricator.services.mozilla.com/D183254
2023-07-12 15:28:07 +00:00
Emilio Cobos Álvarez
8511de0242 Bug 1842027 - Remove nsTextControlFrame::TextEquals. r=masayuki
It is always called from TextControlState, and always ends up in
TextControlState::ValueEquals, so we can avoid some indirection and just
use that.

Depends on D183282

Differential Revision: https://phabricator.services.mozilla.com/D183283
2023-07-12 08:58:09 +00:00
Emilio Cobos Álvarez
072c9af992 Bug 1842027 - Remove always-true aIgnoreWrap parameter from TextControlElement::GetTextEditorValue. r=masayuki
Depends on D183281

Differential Revision: https://phabricator.services.mozilla.com/D183282
2023-07-12 08:57:12 +00:00
Masayuki Nakano
38e75d9885 Bug 1839555 - Get rid of nsIFormControl::AllowDrop r=dom-core,peterv
It was introduced in bug 206859, but the `<input type="text">` in
`<input type="file">` was replaced with `<label>` in bug 345195.
Additionally, it's used only by `EditorBase` to check `<input type="text">`
is in `<input type="file">`.  Therefore, we don't need it anymore.

Differential Revision: https://phabricator.services.mozilla.com/D181599
2023-06-24 00:58:44 +00:00
Emilio Cobos Álvarez
529c9ee321 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01: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
103838fdea Bug 1838219 - Notify of user activation after <input type=file/color> picking. r=edgar
This allows opening popups after this.

Differential Revision: https://phabricator.services.mozilla.com/D180827
2023-06-13 16:36:37 +00:00
Vincent Hilla
366864bd8a Bug 675943 - Part 3: Clean up after implementing dirname. r=edgar
Depends on D178164

Differential Revision: https://phabricator.services.mozilla.com/D178278
2023-06-06 07:51:37 +00:00
Vincent Hilla
a5e211120c Bug 675943 - Part 1: Implement dirname attr for input elements within forms. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D175626
2023-06-06 07:51:36 +00:00
Emilio Cobos Álvarez
9ba33a8798 Bug 1835437 - Be consistent about value sanitization in HTMLInputElement::SetDirectionFromValue. r=smaug
aKnownValue is unsanitized, but GetValue is sanitized. Make sure they
match.

Differential Revision: https://phabricator.services.mozilla.com/D179790
2023-06-04 08:54:25 +00:00
Cosmin Sabou
f429c7dc71 Backed out 3 changesets (bug 675943) for causing wpt unexpected passes.
Backed out changeset 56d084bfc8b8 (bug 675943)
Backed out changeset 8f514549a81c (bug 675943)
Backed out changeset 33fabcece85d (bug 675943)
2023-05-24 14:43:06 +03:00
Vincent Hilla
f1572f7fbe Bug 675943 - Part 3: Clean up after implementing dirname. r=edgar
Depends on D178164

Differential Revision: https://phabricator.services.mozilla.com/D178278
2023-05-24 08:04:52 +00:00