aboutsummaryrefslogtreecommitdiffstats
path: root/components/constellation
Commit message (Collapse)AuthorAgeFilesLines
* `compositing`: Combine `webrender_traits` and `compositing_traits` (#36372)Martin Robinson2025-04-063-5/+6
| | | | | | | | | | | | | | | These two traits both exposed different parts of the compositing API, but now that the compositor doesn't depend directly on `script` any longer and the `script_traits` crate has been split into the `constellation_traits` crate, this can be finally be cleaned up without causing circular dependencies. In addition, some unit tests for the `IOPCompositor`'s scroll node tree are also moved into `compositing_traits` as well. Testing: This just combines two crates, so no new tests are necessary. Fixes: #35984. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Move `ScriptToConstellationMsg` to `constellation_traits` (#36364)Martin Robinson2025-04-056-20/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the last big change necessary to create the `constellation_traits` crate. This moves the data structure for messages that originate from the `ScriptThread` and are sent to the `Contellation` to `constellation_traits`, effectively splitting `script_traits` in half. Before, `script_traits` was responsible for exposing the API of both the `ScriptThread` and the `Constellation` to the rest of Servo. - Data structures that are used by `ScriptToConstellationMsg` are moved to `constellation_traits`. The dependency graph looks a bit like this: `script_layout_interface` depends on `script_traits` depends on `constellation_traits` depends on `embedder_traits`. - Data structures that are used in the embedding layer (`UntrustedNodeAddress`, `CompositorHitTestResult`, `TouchEventResult` and `AnimationState`) are moved to embedder_traits, to avoid a dependency cycle between `webrender_traits` and `constellation_traits`. - Types dealing with MessagePorts and serialization are moved to `constellation_traits::message_port`. Testing: This is covered by existing tests as it just moves types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Make the memory reporting multi-process aware (#35863)webbeef2025-04-054-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | So far the memory reporter aggregates reports from all processes, and runs the system reporter only in the main process. Instead it is desirable to have per-process reports. We do so by: - creating a ProcessReports struct that holds includes the pid in addition to the reports themselves. - running the system memory reporter also in content processes. - updating the about:memory page to create one report per process, and add useful information like the pid and the urls loaded in a given process. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors ![image](https://github.com/user-attachments/assets/0bafe140-539d-4d6a-8316-639309a22d4a) Signed-off-by: webbeef <me@webbeef.org>
* Check all ancestor navigable trustworthiness for mixed content (#36157)Sebastian C2025-04-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Propagate through documents a flag that represents if any of the ancestor navigables has a potentially trustworthy origin. The "potentially trustworthy origin" concept appears to have gotten confused in a couple of places and we were instead testing if a URL had "potentially trustworthy" properties. The main test for the ancestor navigables is [mixed-content/nested-iframes](https://github.com/web-platform-tests/wpt/blob/master/mixed-content/nested-iframes.window.js) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #36108 <!-- Either: --> - [X] There are tests for these changes --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* constellation: Only return focused browsing contexts that exist. (#36330)Josh Matthews2025-04-041-1/+9
| | | | | | | | | | | | | | | | | | The webdriver server relies on the constellation to report which browsing context is focused, and assumes that a focused context is ready for interaction. However, new browsing contexts exist in a weird state where they are not tracked by the constellation until the initial load is complete, which leads to the constellation rejecting attempts to navigate a browsing context right after it's created. These changes ensure the constellation does not report a browsing context as focused until it's actually created and ready for interaction. Testing: Run `./mach test-wpt --product servodriver tests/wpt/mozilla/tests/mozilla/DOMParser.html`, which now runs to completion. Fixes: #34551 Fixes: #36328 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* constellation: Rename messages sent to the `Constellation` (#36341)Martin Robinson2025-04-044-112/+140
| | | | | | | | | | | | | | | | | | | | Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Prevent zombie processes in multi-process mode. (#36329)webbeef2025-04-046-44/+177
| | | | | | | | | | | | | This introduces a process manager that holds for each process a "lifeline": this is the receiving end of a ipc channel that is not used to send anything, but only to monitor the process presence. We turn that ipc receiver into a crossbeam one to integrate the monitoring into the constellation run loop. The sender side is made part of the initial "UnprivilegedContent" data structure sent to the new process, both for content and for service worker processes. When a process dies we currently wait() on it to let the OS do a clean shutdown. Signed-off-by: webbeef <me@webbeef.org>
* constellation: Stop assuming that the viewport is shared by all WebViews ↵Martin Robinson2025-04-045-84/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#36312) The `Constellation` previously held a `window_size` member, but this assumes that all `WebView`s have the same size. This change removes that assumption as well as making sure that all `WebView`s pass their size and HiDIP scaling to the `Constellation` when they are created. In addition - `WindowSizeData` is renamed to `ViewportDetails`, as it was holding more than just the size and it didn't necessarily correspond to a "window." It's used for tracking viewport data, whether for an `<iframe>` or the main `WebView` viewport. - `ViewportDetails` is stored more consistently so that conceptually an `<iframe>` can also have its own HiDPI scaling. This isn't something we necessarily want, but it makes everything conceptually simpler. The goal with this change is to work toward allowing per-`WebView` HiDPI scaling and sizing. There are still some corresponding changes in the compositor to make that happen, but they will in a subsequent change. Testing: This is covered by existing tests. There should be no behavior changes. Fixes: This is part of #36232. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* webgpu: Add a `webgpu_traits` crate (#36320)Martin Robinson2025-04-042-2/+5
| | | | | | | | | | | | | | | This breaks the `script_traits` dependency on `webgpu`. In general, the `traits` crates shouldn't depend on Servo non-`traits` crates. This is necessary to move "script to constellation" messages to the `constellation_traits` crate, making it the entire API for talking to the constellation. This will break a circular dependency when that happens. Testing: Successfully building is enough of a test for this one as it is mainly moving types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Separate `WebviewManager` from `Webview` in `compositor` and `constellation` ↵Shubham Gupta2025-04-043-3/+3
| | | | | | | | | (#36302) Create a separate file for `WebviewManager` to improve clarity. Testing: This change is just a refactor, so no new tests are needed. Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
* Support single-value `<select>` elements (#35684)Simon Wülker2025-04-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/user-attachments/assets/9aba75ff-4190-4a85-89ed-d3f3aa53d3b0 Among other things this adds a new `EmbedderMsg::ShowSelectElementMenu` to tell the embedder to display a select popup at the given location. This is a draft because some small style adjustments need to be made: * the select element should always have the width of the largest option * the border should be part of the shadow tree Apart from that, it's mostly ready for review. <details><summary>HTML for demo video</summary> ```html <html> <body> <select id="c" name="choice"> <option value="first">First Value</option> <option value="second">Second Value</option> <option value="third">Third Value</option> </select> </body> </html> ``` </details> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] Part of https://github.com/servo/servo/issues/3551 - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* libservo: Remove a couple `EmbedderMethods` (#36276)Martin Robinson2025-04-012-16/+1
| | | | | | | | | | | | | | | | | | | | | | | - Remove `EmbedderMethods::get_user_agent_string`. This is now part of the `Preferences` data structure, which should allow it to be per-`WebView` in the future. - Remove `EmbedderMethods::get_version_string`. This was used to include some data along with WebRender captures about the Servo version. This isn't really necessary and it was done to replace code in the past that output the WebRender version, so also isn't what the original code did. I think we can just remove this entirely. The idea with these changes is that `EmbedderMethods` can be removed in a followup and the rest of the methods can be added to `ServoDelegate`. These two methods are ones that cannot be added to a delegate as they are used during `Servo` initialization. Testing: There is currently no testing for libservo. These changes are meant as preparation for adding a suite of `WebView` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Organize component Cargo.toml dependencies (#36224)Alex Touchet2025-03-301-1/+1
| | | Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
* Allow setting userscripts directly without the need of files (#35388)Tony2025-03-272-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow settings userscripts through preferences Signed-off-by: Tony <legendmastertony@gmail.com> * mach fmt instead of cargo fmt Signed-off-by: Tony <legendmastertony@gmail.com> * Fix pref loading not working for array values Signed-off-by: Tony <legendmastertony@gmail.com> * Use pref! in userscripts instead Signed-off-by: Tony <legendmastertony@gmail.com> * Implement the model jdm suggested - Remove userscripts from all places and move it to servoshell - Add in `UserContentManager` struct and passing it through `Servo::new` all the way down to script thread Signed-off-by: Tony <legendmastertony@gmail.com> * Apply suggestions from code review and format Signed-off-by: Tony <legendmastertony@gmail.com> * Revert unrelated change Signed-off-by: Tony <legendmastertony@gmail.com> --------- Signed-off-by: Tony <legendmastertony@gmail.com> Signed-off-by: Tony <68118705+Legend-Master@users.noreply.github.com>
* feat(notification): add `EmbedderMsg::ShowNotification` (#36055)Jason Tsai2025-03-241-0/+1
| | | Signed-off-by: Jason Tsai <git@pews.dev>
* webgpu: leverage routed_promise in calls returning promises (#35859)webbeef2025-03-231-2/+2
| | | | | | | Using the RoutedPromiseListener let us define a different response type for each promise. This removes unreachable branches that used to exist when they all shared the same WebGPUResponse. Signed-off-by: webbeef <me@webbeef.org>
* compositor: Remove the script channel from the compositor (#36089)Martin Robinson2025-03-232-6/+0
| | | | | | | | | | | | This is a clean up after #36062 and #35985. It removes the script channel for each pipeline from the compositor. Now all messages are sent via the `Constellation` first, which will allow breaking the dependency on script in the compositor. In addition, scroll states are actually sent via the `Constellation`, which was an oversight from #36062. Finally, a typo in a method name is fixed. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Allow opening links in a new `WebView` (#35017)webbeef2025-03-231-2/+48
| | | | | | | | | | | | | This changes starts tracking the keyboard modifier state in the `Constellation` and forwards it with every input event. The state is used to modify the target of link click so when the platform-dependent alternate action key is enabled, the target is overriden to "_blank". In addition, specification step numbers and text is updated. Signed-off-by: webbeef <me@webbeef.org> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Create a `constellation_traits` crate (#36088)Martin Robinson2025-03-225-17/+19
| | | | | | | | | | | | | | This change creates a `constellation_traits` crate. Previously messages to the `Constellation` were in the `compositing_traits` crate, which came about organically. This change moves these to a new crate which also contains data types that are used in both compositing/libservo and script (ie types that cross the process boundary). The idea is similar to `embedding_traits`, but this is meant for types not exposed to the API. This change allows deduplicating `UntrustedNodeAddress`, which previously had two versions to avoid circular dependencies. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* metrics: Simplify `ProgressiveWebMetrics` (#35985)Martin Robinson2025-03-213-97/+41
| | | | | | | | | | | | | | | | Simply how `ProgressiveWebMetrics` works: 1. Keep only a single struct instead of one in layout and one script that both implement the `ProgressiveWebMetrics` trait. Since layout and script are the same thread these can now just be a single `ProgressiveWebMetrics` struct stored in script. 2. Have the compositor be responsible for informing the Constellation (which informs the ScripThread) about paint metrics. This makes communication flow one way and removes one dependency between the compositor and script (of two). 3. All units tests are moved into the `metrics` crate itself since there is only one struct there now. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* constellation: Proxy `ScrollState` through the `Constellation` (#36062)Martin Robinson2025-03-212-1/+25
| | | | | | | | | This will allow removing the dependency of the compositor on `script_traits`, which should make our internal dependency chain a lot easier to deal with. Part of #35984. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Cleanup Stylo dependencies (#36046)Oriol Brufau2025-03-191-1/+1
| | | | | | | | | Now that Stylo considers `servo` as the default feature, Servo doesn't need to specify `features = ["servo"]`. Also use the same crate names as Stylo, rather than renaming them with `package`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* constellation: Remove two unused messages to the Constellation (#35972)Martin Robinson2025-03-152-51/+0
| | | | | This also removes supporting code which becomes unused as well. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Migrate to the 2024 edition (#35755)Simon Wülker2025-03-132-6/+6
| | | | | | | | | | | | | | | | | | | | | | * 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>
* canvas: Do not update ImageKey during canvas layout (#35719)Samson2025-03-121-7/+8
| | | Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* base: Finish rename of `TopLevelBrowsingContextId` to `WebViewId` (#35896)Martin Robinson2025-03-116-323/+232
| | | | | | The `WebViewId` name is a lot more descriptive these days to the casual reader, so I think we can go ahead and finish the rename. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Register iframes with the devtools (#35874)Simon Wülker2025-03-091-0/+1
| | | | | | | | | | | Previously, the devtools didn't know about <iframe>s. They either ignored messages coming from iframes or crashed. This reverts https://github.com/servo/servo/pull/34032 and then filters out non-tab globals in the "listTabs" message to the root actor. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add an about:memory page (#35728)webbeef2025-03-072-0/+6
| | | | | | | | | | | | | | | | | This patch exposes a servo internal DOM API that is only made available to about: pages on the navigator object to request memory reports. The about:memory page itself is loaded like other html resources (eg. bad cert, net error) and makes use of this new API. On the implementation side, notable changes: - components/script/routed_promise.rs abstracts the setup used to fulfill a promise when the work needs to be routed through the constellation. The goal is to migrate other similar promise APIs in followup (eg. dom/webgpu/gpu.rs, bluetooth.rs). - a new message is added to request a report from the memory reporter, and the memory reporter creates a json representation of the set of memory reports. - the post-processing of memory reports is done in Javascript in the about-memory.html page, providing the same results as the current Rust code that outputs to stdout. We can decide later if we want to remove the current output. Signed-off-by: webbeef <me@webbeef.org>
* compositor: Make input event handling per-WebView (#35716)Delan Azabani2025-03-052-11/+19
| | | | | | | | | | | | | | | | | This is another step in the move to having a per-WebView renderer. In this step event handling is made per-WebView. Most events sent to Servo are sent via the WebView API already, so this just moves more event handling code to the per-WebView render portion of the compositor. - ServoRenderer is given shared ownership and interior mutability as it is now shared among all WebView(Renderers). - Some messages coming from other parts of Servo must now carry a WebViewId as well so that they can be associated with a particular WebView. - There needs to be some reorganization of `ServoRenderer` in order to avoid issues with double borrow of `RefCells`. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* compositor: Make `PipelineDetails` and pending paint metrics per-WebView ↵Martin Robinson2025-03-042-18/+32
| | | | | | | | | | | | | | | | (#35701) This is one of the first big steps toward making the compositor work per-WebView. It moves the collection of pipelines into the per-WebView data structure in the compositor as well as the pending paint metrics. This means that more messages need to carry information about the WebView they apply to. Note that there are still a few places that we need to map from `PipelineId` to `WebViewId`, so this also includes a shared mapping which tracks this. The mapping can be removed once event handling is fully per-WebView. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-035-29/+36
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* libservo: Clean up interfaces for alert()/confirm()/prompt() (#35579)Delan Azabani2025-02-271-1/+1
| | | Signed-off-by: Delan Azabani <dazabani@igalia.com>
* libservo: Add `WebView` immediately to the Compositor (#35662)Martin Robinson2025-02-262-8/+0
| | | | | | | | | When creating a `WebView`, let the Compositor know synchronously that it exists. This allows the embedder to immediately call methods like `WebView::focus()`. In addition remove messages associated with the `WebViewDelegate::notify_ready_to_show()` method (and the method itself), as now `WebView`s can be shown immediately. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Make auxiliary webviews exist in the constellation immediately (#35672)Delan Azabani2025-02-262-19/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To allow embedders to interact with webviews as soon as they are created, we need to ensure that they exist in both the compositor and the constellation before those interactions happen. #35662 does this for the compositor, while this patch does this for the constellation. When a webview opens another webview (via <a target>, <form target>, window.open(), etc), the embedder creates an “auxiliary” webview, which previously went as follows: - script create_auxiliary_browsing_context - libservo AllowOpeningWebView - embedder request_open_auxiliary_webview (→ constellation FocusWebView) - script create_auxiliary_browsing_context - constellation ScriptNewAuxiliary In that model, the constellation may receive FocusWebView before it receives ScriptNewAuxiliary. Now they are created as follows: - script create_auxiliary_browsing_context - constellation CreateAuxiliaryWebView - libservo AllowOpeningWebView - embedder request_open_auxiliary_webview (→ constellation FocusWebView) - constellation CreateAuxiliaryWebView - script create_auxiliary_browsing_context Since these messages are all synchronous and the constellation will have set up the webview before handling any new messages, the webview will always exist by the time we handle the embedder’s FocusWebView. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Move WebDriver messages to the `embedder` crate (#35602)Martin Robinson2025-02-241-19/+23
| | | | | | | | | | | | | | | | | | | | This is the first step toward moving the WebDriver implementation to servoshell. This move will make it possible to start testing the embedding API with WebDriver. See [this zulip thread][a] for more details. While WebDriver will be able to use a lot of API commands to do what it is doing now, there will still need to be some "cheat codes" for more gnarly access to `ScriptThread` details. That's why we likely won't be able to remove all WebDriver-specific messages from the API -- but maybe they will be useful for embedders somehow. A couple messages have to change as they depended on `script_traits` types, particularly those that used `WindowSizeData` and `LoadData`. I think this helps to encapsulate the WebDriver commands a bit more though. [a]: https://servo.zulipchat.com/#narrow/channel/437943-embedding/topic/webdriver.20as.20embedding.20api.20playgound Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* build winit_minimal with bluetooth disabled (#35590)webbeef2025-02-211-1/+0
| | | Signed-off-by: webbeef <me@webbeef.org>
* compositing: Move image output and shutdown management out of the compositor ↵Martin Robinson2025-02-202-2/+3
| | | | | | | | | | | | | | | | | | | | | | | (#35538) This is a step toward the renderer-per-WebView goal. It moves various details out of `IOCompositor`. - Image output: This is moved to servoshell as now applications can access the image contents of a `WebView` via `RenderingContext::read_to_image`. Most options for this are moved to `ServoShellPreferences` apart from `wait_for_stable_image` as this requires a specific kind of coordination in the `ScriptThread` that is also very expensive. Instead, paint is now simply delayed until a stable image is reached and `WebView::paint()` returns a boolean. Maybe this can be revisited in the future. - Shutdown: Shutdown is now managed by libservo itself. Shutdown state is shared between the compositor and `Servo` instance. In the future, this sharing might be unecessary. - `CompositeTarget` has been removed entirely. This no longer needs to be passed when creating a Servo instance. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
* libservo: Move GL acclerated media setup out of `RenderingContext` and ↵Martin Robinson2025-02-201-20/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | simplify it (#35553) This moves the GL accelerated media setup out of `RenderingContext` which prevents making libservo dependo on the Wayland and X11 versions of surfman explicitly. This support is experimental and (honestly) a bit broken. I've confirmed that this works as well as it did before the change. The main thing here is that the configuration, which currently needs surfman types, moves to servoshell. In addition: 1. Instead of passing the information to the Constellation, the setup is stored statically. This is necessary to avoid introducing a dependency on `media` in `webrender_traits`. It's quite likely that `media` types should move to the internal embedding API to avoid this. This is preserved for a followup change. 2. The whole system of wrapping the media channels in an abstract type is removed. They could be either mpsc channels or IPC channels. This was never going to work because mpsc channels cannot be serialized and deserialized with serde. Instead this just uses IPC channels. We also have other ways of doing this kind of abstraction in Servo so we do not need another. The `mpsc` version was hard-coded to be disabled. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Make WebBluetooth an optional feature. (#35479)Josh Matthews2025-02-184-4/+19
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* deps: Remove some unused `Cargo.toml` (#35466)Martin Robinson2025-02-141-1/+0
| | | | | These were discovered with cargo-machete. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: change 'request_fullscreen_state_change' API to a notification ↵Mukilan Thiyagarajan2025-02-131-1/+3
| | | | | (#35445) Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* libservo: Expose a single `InputEvent` type and pass it to script (#35430)Martin Robinson2025-02-122-266/+109
| | | | | | | | | | | | | | | | | | | | | | | | This change exposes a single `InputEvent` type and now there is only a single delegate method for this `WebViewDelegate::notify_input_event`. - Clipboard events are now handled as `EditingAction` inpute events. In the future this can include things like "Select All", etc. In addition, many parts of the dance to pass these events can now be simplified due to this abstraction. - All forwarded events are handled the same way in the `Constellation`, though they may carry an optional hit test (for events that have a `point`) which affects which `Pipeline` they are sent to. - In the `ScriptThread` we now accept these `InputEvents` and use them everywhere. Now all "compositor events" are "input events". - This allows removing several data structures which are no longer necessary. - We no longer inform the embedder when an event was handled by a WebView as that was only important for a MDI feature that will no longer be so important the full-featured `WebView` API. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* libservo: Don't bounce ready-to-present frame notifications to the ↵Martin Robinson2025-02-122-12/+0
| | | | | | | | | | | | | | | Constellation (#35369) Instead of telling the Constellation to tell the embedder that new frames are ready, have the compositor tell the embedder directly. This should reduce frame latency. Now, after processing compositor updates, run any pending `WebView::new_frame_ready` delegate methods. This change also removes the `refresh` call from the Java interface as that was the only other place that the compositor was rendering the WebRender scene outside of event looping spinning. This `refresh` call was completely unused. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Add a delegate method for HTTP authentication (#35400)Martin Robinson2025-02-101-0/+1
| | | | | | | | | | | | Add a delegate method for HTTP authentication and a related `AuthenticationRequest` object that carries with it the URL as well as whether or not the authentication request is for a proxy or not. This is now separate from the prompt API because requesting authentication doesn't necessarily involve prompting -- this is an implementation detail of the embedder. In addition, the internal bits are cleaned up slightly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Remove message-based API (#35366)Martin Robinson2025-02-101-1/+0
| | | Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Add a `ClipboardDelegate` and a default implementation (#35297)Martin Robinson2025-02-071-3/+3
| | | | | | | | | | | | | | | | | Add a `ClipboardDelegate` to the `WebView` API and a default implementation in libservo for this delegate that works on Mac, Windows, and Linux. Support for Android will be added in the future. This means that embedders do not need to do anything special to get clipboard support, but can choose to override it or implement it for other platforms. In addition, this adds support for handling fetches of clipboard contents and renames things to reflect that eventually other types of clipboard content will be supported. Part of this is removing the string argument from the `ClipboardEventType::Paste` enum because script will need to get other types of content from the clipboard than just a string. It now talks to the embedder to get this information directly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add support for Upgrade request to a potentially trustworthy URL. (#34986)Shubham Gupta2025-02-051-0/+2
| | | | | | | | | | | | | | | | * Add support for Upgrade request to a potentially trustworthy URL. Signed-off-by: Shubham Gupta <shubham13297@gmail.com> * script: Support inheritable insecure request policy in documents and workers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* libservo: Combine `LoadStart, `HeadParsed`, and `LoadComplete` messages (#35260)Martin Robinson2025-02-031-3/+11
| | | | | | | | | These will be a single method in the upcoming `WebView` delegate, so it makes sense to also combine the internal message to match this. In addition, since `LoadStatus` is now exposed to the API if there is ever the need to add more statuses or to move to an event-based version, the API is already set up for this. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script_traits: Rename `ConstellationControlMsg` to `ScriptThreadMessage` ↵Martin Robinson2025-01-303-63/+54
| | | | | | | | | | | (#35226) At some point in the past this message was only sent from the `Constellation` to `script`, but nowadays this is sent from various parts of servo to the `ScriptThread`, so this is a better name. In particular, the current name makes it seeem like this message controls the `Constellation`, which it does not. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Include `WebViewId` into EmbedderMsg variants where possible (#35211)Delan Azabani2025-01-302-93/+74
| | | | | | | | | | | | | | | | | `EmbedderMsg` was previously paired with an implicit `Option<WebViewId>`, even though almost all variants were either always `Some` or always `None`, depending on whether there was a `WebView involved. This patch adds the `WebViewId` to as many `EmbedderMsg` variants as possible, so we can call their associated `WebView` delegate methods without needing to check and unwrap the `Option`. In many cases, this required more changes to plumb through the `WebViewId`. Notably, all `Request`s now explicitly need a `WebView` or not, in order to ensure that it is passed when appropriate. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>