Commit Graph
154 Commits
Author SHA1 Message Date
Masayuki Nakano b2c2b3dc61 Bug 1913925 - Allow WidgetMouseEvent whose mIgnoreCapturingContent and/or mSynthesizeMoveAfterDispatch is true to cross a process boundary r=smaug
We didn't have any ideas of crossing mouse/pointer events which finally cause
synthesized move event to dispatch corresponding boundary events.  However,
`mSynthesizeMoveAfterDispatch` of `eMouseUp` is set to `true` in most cases
because the preceding `ePointerUp` causes releasing implicit capture and
`eMouseUp` may be handled in `EventStateManager::HandleCrossProcessEvent` if
there is a remote target underneath the pointer after `ePointerUp` is handled.
Therefore, we should allow such `eMouseUp` events to cross the process
boundary, but we don't need to copy the members (See the comment in
`ParamTraits<mozilla::WidgetMouseEvent>` for the reason).

I have no idea how to write the xorigin test within WPT. Therefore, this patch
does not contain new test.

Differential Revision: https://phabricator.services.mozilla.com/D220773
2024-09-04 00:28:10 +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 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 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
jackyzy823 94a7d247eb Bug 1757352 - Dispatch contextMenu event when right-clicking. r=geckoview-reviewers,m_kato,botond
Differential Revision: https://phabricator.services.mozilla.com/D200462
2024-03-23 07:24:24 +00:00
Thiago Marques bf8096e153 Bug 1837832 - Change parameter types from T to Coord where appropriate in the remainder of the BasePoint interface r=botond
Differential Revision: https://phabricator.services.mozilla.com/D180814
2023-06-16 18:04:23 +00:00
Mike Hommey 74365b6dfd Bug 1836890 - Remove uses of chromium's OS_* macros in Gecko code. r=nika,media-playback-reviewers,keeler,gfx-reviewers,emilio,necko-reviewers,kershaw,karlt,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D180039
2023-06-06 20:00:47 +00:00
Olli Pettay f18298c006 Bug 1807812 - Remove WidgetEventTime::mTime, r=masayuki,geckoview-reviewers,m_kato
HTMLSelectEventListener changes are needed, since currently that code works somewhat by accident given that
mTime often contains totally bogus values, like PR_IntervalNow(). Those changes then reveal issues also in
browser_editAddressDialog.js.

Differential Revision: https://phabricator.services.mozilla.com/D165618
2023-01-02 12:31:40 +00:00
Hiroyuki Ikezoe d52a0e8301 Bug 1794070 - Refer mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection flag instead of calling SwipeTrackker::CanTriggerSwipe(). r=botond
And rename mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection to
mMayTriggerSwipe.

So basically once after the flag is set, we should use it.

Differential Revision: https://phabricator.services.mozilla.com/D160436
2022-11-22 06:52:52 +00:00
Hiroyuki Ikezoe 2e9c5c3c35 Bug 1794070 - Make mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection private. r=botond
And initialized it only in ctors so that in the next change we can use it to
tell whether this pan event may trigger swipe or not without calling
SwipeTracker::CanTriggerSwipe every time.

There's an unintuitive change in a GTest sending a horizontal pan-start event.
With this changeset, all incomming pan-start events on desktop platforms
basically set mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
to true even if the event is generated in GTests. So the pan start event runs
into the short circuit path for swipe-to-navigation. This is a good thing because
it means the GTest replicates what our browser does properly.

Differential Revision: https://phabricator.services.mozilla.com/D160435
2022-11-22 06:52:51 +00:00
Butkovits Atila 3eac621efe Backed out 13 changesets (bug 1794070) for causing failures at browser_test_swipe_gesture.js. CLOSED TREE
Backed out changeset afe487b23e1c (bug 1794070)
Backed out changeset b119052f690d (bug 1794070)
Backed out changeset 733188f6b7ca (bug 1794070)
Backed out changeset 53273c86140a (bug 1794070)
Backed out changeset e2e39e61efbe (bug 1794070)
Backed out changeset 93b240feb781 (bug 1794070)
Backed out changeset 78aea5c32e14 (bug 1794070)
Backed out changeset 158008a6363b (bug 1794070)
Backed out changeset 3c3e76c8bf49 (bug 1794070)
Backed out changeset 39beb7abc321 (bug 1794070)
Backed out changeset 0ded01fbbd9e (bug 1794070)
Backed out changeset cf4552e5e11b (bug 1794070)
Backed out changeset 317ee240609d (bug 1794070)
2022-11-21 13:41:34 +02:00
Hiroyuki Ikezoe e7ad03fefc Bug 1794070 - Refer mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection flag instead of calling SwipeTrackker::CanTriggerSwipe(). r=botond
And rename mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection to
mMayTriggerSwipe.

So basically once after the flag is set, we should use it.

Differential Revision: https://phabricator.services.mozilla.com/D160436
2022-11-21 03:10:07 +00:00
Hiroyuki Ikezoe 2065d692fe Bug 1794070 - Make mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection private. r=botond
And initialized it only in ctors so that in the next change we can use it to
tell whether this pan event may trigger swipe or not without calling
SwipeTracker::CanTriggerSwipe every time.

There's an unintuitive change in a GTest sending a horizontal pan-start event.
With this changeset, all incomming pan-start events on desktop platforms
basically set mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
to true even if the event is generated in GTests. So the pan start event runs
into the short circuit path for swipe-to-navigation. This is a good thing because
it means the GTest replicates what our browser does properly.

Differential Revision: https://phabricator.services.mozilla.com/D160435
2022-11-21 03:10:07 +00:00
Razvan Cojocaru 363946e17f Bug 1060421 - Change the type of [Int]PointTyped::[x|y] back to [Int]CoordTyped. r=botond
[Int]CoordTyped no longer inherits Units because otherwise
instances of [Int]IntPointTyped may get one Base subobject because
it inherits Units, and others because of BasePoint's Coord members,
which end up increasing the [Int]CoordTyped's objects size (since
according to the ISO C++ standard, different Base subobject are
required to have different addresses).

Differential Revision: https://phabricator.services.mozilla.com/D160713
2022-11-04 18:29:35 +00:00
Botond Ballo accd4e180b Bug 1784849 - Use defaulted copy constructor for MultiTouchInput. r=hiro
This ensures all fields are copied, including new ones that
may be added in the future.

Differential Revision: https://phabricator.services.mozilla.com/D155306
2022-08-23 02:30:45 +00:00
Markus Stange f48511a7b6 Bug 1749352 - Remove unused mFollowedByMomentum. r=botond
Depends on D135922

Differential Revision: https://phabricator.services.mozilla.com/D135923
2022-03-03 04:11:15 +00:00
Emilio Cobos Álvarez 7b269cf2af Bug 1749172 - Fix typo (SCROLL_ASYNCHRONOUSELY -> SCROLL_ASYNCHRONOUSLY) in MouseEvents.h. r=hiro
I was looking at related code and this threw me off a bit.

Differential Revision: https://phabricator.services.mozilla.com/D135454
2022-01-10 21:57:20 +00:00
Eitan Isaacson 1925d59ec1 Bug 1744315 - P1: Introduce chrome-only MozMouseExploreByTouch event. r=botond
The goal of this event is for doing hit testing in content and emit an
accessibility event with the result for Android's explore by touch.

This event allows us to use APZ's ability to target the correct content
doc.

Differential Revision: https://phabricator.services.mozilla.com/D132840
2021-12-28 20:41:22 +00:00
Timothy Nikkel 6c32151a9a Bug 1678771. Set mIsNoLineOrPageDelta on WidgetWheelEvents we create from PanGestureInput when we don't know the line scroll amount so EventStateManager will fill those in for us. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D114358
2021-08-08 22:04:17 +00:00
Kagami Sascha Rosylight 9c4e9c2763 Bug 1710317 - Part 2: Add mButton[s] to WidgetTouchEvent r=aklotz,edgar
It's not ideal to have mButton[s] only to pass them to PointerEvent, but it's required anyway.

Differential Revision: https://phabricator.services.mozilla.com/D115509
2021-05-31 13:39:18 +00:00
Emilio Cobos Álvarez 90f95a2dfc Bug 1708829 - Expose WheelEvent.wheelDelta{,X,Y} for compat with other engines. r=masayuki
The behavior for non-trusted events matches Safari (Chrome does return
deltaX in that case, which seems pretty bogus, because the sign of the
wheelDelta* is the opposite as the delta* props).

Differential Revision: https://phabricator.services.mozilla.com/D114052
2021-05-14 15:17:33 +00:00
Sandor Molnar 27544563c9 Backed out 2 changesets (bug 1708829) for causing mochitest plain failures in test_continuous_wheel_events. CLOSED TREE
Backed out changeset 28faebd5fc72 (bug 1708829)
Backed out changeset 044c2060da7d (bug 1708829)
2021-05-14 17:12:03 +03:00
Emilio Cobos Álvarez 081349c25d Bug 1708829 - Expose WheelEvent.wheelDelta{,X,Y} for compat with other engines. r=masayuki
The behavior for non-trusted events matches Safari (Chrome does return
deltaX in that case, which seems pretty bogus, because the sign of the
wheelDelta* is the opposite as the delta* props).

Differential Revision: https://phabricator.services.mozilla.com/D114052
2021-05-14 12:41:30 +00:00
Kagami Sascha Rosylight 49f3a9cc0b Bug 1706420 - Part 2: Pass tilt/twist info via WidgetTouchEvent r=aklotz,edgar
Differential Revision: https://phabricator.services.mozilla.com/D113056
2021-05-07 18:01:28 +00:00
Kagami Sascha Rosylight c55a6e0893 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Differential Revision: https://phabricator.services.mozilla.com/D113055
2021-05-07 18:01:27 +00:00
Edgar Chen f2f6724e76 Bug 1672726 - Part 1: Rename MultiTouchInput::ToWidgetTouchEvent to ToWidgetEvent; r=botond
So it can be used in DispatchInputOnControllerThread template.

Differential Revision: https://phabricator.services.mozilla.com/D112127
2021-04-22 16:01:26 +00:00
Botond Ballo 294183d485 Bug 1700819 - Avoid dispatching pinch gesture events with mLineOrPageDeltaY == 0. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D110009
2021-03-27 23:29:19 +00:00
Masayuki Nakano 394c5aafdc Bug 1528289 - part 4: Prevent click event if APZC cancels autoscroll synchronously r=botond
The automated tests become orange only in macOS and 32bit Windows builds.  It
fails when left mouse button down is synthesized in the autoscroller (a XUL
`<panel>` element).  Although I'm not sure why that depends on the platform,
APZ cancels active autoscrolling before dispatching `mousedown` event.
Therefore, `AutoScrollParent` nor `AutoScrollChild` cannot block the following
click event.

Therefore, this patch adds new field into `APZEventResult` and set it to `true`
when APZ runs `autoscroll` but canceled by a mouse input.  Then, `nsBaseWidget`
can prevent following click event of `eMouseDown` and `eMouseUp` events as
expected before dispatching them into the DOM tree.  (FYI: Preventing click
event of either `eMouseDown` or `eMouseUp` can prevent the following `click`
event, etc.)

Differential Revision: https://phabricator.services.mozilla.com/D107325
2021-03-23 19:22:49 +00:00
Timothy Nikkel bb6bda6c2d Bug 1696802. Add code to support double tap to zoom on mac. r=botond,mstange
We already have a pref for double tap to zoom with is already enabled by default so it's kind of awkward to add another pref.

Differential Revision: https://phabricator.services.mozilla.com/D107389
2021-03-12 02:10:36 +00:00
alaaemad da14e0492e Bug 1692023 - Add more tests for Linux touchpad zooming r=botond
Differential Revision: https://phabricator.services.mozilla.com/D106132
2021-03-07 18:57:40 +00:00
Edgar Chen 41005632f4 Bug 1662363 - Rename eTopLevel/eChild to ePlatformTopLevel/ePlatformChild; r=smaug
This is a follow-up of bug 1653949.

Differential Revision: https://phabricator.services.mozilla.com/D100729
2021-01-05 09:48:24 +00:00
Markus Stange 95e16eac88 Bug 1615858 - Add MultiTouchInput::SingleTouchData::mHistoricalData. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D95649
2020-11-03 16:46:19 +00:00
Kartikaya Gupta 48867c8b5d Bug 1664558 - Propagate the layers id from InputData to gecko WidgetEvent types. r=botond
Seems like an oversight that these fields were never propagated from APZ to
the generated main-thread WidgetEvents.

Differential Revision: https://phabricator.services.mozilla.com/D94894
2020-10-28 22:02:00 +00:00
Edgar Chen 233a47eaf2 Bug 1666201 - Part 1: Rename ToWidget{Wheel|Mouse}Event to ToWidgetEvent; r=kats
So they can be used in template.

Differential Revision: https://phabricator.services.mozilla.com/D91490
2020-10-01 08:52:10 +00:00
Bogdan Tara 300de37f87 Backed out 5 changesets (bug 1662094, bug 1666201, bug 1520785) for pointerevent related failures CLOSED TREE
Backed out changeset 0ff76cb4b991 (bug 1662094)
Backed out changeset 94bf1aff7bff (bug 1520785)
Backed out changeset 1688cdab3d48 (bug 1666201)
Backed out changeset e960f750c588 (bug 1666201)
Backed out changeset cb30150e8289 (bug 1666201)
2020-10-01 11:46:32 +03:00
Edgar Chen e838bd8a8a Bug 1666201 - Part 1: Rename ToWidget{Wheel|Mouse}Event to ToWidgetEvent; r=kats
So they can be used in template.

Differential Revision: https://phabricator.services.mozilla.com/D91490
2020-09-30 17:29:17 +00:00
Edgar Chen 30cf17089d Bug 1662830 - Initialize mExitFrom in MouseInput::ToWidgetMouseEvent; r=smaug
This is missed in https://phabricator.services.mozilla.com/D88225.
MouseInput::ToWidgetMouseEvent is used only in Android.

Differential Revision: https://phabricator.services.mozilla.com/D89217
2020-09-07 09:32:47 +00:00
Timothy Nikkel c2617e2c1d Bug 1658001. Populate wheelEvent.mLineOrPageDeltaY in PinchGestureInput::ToWidgetWheel for pinch gestures produced from direct manipulation. r=kats
We do this analogously to how PanGestureInput does it except that the delta's that we compute mLineOrPageDeltaY from are computed by us instead of provided to us.

mLineOrPageDeltaY being non-zero is what EventStateManager::DispatchLegacyMouseScrollEvents uses to decide to send legacy mouse events, so we need to populate it to get those legacy events to send.

This fix is Windows only on purpose as pinches on macOS don't seem to send wheel events (Windows sends ctrl+wheel). When Linux gets implemented it will need to be determined what to do.

Differential Revision: https://phabricator.services.mozilla.com/D86495
2020-08-11 09:08:06 +00:00
Timothy Nikkel e23000ad3d Bug 1653700. Populate PanGestureInput::mLineOrPageDeltaX/Y when the events are produced from direct manipulation. r=kats
The macOS widget code already does this here

https://searchfox.org/mozilla-central/rev/d6d8fcc22c3820f2ae08229e0d37be19fba74db9/widget/cocoa/nsChildView.mm#3491

So we factor our a helper from the macOS widget code (which already does this) to use cross platform.

Differential Revision: https://phabricator.services.mozilla.com/D84059
2020-07-18 20:47:04 +00:00
Edgar Chen 70dac10e06 Bug 1648630 - Part 3: Propagate layers id to touch event properly for Fission; r=kats
Differential Revision: https://phabricator.services.mozilla.com/D81869
2020-07-03 07:45:35 +00:00
Edgar Chen fd998ea0a5 Bug 1648630 - Part 1: Remove MultiTouchInput::ToWidgetMouseEvent; r=kats
This was used in B2G and no one uses it now.

Differential Revision: https://phabricator.services.mozilla.com/D81816
2020-07-02 19:27:51 +00:00
Timothy Nikkel ec7e16ebf9 Bug 1648489. Send pinch starts events with some amount of scale instead of none with direct manipulation. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D81477
2020-07-01 09:31:03 +00:00
Kagami Sascha Rosylight 0eaeb35a2f Bug 1643464 - Part 3: Rename LEFT/RIGHT_BUTTON as PRIMARY/SECONDARY_BUTTON r=masayuki,geckoview-reviewers,snorp
Differential Revision: https://phabricator.services.mozilla.com/D80333
2020-06-19 17:50:43 +00:00
Kagami Sascha Rosylight 413c249077 Bug 1643464 - Part 1: Rename eLeft/eRight to ePrimary/eSecondary r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80331
2020-06-19 18:02:41 +00:00
Kartikaya Gupta 8a427f2db0 Bug 1627708 - Add a PinchGestureSource enum that indicates the source of a PinchGestureInput event. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D77828
2020-06-06 00:32:19 +00:00
Timothy Nikkel 969ee91b09 Bug 1643461. Fix calculation of deltaY when creating a widget wheel event from pinch input data on Windows. r=kats
The original code made the mistake of thinking that [event magnification] was a multiplicative quantity (ie if the scale changed from a to b then [event magnification] would be b/a). But it is an additive quantity (so b-a). If we then apply this knowledge to how we calculate the value from the Windows code we get the new formula.

The macOS and non-macOS code could be merged because mCurrentSpan is always 100.0 on macOS, but I'm not going to do that just yet because the Windows specific code isn't mature yet, so I'm not sure if we will need to tweak it more and my goal with this change was to just get the signs right to fix the worst bug. The scale can be addressed later if needed.

Differential Revision: https://phabricator.services.mozilla.com/D78479
2020-06-05 19:45:20 +00:00
Kartikaya Gupta 31956566b7 Bug 1632293 - Replace the BothFingersLifted() special case behaviour with a new pinch input type. r=tnikkel,botond
The BothFingersLifted() mechanism was a bit of a hack to handle the case that
with touch inputs, a user might be able to lift just one finger to transition
from a pinch to a pan or other kind of gesture. This isn't possible with
other kinds of pinch gestures, such as on trackpads or with mousewheels.
So instead of tracking that via special-case behaviour of mFocusPoint, or
adding an extra bool to the PinchGestureInput class, it seems cleaner to
separate the concerns by adding a new type of input event that explicitly
covers the "finger lifted" touch scenario. This patch implements this change,
and removes the BothFingersLifted() machinery.

Differential Revision: https://phabricator.services.mozilla.com/D74415
2020-05-11 16:56:57 +00:00
Botond Ballo ba5c0d6ae5 Bug 1556556 - Remove many uses of IgnoreRootScrollFrame. r=mstange,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D68913
2020-05-05 19:23:35 +00:00
Timothy Nikkel 69a40749b8 Bug 1619187. Handle content prevent defaulting pinch gestures. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D73217
2020-05-02 23:03:20 +00:00
Cosmin Sabou aa464541ea Backed out changeset 70d9a096070b (bug 1619187) for causing Gtest failures. CLOSED TREE 2020-05-02 03:29:43 +03:00