Commit Graph

804 Commits

Author SHA1 Message Date
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
Vincent Hilla
7aea40ce2a Bug 675943 - Part 1: Implement dirname attr for input elements within forms. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D175626
2023-05-24 08:04:51 +00:00
Emilio Cobos Álvarez
49f19736eb Bug 1833477 - Make type attribute changes follow the spec more closely. r=smaug,masayuki
The issue here is that the SetValueInternal call made us go from empty
value to non-empty due to color's specialness of returning black always,
but since the value dirty flag wasn't set, the non-empty value actually
didn't make a difference and just confused the code.

Make the code follow the spec more closely, which fixes this (in
particular the SetDefaultValueAsValue call).

Also, remove some useless code in SetValueInternal() since callers end
up in OnValueChanged() effectively everywhere except when mDoneCreating
is false (in which case we can just wait until DoneCreatingElement calls
us again), and if the do not end up there then that's a bug to fix.

Differential Revision: https://phabricator.services.mozilla.com/D178706
2023-05-23 15:18:03 +00:00
Emilio Cobos Álvarez
aa1abbe381 Bug 1833181 - Avoid attr lookups to check whether input value is empty. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D178078
2023-05-15 17:16:41 +00:00
Emilio Cobos Álvarez
c18930d41f Bug 1833181 - Make SetValueChanged return void. r=smaug
Just a drive-by clean-up.

Differential Revision: https://phabricator.services.mozilla.com/D178077
2023-05-15 16:07:30 +00:00
Masayuki Nakano
68d5732829 Bug 1829570 - part 2: Add an overload of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176488
2023-05-15 01:07:29 +00:00
Adam Vandolder
ef24860971 Bug 1653625 - Make the submission from default action of a submit button also deferred. r=edgar
The submission from requestSubmit() call is non-deferred due to
mDeferSubmission
being cleared in HTMLFormElement::PostHandleEvent when handling a submit
event. The
mDeferSubmission clearing is also to make the submission from the default
action
of a submit button non-deferred.

This patch makes the submission from default action of a submit button
deferred
which could fix this bug, and also simplify the logic a bit.

Since gecko would also trigger submission for untrusted submit event,
see
bug 1370630, we need to handle that case specially.

Differential Revision: https://phabricator.services.mozilla.com/D170941
2023-05-12 23:11:28 +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
Butkovits Atila
2bb3961b6f Backed out 2 changesets (bug 1741469) for causing failures at test_bug1261674-1.html. CLOSED TREE
Backed out changeset b007c139e65c (bug 1741469)
Backed out changeset a75f2a426fa3 (bug 1741469)
2023-04-20 19:38:30 +03:00
Daniel Holbert
67c3942379 Bug 1741469 part 2: Add an off-by-default pref to control whether input type="number" fields are modified when mousewheel-scrolled. r=smaug
The C++ code change here is simply replacing an ifdef with a pref-check (and
associated reindentation for being placed in an "if"-block).

The pref is off-by-default for now, since no other browser seems to modify
these fields through mousewheel scrolling, and users seem to be surprised when
they encounter the behavior in Firefox.  See discussion on the bugzilla page.

Note: now that this behavior is controlled by a pref, we don't need to have
platform-specific #ifdefs and "skip-if" test exemptions. If we decide to bring
this behavior back on certain platforms, we can do so by simply changing the
default value of the pref on those platforms.

Differential Revision: https://phabricator.services.mozilla.com/D175719
2023-04-20 14:23:52 +00:00
Alexander Surkov
fc0dbbd93f Bug 1824374 - implement popover activation behavior, r=emilio
See https://html.spec.whatwg.org/#the-input-element:popover-target-attribute-activation-behavior

Differential Revision: https://phabricator.services.mozilla.com/D175485
2023-04-18 19:50:52 +00:00
Butkovits Atila
45f9b533bd Backed out changeset 241b4b54e654 (bug 1824374) for causing failures at popover-invoking-attribute.html. 2023-04-17 23:44:22 +03:00
Alexander Surkov
affc606a66 Bug 1824374 - implement popover activation behavior, r=emilio
See https://html.spec.whatwg.org/#the-input-element:popover-target-attribute-activation-behavior

Differential Revision: https://phabricator.services.mozilla.com/D175485
2023-04-17 18:10:13 +00:00
Cosmin Sabou
9f788e683a Backed out changeset d030d5dc991d (bug 1824374) for causing popover related wpt failures. 2023-04-15 20:05:46 +03:00
Alexander Surkov
e1328ec198 Bug 1824374 - implement popover activation behavior, r=emilio
See https://html.spec.whatwg.org/#the-input-element:popover-target-attribute-activation-behavior

Differential Revision: https://phabricator.services.mozilla.com/D175485
2023-04-15 13:55:51 +00:00
Masatoshi Kimura
b4394efbb8 Bug 1827771 - Clear the revealed state when input type is changed from password. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175516
2023-04-15 02:30:35 +00:00
Alexander Surkov
50bc93b884 Bug 1823757 - use parsed atoms for popovertarget attribute, r=emilio
Use parsed atoms to store popovertarget attributes as more effective mechanism to search for ID match in attr associated elements implementation. Followup from D173337.

Differential Revision: https://phabricator.services.mozilla.com/D174786
2023-04-11 18:35:51 +00:00
Olli Pettay
b1764a8410 Bug 1819769 - don't dispatch a11y related events when there are no listeners, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D175016
2023-04-11 09:24:21 +00:00
Natalia Csoregi
64f264b62e Backed out changeset 96da9dcee2b0 (bug 1823757) for causing failures on popover-invoking-attribute.html. CLOSED TREE 2023-04-11 09:43:08 +03:00
Alexander Surkov
be39f08c40 Bug 1823757 - use parsed atoms for popovertarget attribute, r=emilio
Use parsed atoms to store popovertarget attributes as more effective mechanism to search for ID match in attr associated elements implementation. Followup from D173337.

Differential Revision: https://phabricator.services.mozilla.com/D174786
2023-04-11 00:53:28 +00:00
Tom Schuster
2b97e58ebf Bug 1824323 - Open picker from datetimebox to get current date/time value. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173959
2023-03-29 19:18:41 +00:00
Emilio Cobos Álvarez
18811e46d5 Bug 1750072 - Allow to prevent password revealing/unrevealing. r=mtigley
The idea is that chrome code would be able to call preventDefault(),
then run primary password authentication when needed, then setRevealPassword
again.

Differential Revision: https://phabricator.services.mozilla.com/D173491
2023-03-27 23:30:33 +00:00
Andi-Bogdan Postelnicu
fccbbc6b44 Bug 1660405 - Move away from mozilla::IsFinite in favor of std::isfinite. r=sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173036
2023-03-22 11:35:33 +00:00
Andi-Bogdan Postelnicu
011e3fc2d9 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 11:35:33 +00:00
Stanca Serban
98c675ed3f Backed out 7 changesets (bug 1660405) for causing bustages on Linux x64 opt. CLOSED TREE
Backed out changeset ad1a5f59214f (bug 1660405)
Backed out changeset a39e95f0aafe (bug 1660405)
Backed out changeset 48629ee0d70d (bug 1660405)
Backed out changeset 8419b99aab60 (bug 1660405)
Backed out changeset 535cc12c8bed (bug 1660405)
Backed out changeset e27052da4927 (bug 1660405)
Backed out changeset 11b0f9cf8091 (bug 1660405)
2023-03-22 13:05:53 +02:00
Andi-Bogdan Postelnicu
2e64d79ba8 Bug 1660405 - Move away from mozilla::IsFinite in favor of std::isfinite. r=sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173036
2023-03-22 09:27:57 +00:00
Andi-Bogdan Postelnicu
5e0156c1e4 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 09:27:56 +00:00
Adam Vandolder
587ddbb864 Bug 1821569 - Align number input sanitization with the spec. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D172198
2023-03-13 18:37:30 +00:00