244 Commits
Author SHA1 Message Date
Masayuki Nakano e0cdd748e5 Bug 2041756 - Make IsForbiddenDispatchingToNonElementContent() not assert whether the message can be dispatched to the DOM r=smaug
`eMouseRawUpdate` and `eTouchRawUpdate` are internal event messages to
dispatch `ePointerRawUpdate` and
`IsForbiddenDispatchingToNonElementContent()` is just a utility method
to help to compute the event target. So, callers may want to know the
`ePointerRawUpdate` event target with `eMouseRawUpdate` or
`eTouchRawUpdate` event message. Therefore, the method should not assert
it and instead, `EventDispatcher::Dispatch` should check it since it's
the only one dispatcher of `WidgetEvent`.

Differential Revision: https://phabricator.services.mozilla.com/D302943
2026-05-29 04:02:10 +00:00
Hiroyuki Ikezoe 9c267d0a95 Bug 2011842 - Filter out invalid message events. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D300226
2026-05-19 12:27:13 +00:00
canalun 14ddbe307c Bug 1929118 - Stop including CSS(Animation|Transition) headers from ContentEvents header. r=emilio,masayuki
As a follow-up on D295112, this patch removes the inclusion of CSS(Animation|Transition)
headers from ContentEvents.h by forward-declaring those classes and moving the implementations
that require complete types into WidgetEventImpl.cpp. This also required the followings:
- moving AnimationEventDispatcher::Dispatch() out of the header, because it also needs the
  full definitions of CSS(Animation|Transition).
- adding CSS(Animation|Transition) headers to Event.cpp, which needs the full definitions and
  had obtained them by including ContentEvents.h before this patch.

Differential Revision: https://phabricator.services.mozilla.com/D298064
2026-05-05 06:27:29 +00:00
Masayuki Nakano 36d387ec65 Bug 2023902 - part 6 - Make nsGUIEventIPC validate WidgetEvent::mClass value strictly r=smaug
If it has wrong value, it's difficult to understand that how an odd
case caused by that occurred. So, detecting that as far as possible
makes it easier to understand the root cause.

Differential Revision: https://phabricator.services.mozilla.com/D295205
2026-04-24 14:16:05 +00:00
Stephen A Pohl 1529adfb4e Bug 2027361: Optimize widget pointer altitude angle and azimuth angle calculations. r=bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D291988
2026-04-04 21:50:08 +00:00
Norisz Fay ef0051e4ae Revert "Bug 2027361: Optimize widget pointer altitude angle and azimuth angle calculations. r=bradwerth" for causing failures @ pointerevent_tiltX_tiltY_to_azimuth_altitude.html
This reverts commit 167820da19.
2026-04-04 05:33:12 +00:00
Stephen A Pohl 167820da19 Bug 2027361: Optimize widget pointer altitude angle and azimuth angle calculations. r=bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D291988
2026-04-04 01:07:21 +00:00
serge-sans-paille 115d971353 Bug 2025273 - Activate modernize-loop-convert clang-tidy check r=media-playback-reviewers,webrtc-reviewers,profiler-reviewers,firefox-svg-reviewers,canaltinova,longsonr,mjf,alwu
This is mostly the result of running ./mach static-analysis check --fix
with the new linter activated, with the following caveats:

- use std::fill when it makes sense
- use appropriate names for the loop target variable
- fix constness
- use array default initialization instead of an explicit loop when it
  makes sense

Differential Revision: https://phabricator.services.mozilla.com/D289172
2026-03-26 12:27:13 +00:00
Sylvestre Ledru 4f6b8b516d Bug 2023419 - Remove Emacs/Vim modelines from widget/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287877
2026-03-16 17:22:02 +00:00
Masayuki Nakano 42a0fe9a4b Bug 2019372 - Clear native key bindings of the reply event r=smaug
The parent process should handle only the shortcut key and access key
when it receives a reply key event. Thus, the editor commands are not
required, but the copy cost may not be cheap. Therefore, we should stop
copying them and the parent process should check whether the reply event
has unexpected edit commands or not.

And also this makes `nsGUIEventIPC.h` sanitizes the `KeyNameIndex` and
`CodeNameIndex`.

Differential Revision: https://phabricator.services.mozilla.com/D286456
2026-03-08 06:19:43 +00:00
Emilio Cobos Álvarez 077d88e977 Bug 2011213 - Remove FMT_STRING() usage. r=padenot
Should not be needed now that we build with C++20.

Differential Revision: https://phabricator.services.mozilla.com/D279521
2026-01-19 15:12:33 +00:00
serge-sans-paille d6013f1999 Bug 2010520 - Use .inc extension for X macro files in dom/ r=media-playback-reviewers,webidl,firefox-svg-reviewers,padenot,devtools-reviewers,ochameau,smaug
Differential Revision: https://phabricator.services.mozilla.com/D279132
2026-01-17 20:45:05 +00:00
serge-sans-paille e8c55440a6 Bug 2010520 - Use .inc extension for X macro files in widget/ r=geckoview-reviewers,win-reviewers,gstoll,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D279131
2026-01-17 20:37:51 +00:00
Pier Angelo Vendrame 56fc255e57 Bug 1991701 - Re-enable touch on Linux with RFP and remove RFPTarget::PointerId. r=tjr,layout-reviewers,emilio
On Windows, we do not spoof touch-related inputs anymore, and we
pretend touch is always available.
There is no reason not to do the same on Linux, even though the code to
report the number of maxTouchPoints is not implemented there.

Differential Revision: https://phabricator.services.mozilla.com/D267266
2025-11-05 18:52:50 +00:00
serge-sans-paille 7662b3abdc Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 19:36:01 +00:00
Cristina Horotan 8a1b1970b7 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing Gtest failures on AlreadyAddRefed.h
This reverts commit e98adca292.
2025-10-21 16:16:29 +00:00
serge-sans-paille e98adca292 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 15:05:17 +00:00
Cristina Horotan aab924e90d Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing build bustage at nsBrowserApp.cpp
This reverts commit fd0ffa193c.
2025-10-21 10:44:13 +00:00
serge-sans-paille fd0ffa193c Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 09:44:11 +00:00
Narcis Beleuzu e1e6bbb1c9 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing bustages on Document.cpp
This reverts commit b23c15e927.
2025-10-21 06:34:58 +00:00
serge-sans-paille b23c15e927 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 06:01:36 +00:00
agoloman 50c5bd8525 Revert (Bug 1987929, Bug 1991701) - for causing perma failures @test_pointer_event.html.
This reverts commit 35055c39b0.

Revert "Bug 1991701 - Re-enable touch on Linux with RFP and remove RFPTarget::PointerId. r=tjr,layout-reviewers,emilio"

This reverts commit 00f1baf7d5.
2025-10-21 00:21:59 +00:00
Pier Angelo Vendrame 00f1baf7d5 Bug 1991701 - Re-enable touch on Linux with RFP and remove RFPTarget::PointerId. r=tjr,layout-reviewers,emilio
On Windows, we do not spoof touch-related inputs anymore, and we
pretend touch is always available.
There is no reason not to do the same on Linux, even though the code to
report the number of maxTouchPoints is not implemented there.

Differential Revision: https://phabricator.services.mozilla.com/D267266
2025-10-20 21:23:16 +00:00
Masayuki Nakano a27e993972 Bug 769207 - part 13: Get rid of MutationEvent r=smaug,dom-core,webidl
Differential Revision: https://phabricator.services.mozilla.com/D263064
2025-09-08 00:28:20 +00:00
Emilio Cobos Álvarez f4bc770eef Bug 1987024 - De-comify a bit command handling. r=masayuki,dom-core
The nsIControllerCommandTable already assumes it's an
nsControllerCommandTable as it has infallible casts. Similarly,
nsIControllerCommand doesn't need to be scriptable.

This is in preparation to expose a global list of always-enabled
commands for the IPC code to use and avoid sending back and forth.

Differential Revision: https://phabricator.services.mozilla.com/D263807
2025-09-05 10:30:55 +00:00
Masayuki Nakano 05022d5218 Bug 1979332 - part 1: Add logging code of synthesizing ePointerMove r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D259753
2025-08-08 00:56:08 +00:00
Masayuki Nakano eb51dedf6d Bug 1967878 - part 2: Make PresShell synthesize ePointerMove separately from eMouseMove r=edgar,smaug,dom-core
Pointer Events should be handled per `pointerId`.  However, currently,
we dispatch pointer boundary events at a layout change only for the
last pointer which updated the last mouse location because we dispatch
a synthesized `ePointerMove` as a preceding pointer event of a synthetic
`eMouseMove`.

This patch makes `PointerInfo` store the last pointer state for each
`pointerId`.  Then, the synthesizer can dispatch synthetic
`ePointerMove` for any active `pointerId`s.  Finally, `PresShell` can
stop handling a preceding `ePointerMove` for a synthetic `eMouseMove`.

Differential Revision: https://phabricator.services.mozilla.com/D252780
2025-06-16 12:54:17 +00:00
Masayuki Nakano 90cd469f14 Bug 1550462 - part 2: Make PresShell::HandleEvent dispatch preceding pointerrawupdate event r=smaug,dom-core,edgar
This patch tries to dispatch ePointerRawUpdate with
PresShell::EventHandler::DispatchPrecedingPointerEvent as same as usual
pointer events.

For using the path, this patch adds 2 internal events, eMouseRawUpdate
and eTouchRawUpdate which are never dispatched into the DOM because
PresShell::EventHandler::DispatchPrecedingPointerEvent will return false
for that and then the caller will stop handling the internal events.

There are 3 dispatchers of the internal raw update events.

One is PresShell::EnsurePrecedingPointerRawUpdate(). This dispatches the
internal event if and only if the coming event of PresShell::HandleEvent will
cause ePointerMove. The reason why PresShell::HandleEvent handles the
preceding raw-update event is, we should support ePointerRawUpdate events
for synthesized events for tests (in-process ones) and in the main process.
Additionally, if a pointerrawupdate event may destroy the target <iframe>.
In such ase, the following pointermove may need to be dispatched on its parent
window or another <iframe> window. Therefore, we need to dispatch the
internal raw update event before considering the target window (PresShell) and
handling the capturing element.

The others are BrowserChild::RecvRealMouseMoveEvent and
BrowserChild::RecvRealTouchMoveEvent. They dispatch the internal events
when they won't dispatch the received event immediately to coalesce with further
similar input.

For avoiding to dispatch the internal event for same source event, this adds
WidgetPointerHelper::convertToPointerRawUpdate member to check it in
PresShell::HandlePrecedingPointerRawUpdate.

Differential Revision: https://phabricator.services.mozilla.com/D243404
2025-05-16 09:53:52 +00:00
Masayuki Nakano 0835ca3b3f Bug 1550462 - part 1: Define pointerawupdate event r=smaug
This patch just defines the event message, an atom for event listener attribute
and managing whether the window may have a listener.

Differential Revision: https://phabricator.services.mozilla.com/D243403
2025-05-16 09:53:48 +00:00
Alexandru Marc 46de26821c Revert "Bug 1550462 - part 3: Enable pointerrawupdate event r=smaug" for causing mochitest failures @ test_pointerrawupdate_event_count.html
This reverts commit eb27445e03.

Revert "Bug 1550462 - part 2: Make `PresShell::HandleEvent` dispatch preceding `pointerrawupdate` event r=smaug,dom-core,edgar"

This reverts commit 502f22686c.

Revert "Bug 1550462 - part 1: Define `pointerawupdate` event r=smaug"

This reverts commit 2b13850454.
2025-05-16 06:32:12 +00:00
Masayuki Nakano 502f22686c Bug 1550462 - part 2: Make PresShell::HandleEvent dispatch preceding pointerrawupdate event r=smaug,dom-core,edgar
This patch tries to dispatch `ePointerRawUpdate` with
`PresShell::EventHandler::DispatchPrecedingPointerEvent` as same as usual
pointer events.

For using the path, this patch adds 2 internal events, `eMouseRawUpdate`
and `eTouchRawUpdate` which are never dispatched into the DOM because
`PresShell::EventHandler::DispatchPrecedingPointerEvent` will return `false`
for that and then the caller will stop handling the internal events.

There are 3 dispatchers of the internal raw update events.

One is `PresShell::EnsurePrecedingPointerRawUpdate()`.  This dispatches the
internal event if and only if the coming event of `PresShell::HandleEvent` will
cause `ePointerMove`.  The reason why `PresShell::HandleEvent` handles the
preceding raw-update event is, we should support `ePointerRawUpdate` events
for synthesized events for tests (in-process ones) and in the main process.
Additionally, if a `pointerrawupdate` event may destroy the target `<iframe>`.
In such ase, the following `pointermove` may need to be dispatched on its parent
window or another `<iframe>` window.  Therefore, we need to dispatch the
internal raw update event before considering the target window (`PresShell`) and
handling the capturing element.

The others are `BrowserChild::RecvRealMouseMoveEvent` and
`BrowserChild::RecvRealTouchMoveEvent`.  They dispatch the internal events
when they won't dispatch the received event immediately to coalesce with further
similar input.

For avoiding to dispatch the internal event for same source event, this adds
`WidgetPointerHelper::convertToPointerRawUpdate` member to check it in
`PresShell::HandlePrecedingPointerRawUpdate`.

Differential Revision: https://phabricator.services.mozilla.com/D243404
2025-05-15 03:22:44 +00:00
Masayuki Nakano 2b13850454 Bug 1550462 - part 1: Define pointerawupdate event r=smaug
This patch just defines the event message, an atom for event listener attribute
and managing whether the window may have a listener.

Differential Revision: https://phabricator.services.mozilla.com/D243403
2025-05-15 03:22:40 +00:00
Masayuki Nakano 8b4fe4eb96 Bug 1953344 -Check the event message and mPressure value before considering its new value r=edgar
I'm not sure why the pen input causes running `CoalescedMouseData::Coalesce`,
but according to the bug report, it runs actually.

This patch adds a new method to `WidgetMouseEventBase` to compute it from
`mPressure` and `mButtons` and make both `CoalescedMouseData::Coalesce` and
`PointerEventHandler::InitPointerEventFromMouse` use it.

Differential Revision: https://phabricator.services.mozilla.com/D241530
2025-03-20 11:27: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
longsonr e4a60617d2 Bug 1933072 - Use NS_hypot to calculate hypotenuse r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D230043
2024-11-27 18:31:59 +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
serge-sans-paille 05acc5a9a3 Bug 1921348 - Remove global constructor from layout/generic/nsTextFrame.cpp r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D223872
2024-10-04 09:55:14 +00:00
David Parks 2f776696c6 Bug 1910452: Part 1 - Intercept drop events for content analysis r=smaug,dlp-reviewers,gstoll,reusable-components-reviewers,mstriemer
Sends OOP drop events to content analysis for approval before sending them to
the DOM.  It intercepts drop events at the browser level and sends them to CA
before calling stopPropagation and preventDefault on them.  (CA also presents a
modal dialog over the tab.) The drag session then ends as usual in the parent
process but remains open on the related browser in the process where it would be
sent to the DOM while the drop is being analyzed.  While CA runs, the browser
dispatches an eQueryDropTargetHittest event to locate the drop target while the
event screen coordinates are still valid.  When CA is complete, a drop or
dragexit event is sent to the drop target (drop if it was approved by CA). Calls
to EndDragSession are delayed during this.

Differential Revision: https://phabricator.services.mozilla.com/D219201
2024-09-11 23:02:22 +00:00
Fatih 18108c9758 Bug 1826051: Improve PointerEvents RFP target for Android. r=tjr
- This patch separates RFPTarget::PointerEvents into PointerEvents and PointerId.
- PointerId protection is disabled for Android.
- WidgetEvents emit non-primary mouse events on Android because any touch other than 1nd touch is considered non-primary
- Sets maximum touch points to 5 on Android

Differential Revision: https://phabricator.services.mozilla.com/D221241
2024-09-10 14:37:50 +00:00
Makoto Kato 1c0209f5f5 Bug 1902949 - button and buttons property of contextmenu should be touch contact. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D220508
2024-09-02 02:50:04 +00:00
Masayuki Nakano a0a9b98b9b Bug 1793267 - Make PostEventHandler::CheckPointerCaptureState synthesize ePointerMove and eMouseMove if nobody captures the pointer anymore r=smaug
When an element starts capturing a pointer, pointer/mouse boundary events are
dispatched by `EventStateManager::PreHandleEvent` [1].  However, when the
capturing element loses the capture, they are not dispatched.

When the pointer capture is implicitly released, the pointer may be over another
document.  Therefore, this patch synthesizes an internal `ePointerMove` and
`eMouseMove` on the widget to make `PresShell::HandleEvent` redirects the event
to proper document under the pointer.

Unfortunately, I add 2 manual tests into WPT.  The reason is, a drag operation
across document boundary with test driver does not work even if I specify the
pointer position within the parent document coordinates.  This is same both on
Firefox and Chrome.  Additionally, writing the new tests as a mochitest won't
work too.  If I use synthesized mouse events, I see similar failure.
Additionally, when I use native events, it works, but unstable to run on CI.

1. https://searchfox.org/mozilla-central/rev/669fac9888b173c02baa4c036e980c0c204dfe02/dom/events/EventStateManager.cpp#1139-1140

Differential Revision: https://phabricator.services.mozilla.com/D218896
2024-08-20 03:42:26 +00:00
Masayuki Nakano ada528874f Bug 1656377 - Implement PointerEvent.azimuthAngle and PointerEvent.altitudeAngle r=smaug
Currently, we set `tiltX` and `tiltY` on Windows, macOS and Linux.  However,
they don't let us know the new values directly.  Therefore, they are required
only for the DOM `PointerEvent`.

Differential Revision: https://phabricator.services.mozilla.com/D219128
2024-08-17 07:43:46 +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 16398887a4 Bug 1905267 - part 2: Make PresShell not use non-element event target when target frame is destroyed and the event wants Element target r=smaug
When event target frame is destroyed, `PresShell::NotifyDestroyingFrame` updates
current event target content to the frame content.  However, event target of
some DOM events need to be `Element`.  Therefore,
`PresShell::mCurrentEventTarget` needs to store at least the handling
`EventMessage` to consider whether the event target can be non-element content
node or only element node.  So, we need to make `PresShell::EventTargetInfo`
store `EventMessage`.  Then, we can make `PresShell::NotifyDestroyingFrame`
prefer inclusive ancestor element as new event target from the `EventMessage`.

Although I don't understand what's going on the reported case, but I found the
simple case when event target is changed to a `Text` with the assertion in
`PresShell::DispatchEventToDOM`.  Therefore, this patch has a new test.

Note that if target frame is a frame for element, e.g., when event target is
a focused element, `IsForbiddenDispatchingToNonElementContent` result won't
change the behavior.  Therefore, its implementation is not optimized for
non-user input events.

Differential Revision: https://phabricator.services.mozilla.com/D217205
2024-07-30 00:06:10 +00:00
David P 805b8742ba Bug 1893119: Part 3 - Add widget to nsContentUtils::GetDragSession r=gstoll,rkraesig
Updates each client of the nsContentUtils method to get the right drag session -- the one for the widget that is currently the source or target of the drag session.
The change to nsDOMWindowUtils::DispatchDOMEventViaPresShellForTesting() supports the change to WidgetDragEvent::InitDropEffectForTests() and enabled a
large number of test fixes in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D211067
2024-07-04 07:48:04 +00:00
Masayuki Nakano b3c5045ec1 Bug 1675847 - part 5: Make contextmenu event dispatchers use WidgetPointerEvent or PointerEvent r=smaug,pip-reviewers,devtools-reviewers,nchevobbe,mconley
`eContextMenu` event may be fired from `widget`.  Therefore, different from
`ePointerClick` and `ePointerAuxClick`, they may cross the process boundary,
may be handled by APZ and may be dispatched into the DOM after a delay.
Therefore, this patch is complicated than the previous patch.  This adds
* New IPC message handlers for sending/receiving a `WidgetPointerEvent`
* New `DelayedPointerEvent` class and templated `MouseInput::ToWidgetEvent`
* `PresShell::EventHandler` handles `eContextMenu` as same as `WidgetMouseEvent`

Differential Revision: https://phabricator.services.mozilla.com/D213003
2024-06-14 00:18:48 +00:00