aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* servoshell: Port desktop servoshell to use delegate API (#35284)Martin Robinson2025-02-061-1/+5
| | | | | Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Simplify `RenderingContext` trait methods (#35251)Ngo Iok Ui (Wu Yu Wei)2025-02-051-90/+28
| | | | | | | | | | | | | | | | | | There are a few methods are still difficult to implement without the help of surfman. To simplify the trait methods, all methods that return surfman types are removed. They are either handled by embedders themselves or abstract to simpler types that servo components need. The most noticeable changes are: - Methods related to native surface are moved to servo_glue. The embedder should decide when to remove/replace the surface and it's outside of servo's scope. - Methods required by servo media now return exact media types for it. The other major change is sevevral difficult trait methods that are reuiqred by WebGL and Servo media have default implementation. So they can be optional for users to implement. Signed-off-by: Wu Wayne <yuweiwu@pm.me>
* libservo: Add WebViewDelegate and ServoDelegate and port `winit_minimal` ↵Delan Azabani2025-02-051-29/+392
| | | | | | | | | | | | | | | | | | | | | | | | (#35196) This change adds the second major part of the new API: delegates which have methods called by the Servo loop. When a delegate is set on a `WebView` or on `Servo` itself, the event loop will call into appropriate delegate methods. Applications can implement the delegate on their own structs to add special behavior per-`WebView` or for all `WebView`s. In addition, each delegate has a default implementation, which automatically exposes "reasonable" behavior such as by-default allowing navigation. There's a lot more work to do here, such as refining the delegate methods so that they all have nice interfaces, particulary with regard to delegate methods that need an asynchronous response. This will be handed gradually as we keep working on the API. Signed-off-by: Delan Azabani <dazabani@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* libservo: Remove `Servo::repaint_synchronously` (#35283)Martin Robinson2025-02-041-4/+0
| | | | | This method is unused, so remove it. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Remove `EmbedderEvent::WindowResize` (#35277)Martin Robinson2025-02-041-10/+3
| | | | | | | | | | Remove this event which is completely unused. In addition, lots of code becomes dead once this happens, so remove that as well. It may be possible that a different behavior is necessary immediately following a window resize, but the new API will handle this in a different way than this embedder event -- which complicates how the event loop is spun in both the API and servoshell. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* chore: Rename `CompositeTarget` enum (#35263)DK Liao2025-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | * chore: Rename CompositeTarget enum Signed-off-by: DK Liao <dklassic@gmail.com> sync name in other documents Signed-off-by: DK Liao <dklassic@gmail.com> sync more name in other documents Signed-off-by: DK Liao <dklassic@gmail.com> * Fix Android/ohos Signed-off-by: DK Liao <dklassic@gmail.com> --------- Signed-off-by: DK Liao <dklassic@gmail.com>
* Finish the integration of `webxr` into the Cargo workspace (#35229)Martin Robinson2025-01-311-0/+2
| | | | | | | | | - Run `cargo fmt` on `webxr` and `webxr-api` - Fix clippy warnings in the existing `webxr` code - Integrate the new crates into the workspace - Expose `webxr` via the libservo API rather than requiring embedders to depend on it explicitly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Include `WebViewId` into EmbedderMsg variants where possible (#35211)Delan Azabani2025-01-301-27/+20
| | | | | | | | | | | | | | | | | `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>
* libservo: Port desktop servoshell to use the new `WebView` API (#35183)Martin Robinson2025-01-281-11/+20
| | | | | | | This removes all uses of `EmbedderEvent` in the desktop servoshell to use the new `WebView` API -- filling it out when necessary. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com>
* libservo: Stop using `script_traits` in the embedding layer (#35185)Martin Robinson2025-01-281-5/+6
| | | | | | | | | | | | | | | 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>
* libservo: Add an initial WebView data structure to the API (#35119)Delan Azabani2025-01-251-59/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a new handle-based webview API to libservo, with two main design goals: 1. The lifetime of the handles controls the lifetime of the webview, giving the embedder full control over exactly when webviews are created and destroyed. This is consistent with how WebKitGTK’s WebView works; the engine can only create webviews via a create request, and can only destroy them via a close request. 2. All methods are infallible; if the constellation dies, the embedder finds out when calling Servo::handle_events. For the moment, the embedder is only responsible for creating the WebView id, and not the internal TopLevelBrowsingContext data structures. This is so that the ScriptThread is able to get a handle on the new WebView's WindowProxy in the case that it's an auxiliary browsing context. In the future, the embedder should also be responsible for creating the TopLevelBrowsingContext and the ScriptThread should have mechanism to associate the two views so that WebView creation is always executed through the same code path in the embedding layer. For now, it's enough that the embedder can get a handle to the new WebView when it's creation is requested. Once we replace EmbedderMsg with a webview delegate trait, we will pass WebView handles to the embedder, rather than webview ids. We’ll also add detailed docs, once the design settles. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Remove type parameter from Servo and IOCompositor (#35121) (#35156)Delan Azabani2025-01-241-10/+6
| | | | | | | | | | | | | | | | | | | * Remove type parameter from Servo and IOCompositor (#35121) Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Fix compile error in libservo example Signed-off-by: Delan Azabani <dazabani@igalia.com> * Fix compile error in servoshell Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* feat: Turn `RenderingContext` into a trait (#35052)DK Liao2025-01-241-26/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: turn RenderingContext into a trait Signed-off-by: DK Liao <dklassic@gmail.com> Add comment and handle drop error Signed-off-by: DK Liao <dklassic@gmail.com> Add doc comment Signed-off-by: DK Liao <dklassic@gmail.com> Allow make_current to propagate Error Signed-off-by: DK Liao <dklassic@gmail.com> Fix all make_current occurances Signed-off-by: DK Liao <dklassic@gmail.com> Move back to Rc<dyn RenderingContext> Signed-off-by: DK Liao <dklassic@gmail.com> fix android/ohos Signed-off-by: DK Liao <dklassic@gmail.com> Fix build Signed-off-by: DK Liao <dklassic@gmail.com> fix android/ohos again Signed-off-by: DK Liao <dklassic@gmail.com> * Fix macOS smoke test Signed-off-by: DK Liao <dklassic@gmail.com> * Add comment for create_texture and destroy_texture Signed-off-by: DK Liao <dklassic@gmail.com> * Improve comments written Signed-off-by: DK Liao <dklassic@gmail.com> --------- Signed-off-by: DK Liao <dklassic@gmail.com>
* prefs: Move some `DebugOptions` to `Preferences` and clean up (#34998)Martin Robinson2025-01-171-5/+3
| | | | | | | | | - Move options configuring antialiasing and WebRender shader precache to the `Preferences` to group them with other related WebRender and DOM settings. - Remove the option to disable antialiasing for canvases. This was unused. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Fix build failure with tracing feature (#35009)Jonathan Schwender2025-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | * Fix build failure with tracing feature Skip tracing preferences for now to avoid: ``` error[E0277]: `Preferences` doesn't implement `std::fmt::Debug` ``` Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * Fix warning about unused tracing span. The tracing span is "used" when it is dropped, so in that sense it is a false positive. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Implement Clipboard Event Api (#33576)Gae242025-01-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * implement ClipboardEvent interface Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * draft implementation of clipboard events Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * handle received clipboard events inside html elemtents Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * use rustdoc style Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix compilation errors due to rebase Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * update arboard crate Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * improve paste events Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * code cleanup revert arboard crate's update, handle text only Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * restrict visibility of some methods to script crate Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * propagate CanGc argument Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * simplify handle_clipboard_msg Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * remove code duplication Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix potential borrow hazard Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * add clipboard_event pref, restore unit test code Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * retrict visibility of some document's methods Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * check if clipboardevent is trusted Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * enable clipboardevent Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix compilation for egl ports Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
* api: Flatten and simplify Servo preferences (#34966)Martin Robinson2025-01-141-10/+19
| | | | | | | | | | | | | | | | | | | Flatten and simplify Servo's preferences code. In addition, have both preferences and options passed in as arguments to `Servo::new()` and make sure not to use the globally set preferences in `servoshell` (as much as possible now). Instead of a complex procedural macro to generate preferences, just expose a very simple derive macro that adds string based getters and setters. - All command-line parsing is moved to servoshell. - There is no longer the concept of a missing preference. - Preferences no longer have to be part of the resources bundle because they now have reasonable default values. - servoshell specific preferences are no longer part of the preferences exposed by the Servo API. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix building with feature=tracing (#34815)Simon Wülker2025-01-031-1/+1
| | | Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* chore: remove `WindowMethods::rendering_context` (#34780)Ngo Iok Ui (Wu Yu Wei)2025-01-011-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Create Servo without initial webview ID Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Add rendering context in App struct Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Make webview manager optional Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Move window creation to init Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Create window from external rendering context Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Resize surface in compositor Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Obey clippy Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Update Android and OHOS Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Add missing arguent on OHOS Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Show webview after focused on Android and OH Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Remove rendering_context in ServoWindowCallbacks Signed-off-by: Wu Yuwei <yuweiwu@pm.me> * Create surface before swapchain in headless mode Signed-off-by: Wu Yuwei <yuweiwu@pm.me> --------- Signed-off-by: Wu Yuwei <yuweiwu@pm.me>
* libservo: update stylo preferences in multiprocess mode. (#34661)Mukilan Thiyagarajan2024-12-171-3/+1
| | | | | | | | | | | | | | | When servo is run in multiprocess mode, the content process receives the preferences via IPC from the main process. However, currently these preferences are only used to update Servo's own preferences by explictly calling Preference::set_all(). This doesn't ensure that stylo's copy of preferences is also updated. This change replaces the call to `Preference::set_all()` with call to `add_user_prefs` which does ensure both Servo's and Stylos' preferences are updated. Fixes #34660. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Add embedder event for preferred color scheme and respond to it in the ↵arthmis2024-12-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | LayoutThread (#34532) * respond to winit platform theme changed event and send it to the layout thread Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactoring viewport and theme change handling functions based on feedback Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fixing issues reported by test-tidy Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update stylo in order to use color_scheme function on Device Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
* Add prefs to limit threadpool sizes (#34478)Jonathan Schwender2024-12-071-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | * Add prefs to limit threadpool sizes Add preferences to control the size of threadpools, so that we can easily reduce the amount of runtime threads and test which pools benefit from more threads. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * Add pref for Webrender threadpool Add a preference to limit the size of the webrender threadpool. Note: WebRender by default calls hooks which register the threads with a profiler instance that the embedder can register with webrender. Servo currently doesn't register such a profiler with webrender, but in the future we might also want to profile the webrender threadpool. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Add `webgpu` feature flag (#34444)atbrakhi2024-12-051-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move script gpu files into webgpu folder Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Modify gpu webidls Signed-off-by: atbrakhi <atbrakhi@igalia.com> * move gpu realted webidl Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add webgpu feature to script Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add dummy implementation for gpucanvascontext Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add skip-if CARGO_FEATURE_WEBGPU Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Move NavigatorGPU and workerNavigator GPU to webgpu idl Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt and cleanup Signed-off-by: atbrakhi <atbrakhi@igalia.com> * review fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> * enable webgpu by default and also some fmt fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Add pref back, fix imports, small cleanups Signed-off-by: atbrakhi <atbrakhi@igalia.com> --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Disable layout-2013 feature by default (#34290)Jonathan Schwender2024-11-211-2/+2
| | | | | | | | | | | | | Most of the time layout-2013 is not needed and just wastes build time. Disable the optional feature by default and require users to specify the feature at compile time if they wish to use the legacy layout. In CI we enable the feature by default for Linux, since that we need it for wpt tests with the legacy layout and CI should ensure that the legacy code continues to compile. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Set all tracing spans to trace level for now (#34256)Delan Azabani2024-11-191-1/+5
| | | | | | | | | | | | | * Clean up tracing instrumentation Signed-off-by: Delan Azabani <dazabani@igalia.com> * Set all tracing spans to trace level for now Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
* ohos: Add basic IME and keyboard support (#34188)Jonathan Schwender2024-11-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ohos: Add basic IME and keyboard support - Add extremely basic support for keyboard events - Add basic IME support - Showing and hiding the IME - inserting text - deleting characters - very basic configuration of the IME Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Apply suggestions from code review Improve the log message Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> * Update ports/servoshell/egl/ohos.rs Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> * ohos: Bump the minimum required SDK version to 5.0 Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: Remove pub from callbacks The callbacks don't need to be public, as we will be registering them. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Rename composition event Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: clippy in log Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: address some clippy warnings Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: Raise Error in mach if unsupported SDK version is used. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Add keyboard-types dependency for android Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
* feat: `webxr` feature flag (#34241)Ngo Iok Ui (Wu Yu Wei)2024-11-131-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add webxr feature flag Add webxr feature flag to embedder_traits Add webxr flag to constellation Add webxr flag to compositor Add webxr flag to canvas Turn registry into optional Add webxr flag to servo lib Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> Co-authored-by: august kline <me@augustkline.com> * Cargo fmt Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> * Add missing license Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> * Cargo clippy Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> --------- Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> Co-authored-by: august kline <me@augustkline.com>
* Add simple fling implementation (#33219)Jonathan Schwender2024-11-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* remove sparkle from components/servo (#33910)Samson2024-10-191-3/+3
| | | | | | | | | | | | | * replace sparkle's GlType with canvas_traits's GlType Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * remove sparkle from components/servo Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Use `ROUTER::add_typed_route` instead of `ROUTER::add_route` everywhere (#33866)Simon Wülker2024-10-181-3/+3
| | | | | | | | | | | | | * Use ROUTER::add_typed_route where possible Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update webxr, media and ipc-channel Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* clippy: Rename `RequestId::new()` to `RequestId::next()` and fix one more ↵komuhangi2024-10-181-0/+1
| | | | | | | | | | | | | | | issue in `servo/lib.rs` (#33881) * clippy: fix clippy warnings in components/ Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com> * Addressed changes from the PR Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com> --------- Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com>
* clippy: Fix warnings in `components/script/dom` & `components/servo` (#33853)tanishka2024-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * clippy: Fix warnings in components/script/dom & components/servo Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Move allow to the level of the named field Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Add blank lines before & after field Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * remove trailing whitespace Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Gate all use of `tracing` behind Cargo feature (#33845)Delan Azabani2024-10-161-1/+4
| | | Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Fix headless mode on Windows (#33817)Cristian Brinza2024-10-141-11/+11
| | | Signed-off-by: crbrz <cristianb@gmail.com>
* Update Servo user agent strings (#33770)Alex Touchet2024-10-101-8/+8
| | | | | | | | | | | | | * Update Servo user agent strings Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com> * Use Firefox ESR version instead Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com> --------- Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
* compositor: Create a single cross-process compositor API (#33619) (#33660)Martin Robinson2024-10-091-92/+24
| | | | | | | | | | | | | | | | | | | | | | Instead of exposing many different kinds of messages to the compositor that are routed through the constellation, expose a single message type which can be sent across IPC channels. In addition, this IPC channel and the route to the crossbeam channel with the compositor is created along with the `CompositorProxy`, simplifying what needs to be passed around during pipeline initialization. Previously, some image updates (from video) were sent over IPC with a special serialization routine and some were sent via crossbeam channels (canvas). Now all updates go over the IPC channel `IpcSharedMemory` is used to avoid serialization penalties. This should improve performance and reduce copies for video, but add a memory copy overhead for canvas. This will improve in the future when canvas renders directly into a texture. All-in-all this is a simplification which opens the path toward having a standard compositor API and reduces the number of duplicate messages and proxying that had to happen in libservo. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Revert "compositor: Create a single cross-process compositor API (#33619)" ↵Martin Robinson2024-10-041-24/+92
| | | | | | | | | (#33645) This reverts commit f2f5614ad64927aa82aa8937ae14a6086df49d2b. This is causing intermittent crashes: https://github.com/servo/servo/actions/runs/11167043809/job/31044255019 Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* compositor: Create a single cross-process compositor API (#33619)Martin Robinson2024-10-031-92/+24
| | | | | | | | | | | | | | | | | | | | | | Instead of exposing many different kinds of messages to the compositor that are routed through the constellation, expose a single message type which can be sent across IPC channels. In addition, this IPC channel and the route to the crossbeam channel with the compositor is created along with the `CompositorProxy`, simplifying what needs to be passed around during pipeline initialization. Previously, some image updates (from video) were sent over IPC with a special serialization routine and some were sent via crossbeam channels (canvas). Now all updates go over the IPC channel `IpcSharedMemory` is used to avoid serialization penalties. This should improve performance and reduce copies for video, but add a memory copy overhead for canvas. This will improve in the future when canvas renders directly into a texture. All-in-all this is a simplification which opens the path toward having a standard compositor API and reduces the number of duplicate messages and proxying that had to happen in libservo. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Compositor: add document id to NewWebRenderFrame variant (#33597)Ngo Iok Ui (Wu Yu Wei)2024-10-021-2/+5
| | | | | | | | | | | | | * Add document id to NewWebRenderFrame variant Signed-off-by: Wu Wayne <yuweiwu@pm.me> * Match the arguments order Signed-off-by: Wu Wayne <yuweiwu@pm.me> --------- Signed-off-by: Wu Wayne <yuweiwu@pm.me>
* fonts: Make `FontKey` and `FontInstanceKey` generation asynchronous (#33600)Martin Robinson2024-10-011-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | Instead of a blocking a layout thread on the generation of WebRender `FontKey`s and `FontInstanceKey`s, generate the keys ahead of time and send the font data to WebRender asynchronously. This has the benefit of allowing use of the font much more quickly in layout, though blocking display list sending itself on the font data upload. In order to make this work for web fonts, `FontContext` now asks the `SystemFontService` for a `FontKey`s and `FontInstanceKey`s for new web fonts. This should happen much more quickly as the `SystemFontService` is only blocking in order to load system fonts into memory now. In practice this still drops layout thread blocking to fractions of a millisecond instead of multiple milliseconds as before. In addition, ensure that we don't send font data or generate keys for fonts that are used in layout but never added to display lists. This should help to reduce memory usage and increase performance. Performance of this change was verified by putting a microbenchmark around `FontContext::create_font` which is what triggered font key generation. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* fonts: Simplify `FontContext` in two ways that affect the unit test (#33541)Martin Robinson2024-09-251-41/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | This is done by no longer forwarding compositor-bound messages through SystemFontService and making `FontContext` non-generic: - Messages from the `FontContext` to the `Compositor` no longer need to be forwarded through the `SystemFontService`. Instead send these messages directly through the script IPC channel to the `Compositor`. - Instead of adding a mock `SystemFontServiceProxy`, simply implement a mock `SystemFontService` on the other side of an IPC channel in the `font_context` unit test. This allows making `FontContext` non-generic, greatly simplifying the code. The extra complexity moves into the unit test. These changes necessitate adding a new kind of `FontIdentifier`, `FontIdentifier::Mock` due to the fact that local fonts have platform-specific identifiers. This avoids having to pretend like the system font service can have web fonts -- which was always a bit of a hack. These two changes are combined into one PR because they both require extensive and similar chages in the font_context unit test which dependended on the details of both of them. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* fonts: Use `IpcSharedMemory` to send font data (#33530)Martin Robinson2024-09-251-20/+14
| | | | | | | | | | | | | | | | | | | | | This changes modifes the way that font data is sent over IPC channels. Instead of serializing the data or sending it via IPC byte senders, font data is copied into shared memory and a copy of the handle is sent over the channel. There is also the idea of sending the file handle of the on disk data of system fonts. This could be implemented as a further followup once there is an abstraction in `ipc-channel` over file handles. To accomplish this, a `FontData` abstraction is added, which also allows caching an in-memory shared `Arc<Vec<u8>>` version of the data (neeeded by some APIs). This could also be a place for caching font tables in the future. Finally, the `FontCacheThread` is renamed to the `SystemFontService` while the proxy for this is now named `SystemFontServiceProxy`. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Add perfetto tracing events to fonts (#33436)atbrakhi2024-09-161-1/+7
| | | | | | | | | | | | | | | | * trace fonts Co-authored-by: Delan Azabani <dazabani@igalia.com> Signed-off-by: atbrakhi <atbrakhi@igalia.com> * review fix Co-authored-by: Delan Azabani <dazabani@igalia.com> Signed-off-by: atbrakhi <atbrakhi@igalia.com> --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com>
* clippy: Fix suggestions in `script`, `libservo`, and `servoshell` (#33453)Ali2024-09-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * fix clone on copy warning in servoshell Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Remove unecessary borrow in libservo Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Ignore too many arguments warning on create_constellation() Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * fix explicit auto-deref warning Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Autofix multiple clippy warnings in components/script Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> --------- Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>
* Align Servo version between user agent string and servoshell about dialog ↵Taym Haddadi2024-09-101-18/+30
| | | | | | | | | | | | | | | (#33398) * Align Servo version between Agen and About screen for consistency Signed-off-by: Taym <haddadi.taym@gmail.com> * Improve passing servo_version to desktop_ua_string Signed-off-by: Taym <haddadi.taym@gmail.com> --------- Signed-off-by: Taym <haddadi.taym@gmail.com>
* Plumb selected tracing spans into hitrace (#33324)Delan Azabani2024-09-101-1/+1
| | | | | | | | | | | | | | | | | * Plumb selected tracing spans into hitrace Signed-off-by: Delan Azabani <dazabani@igalia.com> * Tag the spans in #33189 with the `servo_profiling` field Signed-off-by: Delan Azabani <dazabani@igalia.com> * Add comment about fields vs extensions Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
* webgpu: Factor out swapchain to separate file (#33367)Samson2024-09-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move some stuff to swapchain.rs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Use typed WebGPUContextId instead of u64 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Extract create_swapchain function and move more stuff in it Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * extract destroy_swapchain Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * extract swapchain_present Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * extract update_wr_image callback Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Add tracing events (#33189)atbrakhi2024-09-051-0/+1
| | | Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* compositor: Do not parse the Cargo.lock file while building (#33222)Martin Robinson2024-08-281-1/+2
| | | | | | | | | | | | | | | The compositor's `build.rs` script was parsing the `Cargo.lock` file in order to tag WebRender captures with the WebRender version. The embedder already knows what version of Servo we are using, which should be enough to infer the WebRender revision. This changes does that and generally does a bit of cleaning up of how captures are done. - The name of the capture directory is now `webrender-captures` - There is console output now when captures are done. Before it was hard to know if it succeeded. - Simplify the Compositor constructor a little to avoid passing arguments so much. Signed-off-by: Martin Robinson <mrobinson@igalia.com>