Commit graph

337 commits

Author SHA1 Message Date
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
webbeef
3db0194e5a
Embed user agent stylesheets and media control resouces in libservo (#36803)
Embed user agent stylesheets and media control resouces in libservo as
decided in
https://github.com/servo/servo/pull/36788#issuecomment-2845332210

Signed-off-by: webbeef <me@webbeef.org>
2025-05-04 18:48:09 +00:00
dependabot[bot]
3bef0161fe
build(deps): bump winit from 0.30.9 to 0.30.10 (#36777)
Bumps [winit](https://github.com/rust-windowing/winit) from 0.30.9 to
0.30.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rust-windowing/winit/releases">winit's
releases</a>.</em></p>
<blockquote>
<h2>Winit version 0.30.10</h2>
<h3>Added</h3>
<ul>
<li>On Windows, add
<code>IconExtWindows::from_resource_name</code>.</li>
<li>On Windows, add <code>CursorGrabMode::Locked</code>.</li>
<li>On Wayland, add <code>WindowExtWayland::xdg_toplevel</code>.</li>
</ul>
<h3>Changed</h3>
<ul>
<li>On macOS, no longer need control of the main
<code>NSApplication</code> class (which means you can now override it
yourself).</li>
<li>On iOS, remove custom application delegates. You are now allowed to
override the
application delegate yourself.</li>
<li>On iOS, no longer act as-if the application successfully open all
URLs. Override
<code>application:didFinishLaunchingWithOptions:</code> and provide the
desired behaviour yourself.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>On Windows, fixed ~500 ms pause when clicking the title bar during
continuous redraw.</li>
<li>On macOS, <code>WindowExtMacOS::set_simple_fullscreen</code> now
honors <code>WindowExtMacOS::set_borderless_game</code></li>
<li>On X11 and Wayland, fixed pump_events with
<code>Some(Duration::Zero)</code> blocking with <code>Wait</code>
polling mode</li>
<li>On Wayland, fixed a crash when consequently calling
<code>set_cursor_grab</code> without pointer focus.</li>
<li>On Wayland, ensure that external event loop is woken-up when using
pump_events and integrating via <code>FD</code>.</li>
<li>On Wayland, apply fractional scaling to custom cursors.</li>
<li>On macOS, fixed <code>run_app_on_demand</code> returning without
closing open windows.</li>
<li>On macOS, fixed <code>VideoMode::refresh_rate_millihertz</code> for
fractional refresh rates.</li>
<li>On macOS, store monitor handle to avoid panics after going in/out of
sleep.</li>
<li>On macOS, allow certain invalid monitor handles and return
<code>None</code> instead of panicking.</li>
<li>On Windows, fixed <code>Ime::Preedit</code> cursor offset
calculation.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2385410366"><code>2385410</code></a>
Winit version 0.30.10</li>
<li><a
href="6db1343c0b"><code>6db1343</code></a>
wayland: bump wayland-rs to avoid yanked release</li>
<li><a
href="a26899a75d"><code>a26899a</code></a>
windows: fix incorrect cursor_range calculation in Ime::Preedit</li>
<li><a
href="80bddda641"><code>80bddda</code></a>
macOS: Fix monitors connected via certain Thunderbolt hubs</li>
<li><a
href="5f1e9f6cc1"><code>5f1e9f6</code></a>
macOS: Store UUID in MonitorHandle instead of CGDirectDisplayID</li>
<li><a
href="57baf72741"><code>57baf72</code></a>
Allow the user to register the application delegate on iOS</li>
<li><a
href="da7a09658a"><code>da7a096</code></a>
fix: Support fractional refresh rates in video modes on macOS (<a
href="https://redirect.github.com/rust-windowing/winit/issues/4191">#4191</a>)</li>
<li><a
href="53321dc6f5"><code>53321dc</code></a>
Swizzle sendEvent: instead of subclassing NSApplication</li>
<li><a
href="6556cde246"><code>6556cde</code></a>
macOS: Close windows automatically when exiting</li>
<li><a
href="7672fd5657"><code>7672fd5</code></a>
wayland: support fractional scale for custom cursor</li>
<li>Additional commits viewable in <a
href="https://github.com/rust-windowing/winit/compare/v0.30.9...v0.30.10">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=winit&package-manager=cargo&previous-version=0.30.9&new-version=0.30.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-30 17:43:44 +00:00
Alex Touchet
69605d05cf
servoshell Cargo.toml cleanup (#36506)
Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
2025-04-25 20:23:47 +00:00
Tony
894fbd003d
Initial support for marking custom protocol secure (#36656)
Add initial support for marking custom protocol as secure, this makes it
possible to `fetch` a custom protocol inside secure contexts (e.g.
http://localhost)

Some additional contexts:

- [#embedding > Custom protocol secure
context](https://servo.zulipchat.com/#narrow/channel/437943-embedding/topic/Custom.20protocol.20secure.20context)
-
https://github.com/versotile-org/tauri-runtime-verso/issues/6#issuecomment-2820776128

Testing: use `fetch('urlinfo://abc').then(async (response) =>
console.log(await response.text())).catch(console.log)` in servoshell
with in a secure context (e.g. https://servo.org), and see the response
should not be an error

---------

Signed-off-by: Tony <legendmastertony@gmail.com>
Signed-off-by: Tony <68118705+Legend-Master@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-04-25 10:39:33 +00:00
Jonathan Schwender
cf59aa1948
Return Result from ProtocolRegistry::register() (#36688)
Instead of returning true / false it's better to return a Result (even
if we continue ignoring possible error).

Testing: Doesn't change any behavior

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-04-25 10:02:46 +00:00
Simon Wülker
9dc56d420f
servoshell: Make list of options in <select> prompt scrollable (#36677)
This ensures that the select element is usable when there are a lot of
options.

Testing: We don't have tests for servoshell.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-04-24 11:59:54 +00:00
Astraea Quinn S
b6967fc4c8
[tracing] Add convenience macro for function tracing (#36573)
Adds a convenience macro that adds sane defaults to the tracing macro.

Closes: #36534 
Testing: 
 - Pass in sample test cases and compare against expected behaviour.

---------

Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com>
2025-04-22 19:58:20 +00:00
Euclid Ye
46247a7621
Move click event trigger from embedding layer to ScriptThread (#36413)
1. Move click event trigger from embedding layer to `ScriptThread`
2. Previously, the logic is to trigger click event at same position as
`MouseButtonAction::Up` if `MouseButtonAction::Up` is within 10px of
`MouseButtonAction::Down`, in embedding layer. This PR ~~removes the
condition~~ moves the check to `ScriptThread`.

Testing: tested for webdriver with self written test case. Perform
actions of pointermove, pointerdown, pointerup in sequence. Click event
can now be triggered.
Fixes: #35395 

cc @xiaochengh @jdm 

For `MAYBE? TODO:` part I added, should we do it? I read the
[spec](https://w3c.github.io/uievents/#event-type-click), it doesn't
specify we have to implement MDN's way.

If we should work in the MDN's way, it also should be fixed in another
PR, as this PR doesn't regress anything. Also I am not sure what is the
best way to do it.
Should I handle it in
4d4f94936f/components/script/dom/document.rs (L1296-L1297)?

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-04-18 19:27:57 +00:00
Martin Robinson
d345844ed7
compositing: Remove windowing.rs and making compositing private (#36582)
This file used to contain the `EmbedderDelegate` and `WindowMethods`
traits, but these are gone now, so we can move the one remaining enum
to be in `compositor.rs` where it is used. This change also stops
exposing the `compositing` crate as public Servo API.

Testing: This does not change behavior so is covered by existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-17 11:00:55 +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
Jonathan Schwender
32d59cfff4
Fix git failure on macos (#36544)
Fixes the following warning:
```

warning: servoshell@0.0.1: Could not generate git version information: "dyld[59398]: Symbol not found: _libintl_setlocale\n  Referenced from: <CB4FE7B2-A5DC-34F0-8247-A96F45D664E8> /opt/homebrew/Cellar/git/2.48.1/bin/git\n  Expected in:     <0DA2D46D-7A17-3860-809D-71FD05B785FA> /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libintl.8.dylib\n"
```

This was discussed in
https://github.com/servo/servo/issues/36435#issuecomment-2794224073.

mach sets DYLD_LIBRARY_PATH, which is currently necessary for our unit
tests, but causes git to fail in the build script. Simply unsetting the
environment variable before invoking git works around this problem.

Testing: Tested manually on macos and verified the warning does not
occur anymore.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-04-15 14:55:37 +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
Martin Robinson
c6dc7c83a8
libservo: Make zooming and HiDPI scaling work per-WebView (#36419)
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>
2025-04-14 12:01:49 +00:00
Martin Robinson
d1c4b1be76
libservo: Remove the unused multiview feature (#36485)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-14 07:46:07 +00:00
Martin Robinson
084fe007a1
libservo: Create a WebViewBuilder class to construct WebViews (#36483)
This exposes a new method of creating `WebView`s using the Rust builder
pattern. This will be more important as we add more kinds of
configuration options for `WebView` such as size and HiDPI scaling.

Testing: The API currently doesn't have tests, but functionality is
ensured by the fact that servoshell is the test harness.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-12 18:59:16 +00:00
dependabot[bot]
e965a15348
build(deps): bump hilog from 0.1.1 to 0.2.0 (#36476)
Bumps [hilog](https://github.com/openharmony-rs/hilog) from 0.1.1 to
0.2.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/openharmony-rs/hilog/releases">hilog's
releases</a>.</em></p>
<blockquote>
<h2>v0.2.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Feature: allow dynamic filter swaps by <a
href="https://github.com/PartiallyUntyped"><code>@​PartiallyUntyped</code></a>
in <a
href="https://redirect.github.com/openharmony-rs/hilog/pull/4">openharmony-rs/hilog#4</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/PartiallyUntyped"><code>@​PartiallyUntyped</code></a>
made their first contribution in <a
href="https://redirect.github.com/openharmony-rs/hilog/pull/4">openharmony-rs/hilog#4</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/openharmony-rs/hilog/commits/v0.2.0">https://github.com/openharmony-rs/hilog/commits/v0.2.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/openharmony-rs/hilog/commits/v0.2.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=hilog&package-manager=cargo&previous-version=0.1.1&new-version=0.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-11 17:14:38 +00:00
JoeDow
80a6ba5e42
Implement WebviewDelegate.screen_geometry for OHOS (#36459)
[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>
2025-04-11 06:52:07 +00:00
Kingsley Yung
e6595619e1
Drop vergen_git2 dependency (#36439)
Manually call `git rev-parse --short HEAD` to retrieve the commit hash,
instead of using Emitter from vergen_git2. This helps remove
dependencies and shorten compile time.

Testing: It doesn't require tests because it is a refactoring for
removing dependencies
Fixes: #36435

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-04-10 10:39:44 +00:00
Martin Robinson
2fe57cc2a2
libservo: Move animation tracking from WindowMethods to delegates (#36400)
This changes removes animation tracking from the `WindowMethods` trait
and moves it to `ServoDelegate` and `WebViewDelegate`.

- Animation changes per-`WebView` are now triggered in the compositor
  only when the value is updated there, rather than right after ticking
  animations.
- Both `WebView` and `Servo` now expose an `animation()` method, so
  tracking animation state actually becomes unecessary in many cases,
  such as that of desktop servoshell, which can just read the value
  when the event loop spins.

Testing: No tests necessary as the API layer is still untested. Later,
tests will be added for the `WebView` API and this can be tested then.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-09 19:41:53 +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
Martin Robinson
5a35e1faec
constellation: Rename messages sent to the Constellation (#36341)
Messages that are sent to the `Constellation` have pretty ambiguous
names.
This change does two renames:

- `ConstellationMsg` → `EmbedderToConstellationMessage`
- `ScriptMsg` → `ScriptToConstellationMessage`

This naming reflects that the `Constellation` stands in between the
embedding layer and the script layer and can receive messages from both.
Soon both of these message types will live in `constellation_traits`,
reflecting the idea that the `_traits` variant for a crate is
responsible for exposing the API for that crate.

Testing: No new tests are necessary here as this just renames two enums.

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

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-04 19:39:38 +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
Simon Wülker
0e99539dab
Support single-value <select> elements (#35684)
https://github.com/user-attachments/assets/9aba75ff-4190-4a85-89ed-d3f3aa53d3b0



Among other things this adds a new `EmbedderMsg::ShowSelectElementMenu`
to tell the embedder to display a select popup at the given location.

This is a draft because some small style adjustments need to be made:
* the select element should always have the width of the largest option
* the border should be part of the shadow tree

Apart from that, it's mostly ready for review.

<details><summary>HTML for demo video</summary>

```html
<html>

<body>
<select id="c" name="choice">
  <option value="first">First Value</option>
  <option value="second">Second Value</option>
  <option value="third">Third Value</option>
</select>
</body>
</html>
```
</details>

---

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] Part of https://github.com/servo/servo/issues/3551
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-04-03 12:11:55 +00:00
Martin Robinson
b925c31424
libservo: Start moving WindowMethods to WebViewDelegate (#36223)
`WindowMethods` is used by the embedding layer to get information from
the embedder. This change moves the functionality for getting screen
size and `WebView` offsets to `WebViewDelegate`.

This is important because `WebView`s might be on different screens or
have different offsets on the screen itself, so it makes sense for this
to be per-`WebView` and not global to the embedder. HiDPI and animation
state functionality will move to the embedder in subsequent changes.

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

<!-- Please describe your changes on the following line: -->


---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because they just modify the
`WebView` API surface a bit.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-04-02 11:17:24 +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
Isaac Marovitz
ed995e61a6
servoshell: Use sRGB colorspace on macOS (#35683)
* servoshell: Use sRGB colorspace on macOS

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Make lint happy

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Address review

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Move to helper function

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Rebase Cargo.lock

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Fix build

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Fix build (again)

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

---------

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-03-24 23:59:27 +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
Sebastian C
99d4baa533
bugfix: servoshell: prevent 0 pixel dimensions for render area (#35967)
Signed-off-by: Sebastian C <sebsebmc@gmail.com>
2025-03-18 18:59:16 +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
DK Liao
bcdd34e2aa
chore: Move unsafe operations in unsafe functions to unsafe blocks (#36017)
Signed-off-by: DK Liao <dklassic@gmail.com>
2025-03-18 06:19:35 +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
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
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
chickenleaf
52119c339c
servoshell: Allow keyboard interaction with dialogs (enter / escape) (#35673)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2025-03-10 14:32:39 +00:00
Kafji
34047f8da8
Allow domain-like as URL location input (#35756)
* Allow domain-like as URL location input

Before this patch, domain with subdomain (e.g. book.servo.org) won't be
treated as URL location.

This patch retifies that by adding Firefox's location bar behavior:

  - book.servo.org is URL location
  - book.servo.org. is URL location
  - .book.servo.org is not URL location

Fixes #35754.

Signed-off-by: Kafji <k@kafji.net>

* Chain location input interpretation attempts

Signed-off-by: Kafji <k@kafji.net>

---------

Signed-off-by: Kafji <k@kafji.net>
2025-03-10 03:24:48 +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
dependabot[bot]
db1c23569b
build(deps): bump egui_glow in the egui-related group (#35838)
Bumps the egui-related group with 1 update: [egui_glow](https://github.com/emilk/egui).


Updates `egui_glow` from 0.31.0 to 0.31.1
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.31.0...0.31.1)

---
updated-dependencies:
- dependency-name: egui_glow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: egui-related
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-07 13:49:02 +00:00
dependabot[bot]
18668e3042
build(deps): bump android_logger from 0.14.1 to 0.15.0 (#35840)
Bumps [android_logger](https://github.com/rust-mobile/android_logger-rs) from 0.14.1 to 0.15.0.
- [Release notes](https://github.com/rust-mobile/android_logger-rs/releases)
- [Changelog](https://github.com/rust-mobile/android_logger-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-mobile/android_logger-rs/compare/0.14.1...v0.15.0)

---
updated-dependencies:
- dependency-name: android_logger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-07 13:49:00 +00:00
webbeef
139774e6b5
Add an about:memory page (#35728)
This patch exposes a servo internal DOM API that is only made available to about:
pages on the navigator object to request memory reports. The about:memory page itself is
loaded like other html resources (eg. bad cert, net error) and makes use of this new API.

On the implementation side, notable changes:
- components/script/routed_promise.rs abstracts the setup used to fulfill a promise when the
  work needs to be routed through the constellation. The goal is to migrate other similar
  promise APIs in followup (eg. dom/webgpu/gpu.rs, bluetooth.rs).
- a new message is added to request a report from the memory reporter, and the memory reporter
  creates a json representation of the set of memory reports.
- the post-processing of memory reports is done in Javascript in the about-memory.html page,
  providing the same results as the current Rust code that outputs to stdout. We can decide
  later if we want to remove the current output.

Signed-off-by: webbeef <me@webbeef.org>
2025-03-07 05:25:08 +00:00
dependabot[bot]
621f8eb22d
build(deps): bump the egui-related group with 5 updates (#35810)
Bumps the egui-related group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [egui](https://github.com/emilk/egui) | `0.31.0` | `0.31.1` |
| [egui-winit](https://github.com/emilk/egui) | `0.31.0` | `0.31.1` |
| [ecolor](https://github.com/emilk/egui) | `0.31.0` | `0.31.1` |
| [emath](https://github.com/emilk/egui) | `0.31.0` | `0.31.1` |
| [epaint](https://github.com/emilk/egui) | `0.31.0` | `0.31.1` |


Updates `egui` from 0.31.0 to 0.31.1
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.31.0...0.31.1)

Updates `egui-winit` from 0.31.0 to 0.31.1
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.31.0...0.31.1)

Updates `ecolor` from 0.31.0 to 0.31.1
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.31.0...0.31.1)

Updates `emath` from 0.31.0 to 0.31.1
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.31.0...0.31.1)

Updates `epaint` from 0.31.0 to 0.31.1
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.31.0...0.31.1)

---
updated-dependencies:
- dependency-name: egui
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: egui-related
- dependency-name: egui-winit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: egui-related
- dependency-name: ecolor
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: egui-related
- dependency-name: emath
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: egui-related
- dependency-name: epaint
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: egui-related
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 17:34:12 +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
Martin Robinson
6300e820b4
servoshell: Rename Minibrowser::is_in_browser_rect to Minibrowser::is_in_egui_toolbar_rect (#35717)
"browser rect" is a bit of a misnomer as the browser is the entire
window, but this function is trying to determine if a point is on the
non-WebView toolbar portion of the GUI.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-03-03 11:19:50 +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
Martin Robinson
06d4272462
libservo: Stop double-buffering OffscreenRenderingContext (#35638)
The `OffscreenRenderingContext` does not need to be double-buffered.
Instead, when resizing the framebuffer, create a new one and blit the
old contents onto the new surface. This allows immediately displaying
the contents without having to render paint the WebRender scene one more
time. In addition to speeding up the rendering pipeline, the goal here
is to reduce flickering during resizes (though there is more work to
do).

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-28 11:41:56 +00:00