Commit Graph

222 Commits

Author SHA1 Message Date
Jonathan Schwender
37dfa42731 Unify servo package naming (#42916)
This is a preparation for publishing to crates.io. Changes include:
- Add `servo-` prefixes to avoid name collisions on crates.io
- Use `-` instead of `_` in package names.
- Rename the crates to their original names in Cargo.toml,
  to keep the diff minimal
- Rename `media` to `servo-media-thread` to avoid name collision with
  `servo-media` (originally from the media repository).

This is an outcome of the previous discussion at [#general > Switch
remaining git dependencies to
crates.io](https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Switch.20remaining.20git.20dependencies.20to.20crates.2Eio/with/576336288)

Testing: This should be mostly covered by our CI, but some amount of
breakage is to be expected, since some package names could still be
referenced from scripts which are not tested or run in CI. [mach try
run](https://github.com/jschwe/servo/actions/runs/22502945949)

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2026-03-01 14:15:27 +00:00
Euclid Ye
6c82b3178e paint: Track whether script is handling touchmove per TouchId (#42926)
As titled. The change is prepared a while ago to eliminate dead code, 
but the test case added requires change from `testdriver-actions.js`: 
https://github.com/web-platform-tests/wpt/pull/57607 just landed by
latest wpt-sync: https://github.com/servo/servo/pull/42925.

Part of https://github.com/servo/servo/issues/41923

Testing: Added a WPT test.
Fixes: https://github.com/servo/servo/issues/42921

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-03-01 08:54:24 +00:00
Steven Novaryo
d70ab4e1c0 script: Merge ScrollEvent with SetScrollStates messages (#42834)
Remove embedder defined `ScrollEvent` and merge the payload of it to the
`SetScrollStates` message which tell the `ScriptThread` to update the
scroll state.

In the past, `ScrollEvent` is defined as a embedder's `InputEvent` and
being used only to forward the external scroll node id for a node that
is considered scrolled. This make us sends an additional message to
constellation and additionally, `ScrollEvent` went through lengthy
pipelines as it was deemed as an embedder input event, albeit being a
synthetic input fired by `WebviewRenderer`.

Subsequently, we could introduce a flag to detect whether the scrolling
is still ongoing or not (like whether it is still flinging) for
`scrollend` event.

Testing: No WPT changes

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-02-26 07:36:55 +00:00
Steven Novaryo
ad358de589 libservo: Add allow_virtual_keyboard flag for InputMethodControl (#42467)
Following the convention of other major UAs of gating the virtual
keyboard by certain user activation, adding a flags to let the embedder
knows about the user activation. This would be used to determine whether
the virtual keyboard needs to be shown or not in android and ohos.

Testing: Manual testing.

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-02-24 07:30:49 +00:00
Euclid Ye
16f9f7500e webdriver: Retrieve viewport size in CSS pixel (#42628)
According to
[spec](https://w3c.github.io/webdriver/#ref-for-dfn-move-target-out-of-bounds-2:~:text=the%20viewport%20in%20CSS%20pixels),
we are supposed to retrieve viewport size in CSS pixel.

This is a critical step when performing scroll/pointermove, to stop
invalid actions that happen outside viewport.

Testing: Tested with tests in headed mode manually, narrowing
discrepancy between headed/headless mode. Should not have effect on
automated tests in CI.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-02-15 07:55:08 +00:00
Narfinger
870576f948 devtools: Implement MallocSizeOf for DevtoolsInstance (#42478)
This implements MallocSizeOf for DevtoolsInstance. Major changes:
- Newtype for ActorRegistry because AtomicRefCell<HashMap<String,
Arc<dyn Actor>>> did not like mallocsizeof (even with trait bound on
Actor)
- Implement MallocSizeOf for BTreeSet.
- Implement MallocSizeOf of 0 for AtomicU32 and TcpStream
- Ignore a couple of MallocSizeof for http::Method, http::HeaderMap and
json::Value

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Compilation is the test.
Fixes: Part of addressing https://github.com/servo/servo/issues/42453

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-02-10 17:32:47 +00:00
Narfinger
c324141fb4 base: This cleans up some old unneeded ignore annotation for MallocSizeOf and updates some descriptions (#42483)
We implemented many more MallocSizeOf tests (even if some such as
channels are zero).
Meaning we can not ignore more of it making the code cleaner.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Compilation is the test.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-02-09 17:34:03 +00:00
Euclid Ye
03d8d16748 paint: Track TouchId in PendingTouchInputEvent (#42468)
As you can tell from branch name, the initial goal is to add multi-touch
support for touchmove.
But things get too messy, so I decide to split into two PRs.

This PR
- Track `TouchId` in `PendingTouchInputEvent`
- Rename `id` to `touch_id` for `TouchId`. This is to make distinction
from `id: InputEventId`,
which became very confusing while implementing the initial goal.

Testing: No behaviour change.
Part of #41923

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-02-09 08:49:38 +00:00
Mukilan Thiyagarajan
79ed814ec1 libservo: Expand the UserContentManager API. (#42288)
The patch adds the following functionality to the per-WebView
`UserContentManager` API.
- Removing a `UserScript` at that was previously added.
- Adding a new `UserStyleSheet` representing a user-origin style sheet.
allow removing user script
- Removing a previously added `UserStyleSheet`.

There might be scope for some improvements in the API:
- `UserScript` and `UserStyleSheet` have different ways of representing
the source location - a `PathBuf` and `Url` respectively. This is due to
how those values are used by the underlying evaluation APIs in script
and stylo. More investigation is needed here and could be addressed in
future patches.

Testing: New unit tests are added for the user stylesheet APIs. Existing
tests have been updated to test the removal of user scripts.
2026-02-05 13:26:54 +00:00
Narfinger
8dfeaaf339 webgl: Move from IpcChannel to GenericChannel (#42033)
This moves WebGL component from IpcChannel to GenericChannel. Of note
are the following changes:
- Removal of WebGlSender and WebGlReceiver type alias. As we removed
them in a similar component earlier.
- Moving from IpcByteSender to IpcSender over serde_bytes::ByteBuf. I
think the tradeoff for easier reading is worth it.


Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Compilation and unit tests.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
2026-01-26 18:04:13 +00:00
Josh Matthews
872b7ba485 net: Convert blocking embedder communication to async (#41965)
#41857 exposed some more code in the net crate that performed blocking
communication with the embedder and could prevent other networking tasks
from running. To address that, we need the net code to perform async
receive operations, which requires passing tokio channels to the
embedder.

However, the current embedding message design puts all messages in the
same enum and requires that they are serializable. Embedder messages
from the network do not require this property, since they run in the
same process as the embedder. Therefore, this PR creates a new
EmbedderProxy structure that is generic over the message, allowing each
component of Servo to use a embedder message type that is specific to
that component.

The final benefit of this set of changes is that the embedder messages
for a particular crate can now live in the crate itself (since the only
crate that depends on it is the servo crate), not in the shared
`embedding_traits` crate. This hugely reduces the amount of code that
needs to be rebuilt when changing these messages, enabling much faster
incremental builds for those changes.

Testing: Strictly refactoring; existing test coverage is sufficient.
Fixes: #41958

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-01-21 19:49:01 +00:00
Josh Matthews
6e948ee9a9 script: Use document origin instead of URL when manipulating blobs. (#41966)
Retrieving the origin from the document's URL means the wrong origin can
be returned for documents like about:blank or about:srcdoc.

Testing: Newly-passing test involving a srcdoc and blob.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-01-17 07:31:41 +00:00
shuppy
c2530a49ee Plumb accessibility tree updates from layout to embedder (#41924)
this patch adds some new methods and messages that allow layout to send
the embedder [accessibility tree
updates](https://docs.rs/accesskit/0.22.0/accesskit/struct.TreeUpdate.html):

- layout —[ ScriptThreadMessage::AccessibilityTreeUpdate ]→ script
- script —[ EmbedderMsg::AccessibilityTreeUpdate ]→ libservo
- libservo —[ WebViewDelegate::notify_accessibility_tree_update() ]→
servoshell
- servoshell —[ PlatformWindow::notify_accessibility_tree_update() ]→
servoshell
- servoshell —[ Gui::notify_accessibility_tree_update() ]→ servoshell

Testing: none yet, no functional change
Fixes: part of #4344

---------

Signed-off-by: delan azabani <dazabani@igalia.com>
Co-authored-by: Luke Warlow <lwarlow@igalia.com>
Co-authored-by: Alice Boxhall <alice@igalia.com>
2026-01-16 12:32:08 +00:00
eri
8cf4955731 devtools: Correctly cache console messages (#41895)
Fix caching before the console is opened and stop sending messages
prematurely.

Fix line numbers not showing in console messages because of a missing
`rename_all`.

Remove `getCachedMessages` in favour of sending a list of messages as a
reply to the `watchResources` for `console-message`/`error-message` in
the watcher.

Remove `startListeners` and `stopListeners`. These are legacy methods of
watching properties before the watcher actor. It is preferred to enable
properties in `supported_resources` in the watcher than to use these
messages.

Remove `clearMessagesCache`, only `clearMessagesCacheAsync` seems to be
used now. Add a reply to `clearMessagesCacheAsync`.

Simplify a bit the structs for console messages and prefer serde's
annotations to manual serialization. Merge `handle_console_message` and
`handle_page_error`, and improve the usability of `ConsoleResource`.

Fix some fields in console messages. We are missing `source_id` for now.
This will be easier to add after better support for source actors. We
are also missing stack traces.

| Before | After |
| --- | --- |
| ![Console message list starting at 5 and counting up, showing the file
location but not the line
number](https://github.com/user-attachments/assets/b21159b4-1a95-46aa-9337-0004a922837c)
| ![Console message list starting at 1, showing both the file location
and line number. It says "Connected here" at message number
4](https://github.com/user-attachments/assets/f8ea1a7c-9262-4fa2-a882-cad35af9c2dc)
|

Testing: Manual testing
Fixes: #26666

---------

Signed-off-by: eri <eri@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-01-15 21:41:07 +00:00
Martin Robinson
3cda70dbbb script: Include click count as the detail of mouseup and mousedown events (#41833)
This change improves the counting of clicks for mouse button events by
ensuring that `detail` property of those events includes the click
count. This `detail` differs from that of `dblclick` events where the
`detail` is always 2. In addition, it ensures that the click count can
increase for mouse buttons that do not cause `click` and `dblclick`
events (such as the right mouse button).

Testing: This change adds two Servo-specific WPT-style tests. While this
behavior is specified a bit, the details are implementation specific.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2026-01-12 08:47:20 +00:00
Euclid Ye
014fb968a8 webdriver: Consolidates synchronous and asynchrounous script execution (#41830)
Follow-up to #41823.
Now that we always execute JS with callback, we can safely remove the
obsolete sync script handler.

- Rename `ExecuteAsyncScript` to `ExecuteScriptWithCallback`
- Remove `ExecuteScript` related logic.
- Rewrite async callback wrapper to simplify things.

Testing: I expect no change in behaviour. See if WPT tests agree with
it.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2026-01-11 09:19:09 +00:00
Narfinger
46011ff50c Script: Convert routed_promise to GenericCallback (#41380)
This changes routed_promise to use the GenericCallback functionality.
This mostly effected WebGPU but also Clipboard and Memory Reporting.

We also added a GenericCallback::new_blocking() functionality which
produces a callback and a channel
which then can be blocked on. This was used a couple of times in the
code.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: This should not change functionality.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-01-09 10:09:45 +00:00
Narfinger
13c875eeea Base: Dependency cleanup (#41777)
Removing some unused dependencies in components.

Like a rainforest
the dependencies are growing,
we need a machete.

Testing: Full mach try run here:
https://github.com/Narfinger/servo/actions/runs/20823235587

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-01-08 17:32:35 +00:00
Narfinger
1b8d1bf63c libservo: Stop exporting ipc-channel for gamepad responders and use callbacks (#41412)
With this we stop exporting ipc-channel in libservo and switch to
GenericChannel/GenericCallback.

Testing: Generic Channels are tested all over the place.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-01-06 16:57:02 +00:00
aquaThirsty
d808cc15d0 change #[allow]s to #[expect]s (#41635)
Changed most #[allow]s to #[expect]s, mainly for
clippy::too_many_arguments

Removed unfulfilled expectations

This is my first opensource contribution, so please let me know if
anything should
be done differently.

Testing: Refactor
Part of: #40838

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: TimurBora <timurborisov5561@gmail.com>
Co-authored-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
2026-01-03 10:54:27 +00:00
Narfinger
15aa6ee8c0 Base: Rename IpcSharedMemory to GenericSharedMemory (#41198)
In the future, servo components should depend on the generic channels in
base instead of IpcChannels to correctly optimize for multiprocess vs
non-multiprocess mode.
This reexports IpcSharedMemory as GenericSharedMemory in GenericChannel
and changes all dependencies on it.

Currently this is only a type/name change and does not change
functionality. But in the future we would want want to use non-ipc
things for the data.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: This changes types and does not need testing.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-12-31 13:07:59 +00:00
atbrakhi
ae6f56f194 Separate console.clear() from ConsoleLogLevel (#41495)
Separate `console.clear()` from `ConsoleLogLevel`. See
https://github.com/servo/servo/pull/41311#discussion_r2622642820

Testing: Tested locally. Unfortunately in DevTools tests we do not cover
console tab

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-12-23 14:27:04 +00:00
Mukilan Thiyagarajan
2ccd9f54ad libservo: Let UserContentManager be per WebView and add basic support for mutations. (#41352)
This change moves the `UserContentManager` abstraction from the
`ServoBuilder` to `WebViewBuilder` so that embedders can inject content
for each `WebView` independently. It also adds basic support for runtime
mutations to the `UserContentManager` API. Only adding new scripts is
currently supported, but future changes will add support for both other
mutations such as removal of scripts and addition & removal of
stylesheets. Future changes could also optimize the way mutations are
propagated to `ScriptThread`s by sending just the "delta" rather than
the whole `UserContents` structure for each mutation.

The `UserContentManager` now becomes just a convenient handle for the
embedders to invoke the mutation API while the actual management of the
manager's content is handled by the Constellation. The mutations are
relayed to the constellation via messages. The change also separates the
serialized version containg the user contents into a new `UserContent`
structure so that the API cannot be misused.

Testing: New unit tests have been added for the different scenarios
involving UserContentManager.

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-12-23 06:15:01 +00:00
WaterWhisperer
6623cc1dbb feat: gamepad feature flag (#41451)
Put the Gamepad API and its supporting infrastructure behind a `gamepad`
feature flag. This allows embedders to opt-out of gamepad support at
compile time to save on binary size and reduce dependencies.

Testing:
1. `./mach build -d` (Gamepad enabled by default)
2. `cargo build -p servoshell --no-default-features --features
"libservo/clipboard,js_jit,max_log_level,webgpu"` (Gamepad Disabled)
3. `cargo build -p servoshell --features "gamepad,webxr,..."` (Gamepad &
WebXR Enabled)

Fixes: #40897

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-12-21 13:18:06 +00:00
Narfinger
1b0bd11e11 Use GenericSender and GenericReceiver for WebDriver (#40987)
- Use the generic channel for webdriver.
- Implement try_receive_timeout for GenericReceiver.

Testing: WPT should still work.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-12-19 03:22:02 +00:00
atbrakhi
ba1122b4f5 Add ServoDelegate and WebViewDelegate methods for Console API (#41351)
Route console messages through the embedding API instead of printing
directly, giving embedders control over console output handling.

Testing: Should be covered by exsisting tests
Fixes: #41145

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-12-17 19:06:27 +00:00
atbrakhi
f3488b25a8 Move devtools_traits::LogLevel to embedder_traits (#41311)
This PR moves devtools_traits::LogLevel to embedder_traits in
preparation of upcoming work on creating a ServoDelegate and
WebViewDelegate method for Console API output. Also see
https://github.com/servo/servo/issues/41145

Testing: only moves code, no functional change
Fixes: part of https://github.com/servo/servo/issues/41145

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-12-16 10:38:30 +00:00
Martin Robinson
5b99d3c2b3 servoshell: Create new WebDriver WebViews in new toplevel windows (#41235)
This change makes it is that WebDriver can create whole new windows for
each new `WebView` in servoshell. The motivation for this is:

1. This is how the WebDriver specification is written. The command that
   create a new WebView is actually called "New Window" [^1], so this
   increases compliance with the specification and now we obey the
   type hint sent with that command.
2. This change allows testing multi-window support via the WPT.
3. This will allow adding optimizations (#39923) that are otherwise
   impossible because the WPT expects all open `WebView` to be live and
   visible.

This does not make the change yet for windows opened via `window.open()`
(popups), as that requires #41220 to fix. In order to make this possible
a few changes to the code had to take place:

1. The new `PlatformWindow` creation function has to be passed down to
   the WebDriver handler, which normally doesn't know how to make
   `PlatformWindow`s.
2. This allows moving the UI command code back to the shared part of
   servoshell, meaning that the embedded ports can use it as well
   eventually.
3. Headless windows need a real id to differeniate them now intead of
   just 0.
4. When dropping the headless `PlatformWindow` we need to make it
   current. I'm not sure why surfman doesn't do this, but this is now
   necessary as there are multiple contexts. This is also true when
   resizing the `RenderingContext`.

Finally, errors when making the context current are upgraded to
`error!`s as they typically break the entire execution of the program.

[^1]: https://w3c.github.io/webdriver/#new-window

Testing: This is tested by the entire WPT suite.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-16 10:11:33 +00:00
Martin Robinson
824f551f03 Rename IOCompositor to Paint (#41176)
For a long time, the "Compositor" hasn't done any compositing. This is
handled by WebRender. In addition the "Compositor" does many other
tasks. This change renames `IOCompositor` to `Paint`.

`Paint` is Servo's paint subsystem and contains multiple `Painter`s.
This change does not rename the crate; that will be done in a
followup change.

Testing: This just renames types and updates comments, so no new tests
are necessary.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-10 15:09:49 +00:00
Narfinger
c2f546da01 Base: Implement GenericOneshot channels (#41143)
This implements a GenericOneshot channel. The size in the crossbeam
channel is restricted while in the Ipc case we use the same
IpcChannel(for now).

We also use these channels in WebDriver to prove they work.

Testing: Unit Tests and compilation still works.
Fixes: https://github.com/servo/servo/issues/39019

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-12-09 10:36:59 +00:00
Narfinger
3321438da8 Documentation: Add documentation for EmbedderMsg to clarify (#41032)
EmbedderMsg go towards the Embedder. We clarify this.

Testing: Just a doc comment.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-12-03 15:20:57 +00:00
Martin Robinson
cf8c67df92 libservo: Finish the SimpleDialog API (#40982)
Finish exposing the `SimpleDialog` API in libservo, abstracting away the
response senders into structures with methods. In addition, add a
default behavior so that embedders do not have to explicitly send a
reponse when dialogs are ignored. This makes the API much harder to
misuse.

Finally, the WebDriver API for setting the prompt dialog entry
field is corrected to actually set that value rather than the message.
This makes sense as part of this change as the type safety of the
structures makes setting the message (the old, wrong behavior) harder
 to implement.

Testing: This causes a WebDriver conformance test to start passing.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-12-02 08:20:49 +00:00
Josh Matthews
acbeb25f0b servodriver: Clear cookies between tests. (#40709)
To ensure that tests that modify cookies but don't finish cleanly don't
leave cookie values that interfere with subsequent tests, we need to
clear the cookie storage in between each test that's run.

Testing: Can't test the test runner, just have to watch the patterns in
our test runs.
Fixes: #40668
Fixes: #40672
Fixes: #40673
Fixes: #40674
Fixes: #40695
Fixes: #40697

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-11-28 06:46:52 +00:00
Martin Robinson
6d4937b5d6 servoshell: Add architectural support for opening multiple windows (#40883)
This change is a major re-architecture of servoshell to support multiple
windows. Unfortunately it was not possible to do this incrementally, but
@mukilan and I did this together so we feel more confident about these
changes.

The main change here is that now the `HashMap` of windows that `App`
has can be filled with more than one `ServoShellWindow`.
`ServoShellWindow` is a wrapper around a `PlatformWindow` which can
either be headed, headless, or for embedded platforms. Embedded
platforms (Android and OHOS) are only expected to have a single window,
but there is no reason that more windows cannot be added.

There is still a little bit more work to be done in order to fully
enable
mulitple windows, so this change is just the architectural preparation.

This change enables the embedded and desktop versions of servoshell to
start to be fully integrated so that the entire `RunningAppState` is
shared between them.


Testing: servoshell is the test harness so these changes are covered
by the WPT tests.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-11-27 10:41:32 +00:00
Jan Varga
0899b87dd4 Fix inconsistent strum dependencies and imports (#40907)
The `scripts_traits` crate was the only crate depending on `strum` with
the
`derive` feature. This accidentally allowed other crates to import strum
macros via `strum::` without declaring their own dependency on
`strum_macros`,
causing compilation issues when running `./mach test-unit -p net`.

This PR makes the imports consistent across the code base by:
- replacing all `strum_macro::` imports with `strum::` imports
- removing strum_macro dependencies
- adding derive feature to the strum workspace

Testing: Unit tests continue to pass

Signed-off-by: Jan Varga <jvarga@igalia.com>
2025-11-26 21:37:55 +00:00
Tim van der Lippe
69030f583a libservo: Notify embedder of protocol handler updates (#40653)
This implements step 2 of the web-facing API's.
Now, the embedder receives a notification whether
a webpage wants to register/unregister a protocol
handler. They can't do anything with it yet, that's for a follow-up PR.
But locally testing shows the
following debug log:

```
pid:35180 Requesting to Register for scheme web+test with url https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/%s
```

Part of #40615

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-11-21 18:12:00 +00:00
Martin Robinson
36031e22f2 compositing: Make RefreshDriver per-RenderingContext (#40738)
Instead of having a global `RefreshDriver` for all of Servo, let each
`RenderingContext` have its own `RefreshDriver`. This allows for things
like per-monitor `RefreshDriver`s and helps to ensure that multiple
`BaseRefreshDriver`s can be created for the same `RefreshDriver`.

Testing: This shouldn't change behavior and thus is covered by existing
tests.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-11-19 14:31:25 +00:00
Tim van der Lippe
e1b9c02de3 webdriver: implement protocol handler automation mode (#40733)
The tests now start running rather than erroring, but they aren't
working yet as we don't currently use protocol handlers yet. That's for
follow-up PRs, as that requires more plumbing.

Part of #40615

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-11-19 11:53:17 +00:00
Fuguo
927c907f8d Compositor: Add touch compatibility handling for mouse move events (#40637)
Every time a touchmove event is added, it updates the cursor, causing
frequent hit testing and affecting the performance of scrolling. Adding
a flag to mark the current touchmove is done for compatibility with
touch events. In this case, the last_mouse_move_position will not be
updated.

Testing: No new use cases will be approved; it's just for performance
optimization.
Fixes: A solution for #39433

Signed-off-by: kongbai1996 <1782765876@qq.com>
2025-11-18 04:24:45 +00:00
Martin Robinson
5494995e01 libservo: Add ContextMenuElementInformation to for the context menu API (#40607)
This new data structure allows passing more information when popping up
context menus. It's possible in the future that it will be adapted into
a more generic "hit test result" type API ala WebKit, but for now, this
is probably
enough.

Testing: This change includes new API test assertions.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-17 15:53:43 +00:00
Martin Robinson
1e4feeaa0d script: Add context-based context menu options (#40501)
Add context menu options for images, links, and editable text areas. In
addition add the ability to show menu options that are disabled. This
also improves the visual style of the context menu in egui as part of
supporting disabled options.

Testing: This has been manually tested, but we could we should be able
to
easily add unit tests when enriching the API with information about the
active element under context menus.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2025-11-11 11:03:41 +00:00
atbrakhi
ad8c81d634 servoshell: Implement context menu in servoshell (#40434)
This PR adds context menu support with clickable menu items in the
Minibrowser. The menu appears on right click and supports basic
navigation actions (Back, Forward, Reload).


Testing: We already have tests for ContextMenu in WebView API test.

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-11-08 11:11:09 +00:00
Narfinger
3bfd107686 net: Do not implement Serialize/Deserialize for RasterImage and introduce`SharedRasterImage (#40459)
RasterImage is now not seralizeable and backed by Vec<u8> storage. Add a
new struct `SharedRasterImage` that allows serializeing. This can be
constructed from RasterImage. This introduces some more copying but I
think the tradeoff is ok. Newly introduced copies are for favicon
response to the embedder and EmbedderNotifications.

Testing: Should not change functionality, so covered by existing tests.
Fixes: https://github.com/servo/servo/issues/39626 and related issues.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-11-07 16:49:32 +00:00
WaterWhisperer
241bff962d Change some #[allow]s to #[expect]s (#40458)
Removes some unneeded lints.

Testing: Refactor
Part of: #40383

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-11-06 12:31:48 +00:00
Martin Robinson
f08460cded script: Handle broken image icon in HTMLImageElement (#40429)
Instead of having the `ImageCache` return the broken image icon for
failed loads, have `HTMLImageElement` explicitly request it. This means
that the image is loaded on demand (reducing the usage of resources) and
also simplifying the interface of the `ImageCache` greatly.

In addition, the display of the broken image icon is improved, more
closely matching other browsers. A test for this display (which was
falsely passing before) is updated to reflect the new display of the
broken image icon.

Testing: There is a Servo-specific test for this change. Some WPT tests
start to fail as well. Before these were not properly loading the broken
image icon so they were failing before, just in a hidden way.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-11-06 09:36:21 +00:00
Euclid Ye
bc76eb494e webdriver: Implement extension command Shutdown (#40422)
We implement `ServoExtensionCommand::Shutdown`, which shutdown Servo
elegantly. This is required for Coverage Report. Later, we will
implement Servo's override of [`stop()` in
`WebDriverBrowser`](0d44ca8ddc/tests/wpt/tests/tools/wptrunner/wptrunner/browsers/base.py (L389)).

Testing: Manually tested with PowerShell script.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-11-05 13:26:32 +00:00
Martin Robinson
2c77d9d8a1 libservo: Integrate context menu into the show_embedder_control API (#40402)
This PR integrates showing context menus into the
`WebViewDelegate::show_embedder_control` API. In addition,
`ContextMenuItem` and `ContextMenuAction` data types are exposed which
abstract away the different components of the context menu. Later
changes will implement this API for servoshell as well as add
element-specific actions such as "Select All" and "Copy Image URL".

Testing: This change adds a WebView API test.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-11-04 21:08:04 +00:00
Euclid Ye
2d89cd7471 Reduce unnecessary type conversion and share WebDriverCommandMsg::LoadUrl handler across platform (#40393)
- Reduces unnecessary type conversion between `ServoUrl`, `Url`, string
slice
- Share `WebDriverCommandMsg::LoadUrl` handler across platform

Testing: Covered by existing test. Manually tested for OHOS.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-11-04 13:57:00 +00:00
Sam
53d8c59e77 cargo: Bump Rust to 1.91 (#39471)
Rust 1.90 uses lld by default on linux, which should improve link time
and memory usage (I personally override ld with lld globally). And
because of miscompilations we observed on 1.90 we need to skip to 1.91.

Testing: Existing tests.
try run: https://github.com/sagudev/servo/actions/runs/18951980580

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-10-30 21:14:10 +00:00
atbrakhi
f2c9bb6cc7 libservo: Allow passing device or page pixels as scroll delta (#40267)
This change allows the embedder to pass scroll deltas in either page
pixels or device pixels. In addition, it makes it so that device pixels
are never stored in LayoutVector2D when processing scroll events, which
was very confusing.


Testing: Current tests should cover these changes

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-10-29 16:22:31 +00:00