Commit Graph

918 Commits

Author SHA1 Message Date
Tom Schuster
b8d11d463f Bug 1951893 - Remove unneeded StaticAtom suffixes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D240598
2025-03-11 11:36:09 +00:00
Makoto Kato
b441849346 Bug 1674428 - Part 2. Add method to collect files that is selected WebKitDirectory. r=dom-core,sefeng
When using Android 13 or later, there is no permission to enumerate
directories if on user storage. So `GetFilesHelper` and etc won't work on
Android.

We have to use content resolver APIs to enumerate files in directory.
So I have to add a method to collect files in FilePicker and return
DOM Files.

Differential Revision: https://phabricator.services.mozilla.com/D228761
2025-03-07 12:44:07 +00:00
Edgar Chen
2afeef63bd Bug 1947446 - Part 2: Input element should always defer the form submission during click event; r=smaug
As the input type can be changed to "submit" type during the click event, it may
end up triggering the form submission as the default action.

Differential Revision: https://phabricator.services.mozilla.com/D238781
2025-02-25 22:30:48 +00:00
Edgar Chen
9f0edddf04 Bug 1947446 - Part 1: Input element should always have activation behavior; r=smaug
See https://html.spec.whatwg.org/multipage/input.html#the-input-element.

Differential Revision: https://phabricator.services.mozilla.com/D238780
2025-02-25 22:30:47 +00:00
Edgar Chen
4ac8a8da39 Bug 1949439 - Part 1: Stop dispatching unused DOMFormSubmit chrome-only event; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D239150
2025-02-25 11:23:37 +00:00
Masayuki Nakano
4e6fcb1183 Bug 1943228 - Rename methods GetSomethingWithoutCreation() to GetExtantSomething() r=edgar,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D235256
2025-01-23 23:47:28 +00:00
Masayuki Nakano
a3db2f157c Bug 1941140 - Make TextControlState::UnbindFromFrame clean up controllers if and only if they are exist r=edgar
`HTMLInputElement::GetControllers()` and `HTMLTextAreaElement::GetControllers()`
initializes their controllers before returning the `nsIControllers` instance
[1][2].  Typically, they are initialized at creating their `TextEditor`
instance is initialized [3].  A `TextEditor` for an `HTMLInputElement` is
initialized when it gets focus first time after the `nsTextControlFrame` is
created [4][5].  Therefore, when `TextControlState::UnbindFromFrame` is called,
the element may not have controllers yet.  So, the elements should have simple
getters of their controllers and `UnbindFromFrame` should use them instead.

1. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/HTMLInputElement.cpp#5658-5660
2. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/HTMLTextAreaElement.cpp#502-503
3. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/TextControlState.cpp#1826-1827,1832,1837-1838,1857-1858
4. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/layout/forms/nsTextControlFrame.cpp#447
5. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/TextControlState.cpp#1640-1641,1655-1656

Differential Revision: https://phabricator.services.mozilla.com/D234307
2025-01-19 23:34:07 +00:00
Jonathan Kew
6d25ae0f09 Bug 1936113 - Hook up :open to details, select, dialog, and input elements. r=webidl,emilio
Most of these elements are simple to support.

One slightly tricky item was <input type=date>, as testing indicates that the
front-end code usually (consistently?) hides the picker using setPickerState(),
which does not end up calling closeDateTimePicker() as might be expected.
So to properly track the open/closed state, I had to add a SetDateTimePickerState
webidl method, rather than just patching into the existing Open/Close calls.

Differential Revision: https://phabricator.services.mozilla.com/D234093
2025-01-17 13:49:56 +00:00
Butkovits Atila
530d9d432d Backed out 5 changesets (bug 1936113) for causing failures at select-inside-top-layer.tentative.html. CLOSED TREE
Backed out changeset 2b07b9e7bf57 (bug 1936113)
Backed out changeset a88e93dff614 (bug 1936113)
Backed out changeset 9cfc0a675a42 (bug 1936113)
Backed out changeset 716bdadbea2a (bug 1936113)
Backed out changeset 4ee0855e448f (bug 1936113)
2025-01-17 12:34:24 +02:00
Jonathan Kew
a4d8e36aff Bug 1936113 - Hook up :open to details, select, dialog, and input elements. r=webidl,emilio
Most of these elements are simple to support.

One slightly tricky item was <input type=date>, as testing indicates that the
front-end code usually (consistently?) hides the picker using setPickerState(),
which does not end up calling closeDateTimePicker() as might be expected.
So to properly track the open/closed state, I had to add a SetDateTimePickerState
webidl method, rather than just patching into the existing Open/Close calls.

Differential Revision: https://phabricator.services.mozilla.com/D234093
2025-01-17 09:17:28 +00:00
Edgar Chen
bd5595be28 Bug 1938489 - Don’t update other radio inputs in the same radio group when a radio input is appended to a disconnected subtree; r=avandolder
See https://github.com/whatwg/html/issues/10897.

Differential Revision: https://phabricator.services.mozilla.com/D233421
2025-01-13 09:42:01 +00:00
Emilio Cobos Álvarez
d839027bf7 Bug 1939880 - Make UA widget content use regular shadow dom event retargetting, not NAC retargetting. r=smaug
This allows removing the special case for focus inside the datetime
widget (and fixes similar issues on video when you tab through
the video controls).

This is covered by test_input_datetime_focus_blur_events.html, but happy
to add a <video>-specific event if you think it'd be useful..

Differential Revision: https://phabricator.services.mozilla.com/D233180
2025-01-11 00:08:01 +00:00
Emilio Cobos Álvarez
19b8476a6c Bug 1935672 - Restore a chunk of code that is still needed apparently.
This fixes failures in test_input_datetime_focus_blur_events.html and
such, but it seems like the shadow DOM retargetting should handle
this?

MANUAL PUSH: Orange fix CLOSED TREE
2025-01-03 15:40:59 +01:00
Emilio Cobos Álvarez
cf971e2352 Bug 1935672 - Handle blur on the datetime box earlier. r=smaug
We want the blur handling to happen before the website has seen the
event, so that the value it sees is correct.

It also prevents the input to remain in the `:focus-visible` state
during blur.

Differential Revision: https://phabricator.services.mozilla.com/D233087
2025-01-03 13:17:20 +00:00
Masayuki Nakano
71ada507bb Bug 1680669 - part 6: Make methods of MouseEvent and static methods of Event aware of fractional coordinates r=smaug,emilio,webdriver-reviewers
`screenX`, `screenY`, `clientX`, `clientY`, `x`, `y`, `offsetX` and `offsetY`
are now `double`.  This patch makes the event classes aware of DOM events.

Currently, Chrome allows fractional values only for pointer events whose type
is not `click`, `auxclick` nor `contextmenu` (this exception is defined by the
Pointer Events spec).  Therefore, this patch follows them.

I'm not sure about the untrusted events of non-pointer events, `click`,
`auxclick` and `contextmenu`. Chrome does check whether it's trusted or not
before applying `std::floor` or `std::round` at getter methods (I think that
using `std::round` in `offsetX` and `offsetY` is their bug at least for
untrusted events).  This patch follows them for now but has a pref to allow
for all untrusted events.

Finally, for aligning to Chrome, this patch makes `click`, `auxclick` and
`contextmneu` keep using integer coordinates because it's recommended by the
Pointer Events spec.

Note that this changes the logic in `Event::GetPageCoords`.  It rounded the
client point and scroll point before adding them.  Similarly,
`Event::GetOffsetCoords` too.  It rounded the client point before transforming
it.  Therefore, in strictly speaking, this changes the behavior of other events
which keep returning integer coordinates.  However, I don't see any issues in
our CI.  So, for making the code simpler, let's use it and once we got some
regression reports caused by this, let's make them take additional param to
round the points to integer done in the traditional code.

Differential Revision: https://phabricator.services.mozilla.com/D222728
2024-12-03 07:10:05 +00:00
Oliver Old
054846ec0f Bug 1240005 - Users of do_CreateInstance or InitWithNativePath/InitWithPath not checking return value r=necko-reviewers,xpcom-reviewers,media-playback-reviewers,emilio,karlt,valentin
Differential Revision: https://phabricator.services.mozilla.com/D227280
2024-11-25 16:54:11 +00:00
Oliver Old
82cc01210e Bug 1776893 - Replace do_CreateInstance for nsIFile with NS_NewLocalFile (part 2) r=emilio,necko-reviewers,win-reviewers,handyman,valentin
Differential Revision: https://phabricator.services.mozilla.com/D227297
2024-11-25 16:54:10 +00:00
Edgar Chen
997fb832b3 Bug 1932512 - Pass BrowsingContext to nsIColorPicker::Init; r=geckoview-reviewers,win-reviewers,mac-reviewers,emilio,spohl,m_kato,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D229682
2024-11-25 14:03:25 +00:00
Mike Hommey
dfcbbb2394 Bug 1930836 - Initialize returned values in GetSelection{Start,End}IgnoringType. r=dom-core,jjaschke
Returning uninitialized values is undefined behavior, and while the API
is such that the caller code wouldn't use the value in the case it's not
initialized, the C++ standard doesn't allow it and now clang 19 has a
change in an optimization pass that can end up miscompiling the code as
result.

Differential Revision: https://phabricator.services.mozilla.com/D228769
2024-11-15 08:14:47 +00:00
Leander Schwarz
7fec00d6b7 Bug 1899117 - Add file and input type telemetry for EXIF metadata stripper project. r=bvandersloot,anti-tracking-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D226524
2024-10-29 12:49:37 +00:00
Alexandru Marc
f6aed66e52 Backed out 2 changesets (bug 1899117) for causing py3 failures @ test_yaml_indices.py::test_yamls_sorted. CLOSED TREE
Backed out changeset 814c8b5c6837 (bug 1899117)
Backed out changeset 270d18416ca7 (bug 1899117)
2024-10-29 10:21:33 +02:00
Leander Schwarz
c103134216 Bug 1899117 - Add file and input type telemetry for EXIF metadata stripper project. r=bvandersloot,anti-tracking-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D226524
2024-10-29 07:48:34 +00:00
serge-sans-paille
262f78c07f Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc
a5eb905bf4 Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
07101ac24d Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
004e704b22 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
2c916d4973 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Vincent Hilla
e68a44cb57 Bug 868874 - Remove Decimal::toString(char*, size_t). r=jwatt,dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D216041
2024-10-22 13:21:56 +00:00
Vincent Hilla
257d5eb9f2 Bug 1888507 - Do not dispatch input, change for detached checkbox, radio. r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D217408
2024-10-22 13:21:16 +00:00
Emilio Cobos Álvarez
4c840d573b Bug 1925866 - NS_NewLocalFile's aFollowSymlinks arg is unused. r=xpcom-reviewers,necko-reviewers,valentin,media-playback-reviewers,win-reviewers,karlt,nika,rkraesig
Remove it and related functions, and update the callers.

Differential Revision: https://phabricator.services.mozilla.com/D226261
2024-10-22 09:38:16 +00:00
Zach Hoffman
b335283083 Bug 282266 - Populate imageClickedPoint when submitter is an image button. r=dom-core,layout-reviewers,emilio,masayuki
If the form submission originated from an event dispatch, this patch
ensures that the submitted image button coordinate is not the default.

Differential Revision: https://phabricator.services.mozilla.com/D224651
2024-10-15 12:27:57 +00:00
Masayuki Nakano
528d09c312 Bug 1904279 - Get rid of dom.w3c_pointer_events.dispatch_click_as_pointer_event pref r=smaug,pip-reviewers,search-reviewers,devtools-reviewers,urlbar-reviewers,nchevobbe,dao,jteow,mconley
Keep supporting the pref makes a lot of `click`, `auxclick` and `contextmenu`
event creators complicated (and look messy).  So, let's delete it as soon as
possible.

Differential Revision: https://phabricator.services.mozilla.com/D217225
2024-07-30 06:49:42 +00:00
Masayuki Nakano
44aae6e962 Bug 1909577 - Make some nsFocusManager::GetFocusedElement() users use its static version instead r=emilio,credential-management-reviewers,issammani
Now, we have `nsFocusManager::GetFocusedElementStatic()` which returns focused
element if the `nsFocusManager` instance is available.  Therefore, if
`nsFocusManager::GetFocusedElement()` users do not use other methods of
`nsFocusManager`, they can use `nsFocusManager::GetFocusedElementStatic()` and
make themselves simpler.

Note that some callers return early if `nsFocusManager` is not available, but
they do not return error and `nsFocusManager` instance is available in most
time of the life time of the process.  Therefore, we can simply stop using the
early return.

Differential Revision: https://phabricator.services.mozilla.com/D217527
2024-07-25 00:33:58 +00:00
Emilio Cobos Álvarez
d25d53b6fc Bug 1909311 - Remove nsIFormControlFrame and nsITextControlFrame. r=masayuki,layout-reviewers,dholbert
It's a rather useless interface:

 * nsITextControlFrame is only implemented by nsTextControlFrame, so we
   can just use that.
 * nsIFormControlFrame had very few actual functionality, mostly
   scattered around:
    * SetFormProperty(select) was only useful for nsTextControlFrame.
    * SetFormProperty(value) was only called on file controls.
    * SetFocus() did mostly nothing, or things that can be done in
      ElementStateChanged instead.

There are some do_QueryFrame calls that I replaced for better checks in
font inflation and nsIFrame, but I'll adjust to preserve behavior if you
insist (it just such a somewhat-random check).

Differential Revision: https://phabricator.services.mozilla.com/D217322
2024-07-23 16:16:18 +00:00
Neil Deakin
c18a0f1d1f Bug 1904593, don't clear the autofill state when modified by script, r=dom-core,credential-management-reviewers,dimi,sefeng
It turns out that many sites are modifying the field state immediately after a value has been autofilled, typically to format the value such as add spaces between parts of a credit card number

Differential Revision: https://phabricator.services.mozilla.com/D215113
2024-07-22 14:33:14 +00:00
Daniel Holbert
4267e2c406 Bug 1741469 part 3: Add an off-by-default pref to control whether input type="number"/"range" 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
2024-07-16 16:35:26 +00:00
Ryan Safaeian
ccd363c347 Bug 1900009 - Dispatch DOMPossibleUsernameInputAdded event for valid text and email inputs. r=dimi,edgar
Differential Revision: https://phabricator.services.mozilla.com/D214821
2024-07-12 17:38:48 +00:00
Vincent Hilla
2ddf8f16af Bug 1876163 - Part 5: Consider input / textarea children of dir=auto slot. r=smaug
This patch implements step 2.3.2 from https://html.spec.whatwg.org/#auto-directionality for the special case where the child is an auto-directionality form-associated element according to step 1 of the algorithm.

Depends on D208339

Differential Revision: https://phabricator.services.mozilla.com/D208340
2024-07-09 08:00:35 +00:00
Emilio Cobos Álvarez
87e50520af Bug 1905743 - Tweak TextControlElement to be able to tell if column count is explicit or not. r=dholbert
This is needed because we want implicit width of number and text
controls be the same, but explicit width be different to account for the
spinners. See:

  data:text/html,<input type="number"><br><input type="text"><br><input type="number" min="1" max="9"><br><input type="text" size="1">

For example. This patch on its own shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D215549
2024-07-02 21:17:34 +00:00
Emilio Cobos Álvarez
f925429501 Bug 1905743 - Unify text control button storage. r=dholbert
Split out from the other patch for readability. This doesn't change
behavior but unifies where we store the buttons of
number/search/password inputs.

Differential Revision: https://phabricator.services.mozilla.com/D215548
2024-07-02 21:17:34 +00:00
Edgar Chen
2b74067abf Bug 1904719 - Remove unused HTMLInputElement::mHandlingSelectEvent; r=dom-core,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D214896
2024-06-26 06:41:00 +00:00
Oliver Medhurst
cbcf563dc9 Bug 1877969 - Consume user activation when showing any picker r=dom-core,edgar,geckoview-reviewers,m_kato
Consume transient user activation when showing file/color picker
at any time. Do not open if there is no transent user activation.

Fixed various internal tests broken by this change.

Spec PR: https://github.com/whatwg/html/pull/10344

Differential Revision: https://phabricator.services.mozilla.com/D201096
2024-06-24 10:53:24 +00:00
Cristian Tuns
1613f5053a Backed out changeset 46970b1c1903 (bug 1877969) for causing xpcshell failures in test_bug1086684.js CLOSED TREE 2024-06-21 11:48:23 -04:00
Oliver Medhurst
d62e94c895 Bug 1877969 - Consume user activation when showing any picker r=dom-core,edgar,geckoview-reviewers,m_kato
Consume transient user activation when showing file/color picker
at any time. Do not open if there is no transent user activation.

Fixed various internal tests broken by this change.

Spec PR: https://github.com/whatwg/html/pull/10344

Differential Revision: https://phabricator.services.mozilla.com/D201096
2024-06-21 14:17:22 +00:00
Andrea Marchesini
c6f1009e59 Bug 1860321 - Check the return value of nsIFilePicker::GetDomFileOrDirectory, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D214265
2024-06-19 16:08:21 +00:00
Masayuki Nakano
e1fd41420f Bug 1675847 - part 3: Make ePointerClick event dispatchers and handlers use WidgetPointerEvent r=smaug,search-reviewers,devtools-reviewers,nchevobbe,jteow
This patch makes the all `ePointerClick` event dispatcher in C++ code use
`WidgetPointerEvent` instead of `WidgetMouseEvent`.

Then, this patch also makes the all `click` event dispatcher in chrome code use
`PointerEvent` instead of `MouseEvent`.  For detecting wrong trusted event
dispatching of `click` event, this patch adds assertion into `MouseEvent`.
Therefore, all chrome test dispatchers also changed to use `PointerEvent`.

Finally, this patch includes a change of a WPT.  That checks the `pointerId`
caused by executing an access key.  In this case, the value should be `-1`
rather than the default value `0` because Pointer Event spec defines so for
synthetic pointer events caused by non-pointing devices [1].  Chrome also
sets it to `-1` and fails [2].  Therefore, the new assertion will pass on both
Firefox and Chrome.

1. https://w3c.github.io/pointerevents/#dom-pointerevent-pointerid
2. https://wpt.fyi/results/uievents/interface/keyboard-accesskey-click-event.html?run_id=5087897523060736&run_id=5136270464647168&run_id=5163620816388096&run_id=5201281304231936

Differential Revision: https://phabricator.services.mozilla.com/D213001
2024-06-14 00:18:47 +00:00
Masayuki Nakano
fb5048e05b Bug 1675847 - part 1: Rename eMouseClick and eMouseAuxClick r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D212999
2024-06-14 00:18:46 +00:00
James Teh
5ec975e7d7 Bug 1901633: Focus the first possible radio button in a group if the selected radio button is disabled or hidden. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D213180
2024-06-13 02:35:06 +00:00
Emilio Cobos Álvarez
8b01085e4f Bug 1898214 - Implement min/max-derived sizing for <input type=number>. r=smaug
See https://github.com/whatwg/html/issues/10390 for the spec issue.

Differential Revision: https://phabricator.services.mozilla.com/D212545
2024-06-06 17:38:26 +00:00
Stanca Serban
1e7737760a Backed out changeset cd09151a1c46 (bug 1898214) for causing OS X wpt failures in transform-input-014.html. 2024-06-05 18:46:28 +03:00