Commit graph

38 commits

Author SHA1 Message Date
Shubham Gupta
54f23a8e3d
build(deps): bump ohos-ime from 0.2.0 to 0.3.0 (#37180)
This patch updates the ohos-ime version from v0.2.0 to v0.3.0

Testing: N/A
Fixes: #37181

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
2025-05-29 09:50:33 +00:00
Narfinger
3af0992ead
Added a new workflow that benchmarks simple startup and loading of servo.org on HarmonyOS. (#36878)
Added a new workflow that benchmarks simple startup and loading of
servo.org on HarmonyOS.
Needs https://github.com/servo/ci-runners/pull/34 to be merged and
applied to the runners.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-05-15 12:52:33 +00:00
Astraea Quinn S
366515f256
[OH] Provide correct geometry offset and fix available screen dimensions (#36915)
This commit corrects the geometry details provided under the OH platform
by getting the offset from the OS. OH port provides correct offset and
available space.

Fixes: #36466

---------

Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
2025-05-09 15:07:49 +00:00
Jonathan Schwender
063bfc761e
ohos: Set custom log domain (#36913)
This allows us to easily filter logs related to the servo app via our
domain tag, e.g.
The domain value was chosen empirically and doesn't seem to collide as
of now. From the OpenHarmony side there are no requirements on the value
as long as it is between `0x0000` and `0xFFFF`. A value of zero (current
status) doesn't allow filtering in hilog.

```
hdc shell hilog -D 0xE0C3
```



Testing: No functional changes

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2025-05-08 17:35:45 +00:00
Martin Robinson
d8a7abda69
libservo: Expose a ServoBuilder (#36549)
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>
2025-04-16 16:58:52 +00:00
Astraea Quinn S
064f82d0a3
[OHOS] Allow setting the log-filter via cli arguments (#36444)
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>
2025-04-15 10:19:13 +00:00
Euclid Ye
86957be5f0
Create config_dir if none exist for caching (#35761)
* 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>
2025-03-18 18:36:33 +00:00
Simon Wülker
bb0d08432e
Migrate to the 2024 edition (#35755)
* Migrate to 2024 edition

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

* Allow unsafe_op_in_unsafe_fn lint

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

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

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

* Compile using the 2024 edition

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-13 10:28:11 +00:00
Jonathan Schwender
f7ddac249b
ohos: Remove direct link to ace_napi.z (#35921)
The underlying issue was solved in napi-ohos 1.0.2,
and we have already updated to 1.0.4

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-03-11 19:34:32 +00:00
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* 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>
2025-03-03 11:26:53 +00:00
Delan Azabani
276f6a3ba7
libservo: Clean up interfaces for alert()/confirm()/prompt() (#35579)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-02-27 02:49:08 +00:00
Martin Robinson
23524a5413
libservo: Move size handling to RenderContext from WindowMethods (#35621)
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>
2025-02-25 15:03:53 +00:00
Martin Robinson
19e41ab9f9
libservo: Add a ClipboardDelegate and a default implementation (#35297)
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>
2025-02-07 10:43:46 +00:00
Mukilan Thiyagarajan
e0689c1f0b
Migrate Android and OHOS ports to the delegate API (#35315)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-02-06 14:21:29 +00:00
Martin Robinson
fdfaf7b15c
libservo: Combine LoadStart, HeadParsed, and LoadComplete` messages (#35260)
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>
2025-02-03 22:31:17 +00:00
Jonathan Schwender
53fcc98585
ohos: Support resizing the surface (#35158)
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>
2025-01-29 15:45:17 +00:00
Martin Robinson
c633ca1cde
servoshell: Port Android / OHOS servoshell to use the WebView API (#35192)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-29 11:09:10 +00:00
Martin Robinson
a1cf0cbf86
libservo: Stop using script_traits in the embedding layer (#35185)
Many types used directly in the `libservo` API are in the
`script_traits` crate, which was created to break circular dependencies.
Move all API exposed types to `embedder_traits` which now contains types
exposed via the `libservo` embedding API. Also expose these at the root
of the `libservo` `servo` crate so that the API won't break when they
move around in the future.

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

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-28 11:15:36 +00:00
Jonathan Schwender
e3d347d4b4
CI: Test ohos on HarmonyOS device (#35006)
* ohos: Add event for page loaded

We can use this to check if we succeeded.

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

* CI: Test OpenHarmony on self-hosted runner

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

* fix typo

Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
2025-01-23 03:35:51 +00:00
Jonathan Schwender
a94c0c04a6
Update xcomponent-sys to 0.2.0 (#34898)
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>
2025-01-08 17:11:15 +00:00
Jonathan Schwender
0dd8798148
servoshell: Remove duplicate egl bindings on android/ohos (#34716)
- 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>
2024-12-20 15:08:09 +00:00
Jonathan Schwender
09684a3501
Fix various clippy warnings on OpenHarmony (#34281)
* 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>
2024-11-19 05:21:48 +00:00
Jonathan Schwender
538ac61a82
ohos: Add basic IME and keyboard support (#34188)
* 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>
2024-11-15 15:04:48 +00:00
Jonathan Schwender
72971bd271
Add simple fling implementation (#33219)
* Add simple fling implementation

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

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

* Multiply initial velocity with 2

This makes the experience much more snappy.

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

* address review comments

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

* Rename constants and add todo

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

* fmt

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

* Add a few periods to make comments consistent

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

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-11-10 10:15:42 +00:00
Jonathan Schwender
dcb9058fe3
ohos: Bump napi-ohos (#34160)
Update napi-ohos and migrate away from deprecated `JsFunction`
and use the new `Function` and `build_threadsafe_function()`
methods.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-11-10 03:34:07 +00:00
Jonathan Schwender
4f6283d7fe
ohos/android: Fix some compiler warnings (#34178)
* ohos: Remove unnecessary library links

`ohos-sys` now correctly links all required libraries, so we
don't need to specify them here again.
We still specify `ace_napi.z`, since we use napi via `napi-ohos`, which currently does not add the required link.

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

* Disable some unused functions on ohos/android

- get_default_url()
- parse_url_or_filename()
- add_noto_fallback_families

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

* ohos: Remove unneeded import

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

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-11-07 19:53:57 +00:00
Jonathan Schwender
9fcfe09e51
ohos: Add toast prompt (#33621)
* ohos: Add toast prompt

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

* ohos: Add toast on `load_ended`

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

* Apply review feedback

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>
2024-10-03 16:33:21 +00:00
Jonathan Schwender
e534c7d461
ohos: Allow passing arguments to servoshell (#33588)
* 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>
2024-10-02 04:27:18 +00:00
Jonathan Schwender
88ffe9f7a5
ohos: Bundle resource files in hap (#33513)
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>
2024-09-24 04:29:53 +00:00
Jonathan Schwender
313fc663a6
android/ohos: Fix wrong production cfg (#33488)
Our build script sets `servo_production` and not `production`.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2024-09-18 07:42:52 +00:00
Jonathan Schwender
8a0c7487e7
ohos: Present on vsync signals (#33117)
Rely on callbacks from the vertical synchronization driver,
to drive presentation.
Future commits will base animation updates and touchless
gestures like fling off these vsync events.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-30 13:25:50 +00:00
Jonathan Schwender
2537234090
ohos: Add FFI-APIs to navigate back and forward (#33206)
To be useful it requires using the latest version of the OH demo ArkTS app,
but it is still compatible with older versions, as the newly added FFI functions
will simply be unused in such a case.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-08-27 11:48:17 +00:00
Jonathan Schwender
3576c02ae2
ohos: Remove custom touch history code (#33113)
The TouchHandler in servo already does the equivalent,
so there is no need to have this code in the OH specific code.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-08-19 05:52:34 +00:00
Jonathan Schwender
4b3ed4b684
ohos: Fix log filtering (#33076)
* Increase default filtering to warn
 * fix module filtering (filter_builder was never used)

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-08-16 02:31:35 +00:00
Jonathan Schwender
97c84b6127
ohos/android: Redirect stdout/stderr to log sink (#32858)
* ohos: redirect stdout/stderr to logging sink

Based on the existing android `redirect_stdout_to_logcat` implementation,
but using the safe abstractions from `nix` and dumping to the `log` sink,
instead of directly writing the log.

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

* android: Use new shared implementation for logcat redirection.

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

* servoshell: Register cfg(production)

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

* Update ports/servoshell/egl/log.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>

* Change info! to debug! to match original behavior on 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: Martin Robinson <mrobinson@igalia.com>
2024-08-15 09:26:03 +00:00
Jonathan Schwender
d46c66f9da
ohos: Bump ohos-sys to v0.2.1 (#32834)
* 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>
2024-07-23 07:58:54 +00:00
Jonathan Schwender
b206a0f4a3
ohos: Add default log filter (#32760)
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-12 04:12:25 +00:00
Jonathan Schwender
9455169813
Add OpenHarmony support to servoshell (#32594)
* 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>
2024-06-28 12:51:50 +00:00