aboutsummaryrefslogtreecommitdiffstats
path: root/ports/servoshell/egl/ohos/simpleservo.rs
Commit message (Collapse)AuthorAgeFilesLines
* libservo: Expose a `ServoBuilder` (#36549)Martin Robinson6 days1-21/+7
| | | | | | | | | Expose a `ServoBuilder` for easily creating Servo instances using default values. This change enables removing `EmbedderTraits`. Testing: This is covered by `Servo` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* [OHOS] Allow setting the log-filter via cli arguments (#36444)Astraea Quinn S7 days1-0/+2
| | | | | | | | | | This PR allows setting the log-filter according to the env_filter spec via CLI arguments. Testing is currently in progress, will be done on machines running OHOS. --------- Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com> Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* libservo: Make zooming and HiDPI scaling work per-`WebView` (#36419)Martin Robinson8 days1-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | libservo: Make zooming and HiDPI scaling work per-`WebView` This change moves all zooming and HiDPI scaling to work per-`WebView` in both libservo and Compositor. This means that you can pinch zoom one `WebView` and it should now work independently of other `WebView`s. This is accomplished by making each `WebView` in the WebRender scene have its own scaling reference frame. All WebViews are now expected to manage their HiDPI scaling factor and this can be set independently of other WebViews. Perhaps in the future this will become a Servo-wide setting. This allows full removal of the `WindowMethods` trait from Servo. Testing: There are not yet any tests for the WebView API, but I hope to add those soon. Co-authored-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Shubham Gupta <shubham13297@gmail.com>
* Implement WebviewDelegate.screen_geometry for OHOS (#36459)JoeDow11 days1-0/+9
| | | | | | | | | | | | | | | | | | [OHOS]Bugfix: unimplemented WebviewDelegate.sceen_geometry causes failed page loading this [PR 36223](https://github.com/servo/servo/pull/36223) causes that some page can not be loaded on ohos platform. The newly added WebviewDelegate.screen_geometry is unimplemented at ohos platform Besides, this commit also fix the bug that failed to copy the prefs.json to cache dir when the servo is started at the first time after an ohos application is installed, due to the cache dir is not existed. @mrobinson @jschwe Testing: the ohos platform test demo hap Fixes: No issue exists i can find Signed-off-by: coding-joedow <ibluegalaxy_taoj@163.com>
* libservo: Remove a couple `EmbedderMethods` (#36276)Martin Robinson2025-04-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | - 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>
* Allow setting userscripts directly without the need of files (#35388)Tony2025-03-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Create `config_dir` if none exist for caching (#35761)Euclid Ye2025-03-181-1/+17
| | | | | | | | | | | | | | | | | | | | | * Create config_dir if none exist for caching Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * remove specialized behaviour for ohos; copy prefs.json if necessary Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * downgrade the log to trace verbosity Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * update wpt-test Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-3/+3
| | | | | | | | | | | | | * 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>
* servoshell: Read prefs.json from bundle on OHOS (#35581)Narfinger2025-03-011-2/+11
| | | | | | | | | | | | | | | | | * Allows to read the prefs.json from the hap bundle on OHOS. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> * incorporate suggestions Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> * incoroporate requested changes Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
* libservo: Move size handling to `RenderContext` from `WindowMethods` (#35621)Martin Robinson2025-02-251-9/+3
| | | | | | | | | | | | | | | | | | | | | This is the first step toward removing `WindowMethods`, which will gradually be integrated into the `WebView` and `WebViewDelegate`. Sizing of the `WebView` is now handled by the a size associated with a `RenderingContext`. `WebView`s will eventually just paint the entire size of their `RenderingContext`. Notes: - This is transitionary step so now there is a `WebView::resize` and a `WebView::move_resize`. The first is the future which will resize the `WebView` and its associated `RenderingContext`. The second is a function that the virtual `WebView`s that will soon be replaced by a the one-`WebView` per `WebView` model. - We do not need to call `WebView::move_resize` at as much any longer because the default size of the `WebView` is to take up the whole `RenderingContext`. - `SurfmanRenderingContext` is no longer exposed in the API, as a surfman context doesn't naturally have a size unless a surface is bound to it. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* compositing: Move image output and shutdown management out of the compositor ↵Martin Robinson2025-02-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | (#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: Expose `SoftwareRenderingContext` and `WindowRenderingContext` ↵Martin Robinson2025-02-181-33/+31
| | | | | | | | | | | | | | (#35501) Expose two easy-to-use wrappers around `SurfmanRenderingContext` that make the API simpler to use: - `WindowRenderingContext`: This `RenderingContext` is a newtype around `SurfmanRenderingContext` takes a `raw-window-handle` display and window and creates a full window rendering context. - `SoftwareRenderingContext`: is wraps `SurfmanRenderingContext` and adds a swap chain in order to expose a software GL rendering context. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add cli option for tracing-filter (#35370)Jonathan Schwender2025-02-081-1/+2
| | | | | | | | Using environment variables is not really an option on ohos/android, so add a CLI option to configure tracing. Making it a `pref`, so that we can persist the filter might also be desirable. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Migrate Android and OHOS ports to the delegate API (#35315)Mukilan Thiyagarajan2025-02-061-6/+6
| | | | Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-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>
* ohos: Support resizing the surface (#35158)Jonathan Schwender2025-01-291-19/+14
| | | | | | A window resize requires to also resize the webview, otherwise it will stay at the original size. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* servoshell: Port Android / OHOS servoshell to use the WebView API (#35192)Martin Robinson2025-01-291-12/+3
| | | Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Stop using `script_traits` in the embedding layer (#35185)Martin Robinson2025-01-281-6/+5
| | | | | | | | | | | | | | | 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>
* feat: Turn `RenderingContext` into a trait (#35052)DK Liao2025-01-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* api: Flatten and simplify Servo preferences (#34966)Martin Robinson2025-01-141-45/+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>
* Update xcomponent-sys to 0.2.0 (#34898)Jonathan Schwender2025-01-081-1/+1
| | | | | | | | Use xcomponent exclusively via `xcomponent_sys` instead of using some of the APIs from ohos-sys. ohos-sys simply re-exports xcomponent-sys, so using both makes updating either difficult. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Update all network-related dependencies to the latest versions (#34630)Josh Matthews2025-01-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update all network-related dependencies to the latest versions: * rustls * hyper * http * headers * tungstenite * async-tungstenite Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix panics with 1xx responses in WPT tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use reported response length when calculating available ranges. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Clean up commented fragments in blob and file handlers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix clippy warning. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Cleanup. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix up unit tests for dependency upgrades. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update aws-lc-sys to fix Windows builds. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use ring instead of aws-lc-sys. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * embedding: Require embedder to initialize a rustls CryptoProvider. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Disable aws-lc-rs pending OhOS build fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* chore: remove `WindowMethods::rendering_context` (#34780)Ngo Iok Ui (Wu Yu Wei)2025-01-011-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* servoshell: Remove duplicate egl bindings on android/ohos (#34716)Jonathan Schwender2024-12-201-7/+1
| | | | | | | | | | - The default value for SwapInterval is 1, so setting it to 1 changes nothing - We don't clear the screen immediately anymore, which was the only useage of the egl bindings this saves us from duplicated EGL bindings. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Fix various clippy warnings on OpenHarmony (#34281)Jonathan Schwender2024-11-191-10/+4
| | | | | | | | | | | | | | | | | | * ohos: Fix more clippy warnings Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * Remove unnecessary `macro_use` We can use `use` instead. Removes a warning about unused macro_use on OpenHarmony. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* servoshell: Fix --no-default-features and make webxr optional on ↵Jonathan Schwender2024-11-131-1/+6
| | | | | | | | | | | | | | | | | | | ohos/android (#34242) * servoshell: fix --no-default-features The Embeddertraits only contain `register_webxr` if the webxr feature is enabled, hence we also need to guard the trait implementation. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * ohos/android: Make webxr optional in servoshell Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* ohos: Allow passing arguments to servoshell (#33588)Jonathan Schwender2024-10-021-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ohos: Bump minimum CMake version By bumping the minimum CMake version, we avoid a deprecation warning. The OH 4.0 SDK ships with CMake 3.16, so we can be sure that we have CMake 3.16 or newer available. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: Allow passing arguments to servoshell Allows passing options passed via `wants` to the Ability through to servoshell. This allows easier debugging, either by calling servoshell from a test app, or from the commandline, e.g. ``` hdc shell aa start -a EntryAbility -b org.servo.servoshell -U "https://www.wikipedia.org" \ --pb dom.webgpu.enabled true \ --ps dom.webgpu.wgpu_backend "gl" \ --pi layout.threads 4 ``` Note: While the OH `wants` API differentiates between boolean, string and integer values, we convert everything back to strings, so we can reuse the same parsing code as the desktop servoshell. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* ohos: Bundle resource files in hap (#33513)Jonathan Schwender2024-09-241-3/+9
| | | | | | | | | | Bundle resource files into the .hap, so they are available as files in the application sandbox, instead of included into the shared library. This should slightly reduce the binary size in debug and release mode. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
* Make tracing available on all platforms, with or without perfetto (#33301)Delan Azabani2024-09-041-0/+1
| | | | | | | | | | | | | * Make tracing available on all platforms Signed-off-by: Delan Azabani <dazabani@igalia.com> * Gate perfetto support behind its own feature Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
* ohos: Bump ohos-sys to v0.2.1 (#32834)Jonathan Schwender2024-07-231-3/+1
| | | | | | | | | | | | | * ohos: Use ohos-sys from crates.io Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * ohos: Bump ohos-sys to v0.2.1 Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Add OpenHarmony support to servoshell (#32594)Jonathan Schwender2024-06-281-0/+110
* Generate EGL bindings for ohos Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Adjust servoshell `bin` error message for android/ohos Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: disable WebGL offscreen buffers are not implemented yet on ohos. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Add OpenHarmony support to servoshell Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Share ResourceReaderInstance Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Share android/ohos HostTrait Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Share servo glue Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * Pass Init options from ArkTS to Servo Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * f rebase ResourceReaderMethods Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * fixup! Share ResourceReaderInstance Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Fix typo Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Update Cargo.lock Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * ohos: Move WebGL check to webgl thread Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Remove commented code Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Remove commented and duplicate / unused code Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>