Commit Graph
165 Commits
Author SHA1 Message Date
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
serge-sans-paille ae1341ef2a Bug 2020590 - Replace copy assignment by move assignment in misc subdirectory r=firefox-style-system-reviewers,layout-reviewers,emilio
Commit automatically generated through clang-tidy's
performance-use-std-move new pass.

- nsCOMPtr benefits from being moved
- Maybe type has a custom move-assign operator
- nsAutoCString benefits from being moved
- nsRegion benefits from being moved

Differential Revision: https://phabricator.services.mozilla.com/D285677
2026-03-06 10:47:28 +00:00
Emilio Cobos Álvarez 6c50119778 Bug 1994942 - Use FrameToWidgetOffset more and remove TranslateViewToWidget(). r=tnikkel,layout-reviewers
No intended behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D272109
2025-11-11 16:44:18 +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
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 ebfaa9e7aa Bug 1978818 - Make PositionedEventTargeting prefer actual nearest element if found nearest element is not directly clickable/touchable r=smaug,dom-core,layout-reviewers,emilio
In bug 1181763, we made the method retarget to inner element when
tapping/clicking around the inner element because there are nested
click event handlers in the reported case.  This should be reasonable
if the inner element is in a clickable/touchable element which is
different from the clickable/touchable element at the event point since
it's hard to click/tap a small element and users usually don't click/tap
around the another element to click/tap the outer element which should
be bigger than the inner one.

However, in the reported case in bug 1978818, the click event handler
may check the event target strictly.  Then, retargeting to an inner
element may block the user's intention.  Therefore, we should not
retarget if and only if the user clicks/taps outer element and already
found nearest target is clickable/touchable by the same element at
the clicked/tapped position.

Differential Revision: https://phabricator.services.mozilla.com/D261848
2025-09-16 02:33:35 +00:00
Masayuki Nakano ee7ef731c9 Bug 1983191 - Make PositionedEventTargeting use the nearest point in the frame region r=smaug,dom-core,layout-reviewers,emilio
The found frame may be covered by another frame.  However, current
implementation may use the covered frame as the target if it's the
nearest frame from the click/touch point.

A frame is covered by another frame means that web apps try to prevent
the users to click/tap the frame.  Therefore, current behavior may make
it possible to click/tap an element which is tried to hidden.  Thus,
current behavior may be not expected by both the web app developers and
the users.

This patch uses a part of intersection observer to get clipped border
box of a candidate frame.  So, if the frame is clipped by the
containers, the hidden region becomes not clickable/touchable.

NOTE: This backouts D67521 which is the patch for the test.  If the
resolution is not 1.0, it's fine to skip the midpoint tests on Android
because it's tested on the desktop platforms within the decimal world.

Differential Revision: https://phabricator.services.mozilla.com/D261223
2025-09-16 00:09:07 +00:00
Narcis Beleuzu 684357a96b Revert "Bug 1983191 - Make PositionedEventTargeting use the nearest point in the frame region r=smaug,dom-core,layout-reviewers,emilio" for causing failures on test_event_target_radius.html
This reverts commit 884f38e5c4.
2025-09-09 07:53:38 +00:00
Masayuki Nakano 884f38e5c4 Bug 1983191 - Make PositionedEventTargeting use the nearest point in the frame region r=smaug,dom-core,layout-reviewers,emilio
The found frame may be covered by another frame.  However, current
implementation may use the covered frame as the target if it's the
nearest frame from the click/touch point.

A frame is covered by another frame means that web apps try to prevent
the users to click/tap the frame.  Therefore, current behavior may make
it possible to click/tap an element which is tried to hidden.  Thus,
current behavior may be not expected by both the web app developers and
the users.

This patch uses a part of intersection observer to get clipped border
box of a candidate frame.  So, if the frame is clipped by the
containers, the hidden region becomes not clickable/touchable.

Differential Revision: https://phabricator.services.mozilla.com/D261223
2025-09-09 06:29:30 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Masayuki Nakano 8ac005d79b Bug 1957321 - Make FindFrameTargetedByInputEvent() refer clickable ancestors too for single touch start r=smaug
Pointer Events now defines that click event target should be the captured target
which is the target of the source event [1] and `pointerdown` will start
implicit pointer capture with its target when nobody explicitly sets pointer
capture [2].

Once we will use the standardized behavior in bug 1885232, touch input device
users will become harder to click an element which does not have touch event
listeners because `touchstart` event target which is same as the `pointerdown`
event target is not retargeted and it becomes the following `click` event
target.

Therefore, single touch start around clickable element should be retargeted to
the element if there is no touchable element.

Differential Revision: https://phabricator.services.mozilla.com/D245686
2025-04-17 04:05:15 +00:00
Botond Ballo 4a8910a31b Bug 1928758 - Avoid repositioning event if its target has not changed. r=ajakobi
The repositioning should be a no-op in such cases.

Differential Revision: https://phabricator.services.mozilla.com/D230888
2024-12-04 01:09:00 +00:00
Alex Jakobi 4d0af499d7 Bug 1914368 - Transform frame point back relative to its root r=botond
Differential Revision: https://phabricator.services.mozilla.com/D222658
2024-11-29 21:34:49 +00:00
Alex Jakobi 1328bd57c1 Bug 1733509 - Use TryInferEnclosingResolution for event retargeting. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D205378
2024-04-17 18:47:01 +00:00
Sandor Molnar aca279e8f8 Backed out changeset 6affdb4f3016 (bug 1733509) for causing gv-junit crashes @ TryInferEnclosingResolution CLOSED TREE 2024-04-16 03:37:01 +03:00
Alex Jakobi b176ebfb29 Bug 1733509 - Use TryInferEnclosingResolution for event retargeting. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D205378
2024-04-15 22:59:32 +00:00
Artur Iunusov 69470f6b4e Bug 1770944 - Remove nsGkAtoms::mozbrowser. r=smaug
Depends on D175898

Differential Revision: https://phabricator.services.mozilla.com/D183229
2024-03-07 13:04:22 +00:00
Narcis Beleuzu 197b39f007 Backed out 16 changesets (bug 1770944) as req by asuth.
Backed out changeset 61af32f40777 (bug 1770944)
Backed out changeset 4ff0c45db93b (bug 1770944)
Backed out changeset 8a217eff7bcd (bug 1770944)
Backed out changeset 6435f48c96bf (bug 1770944)
Backed out changeset 0d2432765ca0 (bug 1770944)
Backed out changeset 58e02566db85 (bug 1770944)
Backed out changeset 0a8c4c2460ee (bug 1770944)
Backed out changeset 9416bafd9982 (bug 1770944)
Backed out changeset 79de4f83fe2e (bug 1770944)
Backed out changeset 63ac518aceb0 (bug 1770944)
Backed out changeset 14952f872b77 (bug 1770944)
Backed out changeset f65e0967ad75 (bug 1770944)
Backed out changeset bd53c42038f7 (bug 1770944)
Backed out changeset 36c378ba8212 (bug 1770944)
Backed out changeset 9ba54ab06348 (bug 1770944)
Backed out changeset fb5a54b3cbe9 (bug 1770944)
2024-02-23 21:11:08 +02:00
Artur Iunusov c37653d8b7 Bug 1770944 - Remove nsGkAtoms::mozbrowser. r=smaug
Depends on D175898

Differential Revision: https://phabricator.services.mozilla.com/D183229
2024-02-22 10:13:14 +00:00
Sandor Molnar 6699491437 Backed out 16 changesets (bug 1770944) for causing asan failures @ dom/base/InProcessBrowserChildMessageManager.cpp
Backed out changeset b73885731e73 (bug 1770944)
Backed out changeset 23d0dc98eb51 (bug 1770944)
Backed out changeset 15661e24d8e1 (bug 1770944)
Backed out changeset 97aa839dc200 (bug 1770944)
Backed out changeset 0d4318bf3239 (bug 1770944)
Backed out changeset be28bb62e9f3 (bug 1770944)
Backed out changeset 708b2671410e (bug 1770944)
Backed out changeset 0a138f3b56b9 (bug 1770944)
Backed out changeset 3a149ef794c2 (bug 1770944)
Backed out changeset 4b6ae7dd0e69 (bug 1770944)
Backed out changeset e3960ad85182 (bug 1770944)
Backed out changeset 9ea253525227 (bug 1770944)
Backed out changeset 1828b66c2f7c (bug 1770944)
Backed out changeset 55b0886f9025 (bug 1770944)
Backed out changeset a4197071d10a (bug 1770944)
Backed out changeset 9b18524f541e (bug 1770944)
2024-02-20 20:34:55 +02:00
Artur Iunusov a79d7549bc Bug 1770944 - Remove nsGkAtoms::mozbrowser. r=smaug
Depends on D175898

Differential Revision: https://phabricator.services.mozilla.com/D183229
2024-02-20 16:53:23 +00:00
Emilio Cobos Álvarez 529c9ee321 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Makoto Kato fca0649181 Bug 1683747 - Don't use retarget when target is in <textarea>. r=botond,emilio
When using apz-retarget, hit test area is expanded. So if this area includes
previous line in <textarea>, we will select previous line. But when hit test
area is empty area of <textarea>, we should set caret to last character.

So I think that we should be disable apz-retarget if target is in <textarea>.

Differential Revision: https://phabricator.services.mozilla.com/D107441
2023-05-30 04:46:56 +00:00
Emilio Cobos Álvarez 1c58e2a928 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Emilio Cobos Álvarez e4291f8aba Bug 1761493 - Make Gecko internally consistent wrt what a link is. r=smaug
This is mostly edge-casey, but see bug 1757156 for an example where it's
causing some issues (granted, they could use `href="#"` or something
instead of an empty href).

It feels weird if a link looks like a link (because the CSS definition
of a link matches, which is "has an href") but then mostly doesn't
behave as a link.

We can't navigate anywhere if we don't have a valid URI but maybe JS
handles the relevant events as in bug 1757156.

Use the CSS definition (has href) since that's interoperable across
browsers. This should also make some stuff much faster (since checking
'is link' is now just a bit check instead of a virtual call).

(Awaiting try results, if no tests need adjustments then I need to write
some)

Differential Revision: https://phabricator.services.mozilla.com/D142107
2022-03-30 17:34:31 +00:00
Emilio Cobos Álvarez 3fad129a52 Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 17:00:36 +00:00
Butkovits Atila 64999a3215 Backed out 4 changesets (bug 1733384) for causing failures at browser_windowPrompt.js. CLOSED TREE
Backed out changeset fa609fadac26 (bug 1733384)
Backed out changeset dd1936d9fe17 (bug 1733384)
Backed out changeset 1a073e40ab1a (bug 1733384)
Backed out changeset 65708a4c708f (bug 1733384)
2021-10-07 17:52:51 +03:00
Emilio Cobos Álvarez 671a086845 Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 11:47:34 +00:00
Botond Ballo e8d07db92c Bug 1704062 - Fix include-what-you-use error in PositionedEventTargeting.cpp. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D116061
2021-05-27 04:32:10 +00:00
Edgar Chen 49c76bf979 Bug 1688105 - Part 2: Get rid of dom.w3c_pointer_events.enabled; r=smaug
Depends on D102668

Differential Revision: https://phabricator.services.mozilla.com/D102669
2021-01-25 16:22:44 +00:00
Kartikaya Gupta 90ea1bb5fe Bug 1686002 - Don't retarget touches if they land inside a clickable element. r=botond
Touches that land on a descendant of a clickable element should
not get retargeted to other nearby elements because the descendant
itself can react to those touch events.

Differential Revision: https://phabricator.services.mozilla.com/D102827
2021-01-23 06:00:21 +00:00
Simon Giesecke 46908cfb51 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Kartikaya Gupta 9ba6995eac Bug 1668870 - Ignore touch listeners in the system group for event retargeting. r=smaug
The audio/video controls element has touch listeners on the scrubber, which
steals events when we don't want it to. So let's ignore those listeners.

Ignoring system group listeners for the purposes of event retargeting seems
reasonable in the general case, because those listeners are coming from the
browser itself. If we're relying on the event retargeting to make those browser
elements easy to hit, then we should not be doing that and instead just make
them bigger.

Test coverage for this change is provided by the android-components tests that
failed in bug 1668112. The next patch re-enables touch event retargeting and
exercises this code in the context of those tests.

Depends on D92436

Differential Revision: https://phabricator.services.mozilla.com/D92437
2020-10-06 18:03:25 +00:00
Kartikaya Gupta caff9015a6 Bug 1666792 - Don't allow events to get retargeted outside the nearest z-index container. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D92157
2020-10-02 18:08:12 +00:00
Emilio Cobos Álvarez 96d2c59b95 Bug 1668156 - Make PositionedEventTargeting code not violate TransformRectToAncestor invariants. r=kats
And enable the assertion for the same-document case.

Without this patch, the assertion would fire in tests like
gfx/layers/apz/test/mochitest/test_group_zoom.html, where stuff like
MaybeHandleEventWithAccessibleCaret, which passes a non-root-frame down
here, and a target, which ends up violating the preconditions of
ClipToFrame, etc.

Enable the assertion for the same-document case, there are other
violations when fission is enabled in the cross-document case.

Differential Revision: https://phabricator.services.mozilla.com/D91966
2020-09-30 17:20:21 +00:00
Kartikaya Gupta 997b354950 Bug 1667656 - Replace AppendToString of nsRegion with ostream usage. r=mattwoodrow
Apparently a bunch of Stringify(nsRect) sites were getting converted to
Stringify(nsRegion(nsRect)) due to the the nsRegion implicit constructor, so
this updates those too.

Depends on D91524

Differential Revision: https://phabricator.services.mozilla.com/D91525
2020-09-28 01:14:00 +00:00
Kartikaya Gupta 79a7cd4e62 Bug 1667176 - Use ostream operator instead of AppendToString for nsPoint. r=mattwoodrow
Depends on D91338

Differential Revision: https://phabricator.services.mozilla.com/D91339
2020-09-25 08:57:24 +00:00
Kartikaya Gupta 996a33b90d Bug 1637908 - Introduce a touchable heuristic and use it for retargeting touch events. r=snorp
The existing heuristics in GetClickableAncestor have evolved over time to be
quite specific to mouse/click events, because those are the ones that we have
enabled by default. The heuristics we want for touch events are different and
should generally be very conservative, because we almost never want to retarget
the raw touch events. This patch introduces a new GetTouchableAncestor
function that implements this new conservative heuristic function and uses it
for determining the retargeting destination for touch events.

Differential Revision: https://phabricator.services.mozilla.com/D91027
2020-09-22 20:40:06 +00:00
Kartikaya Gupta 8283eeec29 Bug 1637908 - Minor cleanup. r=snorp
Depends on D91025

Differential Revision: https://phabricator.services.mozilla.com/D91026
2020-09-22 20:42:52 +00:00
Kartikaya Gupta e3b79a9c34 Bug 1637908 - Move the clickableAncestor computation further down. r=snorp
There's a few early-return conditions where we don't need to do this computation
at all. So this patch just moves the computation to after the early-returns. No
functional changes intended.

Differential Revision: https://phabricator.services.mozilla.com/D91025
2020-09-22 20:43:02 +00:00
lonocvb 4b3b2dc064 Bug 1662655 - Elements with pointer event are considered clickable. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D89236
2020-09-03 08:03:32 +00:00
Nicholas Nethercote b36ad5fb29 Bug 1572508 - Convert ui.touch.* and ui.mouse.* VarCache prefs to static prefs. r=KrisWright,kats,geckoview-reviewers,agi.
This is a weird conversion because the existing VarCache mirror prefs are in a
two static structs, one for touch prefs and one for the equivalent mouse prefs,
and we dynamically select the appropriate struct in `GetPrefsFor()`.

(But note that `ui.mouse.radius.reposition` and
`ui.mouse.radius.inputSource.touchOnly` do not have corresponding `touch`
prefs! For touch events they are always considered to be false.)

The commit make the following changes.
- It makes the prefs into static prefs.
- It moves the code in `GetPrefsFor()` into a constructor for
  `EventRadiusPrefs`, and copies the pref values into a temporary object of
  that type. Those copied values are then used by the subsequent code.
- It removes the two static `EventRadiusPrefs` structs.
- It renames some fields in `EventRadiusPrefs` to make them more closely match
  the pref names.

Differential Revision: https://phabricator.services.mozilla.com/D79405
2020-06-15 06:23:48 +00:00
Botond Ballo 4e0a9be574 Bug 1638594 - Log the viewport type in FindFrameTargetedByInputEvent(). r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D79588
2020-06-13 03:12:19 +00:00
Botond Ballo df4f0fd392 Bug 1637135 - Don't assume visual coordinates in event retargeting helpers. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D76996
2020-05-27 06:54:35 +00:00
Sylvestre Ledru f3c69f480a Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D73347
2020-05-09 14:51:53 +00:00
Botond Ballo 6748fc1cb3 Bug 1631568 - Have nsLayoutUtils::GetFrameForPoint() and GetFramesForArea() take a RelativeTo parameter. r=tnikkel
This removes the need for FrameForPointOptions::IsRelativeToLayoutViewport,
and makes sure each call site of these functions indicates whether the
input point/rect is in visual or layout coordinates.

Several call sites were passing in layout coordinates without setting the
IsRelativeToLayoutViewport flag, which this patch corrects.

Differential Revision: https://phabricator.services.mozilla.com/D71705
2020-05-05 15:24:12 +00:00
Botond Ballo 9703b5367d Bug 1556556 - Miscellaneous fixes related to event coordinate transformations. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D69639
2020-05-05 19:28:15 +00:00
Botond Ballo 320621dab4 Bug 1556556 - Perform app unit to milimetre conversion correctly in PositionedEventTargeting. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D68922
2020-05-05 19:27:52 +00:00
Botond Ballo b3354ab1ca Bug 1556556 - Use FrameForPointOption::IsRelativeToLayoutViewport when passing layout-relative coordinates to GetFrameForPoint(). r=kats
Differential Revision: https://phabricator.services.mozilla.com/D71455
2020-05-05 19:26:50 +00:00