Commit graph

698 commits

Author SHA1 Message Date
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
Dimi Lee
f39a177e9a Bug 1166995 - P2. Call onFormSubmit when a form or a password field is removed from the DOM tree r=sfoster,tgiles,smaug
This patch adds two events - `DOMFormRemoved` and `DOMInputPasswordRemoved`.
These events are notified when a form/password field is removed from
the DOM tree. When the LoginManagerChild receives the event, it calls
_onFormSubmit as the form is submitted.

This patch also adds a WeakFieldSet formlessModifiedPasswordFields to
record all the form-less password fields that users have interacted
with to track whether a formless password is removed

Depends on D106024

Differential Revision: https://phabricator.services.mozilla.com/D106025
2021-03-16 09:15:19 +00:00
Emilio Cobos Álvarez
678b10493d Bug 1698315 - Manage placeholder and autofill preview visibility using CSS rather than custom code. r=masayuki
Should be much simpler and doesn't need to deal with the different
stuff. We already have pseudo-classes for this, :autofill and
:placeholder-shown.

I initially wrote this because this is the only limitation that forces
us to have the placeholder text as a direct child of the text control
frame. In the end I kept that as-is, but this simplification is still
worth it.

We remove dom.placeholder.show_on_focus because it doesn't behave
correctly (it doesn't match the :placeholder-shown pseudo-class and it
should). It was introduced in bug 807613 and never turned to false by
default. I suspect nobody will miss this, but if somebody complains
about it we can reintroduce it properly (handling the pref in DOM
instead, changing the right state bits).

Differential Revision: https://phabricator.services.mozilla.com/D108304
2021-03-15 08:52:43 +00:00
Kagami Sascha Rosylight
7a84361402 Bug 1696123 - Always copy the checkedness of input elements r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D107130
2021-03-09 14:12:34 +00:00
Kagami Sascha Rosylight
a2323b59a0 Bug 1691515 - Add MOZ_KNOWN_LIVE member annotation r=andi
Differential Revision: https://phabricator.services.mozilla.com/D107321
2021-03-05 23:23:03 +00:00
Emilio Cobos Álvarez
b0bc0f75a5 Bug 1693969 - Remove <form novalidate> handling from :-moz-ui-{valid,invalid} pseudo-classes. r=smaug
There's no way to know whether the submission will actually be
validated, because formnovalidate on submit buttons is a thing (and even
if all the submit controls had formnovalidate, you could still submit
the form and validate it via form.submit()), so it seems better to make
these pseudo-classes not depend on this.

Differential Revision: https://phabricator.services.mozilla.com/D105968
2021-02-23 11:26:17 +00:00
Alexis Beingessner
07f2f659c6 Bug 1686616 - make StringBundle use Components instead of Services. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D105531
2021-02-18 13:26:32 +00:00
Andreu Botella
ce8162c71a Bug 1665014 - Make the check for hidden input "_charset_" case-insensitive. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D103082
2021-01-26 23:17:17 +00:00
Kagami Sascha Rosylight
2e396db5f4 Bug 1680951 - Do not scroll when calling select() r=masayuki
This is intended to be a hotfix for the URL bar regression. Ideally there should be a spec or this behavior should be removed completely.

Previously select() scrolled back to the start position before the regression, but this fix does not restore that behavior.

Differential Revision: https://phabricator.services.mozilla.com/D98972
2020-12-09 20:59:17 +00:00
Masayuki Nakano
81be9a4e86 Bug 1681240 - Make TextControlState::SetValueFlags an enum class r=saschanaz
Using integer as a bit field may cause simple mistake and may not be easy
to read, and we have `EnumSet` class which can treat an `enum class` as
a bit flags so that we should make it an `enum class` and use it with the
`EnumSet` class.

Differential Revision: https://phabricator.services.mozilla.com/D99172
2020-12-09 23:34:28 +00:00
Butkovits Atila
c405a6ab26 Backed out changeset 29bbd5887d66 (bug 1680951) for failure on browser_blockingCookies.js. CLOSED TREE 2020-12-08 14:46:48 +02:00
Kagami Sascha Rosylight
f7757cbe10 Bug 1680951 - Do not scroll when calling select() r=masayuki
This is intended to be a hotfix for the URL bar regression. Ideally there should be a spec or this behavior should be removed completely.

Previously select() scrolled back to the start position before the regression, but this fix does not restore that behavior.

Differential Revision: https://phabricator.services.mozilla.com/D98972
2020-12-08 07:52:07 +00:00
Kagami Sascha Rosylight
5cae826a74 Bug 1680798 - Assign forward selection in Select() before bug 1541454 r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D98823
2020-12-05 07:47:50 +00:00
Kagami Sascha Rosylight
a2aec71886 Bug 1679461 - Use SetSelectionRange in Select(), regardless of focus state r=masayuki
SelectAll() also is no-op without a frame, so this replaces it with SetSelectionRange.

Differential Revision: https://phabricator.services.mozilla.com/D98184
2020-12-02 19:27:19 +00:00
Bogdan Tara
225a24f0bc Backed out 3 changesets (bug 1677263, bug 1679460, bug 1679461) for test_focus.xhtml failures CLOSED TREE
Backed out changeset 03db12dabc63 (bug 1677263)
Backed out changeset 75de13448090 (bug 1679460)
Backed out changeset 4f4fd8e7ce93 (bug 1679461)
2020-12-02 21:16:28 +02:00