Commit graph

33 commits

Author SHA1 Message Date
Narfinger
d1389378ad Incorporate suggestions.
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-05-27 11:33:58 +02:00
Narfinger
7de9716dc0 Fix a crash in the touch handler.
If some move events take the long route over the script thread but get
cleaned up by a fling the late one will crash the handler.
Now we just ignore move events that are already cleaned up.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-05-19 10:04:07 +02:00
Jonathan Schwender
1ea80c4335
touch: Fix panic with -Zconvert-mouse-to-touch (#36531)
- We previously converted all mouse move events to touch events, but we
should only be doing that while a mouse button is pressed (a finger
always does touch-down -> move -> up / cancel)
- Only consider Left mouse button for mouse-to-touch. We currently
already hardcode TouchId 0, which we would need to change in order to
properly support Multi-touch. Since we don't have any Multi-touch
gestures at the moment, we leave this unimplemented and simply only
evaluate the left mouse button.

Testing:  Manual testing. We don't have servodriver support yet.
Fixes: #36526

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-04-15 09:59:30 +00:00
Bi Fuguo
272da2981d
Fixed the crash issue when the openharmony web component is adapted. (#36229)
Signed-off-by: kongbai1996 <1782765876@qq.com>
2025-03-31 09:46:49 +00:00
Bi Fuguo
fa6463dc1b
Fixed an incorrect touchmove event triggered when the second finger is pressed. (#36218)
Signed-off-by: kongbai1996 <1782765876@qq.com>
2025-03-29 14:32:50 +00:00
Simon Wülker
bb0d08432e
Migrate to the 2024 edition (#35755)
* Migrate to 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Allow unsafe_op_in_unsafe_fn lint

This lint warns by default in the 2024
edition, but is *way* too noisy for servo.

We might enable it in the future, but not now.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Compile using the 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-13 10:28:11 +00:00
Bi Fuguo
f594691af9
Optimize IPC for non-cancelable touch events (#35785)
* The cancelable feature is optimized. If the cancelable feature is a non-cancelable feature, no message is sent back to the Compositor.
Add a warning log when prevent TouchsequenceInfo cannot be found.

Signed-off-by: kongbai1996 <1782765876@qq.com>

* fix Clippy Error Reported in the Pipeline.

Signed-off-by: kongbai1996 <1782765876@qq.com>

---------

Signed-off-by: kongbai1996 <1782765876@qq.com>
2025-03-04 06:46:25 +00:00
Bi Fuguo
a22f95a6a7
Fix the problem that touchmove crashes occasionally. Fix crash when multiple touch cancels occur (#35763)
* Fix the problem that touchmove crashes occasionally.
Check whether touchSequenceInfo exists when touch_sequence_map is modified in on_touch_event_processed.

Signed-off-by: kongbai1996 <1782765876@qq.com>

* Remove outdated todo.

We already transition to Finished in `on_touch_cancel`
in the Touch handler, so we don't need any logic
in the event handler.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

---------

Signed-off-by: kongbai1996 <1782765876@qq.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-03-03 15:30:57 +00:00
Bi Fuguo
f3a8bf8ca2
Touch handler: Fix race condition and rate-limit move events (#35537)
* TouchSequenceInfo is added to store information about a touch sequence.
  For details about TouchSequenceInfo, see the code comments.
The handling_touch_move attribute is added to the TouchHandler, indicating that the script is processing the touch move event.
  When handling_touch_move is set to true, the touch move event does not need to be sent to the script thread.

Signed-off-by: kongbai1996 <1782765876@qq.com>

* move touch state, active_touch_point and handling_touch_move to TouchSequenceInfo form TouchHandler.
remove TouchSequenceInfo end_sequence property, add Finished state mark sequence end.
if preventDefault on touchup, do not prevent Fling.

Signed-off-by: kongbai1996 <1782765876@qq.com>

* Refactor Touchhandler

- Add a newtype wrapper for the TouchSequenceId
- Move more state back into the TouchSequenceState
- Rename TouchAction to TouchMoveAction,
  since it only covers immediate actions now.
  Everything else is handled via state, since
  it needs to wait on the handler.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Fix test-tidy

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Fix clippy missing-default lint

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Fix remaining clippy lints

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Remove accidental committed test file

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Remove wrong todo comment

(move events that are sent to script are just raw  touchpoints,
 no merging needed)

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Fix preventdefault after long touch_down handler

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

---------

Signed-off-by: kongbai1996 <1782765876@qq.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-02-25 07:13:16 +00:00
Bi Fuguo
3fe42a0b5a
implement Touchevent prevent default behavior (#35031)
* implement Touchevent prevent default behavior

* The status change logic of the `TouchHandler` is changed.
> The `WaitingForScript` state is canceled. TouchAction can be identified
  based on the current touch type and numbers if touch points.
* Sends current event to script thread along with recognized `TouchAction`.
> After dispatch event, script thread sends a `TouchEventProcess(EventResult)`
  message to main thread. If the event is set to `DefaultAllowed`, the
  corresponding `TouchAction` information is added.
* After receiving `DefaultAllowed(TouchAction)` message, main thread executes corresponding action.
> `DefaultPrevented(TouchEventType)` is received. Use `prevent_click` to mark
  that the default `Click` is blocked, and `prevent_move` to mark that the
  default `Scroll` and `Zoom` are blocked. In this way, all TouchActions
  implement preventDefault.
Signed-off-by: Bi Fuguo <1782765876@qq.com>

* fix some suggestions

* support preventDefault fling
* move `TouchAction` to share touch directory
* check preventDefault everytime when touch
* fix zoom ineffective

Signed-off-by: Bi Fuguo <1782765876@qq.com>

* fix some suggestions

rename on_event_processed to  on_touch_event_processed
clear unused features

Signed-off-by: Bi Fuguo <1782765876@qq.com>

* Optimizes pan performance by continuously sliding without waiting for the eventhandler.

Signed-off-by: kongbai1996 <1782765876@qq.com>

* resolve conflict

Signed-off-by: kongbai1996 <1782765876@qq.com>

---------

Signed-off-by: Bi Fuguo <1782765876@qq.com>
Signed-off-by: kongbai1996 <1782765876@qq.com>
2025-02-17 10:50:04 +00:00
Martin Robinson
a1cf0cbf86
libservo: Stop using script_traits in the embedding layer (#35185)
Many types used directly in the `libservo` API are in the
`script_traits` crate, which was created to break circular dependencies.
Move all API exposed types to `embedder_traits` which now contains types
exposed via the `libservo` embedding API. Also expose these at the root
of the `libservo` `servo` crate so that the API won't break when they
move around in the future.

The idea with `embedder_traits` in the future is that it contains types
that are available throughout servo because they are used in the
embedding API and thus should have minimal dependencies on other Servo
crates (a bit like `base`).

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-28 11:15:36 +00:00
Bi Fuguo
dd06416ed5
fix click event when long time in touchstart (#34812)
* fix click event when long time in touchstart

Signed-off-by: kongbai1996 <1782765876@qq.com>
Signed-off-by: Bi Fuguo <1782765876@qq.com>

* update TouchAction::Click condition

Signed-off-by: Bi Fuguo <1782765876@qq.com>

---------

Signed-off-by: kongbai1996 <1782765876@qq.com>
Signed-off-by: Bi Fuguo <1782765876@qq.com>
2025-01-14 06:44:27 +00:00
Nico Burns
63793ccbb7
Use webrender_api::units::DevicePixel rather than style_traits::DevicePixel unless interfacing with Stylo (#34353)
* Use webrender_api::units::DevicePixel rather than style_traits::DevicePixel unless interfacing with Stylo

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix OpenHarmony build

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2024-11-25 23:42:04 +00:00
Jonathan Schwender
72971bd271
Add simple fling implementation (#33219)
* Add simple fling implementation

Add a simple fling implementation, which depends on a refresh tick from the
embedder.
Currently this refresh tick is only implemented for OpenHarmony
(using the vsync signal).
The fling implementation is very simple, without any fancy things like acceleration.
This can be improved in the future.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Multiply initial velocity with 2

This makes the experience much more snappy.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* address review comments

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Rename constants and add todo

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* fmt

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Add a few periods to make comments consistent

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-11-10 10:15:42 +00:00
eri
03d64d0675
clippy: Fix assorted warnings in components/ (#31628)
* clippy: fix assorted warnings in `components/`

* fix: new and default

* fix: review comments
2024-03-13 08:31:58 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
kingdido999
e4cd04399e Format component compositing #21373 2018-08-31 08:19:22 +08:00
janczer
661d234c3c Change debug assertions to specific ones 2018-02-07 09:21:24 +01:00
Simon Sapin
e17697fb0e Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender 2017-12-08 14:32:28 +01:00
Alan Jeffrey
caa3585219 Fixed scaling artefacts in paint worklets caused by zoom and hidpi. 2017-07-20 17:25:50 -05:00
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
Glenn Watson
0af27a3434 Rename ScreenPx to DeviceIndependentPixel. 2017-02-22 14:37:24 +10:00
Ms2ger
7879edb451 Move DevicePixel to script_traits. 2017-01-11 15:27:14 +01:00
Corey Farwell
531289ebb7 Indicate items in doc comments as code-like. 2016-11-08 09:33:03 -05:00
Glenn Watson
acfdfd2fa9 Remove old rendering backend.
This removes paint threads, rust-layers dependency, and changes
optional webrender types to be required.

The use_webrender option has been removed, however I've left
the "-w" command line option in place so that wpt
runner can continue to pass that. Once it's removed from there
we can also remove the -w option.

Once this stage is complete, it should be fine to change the
display list building code to generate webrender display
lists directly and avoid the conversion step.
2016-10-18 10:21:27 +10:00
Martin Robinson
6259df5e2d Update to euclid 0.8 2016-08-12 03:12:06 +02:00
Johannes Linke
6b215f38ee Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
Beomjin Kim
2637d30c2a Moved ScriptToCompositorMsg enum and EventResult enum to script_traits
Moved ScriptToCompositorMsg enum and EventResult enum to script_traits
resolving issue #8835.
2015-12-20 00:31:33 +09:00
Matt Brubeck
eb2a37d41c Refactor touch handling and add pinch zoom gesture 2015-12-16 10:03:49 -08:00