Commit graph

377 commits

Author SHA1 Message Date
Neil Deakin
1515db9b71 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
3b42787268 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
50eb344091 Bug 1893532 - Improve error message of HTMLInputElement.stepUp/stepDown. r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D208671
2024-05-01 00:11:33 +00:00
Emilio Cobos Álvarez
8925ee2d3d 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
Daniel Holbert
d6f406d8ba Bug 1873802: Make nsRangeFrame place the thumb at the minimum position if it happens to get reflowed before its element is done being created. r=emilio
Some context:
- Our HTML parser treats element creation, attribute-parsing, and
  "DoneCreatingElement"-calls as being separate operations, and it can yield
  between them.
- HTMLInputElement doesn't sanitize its values until DoneCreatingElement has
  been called, presumably sanitization itself depends on values (e.g. min/max)
  that might not have been parsed yet.
- So if the HTML parser yields at just the right point (before
  DoneCreatingElement), then we might generate and reflow a nsRangeFrame whose
  underlying values (on the element) haven't yet been sanitized.

This patch handles this situation by exposing a getter to tell us whether
DoneCreatingElement has been called.  If that getter returns false, we assume
that value-sanitization hasn't happened, and we disregard the element's
(presumed-to-be-unsanitized) numeric values when determining the
range's thumb-position.

Differential Revision: https://phabricator.services.mozilla.com/D198331
2024-01-16 17:38:30 +00:00
Emilio Cobos Álvarez
71838e2f11 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
Emilio Cobos Álvarez
72ccddb050 Bug 1856156 - Recompute auto directionality on input type changes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D198588
2024-01-15 19:35:43 +00:00
Vincent Hilla
d83fd88bed Bug 1858084 - Make dir=auto and dirname apply to more input types. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D194878
2023-12-19 18:17:22 +00:00
jneuberger
9fe5ac2c97 Bug 1863801 - P2. Add DOMFormRemoved event listener after successful fetch or XHR request r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D193308
2023-12-06 14:55:01 +00:00
Masayuki Nakano
4bb761eb3e Bug 1863759 - Make IMEStateManager recreate IMEContentObserver if the active one is not observing editable content of focused element r=smaug,m_kato
The test case is a special case that changes focused element from a text control
to an editing host.  Therefore, without a focus change, focused editor is
changed from a `TextEditor` to `HTMLEditor`.  At this time, `IMEContentObserver`
needs to switch the observing target from the anonymous content if `<input>` to
children of it.

However, the editable content becomes completely changed without a focus change
in the DOM.  Therefore, `IMEStateManager` needs to synthesize a fake focus move
for IME.  Therefore, this patch make `IMEStateManager` recreate
`IMEContentObserver` if active one is not observing editable content for the
focused element under "current" conditions at checking it.  (When
`IMEContentObserver` is being destroyed, it sends "blur" notification to IME
and the new `IMEContentObserver` instance posts "focus" notification with
all editable content data.  I.e., recreating `IMEContentObserver` generates
a fake focus move from IME point of view.)

Additionally, there is the opposite case, that is, editing host of an `<input>`
whose type is not a text control may become a text control.  Therefore, this
adds new WPTs to check the handler is the text editor for the text control or
the HTML editor.  The tests passed on Firefox and Chrome at least.

FYI: I guess that in this case, we need to kick `focus` event listener of the
`HTMLEditor`, but anyway, users cannot change the content because it's the
case that an atomic content is the editing host.  Therefore, I don't touch
about that in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D193262
2023-12-05 02:33:18 +00:00
Issam Mani
1149ca2518 Bug 1864379 - P1. Don't dispatch LoginManager DOM events for disconnected input elements. r=dimi,emilio
Differential Revision: https://phabricator.services.mozilla.com/D194768
2023-12-04 11:39:19 +00:00
Olli Pettay
3b643c8c3a Bug 1832026, create TextControlState lazily, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D195383
2023-12-04 10:59:34 +00:00
Noemi Erli
cb5c9fb296 Backed out 7 changesets (bug 1863801, bug 1865876) for causing failures in browser_creditCard_doorhanger_iframe.js CLOSED TREE
Backed out changeset 395e2da83ee8 (bug 1865876)
Backed out changeset c27de56bd433 (bug 1863801)
Backed out changeset 8d297207efc7 (bug 1863801)
Backed out changeset 193d5c08a17f (bug 1863801)
Backed out changeset dd78261ec1d8 (bug 1863801)
Backed out changeset 5f6ad20da89e (bug 1863801)
Backed out changeset 31e08bae4ce6 (bug 1863801)
2023-12-01 22:16:15 +02:00
jneuberger
2b8f2f2621 Bug 1863801 - P2. Add DOMFormRemoved event listener after successful fetch or XHR request r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D193308
2023-12-01 19:12:54 +00:00
Sandor Molnar
b7fe69a4ab 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
ed12e0d2d0 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
Emilio Cobos Álvarez
ac4f977dc8 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
Adam Vandolder
3198d33ca2 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
1497f6f44d Backed out changeset 8f8492410799 (bug 1685926) for causing bustage on SVGAnimatedPathSegList.cpp. CLOSED TREE 2023-09-28 10:40:31 +03:00
Adam Vandolder
226c8aba6a 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
8ce555ea94 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
190df7c40c 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
dfde72b50b 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
1258d560fb 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
4487727b74 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
cbfc2b9552 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
Emilio Cobos Álvarez
c27a2129fd 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
37cdd46442 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
9576c0ea12 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
b1ad2fb6f3 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
71d548bcdf 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
Vincent Hilla
6bb941a5ab Bug 1841801 - Make dirname apply to hidden, tel, url, email. r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D183114
2023-07-24 09:44:20 +00:00
Emilio Cobos Álvarez
8510eba432 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
945ed5ad06 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
035b0a67ec 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
cd6c4af40f 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
4cc6758558 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
7bddcf9e5a 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
6957543e5e 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
2c6de5f038 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
Vincent Hilla
ae0257ca20 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
1397cacaf8 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
Cosmin Sabou
50307024b4 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
f3ec29ff3d 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
cbddce7dcc 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
b8ac0dfcbe 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
f37d9339a7 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
407a5169d2 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
Emilio Cobos Álvarez
25b79c7b15 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
51758cfc9b 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