Commit graph

37 commits

Author SHA1 Message Date
Oriol Brufau
1499e2a874
Remove some references to layout 2013 vs layout 2020 (#37007)
We no longer have both layout systems.

Testing: not needed (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-05-14 19:53:48 +00:00
Astraea Quinn S
8473946d11
[OH] allow setting log_filter via prefs.json (#36916)
This PR allows us to set the `log_filter` via `prefs.json` as well as
commandline arguments.

Priority goes commandline > prefs.json > compile-time default.

Testing: I compiled and run servo on an OH device, and then checked the
logs:

```
hdc hilog | tee log | rg 'Set log_filter to'
```

```
05-08 15:25:59.389 55824 55993 D A00000/org.servo.servo/servoshell::prefs: Set log_filter to: Some("debug,geometry=trace")
```

Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com>
2025-05-08 16:10:30 +00:00
Josh Matthews
bbfa283518
Remove service worker pref from experimental web features. (#36867)
Most sites that feature detect Service Workers in Servo immediately
break when this pref is enabled, since our implementation is very
incomplete. This provides a poor user experience when recommending the
`--enable-experimental-web-platform-features` flag.

Testing: Existing test coverage should be unchanged.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-06 17:25:16 +00:00
Astraea Quinn S
a77ee1521a
Fix missing user-agent from servo-shell (#36859)
Properly passes user-agent from servoshell args to the preferences.

Testing:
```bash
RUST_LOG=warn WAYLAND_DISPLAY='' ./mach run -r --screen-size=375x812 --window-size=375x812 --pref=dom_svg_enabled --pref=dom_intersection_observer_enabled --user-agent "Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"


RUST_LOG=warn WAYLAND_DISPLAY='' ./mach run -r --screen-size=375x812 --window-size=375x812 --pref=dom_svg_enabled --pref=dom_intersection_observer_enabled
```

Fixes: N/A

---------

Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-05-05 16:51:11 +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
Gae24
d1243a1867
dom: Implement ClipboardItem (#36336)
implement the `ClipboardItem` interface

Testing: covered by existing wpt tests

part of #36084

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-04-06 23:47:57 +00:00
Tim van der Lippe
b87bf0b806
Stub out Trusted Types interfaces (#36355)
Some methods are implemented fully, while others are implemented
partly. With these implementations, there are no observed crashes
when running the trusted-types web-platform-tests.

Most notably, the tests/wpt/tests/trusted-types/idlharness.window.js
is now fully passing.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-04-05 13:08:56 +00:00
Oriol Brufau
7c89e24f34
Remove layout_writing_mode_enabled from experimental features (#36339)
Running tests with --enable-experimental-web-platform-features would
make so many of them fail asserts because of this feature.

Testing: No need to test since
`--enable-experimental-web-platform-features` isn't used by default
This is part of #36315

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-04 15:33:58 +00:00
Martin Robinson
4402b7cf8f
libservo: Remove a couple EmbedderMethods (#36276)
- 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>
2025-04-01 22:59:50 +00:00
Tony
5a76906d64
Allow setting userscripts directly without the need of files (#35388)
* 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>
2025-03-27 03:00:08 +00:00
Manuel Rego
8f79b77c13
Add --enable-experimental-web-platform-features command line (#36022)
This command line argument will enable a set of web platform features
that are under development but not ready to be enabled by default.

Signed-off-by: Manuel Rego Casasnovas <rego@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-03-19 12:18:36 +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
Oriol Brufau
7594dc6991
Remove legacy layout (layout 2013) (#35943)
We were already not compiling it and not running tests on it by default.
So it's simpler to just completely remove it.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-03-13 07:26:57 +00:00
webbeef
aa76847502
Remove obsolete memory profiler console output (#35861)
Signed-off-by: webbeef <me@webbeef.org>
2025-03-08 02:41:08 +00:00
Jonathan Schwender
ce9566c5fe
servoshell: Minor fixes to cli help. (#35794)
Fixes the `--pref` enable hint to use `_` instead of dots.
Remove `--prefs-file` from the hint, since the hint is placed
directly after the long option. (The help line displayed as
`--prefs-file --prefs-file /path/to/prefs.json` before).

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-03-04 20:13:07 +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
webbeef
27970e1847
Set a valid default value for the --userscripts command line option (#35740)
This prevents a crash when not specifying the path and matches the help message for that option.

Signed-off-by: webbeef <me@webbeef.org>
2025-03-02 07:14:18 +00:00
Narfinger
5fa014d389
servoshell: Read prefs.json from bundle on OHOS (#35581)
* 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>
2025-03-01 10:53:35 +00:00
Josh Matthews
de66f72197
Allow webdriver screenshots to occur immediately upon request. (#35677)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-26 15:45:19 +00:00
Martin Robinson
54b5c7b632
compositing: Move image output and shutdown management out of the compositor (#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>
2025-02-20 18:27:49 +00:00
Martin Robinson
118a813dba
servoshell: Move initial_window_size and screen_size_override into ServoShellPreferences from Opts (#35407)
These settings just configure `servoshell` so should be in
`ServoShellPreferences` instead.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-10 20:48:48 +00:00
Martin Robinson
75cf3d7265
dom: Always replace unpaired surrogates when handling page text (#35381)
Background:

> JavaScript strings are potentially ill-formed UTF-16 (arbitrary
> Vec<u16>) and can contain unpaired surrogates. Rust’s String type is
> well-formed UTF-8 and can not contain any surrogate. Surrogates are
> never emitted when decoding bytes from the network, but they can sneak
> in through document.write, the Element.innerHtml setter, or other DOM
> APIs.

In 2015, Servo launched an experiment to see if unpaired surrogates
cropped up in page content. That experiment caused Servo to panic if
unpaired surrogates were encountered with a request to report the page
to bug #6564. During that time several pages were reported with unpaired
surrogates, causing Servo to panic. In addition, when running the WPT
tests Servo will never panic due to the `-Z replace-surrogates` option
being passed by the test driver.

Motivation:

After this 10 year experiment, it's clear that unpaired surrogates are a
real concern in page content. Several reports were filed of Servo
panicking after encountering them in real world pages. A complete fix for
this issue would be to somehow maintain unpaired surrogates in the DOM,
but that is a much larger task than simply emitting U+FFD instead of an
unpaired surrogate.

Since it is clear that this kind of content exists, it is better for
Servo to try its best to handle the content rather than crash as
production browsers should not crash due to user content when possible.
In this change, I modify Servo to always replace unpaired surrogates.

It would have been ideal to only crash when debug assertions are
enabled, but debug assertions are enabled by default in release mode --
so this wouldn't be effective for WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-09 08:56:05 +00:00
Jonathan Schwender
654df4c8b7
Add cli option for tracing-filter (#35370)
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>
2025-02-08 07:10:12 +00:00
Martin Robinson
e227e0913b
servoshell: Move headless setting to ServoShellPreferences (#35377)
This is only used in servoshell, even though it was plumbed through
script previously. It's just about how the `RenderingContext` is set up,
which is something managed entirely outside of servo itself.

In addition, make the name of `servo_shell_preferences` in `app.rs` more
consistent with the rest of the codebase.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-07 20:04:31 +00:00
Xiaocheng Hu
4716dca505
Clean up some stale debug options for ServoDriver (#35281)
* Clean up some stale debug options for ServoDriver

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

* Fix wpt manifest

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

---------

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-02-04 12:59:06 +00:00
Delan Azabani
2ce7709b8b
libservo: Add an initial WebView data structure to the API (#35119)
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>
2025-01-25 08:17:50 +00:00
Martin Robinson
f5f5a3f79e
Fix some clippy issues on the Android build (#35147)
This fixes a variety of clippy issues that show up on the Android build.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-23 15:18:58 +00:00
Martin Robinson
2d09552234
prefs: Move some DebugOptions to Preferences and clean up (#34998)
- 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>
2025-01-17 11:47:47 +00:00
Samson
b92a598e62
chore: Update wgpu and fix webgpu pref (#35020)
* Update wgpu to v24

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* `dom.webgpu.enabled` -> `dom_webgpu_enabled`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-01-16 14:42:47 +00:00
Martin Robinson
e81951a973
layout: Remove the obsolete layout tracing functionality (#35001)
There were two kinds of layout tracing controlled by the same debugging
option:

 - modern layout: Functionality that dumped a JSON serialization of the
   layout tree before and after layout.
 - legacy layout: A scope based tracing that reported the process of
   layout in a structured way.

I don't think anyone working on layout is using either of these two
features. For modern layout requiring data structure to implement
`serde` serialization is incredibly inconvenient and also generates a
lot of extra code.

We also have a more modern tracing functionality based on perfetto that
we have started to use for layout and IMO it's actually being used and
more robust.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-15 13:24:14 +00:00
Martin Robinson
f5ef8aaed3
config: Remove legacy-layout and unused Preferences and Opts (#34994)
There are some preferences and options that are only used by legacy
layout or not used at all. This PR removes them.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 20:12:14 +00:00
Martin Robinson
0e616e0c5d
api: Flatten and simplify Servo preferences (#34966)
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>
2025-01-14 13:54:06 +00:00
Daniel Adams
e85491b5fc
Allow prefs to be overridden from a file and set WPT-specific prefs from file (#33163)
* Allow prefs to be passed in from a separate file

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Add wpt-prefs.json for setting WPT-specific prefs

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* fix argument to read_prefs_file

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update test_parse_pref test

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Add line in executorservo.py to read from wpt-prefs.json

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update MANIFEST.json

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update expectations

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Disable dom.webxr.test for interfaces test

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-24 06:47:57 +00:00
Delan Azabani
a3d2f0c586
Enable debug assertions for all builds other than official releases (#30509)
* Run main and try jobs with debug assertions

* use single quotes in workflow expressions

* set force-debug-assertions in main.yml

* set force-debug-assertions as part of decision job

* fix typo in MachCommands.build

* fix more hardcoded profile names

* fix tidy

* split cargo_profile_option on windows

* Fix running servoshell and unit tests through a symlink

* rename steps to make them less confusing

* fix more hardcoded cargo profile options

* fix missing inputs in linux-wpt and mac-wpt

* make filename an inherent method of Resource

* rework release-with-debug-assertions profile to production profile

* rework resource logic to eliminate std_test_override

* set production flag in nightly release builds

* clean up servobuild.example and windows.yml

* oops forgot to check in embedder_traits/build.rs

* fix mach test-unit behaviour through symlink

* unit tests only need current_dir and ancestors

* fix macOS package smoketest breakage

* expect css/css-color/currentcolor-003 to crash under layout 2013

* fix more references to {force,release-with}-debug-assertions

* fix local build failures under --profile production
2023-10-26 08:22:14 +00:00
Delan Azabani
351b5036bf
Fix running servoshell and unit tests through a symlink (#30537)
* Fix running servoshell and unit tests through a symlink

* make filename an inherent method of Resource

* fix mach test-unit behaviour through symlink

* unit tests only need current_dir and ancestors

* fix macOS package smoketest breakage
2023-10-18 10:33:51 +00:00
Delan Azabani
90ad5920e2
[NFC] servoshell: fix rust-analyzer and rustfmt breakage (#30340) 2023-09-12 06:27:10 +00:00
Atbrakhi
66567faeb2
Rename ports/winit package to servoshell (#30163)
* rename winit package to servoshell

* revert previous changes and rename only package
2023-08-28 14:36:57 +00:00
Renamed from ports/winit/prefs.rs (Browse further)