Commit graph

712 commits

Author SHA1 Message Date
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
Alexandru Michis
1df3b4b4d2 Backed out 3 changesets (bug 1712724) for causing mochitests without e10s failures in test_focus.xhtml
CLOSED TREE

Backed out changeset 61d8ca98120b (bug 1712724)
Backed out changeset 46b1d60b6b6b (bug 1712724)
Backed out changeset 36504d508b34 (bug 1712724)
2021-05-26 08:18:02 +03:00
Emilio Cobos Álvarez
ef6415ef1f 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-25 22:29:02 +00:00
Kagami Sascha Rosylight
1638851116 Bug 1712255 - Defer SetMaxLength in SetValueFromSetRangeText r=masayuki
Capping selection range in SetValue early makes the subsequent SetSelectionRange call unable to detect actual selection range change. This patch defers it so that select events can be consistently fired.

Differential Revision: https://phabricator.services.mozilla.com/D115729
2021-05-24 03:11:27 +00:00
Kagami Sascha Rosylight
69d0e90d28 Bug 1708702 - Add to radio group after handling type change r=edgar
The previous assumption was that mType would be updated before AfterSetAttr(), but that assumption is invalidated by bug 1347640. This patch moves the radio group addition part to the position after HandleTypeChange() is called.

Differential Revision: https://phabricator.services.mozilla.com/D114038
2021-05-03 08:53:02 +00:00
Kagami Sascha Rosylight
8fa77f5e60 Bug 1708228 - Part 4: Remove aNotify from nsRadioSetValueMissingState r=smaug
It already had no use before the patches.

Differential Revision: https://phabricator.services.mozilla.com/D113808
2021-04-30 11:25:24 +00:00
Kagami Sascha Rosylight
7185cfec97 Bug 1708228 - Part 3: Remove aNotify from HTMLInputElement::VisitGroup r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113807
2021-04-30 11:25:23 +00:00
Kagami Sascha Rosylight
4d0c7b86de Bug 1708228 - Part 2: Remove redundant flush param from nsIRadioGroupContainer r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113806
2021-04-30 11:25:23 +00:00
Emilio Cobos Álvarez
c5e28b2599 Bug 1705946 - Add some prefs for datetime-local. r=smaug
This is a bit subtler than needed (ideally we'd just need one pref)
because android enables the support for the type even if it only creates
a textbox.

Co-Authored-By: Fernando García <fernando.garciagomez.01@telefonica.com>

Differential Revision: https://phabricator.services.mozilla.com/D112488
2021-04-18 18:05:54 +00:00
Olli Pettay
20de573529 Bug 1704660, add a null check for a CreateStringBlob caller, r=edgar
The form isn't submitted to the server because
https://searchfox.org/mozilla-central/rev/3de2db87f3c9001ae478318d47a2ca3427574382/docshell/base/nsDocShell.cpp#12834
returns early.

Differential Revision: https://phabricator.services.mozilla.com/D111852
2021-04-13 19:41:51 +00:00
Emilio Cobos Álvarez
737b09dc24 Bug 1702670 - Fix some orange by keeping the UpdateState() call from SetValueChanged unconditionally.
Because the ui-validity bits depend on it.

MANUAL PUSH: Mochitest failures on a CLOSED TREE
2021-04-08 19:05:00 +02:00
Emilio Cobos Álvarez
bae4f3b10e Bug 1702670 - Fix state management for "last value change was interactive" for inputs / textareas. r=smaug
This and "value changed" affect the "too long" and "too short" validity
states.

The validity state tracking code is quite messy...

Differential Revision: https://phabricator.services.mozilla.com/D111254
2021-04-08 16:02:17 +00:00
Emilio Cobos Álvarez
7f5364389c Bug 1700640 - Map width and height to aspect-ratio in <canvas>, <input type=image>, and <video>. r=boris
As per https://html.spec.whatwg.org/#attributes-for-embedded-content-and-images:

> The width and height attributes map to the aspect-ratio property on
> img, canvas, and video elements, and input elements with a type
> attribute in the Image Button state.

See https://github.com/whatwg/html/issues/6527 for the parsing issue
with canvas and zero. For now allow both behaviors in the tests.

We also remove the width-and-height-map-to-aspect-ratio pref, as it is
true everywhere and has been for a while.

Differential Revision: https://phabricator.services.mozilla.com/D109618
2021-03-24 22:18:55 +00:00
Andreu Botella
045a9ed26a Bug 1459859 - Treat an empty <input type=file> as an empty File in FormData. r=smaug,robwu
This patch changes the value of an empty `<input type=file>` control as obtained from the `FormData` API, which used to be an empty string, to be a `File` object with empty contents, whose name is the empty string and whose type is `"application/octet-stream"`.

Differential Revision: https://phabricator.services.mozilla.com/D106605
2021-03-24 18:43:58 +00:00
Csoregi Natalia
2ca60f01bc Backed out changeset 57563a99fe53 (bug 1459859) for failures on test_ext_webrequest_upload.html. CLOSED TREE 2021-03-24 14:08:13 +02:00
Andreu Botella
b2d31f19aa Bug 1459859 - Treat an empty <input type=file> as an empty File in FormData. r=smaug
This patch changes the value of an empty `<input type=file>` control as obtained from the `FormData` API, which used to be an empty string, to be a `File` object with empty contents, whose name is the empty string and whose type is `"application/octet-stream"`.

Differential Revision: https://phabricator.services.mozilla.com/D106605
2021-03-24 11:11:25 +00:00
Emilio Cobos Álvarez
f2d4b8c005 Bug 1699570 - Make mouse_focuses_formcontrol on chrome documents match the old behavior. r=mstange
For that, we make accessibility.mouse_focuses_formcontrol a static pref,
and make it work in all platforms because it's simpler and allows to
test mac-specific things on other platforms more easily.

Differential Revision: https://phabricator.services.mozilla.com/D109006
2021-03-18 23:01:45 +00:00