Commit graph

728 commits

Author SHA1 Message Date
Kagami Sascha Rosylight
9976ecf87c Bug 1774035 - Stop opening pickers from disabled input elements r=smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D149157
2022-06-14 17:27:22 +00:00
Butkovits Atila
7b1c9fc461 Backed out changeset 84317cf0446c (bug 1774035) for causing crashes at mozilla::dom::HTMLInputElement. CLOSED TREE 2022-06-14 17:58:59 +03:00
Kagami Sascha Rosylight
7fc6a55ae2 Bug 1774035 - Stop opening pickers from disabled input elements r=smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D149157
2022-06-14 14:14:21 +00:00
Emilio Cobos Álvarez
12bd84f0c5 Bug 1773070 - While at it rename ContentStateChanged to ElementStateChanged, and make it take elements. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148553
2022-06-07 23:09:54 +00:00
Emilio Cobos Álvarez
47afabb81a Bug 1773070 - While at it use some better names for some bits. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148538
2022-06-07 23:09:53 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Emilio Cobos Álvarez
72d2420c2b Bug 1766395 - Remove dom.forms.datetime-local prefs. r=edgar
We shipped this a while ago.

Differential Revision: https://phabricator.services.mozilla.com/D144800
2022-04-27 14:10:27 +00:00
Tom Schuster
eed1aead2d Bug 1745005 - Add showPicker() to <input> elements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D142754
2022-04-22 18:43:48 +00:00
criss
1ce796a4ee Backed out changeset fa6795d107b1 (bug 1745005) for causing multiple failures. CLOSED TREE 2022-04-13 13:23:03 +03:00
Tom Schuster
43b158ae1a Bug 1745005 - Add showPicker() to <input> elements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D142754
2022-04-13 07:35:57 +00:00
Edgar Chen
c82b0711e1 Bug 1760560 - Remove directory upload API; r=smaug
HTMLInputElement.getFilesAndDirectories is used for testing Directory API, so
still keep it but mark as chrome only.

Differential Revision: https://phabricator.services.mozilla.com/D142444
2022-04-04 09:54:34 +00:00
Emilio Cobos Álvarez
5101af9a94 Bug 1760709 - Take directionality into account when handling left/right on radios. r=smaug
We have similar code for range inputs. This matches Blink (but not
WebKit), but I think it's a better default.

The spec seems to leave this up to UAs, so for now landing a
moz-specific WPT. Should be trivial to upstream if we want.

Depends on D141705

Differential Revision: https://phabricator.services.mozilla.com/D141706
2022-03-22 11:10:54 +00:00
Emilio Cobos Álvarez
0b00fcf9fd Bug 1760709 - Remove some useless namespacing in HTMLInputElement. r=smaug
Drive-by cleanups.

Differential Revision: https://phabricator.services.mozilla.com/D141705
2022-03-22 11:10:53 +00:00
Sylvestre Ledru
98949ee751 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Emilio Cobos Álvarez
fcbb87eb0f Bug 1752651 - Clone indeterminateness of input elements. r=smaug
Matches other browsers and makes sense.

Differential Revision: https://phabricator.services.mozilla.com/D137442
2022-01-31 13:14:46 +00:00
Ting-Yu Lin
03683daeeb Bug 1751473 Part 2 - Use CSSIntPoint instead of nsIntPoint in image event handling code. r=emilio
The old code operates in the CSS pixel coordinate, so we should use the type
system to express that. With this patch, nsImageControlFrame, nsImageFrame, and
nsImageMap now have no usage of nsIntPoint.

Differential Revision: https://phabricator.services.mozilla.com/D136647
2022-01-22 01:07:19 +00:00
Emilio Cobos Álvarez
8ce808ebbd Bug 1743047 - Use "reveal" rather than show terminology consistently for the reveal password button. r=Gijs,fluent-reviewers
The pseudo-class and nsContextMenu context attribute were using reveal,
the pseudo-element and webidl attribute were using "show".

Use reveal consistently and update the accesskey so that there aren't
conflicts with existing commands. Also enable the feature in
browser_contextmenu_input.js so that this change is tested.

Differential Revision: https://phabricator.services.mozilla.com/D136086
2022-01-17 14:18:51 +00:00
Edgar Chen
8936a84092 Bug 1695636 - Part 3: Do not trigger form submission or click event for untrusted key event; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D135464
2022-01-12 14:24:02 +00:00
Edgar Chen
a7a61c5630 Bug 1695636 - Part 2: Handle form submission for keypress event in a central place; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D135675
2022-01-12 14:24:02 +00:00
Edgar Chen
6123594d4f Bug 1695636 - Part 1: Remove nsresult return value from HTMLInputElement::MaybeSubmitForm; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D135226
2022-01-12 14:24:01 +00:00
Emilio Cobos Álvarez
5d109f0749 Bug 1749590 - Don't do localization shenanigans for <input type=range>. r=edgar
It should never need to deal with a localized value, unlike
<input type=number>.

Differential Revision: https://phabricator.services.mozilla.com/D135673
2022-01-12 04:42:43 +00:00
Emilio Cobos Álvarez
d95d7abddc Bug 1735076 - Use ProgrammaticFocusFlags from nsXULCommandDispatcher. r=smaug
Relevant calls are here:

  https://searchfox.org/mozilla-central/rev/21a9b72545da06681db97c4b3a2a6be761f4aae5/toolkit/content/widgets/button.js#42-68

This makes sure to set the FLAG_BYKEY properly if needed, instead of passing
down raw flags to nsFocusManager. Clean up a bit while at it.

Let me know if you want a test for this, but we have tests for programmatic
focus and :focus-visible already, so my gut feeling is that testing this
particular XUL-specific change is not super-worth-it...

Differential Revision: https://phabricator.services.mozilla.com/D133690
2021-12-23 18:34:05 +00:00
Noemi Erli
70d14084ab Backed out changeset 93b9da069dde (bug 1735076) for causing failures in browser_searchbar_openpopup.js CLOSED TREE 2021-12-21 21:53:42 +02:00
Emilio Cobos Álvarez
4a513d4585 Bug 1735076 - Use ProgrammaticFocusFlags from nsXULCommandDispatcher. r=smaug
Relevant calls are here:

  https://searchfox.org/mozilla-central/rev/21a9b72545da06681db97c4b3a2a6be761f4aae5/toolkit/content/widgets/button.js#42-68

This makes sure to set the FLAG_BYKEY properly if needed, instead of passing
down raw flags to nsFocusManager. Clean up a bit while at it.

Let me know if you want a test for this, but we have tests for programmatic
focus and :focus-visible already, so my gut feeling is that testing this
particular XUL-specific change is not super-worth-it...

Differential Revision: https://phabricator.services.mozilla.com/D133690
2021-12-21 18:22:30 +00:00
championshuttler
5e9287bf89 Bug 1724706 - Remove Obsolete comment in HTMLInputElement::AfterSetFilesOrDirectories.r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D132394
2021-11-29 23:18:27 +00:00
Edgar Chen
531ef37175 Bug 1556364 - Part 2-1: Split nsGenericHTMLFormControlElement-only members from nsIConstraintValidation to a separated class; r=smaug
As ElementInternal has it own implmentation.

Differential Revision: https://phabricator.services.mozilla.com/D130259
2021-11-26 11:47:39 +00:00
Marian-Vasile Laza
807599b18f Backed out 5 changesets (bug 1556364) for causing web-platform test failures. CLOSED TREE
Backed out changeset dabffbe71a31 (bug 1556364)
Backed out changeset 76fc30f27c39 (bug 1556364)
Backed out changeset f6f7f949551f (bug 1556364)
Backed out changeset c77ef41d43d4 (bug 1556364)
Backed out changeset 2c8c74e99e47 (bug 1556364)
2021-11-26 05:01:08 +02:00
Edgar Chen
ab401654c2 Bug 1556364 - Part 2-1: Split nsGenericHTMLFormControlElement-only members from nsIConstraintValidation to a separated class; r=smaug
As ElementInternal has it own implmentation.

Differential Revision: https://phabricator.services.mozilla.com/D130259
2021-11-25 21:58:04 +00:00
Emilio Cobos Álvarez
2dca36cb25 Bug 502258 - Add a Show Password button to <input type=password> controls. r=Gijs
It's controlled by the pref:
layout.forms.input-type-show-password-button.enabled

Differential Revision: https://phabricator.services.mozilla.com/D130407
2021-11-25 20:12:05 +00:00
Masayuki Nakano
71fc64caea Bug 1735745 - Make SelectionChangeEventDispatcher dispatch select event and selectchange event only when there may be corresponding event listeners r=smaug
`select` event on text controls now dispatched immediately before
`selectionchange`.  However, it needs to create `AsyncEventDispatcher` for
each.  This cost may not be expensive, but they are called really a lot even
if there is no corresponding event listener.

Therefore, this patch makes `nsPIDOMWindow` and `EventListenerManager` have
`MayHave*EventListeners` flag separately for each, and makes
`SelectionChangeEventDispatcher` does not try to do create
`AsyncEventDispatcher` when there is no corresponding event listener.

Differential Revision: https://phabricator.services.mozilla.com/D131750
2021-11-25 07:09:23 +00:00
Emilio Cobos Álvarez
a5f66c95e1 Bug 1740230 - Remove some prefs for pseudo-classes that we have shipped/unshipped successfully. r=dholbert
And remove code for :-moz-submit-invalid completely.

Differential Revision: https://phabricator.services.mozilla.com/D130737
2021-11-10 13:27:47 +00:00
Edgar Chen
ad06ef9d0a Bug 1737364 - Part 2: Elements should be barred from constraint validation if it has a datalist element ancestor; r=smaug
Add a new flag, ELEMENT_IS_DATALIST_OR_HAS_DATALIST_ANCESTOR, to indicate that
the element is a HTML datalist element or has a HTML datalist element ancestor.

Per https://html.spec.whatwg.org/multipage/form-elements.html#the-datalist-element:barred-from-constraint-validation

Differential Revision: https://phabricator.services.mozilla.com/D129717
2021-11-03 20:07:43 +00:00
Masayuki Nakano
4341d6fb0c Bug 1455514 - part 1: Add accessors and static helper methods to retrieve nsINode or its concrete classes from EventTarget r=smaug
Currently, checking whether an `EventTarget` is `nsINode` (or its concrete
classes) or not requires a QI, but it's expensive and used a lot while we
handle each event.  Therefore, it'd be nicer for creating a virtual method,
`EventTarget::IsNode()` and use it for the check.

If trying to convert `EventTarget` to a concrete class, it may require two
virtual method calls.  I'm not sure whether it's cheaper than a QI, but at
least, it won't depend on the UUID check order of `QueryInterface()` when
multiple interfaces are implemented.

Differential Revision: https://phabricator.services.mozilla.com/D129781
2021-11-02 13:03:43 +00:00
Edgar Chen
36107cfddf Bug 1556363 - Part 1: Check disabled state for submission in a common place; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D129048
2021-10-25 20:43:10 +00:00
Eden Chuang
ff75c055b2 Bug 1730156 - Do not create DispatchChangeEventCallback if associated HTMLInputElement has no scriptGlobalObject. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D126095
2021-10-13 14:42:15 +00:00
Edgar Chen
6c7f4da558 Bug 1556351 - Part 3: Rename nsGenericHTMLFormElementWithState to nsGenericHTMLFormControlElementWithState; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124786
2021-10-04 20:51:26 +00:00
Makoto Kato
e63a60f263 Bug 1731931 - More clean up IMEStateManager::SetIMEState. r=masayuki
Depends on D126574

Differential Revision: https://phabricator.services.mozilla.com/D126575
2021-09-27 12:41:40 +00:00
Sean Feng
c01f1a8018 Bug 1729342 - Use delegatesFocus for <input type=date/time/datetime-local> widget r=emilio
Currently datetimebox uses some hardcoded logic to find the edit
field inside the shadow tree and focus it.

Since we have delegatesFocus implemented, we could just use it without
these logic.

Differential Revision: https://phabricator.services.mozilla.com/D125440
2021-09-20 18:33:41 +00:00
Edgar Chen
c2873164e2 Bug 1729358 - Part 1: Move FocusState to TextControlElement; r=smaug
And convert FocusTristate to enum class.

Differential Revision: https://phabricator.services.mozilla.com/D124693
2021-09-07 09:47:09 +00:00
Emilio Cobos Álvarez
5b32ac83c1 Bug 1729343 - Use CamelCase in HTMLInputElement::FromClone. r=smaug
That's what the code style asks for. All-lowercase is unseen elsewhere afaict.

Differential Revision: https://phabricator.services.mozilla.com/D124689
2021-09-07 08:25:38 +00:00
Emilio Cobos Álvarez
580e65503f Bug 1729292 - Honor scroll margin of host when we're scrolling to a chrome-only-access element. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124691
2021-09-07 08:24:59 +00:00
Tom Schuster
9766eeb6fe Bug 1723629 - Use the 'All supported types' filter even when some MIME types are unknown. r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D124579
2021-09-06 11:26:19 +00:00
Edgar Chen
7d1d31d3e9 Bug 1728537 - Part 1: Move SaveState out of nsIFormControl; r=smaug
And make it return void as the return value isn't used at callsites.

Differential Revision: https://phabricator.services.mozilla.com/D124179
2021-09-01 16:51:58 +00:00
Edgar Chen
262f7ec893 Bug 1728081 - Part 4: Make HTMLFormElement::GetDefaultSubmitElement return nsGenericHTMLFormElement; r=smaug
so that the callers don't need to queryInterface it back to nsIContent.

Differential Revision: https://phabricator.services.mozilla.com/D123952
2021-08-30 18:44:51 +00:00
Edgar Chen
af2f2867e6 Bug 1721349 - Move mSubmitter from HTMLFormSubmission to FormData and make it participate in cycle collection; r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D120334
2021-07-21 09:52:20 +00:00
Edgar Chen
999d851597 Bug 586329 - Clear the defer submission state when submit button is removed from the form during its click event handler; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D119396
2021-07-16 11:24:52 +00:00
Tom Schuster
b5d465f4cc Bug 1719703 - Implement cancel event on <input type=file>. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D119437
2021-07-11 20:05:03 +00:00
Emilio Cobos Álvarez
2b0eae6061 Bug 1715134 - Make form control type an enum class. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117087
2021-06-08 09:43:59 +00:00
Emilio Cobos Álvarez
88bb474e07 Bug 1481400 - Centralize keyboard activation code. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D116584
2021-06-03 08:15:24 +00:00
Emilio Cobos Álvarez
2314b37da7 Bug 1712724 - Don't trigger select on programmatic focus during keyboard events. r=smaug
Depends on D115900

Differential Revision: https://phabricator.services.mozilla.com/D115901
2021-05-26 11:21:44 +00:00