Compare commits

...

565 Commits

Author SHA1 Message Date
Delan Azabani
b29afd0f20 CI: fix self-hosted runners in Linux builds
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-09-10 14:42:13 +08:00
Delan Azabani
ce57cc80c2 wip
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-09-10 14:42:13 +08:00
Oriol Brufau
f1ad364ec2 Fix reordering of table-header-group and table-footer-group (#33383)
We weren't moving a table-header-group to the front if it was the first
row group. However, there might still be preceding rows that don't
belong to any row group.

And similarly, we weren't moving a table-footer-group to the end if it
was the last row group. However, there might still be following rows
that don't belong to any row group.

This patch fixes the logic, and enables existing tests from Microsoft
that were missing a reference.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 23:20:48 +00:00
webbeef
193f592617 Send less title changes to the embedder (#33287)
Instead of sending a title change for each incremental parsing change, we now do it when:
- the element is bound to the tree.
- the parser is done with the element (in pop()).
- the title content changes after the parsing, eg. using document.title .

Signed-off-by: webbeef <me@webbeef.org>
2024-09-09 22:41:02 +00:00
Andriy Sultanov
e5150dbda1 Propagate CanGc from Document::new() (#33386)
* Add canGc as a parameter to autogenerated trait methods

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

* Propagate CanGc from Document::new()

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

---------

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
2024-09-09 22:38:01 +00:00
Simon Wülker
10e5bb72d9 Initial support for <link rel="prefetch"> (#33345)
* Properly store link relations

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

* Send fetch request for prefetch links

We don't actually *do* anything with the response yet
(handle errors etc) but its a first step.

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

* Fire load/error events for prefetch loads

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

* Set prefetch destination/cors setting correctly

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

* Update WPT expectations

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

* Fix ./mach test-tidy errors

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

* Set correct "Accept" value for prefetch requests

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

* Add spec text to individual steps

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-09 18:52:56 +00:00
Cristian Brinza
2993577ac0 script: Added missing spec step in Location::SetHash (#33380)
* Implement missing spec step in Location::SetHash

Signed-off-by: crbrz <cristianb@gmail.com>

* Fixed wrong URL fragment when hash set to empty string

Signed-off-by: crbrz <cristianb@gmail.com>

* Add WPT tests

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-09-09 16:58:26 +00:00
Simon Wülker
cc3c69b953 implement console.timeLog (#33377)
* Implement console.timeLog

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

* Adjust WPT expectations

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-09 16:48:49 +00:00
Taym Haddadi
8c0a566860 Fix devtool crashs after entering window.location in console (#33381)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-09 15:09:06 +00:00
Martin Robinson
d169a82d2e layout: Implement proper absolute child position for flexbox (#33346)
This implements the requirements outlined in the [flexbox specification]
about how to position absolute children of flex containers. We must
establish a static position rectangle (to use if all insets are auto)
and also align the child into that rectangle.

[flebox specification]: https://drafts.csswg.org/css-flexbox/#abspos-items

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-09 14:44:16 +00:00
webbeef
a3a86d5913 script: Implement TextEncoder::encodeInto() (#33360)
* Implement TextEncoder::encodeInto()

Signed-off-by: webbeef <me@webbeef.org>

* Update components/script/dom/textencoder.rs

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

* Update components/script/dom/textencoder.rs

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

---------

Signed-off-by: webbeef <me@webbeef.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 14:40:12 +00:00
Mukilan Thiyagarajan
52a447b1e3 android: make aarch64 the default target (#33379)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-09-09 14:38:01 +00:00
Martin Robinson
8842fe9df5 script: Use time@0.3 for input elements and do conversion in a &str trait (#33355)
This changes converts all input element parsing and normalization to use
`time` instead of `chrono`. `time` is used by our dependencies, so it
makes sense to work toward removing the Servo dependency on chrono.

In addition, parsing and normalization also moves to a trait on &str to
prepare for the possibility of all script parsers moving to a separate
crate that can have unit tests written against it.

Code duplication is eliminated when possible and more conversion is done
using integer types. These two things together mean we pass more tests
now.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 14:33:16 +00:00
Samson
687f356db9 webgpu: Factor out swapchain to separate file (#33367)
* Move some stuff to swapchain.rs

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

* Use typed WebGPUContextId instead of u64

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

* Extract create_swapchain function and move more stuff in it

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

* extract destroy_swapchain

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

* extract swapchain_present

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

* extract update_wr_image callback

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

* fixup

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-09 13:29:04 +00:00
Daniel Adams
938fd8c12f webxr: Update XRInputSource gamepad index to be -1 (#33369)
* Update XRInputSource gamepad index to be -1

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

* Update test expectations

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-09 11:07:56 +00:00
Delan Azabani
9cfbaf92e5 CI: fix self-hosted runners in try-label builds (#33373)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-09-09 04:43:25 +00:00
Oriol Brufau
4d0bef0ac3 Remove unused imports (#33371)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-09 03:02:24 +00:00
Delan Azabani
8bb739b818 CI: use self-hosted runners for Linux build jobs (#33321)
* CI: use self-hosted runners for Linux build jobs

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Set ccache and incremental env variables when not self-hosted

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Force GitHub-hosted runner when in upload mode

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Revert s/python/python3/ now that our image has python

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Remove stray comment in timeout workflow

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Update description of runner-select job

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Apply suggestions from code review

Address couple minor naming / formatting nits

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

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-08 15:06:44 +00:00
Martin Robinson
e70507ca40 tidy: Fix rustdoc warnings and add a tidy check for a common URL issue (#33366)
This change fixes all rustdoc errors and also adds a tidy check for a
very common rustdoc URL issue. Eventually rustdoc warnings should likely
cause the build to fail, but this catches those issues sooner in order
to not waste so much developer time.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-08 15:04:19 +00:00
webbeef
f6ae050077 net: use saturating_sub when substracting durations to prevent underflows (#33341)
* net: use saturating_sub when substracting durations to prevent underflows

Signed-off-by: webbeef <me@webbeef.org>

* Add regression test. (#1)

* Add regression test.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: webbeef <me@webbeef.org>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-09-08 07:36:27 +00:00
Servo WPT Sync
85823edd01 Update web-platform-tests to revision b'ec9b870fec350e59e9db48ae2858e914a07f38d6' (#33359)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-09-08 01:41:09 +00:00
Simon Wülker
1c6fb1a7ba Set empty object as console prototype (#33358)
* Remove console prototype hack

The console object has an empty object as its prototype,
not the realm object prototype.

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

* Update WPT expectations

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-07 23:10:47 +00:00
Martin Robinson
f3f96c3393 layout: Do not use orthogonal baselines in flex layout (#33347)
When a baseline is orthogonal to the main flexbox axis, it should not
take part in baseline alignment. This change does that for column flex.
While there is no support for vertical writing modes, this change is
made to be as writing mode-agnostic as possible.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-07 22:08:48 +00:00
Taym Haddadi
a43e296436 Fix devtool crashs after clicking Enable connection prompt (#33305)
* Fix devtool crashs after clicking Enable connection prompt

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Use early error return

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-07 20:58:16 +00:00
Samson
567c3185f8 chore: Update wgpu (#33357)
* Update wgpu

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>
2024-09-07 20:28:36 +00:00
Taym Haddadi
152e62022a Move convert_label to Into implementation (#33348)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-06 21:58:13 +00:00
dependabot[bot]
bc04f94a30 build(deps): bump wayland-cursor from 0.31.5 to 0.31.6 (#33351)
Bumps [wayland-cursor](https://github.com/smithay/wayland-rs) from 0.31.5 to 0.31.6.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-cursor
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-06 17:48:38 +00:00
dependabot[bot]
5d85f283c7 build(deps): bump cpufeatures from 0.2.13 to 0.2.14 (#33350)
Bumps [cpufeatures](https://github.com/RustCrypto/utils) from 0.2.13 to 0.2.14.
- [Commits](https://github.com/RustCrypto/utils/compare/cpufeatures-v0.2.13...cpufeatures-v0.2.14)

---
updated-dependencies:
- dependency-name: cpufeatures
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-06 17:42:13 +00:00
dependabot[bot]
3fb4833c88 build(deps): bump bytemuck from 1.17.1 to 1.18.0 (#33349)
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.17.1 to 1.18.0.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.17.1...v1.18.0)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: indirect
  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>
2024-09-06 17:34:44 +00:00
Martin Robinson
c24c7d8e4d layout: Lay out absolutes in atomic containing blocks (#33336)
When inline atomics establish containing blocks for absolute
descendants, layout should happen with those atomics as the containing
block. This ensures that the absolute descendents have the correct
containing block and Fragment parent. This wasn't happening before and
this change fixes that.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-09-06 13:42:45 +00:00
Samson
ebed9218f2 webgpu: Move actual Create* implementations from GPUDevice to Self (#33320)
* Move actual Create* implementations from `GPUDevice` to Self

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

* move Create*Pipeline to Self::create

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

* `parse_render_pipeline` outside`GPURenderPipeline::create`

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-05 19:48:16 +00:00
Martin Robinson
312cf0df08 script: Create a CrossProcessInstant to enable serializable monotonic time (#33282)
Up until now, Servo was using a very old version of time to get a
cross-process monotonic timestamp (using `time::precise_time_ns()`).
This change replaces the usage of old time with a new serializable
monotonic time called `CrossProcessInstant` and uses it where `u64`
timestamps were stored before. The standard library doesn't provide this
functionality because it isn't something you can do reliably on all
platforms. The idea is that we do our best and then fall back
gracefully.

This is a big change, because Servo was using `u64` timestamps all over
the place some as raw values taken from `time::precise_time_ns()` and
some as relative offsets from the "navigation start," which is a concept
similar to DOM's `timeOrigin` (but not exactly the same). It's very
difficult to fix this situation without fixing it everywhere as the
`Instant` concept is supposed to be opaque. The good thing is that this
change clears up all ambiguity when passing times as a `time::Duration`
is unit agnostic and a `CrossProcessInstant` represents an absolute
moment in time.

The `time` version of `Duration` is used because it can both be negative
and is also serializable.

Good things:
 - No need too pass around `time` and `time_precise` any longer.
   `CrossProcessInstant` is also precise and monotonic.
 - The distinction between a time that is unset or at `0` (at some kind
   of timer epoch) is now gone.

There still a lot of work to do to clean up timing, but this is the
first step. In general, I've tried to preserve existing behavior, even
when not spec compliant, as much as possible. I plan to submit followup
PRs fixing some of the issues I've noticed.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-05 18:50:09 +00:00
dependabot[bot]
35baf056f6 build(deps): bump serde_json from 1.0.127 to 1.0.128 (#33333)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.127 to 1.0.128.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/1.0.127...1.0.128)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:41:39 +00:00
dependabot[bot]
5d30f8f3cc build(deps): bump rustix from 0.38.35 to 0.38.36 (#33332)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.35 to 0.38.36.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.35...v0.38.36)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:35:24 +00:00
dependabot[bot]
a59f295fa2 build(deps): bump wayland-scanner from 0.31.4 to 0.31.5 (#33330)
Bumps [wayland-scanner](https://github.com/smithay/wayland-rs) from 0.31.4 to 0.31.5.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-scanner
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:35:05 +00:00
dependabot[bot]
004fd0281b build(deps): bump wayland-client from 0.31.5 to 0.31.6 (#33331)
Bumps [wayland-client](https://github.com/smithay/wayland-rs) from 0.31.5 to 0.31.6.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-client
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:31:46 +00:00
dependabot[bot]
5350edb6ea build(deps): bump ohos-sys from 0.3.0 to 0.3.1 (#33329)
Bumps [ohos-sys](https://github.com/openharmony-rs/ohos-sys) from 0.3.0 to 0.3.1.
- [Changelog](https://github.com/openharmony-rs/ohos-sys/blob/main/CHANGELOG.md)
- [Commits](https://github.com/openharmony-rs/ohos-sys/commits)

---
updated-dependencies:
- dependency-name: ohos-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:28:57 +00:00
dependabot[bot]
0ee1a5e82c build(deps): bump rustfix from 0.8.4 to 0.8.5 (#33328)
Bumps [rustfix](https://github.com/rust-lang/cargo) from 0.8.4 to 0.8.5.
- [Changelog](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cargo/commits)

---
updated-dependencies:
- dependency-name: rustfix
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:22:24 +00:00
dependabot[bot]
aa8c8f8153 build(deps): bump tokio-util from 0.7.11 to 0.7.12 (#33326)
Bumps [tokio-util](https://github.com/tokio-rs/tokio) from 0.7.11 to 0.7.12.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-util-0.7.11...tokio-util-0.7.12)

---
updated-dependencies:
- dependency-name: tokio-util
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:19:35 +00:00
dependabot[bot]
e271a47c06 build(deps): bump wayland-backend from 0.3.6 to 0.3.7 (#33327)
Bumps [wayland-backend](https://github.com/smithay/wayland-rs) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:19:30 +00:00
dependabot[bot]
66544c39cc build(deps): bump tokio-stream from 0.1.15 to 0.1.16 (#33325)
Bumps [tokio-stream](https://github.com/tokio-rs/tokio) from 0.1.15 to 0.1.16.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-stream-0.1.15...tokio-stream-0.1.16)

---
updated-dependencies:
- dependency-name: tokio-stream
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 17:16:27 +00:00
webbeef
7e493ba865 minibrowser: Reset the location field when switching tabs (#33316)
Signed-off-by: webbeef <me@webbeef.org>
2024-09-05 13:45:11 +00:00
dependabot[bot]
e6ee879d2a build(deps): bump cc from 1.1.15 to 1.1.16 (#33317)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.15 to 1.1.16.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.15...cc-v1.1.16)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 13:33:47 +00:00
atbrakhi
0f24b8c823 Add tracing events (#33189)
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2024-09-05 12:11:12 +00:00
Oriol Brufau
37e1c3385e Treat align-self: normal as stretch on flex items (#33314)
According to https://drafts.csswg.org/css-align/#align-flex
It was being treated as `auto` instead.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-05 11:15:41 +00:00
Ben
8263fe5495 Added some keyboard shortcuts for focusing tabs (#33319)
Currently Cmd/Ctrl + [1-9] and Ctrl + PageUp/Down, since they are
present in most major browsers.

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>
2024-09-05 10:38:29 +00:00
Daniel Adams
75c7712905 webxr: Add some missing internal checks/validation (#33318)
* Ensure depthFar is non-negative

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

* Properly append default features in requestSession

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

* Ensure XRRigidTransform init members have finite values

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-05 03:39:27 +00:00
Andriy Sultanov
aadc212b95 jsstring_to_str should accept a NonNull argument for the JS string (#33306)
Instead of asserting the raw pointer is not null, force callers to
produce a NonNull pointer.

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
2024-09-05 03:25:49 +00:00
Delan Azabani
642c25d9a7 CI: use monitor API for self-hosted runners (#33315)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-09-04 17:11:32 +00:00
Taym Haddadi
00389cf007 Transform convert_* functions in gpuconvert.rs to From/TryFrom implementations (#33302)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-04 16:03:59 +00:00
Delan Azabani
c0ced7a524 Make tracing available on all platforms, with or without perfetto (#33301)
* 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>
2024-09-04 12:56:29 +00:00
Ben
891562be8e servoshell: Add close buttons and increase interactivity of tabs (#33244)
* Improved the minibrowser tab bar

Added a close button for each tab as well as another button for opening
a new tab, also changed the styling so it looks more like other
browsers.

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>

* Make sure to restore the egui visuals after drawing a browser tab

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>

* Only use colors from the current theme for the minibrowser tabbar

That way we can easily switch between light and dark mode

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>

---------

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>
2024-09-04 11:31:23 +00:00
Samson
3c6ca33832 webgpu: Support pipeline-overridable constants (#33291)
* Impl pipeline constants

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

* More relaxed lifetimes

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

* Update expectations

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

* Replace convert function with `From` implementation

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-04 11:31:07 +00:00
Daniel Adams
a976db3ec0 Update layout of servoshell android app (#33294)
* Update layout of servoshell android app

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

* Remove gap after loop/idle text

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-04 11:30:52 +00:00
Simon Wülker
961fcfc46d Only handle most recent resize event in script thread (#33297)
This avoids having to do unnecessary layout work and
prevents resize events from accumulating, which looks
weird.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-04 11:30:39 +00:00
Simon Wülker
fc5f8e9237 Implement HTMLQuoteElement "cite" attribute (#33307)
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-04 11:29:59 +00:00
dependabot[bot]
febb4f24c4 build(deps): bump syn from 2.0.76 to 2.0.77 (#33285)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.76 to 2.0.77.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.76...2.0.77)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-04 10:28:03 +00:00
atbrakhi
ba7e53264d Add initial support for tracing and tracing-perfetto (#33188)
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2024-09-04 08:24:29 +00:00
Samson
abe532dd2f CI: Force github hosted runners and remove concurrency on select-runner job (#33308)
temporary fix for #33276

Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-09-04 08:23:40 +00:00
Oriol Brufau
27d87f104e Fix intrinsic sizing of column flex containers (#33299)
From https://drafts.csswg.org/css-flexbox-1/#intrinsic-cross-sizes,
> The min-content/max-content cross size of a single-line flex container
> is the largest min-content contribution/max-content contribution
> (respectively) of its flex items.

We were using the min/max-content size instead of the min/max-content
contribution.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-04 06:44:31 +00:00
Simon Wülker
e43e477842 Implement compact/type attributes for HTMLUListElement (#33303)
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-04 06:17:27 +00:00
dependabot[bot]
93cd8d1ba4 build(deps): bump indexmap from 2.4.0 to 2.5.0 (#33284)
Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.4.0 to 2.5.0.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.4.0...2.5.0)

---
updated-dependencies:
- dependency-name: indexmap
  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>
2024-09-04 04:59:01 +00:00
Samson
e857cdf022 Hack around DCO not in MQ (#33290)
See https://github.com/servo/servo/pull/33283#issuecomment-2325240423

Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-09-03 07:56:03 +00:00
Delan Azabani
4b96d8ef36 CI: label self-hosted runners with run id to aid debugging (#33283)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-09-03 07:55:55 +00:00
Taym Haddadi
6c0394bc80 Impl PartialEq and Eq for DomObject (#33212)
* Impl PartialEq and Eq for DomObject

Signed-off-by: Taym <haddadi.taym@gmail.com>

* move to Eq and PartialEq to domobject_derive

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-02 09:50:46 +00:00
Jonathan Schwender
31e84a8c48 ohos: Enable Webgl context creation on OH 5.0 (#33257)
* ohos: Enable Webgl context creation on OH 5.0

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

* Bump surfman to 0.9.8

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

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-09-02 07:00:11 +00:00
Jonathan Schwender
c9548d82ef bootstrap: Avoid needless sudo when pkgs are installed (#33281)
- Previously on fedora `./mach bootstrap` would always detect it needs to
  reinstall packages and require root permissions.
- use custom queryformat for `rpm -qa` to to just get the package name
  (e.g. `openssl-libs` instead of `openssl-libs-3.2.2-3.fc40.i686`
- Use a list to store the output result instead of one string
- Fedora (40) installs `zlib-ng` instead of `zlib` and `libjpeg-turbo` instead
  of `libjpeg`, meaning that `rpm` / dnf commands report `zlib` as not installed.
  Specifying the actually installed package avoids this problem.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-09-02 06:56:38 +00:00
Jonathan Schwender
35ca050bfb android: Fix install (#33277)
self.config["android"]["target"] is unset, causing an exception.
We can just use self.target.triple() instead.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2024-09-01 20:17:34 +00:00
Josh Matthews
a62612a025 Make all platforms use a delay during cookie tests. (#33279)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-09-01 20:07:46 +00:00
dependabot[bot]
12a782dc20 build(deps): bump glslopt from 0.1.10 to 0.1.11 (#33268)
Bumps [glslopt](https://github.com/jamienicol/glslopt-rs) from 0.1.10 to 0.1.11.
- [Commits](https://github.com/jamienicol/glslopt-rs/commits)

---
updated-dependencies:
- dependency-name: glslopt
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 17:28:08 +00:00
dependabot[bot]
06778e3643 build(deps): bump object from 0.36.3 to 0.36.4 (#33269)
Bumps [object](https://github.com/gimli-rs/object) from 0.36.3 to 0.36.4.
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.3...0.36.4)

---
updated-dependencies:
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 15:28:38 +00:00
Daniel Adams
9fdaf9bf0c Update FakeXRDevice to support updating bounds (#33271)
* Update FakeXRDevice to support updating bounds

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

* Add missing spec link

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

* Mark secondaryViews as optional in FakeXRDevice.setViews

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-09-01 11:58:32 +00:00
Servo WPT Sync
3453d9fdad Update web-platform-tests to revision b'5d8ec746ed021738e7ee0cee92ad1a1814ba00fe' (#33274)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-09-01 01:40:45 +00:00
Oriol Brufau
3acc9edd82 Fix various issues with replaced elements in flex layout (#33263)
In particular, this takes into account that flex items may be stretched,
and if they have an aspect ratio, we ma6y need to convert the stretched
size through the ratio.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-30 23:39:18 +00:00
Cristian Brinza
4ae2610c24 fonts: Enable fast text shaping on Windows (#33123)
* Use patched dwrote

Signed-off-by: crbrz <cristianb@gmail.com>

* Enable fast text shaping

Signed-off-by: crbrz <cristianb@gmail.com>

* Add fast text shape test

Signed-off-by: crbrz <cristianb@gmail.com>

* Update dwrote to 0.11.1

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-08-30 23:16:26 +00:00
Martin Robinson
6f333a8e29 net: Stop using both versions of the time crate in the cookie code (#33260)
`std::time` is good enough for us here. `cookie` is using `time 0.3`,
but Servo can convert to standard library types when getting data from
`cookie`. This reduces our direct dependencies and removes more use of
the very old `time 0.1` series.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-30 17:15:47 +00:00
dependabot[bot]
1e9344cb5c build(deps): bump tokio from 1.39.3 to 1.40.0 (#33270)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.39.3 to 1.40.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.39.3...tokio-1.40.0)

---
updated-dependencies:
- dependency-name: tokio
  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>
2024-08-30 17:08:41 +00:00
Samson
5e89643fa7 chore: Update wgpu to 34bb9e4ceb45a5b1cfc5df6aa2b2e201cc55372c (#33266)
* Update wgpu to include local const

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

* set expectations

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-30 16:38:34 +00:00
Martin Robinson
a4ceb82ef5 script: Stop using time in DOM timers (#33262)
This switches to using `std::time` types for DOM timer operations, which
allows removing our custom time units in favor of `Duration`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-30 15:20:44 +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
Martin Robinson
a58d816319 net: Stop using legacy time in the HTTP and CORS caches (#33259)
This is part of switching away from using a very old version of `time`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-30 12:54:02 +00:00
Samson
817a91f2ac webgpu: Clean up GPUCommandEncoders and add some validation (#33223)
* TextureUsages::from_bits_retain

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

* Fixup CreateBindGroupLayout

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

* GPUExtent3D checking and converting

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

* Cleanup GPUCommandEncoders and some TODOs

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

* validate gpuorigin3d

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

* validate GPUColor

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

* set good expect

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-30 11:23:17 +00:00
Martin Robinson
83a40c5180 script: Stop using legacy time for Document::reflow_timeout (#33258)
Use `std::time` from the Rust standard library instead. This is one step
toward removing our use of the legacy `time` crate which has security
issues.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-30 08:00:34 +00:00
Oriol Brufau
cd8b803368 Use the proper aspect ratio in flexbox (#33256)
When computing the automatic minimum size, flex layout was using the
natural aspect ratio, ignoring the `aspect-ratio` property.

`ReplacedContent::inline_size_over_block_size_intrinsic_ratio()` is now
made private to avoid more accidental uses.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-30 06:28:14 +00:00
dependabot[bot]
13cbcf614a build(deps): bump ohos-sys from 0.2.2 to 0.3.0 (#33253)
Bumps [ohos-sys](https://github.com/openharmony-rs/ohos-sys) from 0.2.2 to 0.3.0.
- [Changelog](https://github.com/openharmony-rs/ohos-sys/blob/main/CHANGELOG.md)
- [Commits](https://github.com/openharmony-rs/ohos-sys/compare/v0.2.2...v0.3.0)

---
updated-dependencies:
- dependency-name: ohos-sys
  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>
2024-08-29 17:02:03 +00:00
Oriol Brufau
4bf941bc8a Fix automatic minimum size for column flexbox (#33248)
`main_content_size_info()` was always assigning the main-axis automatic
minimum size into the inline axis. But in a column flexbox, the main
axis corresponds to the block axis.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-29 16:55:44 +00:00
Cristian Brinza
9ea02fa4b4 Fix minibrowser scroll by keyboard (#33252)
* Fix minibrowser scroll by keyboard

Signed-off-by: crbrz <cristianb@gmail.com>

* Apply suggested change

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Cristian Brinza <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
Signed-off-by: Cristian Brinza <cristianb@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-08-29 16:39:08 +00:00
Cristian Brinza
99bd6afa81 Pass keyboard events to WebView on Windows (#33225)
* Pass keyboard events to webview on Windows

Signed-off-by: crbrz <cristianb@gmail.com>

* Refactor WebViewManager::handle_key_from_window

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-08-29 16:06:35 +00:00
Samson
8dd40ed2bd mach: Add test-speedometer command and --bmf-output to speedometer and dromaeo (#33247)
* Allow exporting Dromaeo results as BMF JSON

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

* Add speedometer runner

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-29 15:58:57 +00:00
Oriol Brufau
0643aa4708 Handle aspect ratios in ReplacedContent::inline_content_sizes (#33240)
We were only handling the aspect ratio of a replaced element when
computing its min/max-content contribution, but not when computing
the min/max-content size. Now both cases will take it into account.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-29 15:38:59 +00:00
Martin Robinson
3f93de7f54 layout: Stop using unicode-segmentation in layout (#33250)
`layout` already uses `icu_segmentation` so there's no need to pull in
another segmenter. This reduces the number of segmenters used in the
crate to 2 from 3.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-29 14:51:39 +00:00
Oriol Brufau
93abdf7cb5 layout: Add an indefinite containing block for intrinsic sizing (#33204)
When computing the min-content or max-content size of an element we
need to ignore `inline-size`, `min-inline-size` and `max-inline-size`.

However, we should take the block-axis sizing properties into account.
That's because the contents could have percentages depending on them,
which can then affect their inline size via an aspect ratio.

Therefore, this patch adds `IndefiniteContainingBlock`, which is similar
to `ContainingBlock`, but it allows an indefinite inline-size. This
struct is then passed arround during intrinsic sizing.

More refinement will be needed in follow-up patches in order to fully
address the problem.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-29 14:10:46 +00:00
Oriol Brufau
46dbe4ce32 Obey min and max cross sizes of flex items (#33242)
When laying out the contents of a flex item, we used to resolve their
cross-axis percentages against the preferred cross size of the item.
Now we will take the min and max cross sizes into account.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-29 11:24:23 +00:00
Oriol Brufau
59c74c874a Obey min-block-size and max-block-size in floats (#33241)
We were using the unclamped `box_size.block` instead of `block_size`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-29 11:24:07 +00:00
Jonathan Schwender
e8d0f85f52 Bump xi_unicode to latest version (#33246)
* Bump xi_unicode to latest version

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

* dep: update XI_LINE_BREAKING_CLASS_ZWJ constant to 42

This matches the value returned by xi-unicode's linebreak_property
for `u200D` codepoint in v0.3.0 of the crate.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-29 10:43:13 +00:00
Martin Robinson
65c2e75379 ci: Fix the WPT export job after the repository change (#33228)
The GitHub search API is a bit sensitive. There isn't a great way to
search for the repository organization and the branch name when looking
for open PRs. Instead use the bot username as the author name, which
should likely have been having before. This fixes the WPT export job.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-29 09:26:04 +00:00
dependabot[bot]
89421b70ad build(deps): bump rustc_version from 0.4.0 to 0.4.1 (#33236)
Bumps [rustc_version](https://github.com/djc/rustc-version-rs) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/djc/rustc-version-rs/releases)
- [Commits](https://github.com/djc/rustc-version-rs/compare/v0.4.0...v0.4.1)

---
updated-dependencies:
- dependency-name: rustc_version
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 08:19:00 +00:00
Daniel Adams
5ffdce9aee servoshell: Enable OpenXR by default and remove old WebVR prefs, adjust XrDiscovery initialization (#33245)
* Remove WebVR prefs, enable OpenXR by default

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

* Prefer OpenXR if available, otherwise use GLWindow

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-29 05:06:57 +00:00
Mukilan Thiyagarajan
1aff31fd96 wpt: fix path to wpt-prefs.json (#33243)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-29 04:37:35 +00:00
Samson
c69acd1848 Fix run_dromaeo.py (#33239)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-28 19:03:42 +00:00
dependabot[bot]
b2a9184ddc build(deps): bump euclid from 0.22.10 to 0.22.11 (#33238)
Bumps [euclid](https://github.com/servo/euclid) from 0.22.10 to 0.22.11.
- [Release notes](https://github.com/servo/euclid/releases)
- [Commits](https://github.com/servo/euclid/commits)

---
updated-dependencies:
- dependency-name: euclid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 17:45:38 +00:00
dependabot[bot]
3d0c4f9ea8 build(deps): bump filetime from 0.2.24 to 0.2.25 (#33234)
Bumps [filetime](https://github.com/alexcrichton/filetime) from 0.2.24 to 0.2.25.
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.24...0.2.25)

---
updated-dependencies:
- dependency-name: filetime
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 17:36:05 +00:00
dependabot[bot]
1e47361537 build(deps): bump webxr from 06cf810 to 7656508 (#33233)
Bumps [webxr](https://github.com/servo/webxr) from `06cf810` to `7656508`.
- [Commits](06cf8102e1...7656508fdc)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 17:35:06 +00:00
dependabot[bot]
0a9fe1beb2 build(deps): bump rustix from 0.38.34 to 0.38.35 (#33232)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.34 to 0.38.35.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.34...v0.38.35)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 17:32:56 +00:00
dependabot[bot]
64b31b6e6a build(deps): bump webrender from c0bcdd0 to 8468e81 (#33231)
Bumps [webrender](https://github.com/servo/webrender) from `c0bcdd0` to `8468e81`.
- [Release notes](https://github.com/servo/webrender/releases)
- [Commits](c0bcdd024a...8468e81608)

---
updated-dependencies:
- dependency-name: webrender
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 17:21:34 +00:00
Callum Leslie
87f437d230 fix clippy warning for clamp pattern in webgl_thread (#33230)
Signed-off-by: Callum Leslie <git@cleslie.uk>
2024-08-28 17:01:13 +00:00
Simon Wülker
7c4ba51f51 Don't allow minibrowser tab titles to be empty (#33229)
* avoid unnecessary clones when setting tab title in minibrowser

This is of course not a performance issue, but rather just bad style.
Especially since the url doesn't even need to be .clone()'d
in the first place.

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

* Don't allow empty tab titles in minibrowser

These look very confusing. If the page has no title
its better to fall back to the url instead of displaying
absolutely nothing. (This is what firefox seems to do
too)

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-08-28 16:57:28 +00:00
Callum Leslie
ef42ac0dfc Fix several clippy warnings in components/devtools (#33227)
Signed-off-by: Callum Leslie <git@cleslie.uk>
2024-08-28 16:36:43 +00:00
Chocolate Pie
590527176e layout: Add initial support for clip-path: [<basic-shape> || <shape-box>] (#33107)
* Turn on clip-path tests and add results

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

* enhance: Add support for `clip-path: [<basic-shape> || <shape-box>]`

Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>

* Changes from review

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

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-28 15:00:34 +00:00
Oriol Brufau
f810983fd2 Remove unused import (#33226)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-28 14:09:25 +00:00
Samson
fe44010000 mach: Extract binary select into common_command_arguments (#33205)
* Extract binary select into common_command_arguments

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

* fixups

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

* Small English edit

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-28 12:07:02 +00:00
Martin Robinson
b29b614775 ci: Use Servo's wpt repository for WPT export (#33224)
This switches the WPT export script to use Servo's fork the `wpt`
upstream repository. The reasoning is that Servo developers's can fix
issues with branches there. This isn't possible because no one has
permissions to the servo-wpt-sync fork of the repository.

I have given `servo-wpt-sync` write persmissions to `servo/wpt`.

This also updates the tests a bit to reflect the new default repository.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-28 11:29:51 +00:00
Taym Haddadi
bb5547a5d0 Fix panic in parser-reentrancy-customelement.window.js (#33162)
* Try to fix panic in parser-reentrancy-customelement.window.js

Signed-off-by: Taym <haddadi.taym@gmail.com>

* ./mach fmt

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Only return with ToTokenizerMsg::End and continue for others

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-28 11:01:21 +00:00
Oriol Brufau
9639d36550 Remove width and height presentational hints for <canvas> (#33211)
According to HTML, the `width` and `height` attributes should only set
the natural sizes and the aspect ratio.
The `width` and `height` properties should stay as `initial` by default.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-28 10:20:18 +00:00
Martin Robinson
a6b9640c99 compositor: Do not parse the Cargo.lock file while building (#33222)
The compositor's `build.rs` script was parsing the `Cargo.lock` file in
order to tag WebRender captures with the WebRender version. The embedder
already knows what version of Servo we are using, which should be enough
to infer the WebRender revision. This changes does that and generally
does a bit of cleaning up of how captures are done.

- The name of the capture directory is now `webrender-captures`
- There is console output now when captures are done. Before it was hard
  to know if it succeeded.
- Simplify the Compositor constructor a little to avoid passing
  arguments so much.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-28 08:36:54 +00:00
Mukilan Thiyagarajan
5092cece7a wpt: fix the path to wpt-prefs.json on WPT runner (#33220)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-28 07:50:16 +00:00
Jonathan Schwender
6de7848aff android: Remove unused imports in android.rs (#33218)
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-08-28 03:51:00 +00:00
atbrakhi
2037884469 Fix clippy wanings in layout (#33215)
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2024-08-27 20:53:43 +00:00
Samson
12661c1920 Update wgpu (#33209)
no gfx_select macro and some minor changes to passes

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-27 20:31:31 +00:00
webbeef
1b48bd18aa Basic tab strip for the minibrowser (#33100)
This implements a simple tab system for servoshell:
- The egui part uses the built-in SelectableLabels components and
  display the full tab title on hover.
- WebView structs now hold all the state for each WebView. When we
  need "global" state, we return the focused WebView state, eg.
  for the load status since it's still global in the UI.
- New keyboard shortcut: [Cmd-or-Ctrl]+[W] to close the current tab.
- New keyboard shortcut: [Cmd-or-Ctrl]+[T] to create a new tab.
- The new tab content is loaded from the 'servo:newtab' url using a
  couple of custom protocol handlers.

Signed-off-by: webbeef <me@webbeef.org>
2024-08-27 20:17:33 +00:00
dependabot[bot]
a0ff57cea1 build(deps): bump bytemuck from 1.17.0 to 1.17.1 (#33214)
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.17.0 to 1.17.1.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.17.0...v1.17.1)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-27 17:20:09 +00:00
Martin Robinson
87027d2e5c Remove measurement of layout query wait time (#33210)
Now that the script thread and the layout thread are the same the wait
time effectively zero, so there's no need to measure it. This also
removes one dependency and removes one use of legacy time.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-27 16:01:48 +00:00
Oriol Brufau
50eb69a7e0 Allow creating a ContentSizes from Au (#33208)
No change in behavior, it just simplies some code a little bit.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-27 15:22:47 +00:00
Oriol Brufau
dbd0a79b3e Allow caching IndependentFormattingContext::inline_content_sizes() (#33207)
For non-replaced formatting contexts, this method redirected directly to
`NonReplacedFormattingContextContents::inline_content_sizes()`, which
has the actual logic for the computation.

Thus it was bypassing the cache, which is handled in
`NonReplacedFormattingContext::inline_content_sizes()`.

Therefore, this patch redirects to the latter.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-08-27 13:43: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
Delan Azabani
658df79d88 CI: use self-hosted runners for Windows build jobs (#33081)
* CI: use self-hosted Windows runners in main workflow

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Fix a couple of robustness issues by generating a unique build id

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Work around needs-context expressions being busted in concurrency

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* CI: use self-hosted Windows runners in try and try-label workflows

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Rename windows workflow back for simplicity

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Clarify why the copy resources step is for GitHub-hosted jobs only

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Fix cancelled status problem by dispatching instead of calling

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Tweak retry strategy to avoid hitting REST API rate limits

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Update dispatch-workflow.yml accordingly

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Rework to use simpler approach with runner labels

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Use org-scoped self-hosted runners

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Don’t run runner-timeout job when GitHub-hosted runner is selected

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Downgrade to Python 3.10

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Avoid failing when RUNNER_API_TOKEN is missing (such as in forks)

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Fix undefined needs output when RUNNER_API_TOKEN is missing

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Reset working tree, in case it was dirty in the runner image

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Clearer runner assignment timeout jobs that fail and offer help

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Fix some other sources of incremental build breakage (but not PATH)

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Log reasons why we fall back to GitHub-hosted runners

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Allow self-hosted runners to be disabled via repository variable

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Always install crown, even on self-hosted runners

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Rename incremental build debugging step

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Clean up job friendly names

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Reduce fetch depth, now that this job no longer lints

Signed-off-by: Delan Azabani <dazabani@igalia.com>

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-08-27 11:04:42 +00:00
Oriol Brufau
5d43d88b6c Respect min/max constraints in the block axis of block containers (#33203)
Consider a block container that establishes an inline formatting context
and has a definite `block-size` which is clamped by `min-block-size` or
`max-block-size`.

We were already sizing such container correctly, however, its contents
were resolving their percentages against the unclamped `block-size`
value.

This patch fixes the `ContainingBlock` that we pass to the contents so
that they resolve percentages correctly.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-27 09:05:43 +00:00
Ben
fef44620cc Fixed build error on macos (#33200)
This was due to uname reporting the architecture as arm64
instead of aarch64 on macos

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>
2024-08-27 08:31:26 +00:00
Mukilan Thiyagarajan
173b6f183c wpt: check for wpt-prefs.json in "./servo" sub-directory (#33202)
The current working directory when running on WPT runners is not the
folder with the servo binary, but a parent folder into which the servo
nightly tar is extracted. This means the binary is `$PWD/servo/servo`
and resources directory in in `$PWD/servo/resources`, so the current
hardcoded relative path `resources/wpt-prefs.json` will not work on WPT
runners.

This is causing crashes in WPT runner:

https://github.com/web-platform-tests/wpt/runs/29284407168
https://community-tc.services.mozilla.com/tasks/J7MqNwJGQRSkIWlvB5ktPQ/runs/0/logs/live/public/logs/live.log

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-27 08:04:12 +00:00
Samson
7fce24f9d5 webgpu: Sync GPUBuffer (#33154)
* More helpers on `Promise`

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

* Sync `GPUBuffer`

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

* Set some good expectations

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

* Some bad expect

also on firefox

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

* Extract DataBlock, DataView impl from GPUBuffer

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

* Fix size check to work on 32bit platforms

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-27 07:54:55 +00:00
Martin Robinson
bb5926b329 mach: Do not manually install toolchain for non-cross builds (#33190)
* mach: Do not manually install toolchain for non-cross builds

This fixes the Apple Silicon build where the installed toolchain does
not match the host triple. We only install toolchains manually for cross
builds, because cargo and friends will do this automatically when
executing.

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

* fix lints

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-27 05:30:43 +00:00
dependabot[bot]
ba4e081e8e build(deps): bump serde from 1.0.208 to 1.0.209 (#33196)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.208 to 1.0.209.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.208...v1.0.209)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 18:56:21 +00:00
dependabot[bot]
f84da1521a build(deps): bump fastrand from 2.1.0 to 2.1.1 (#33198)
Bumps [fastrand](https://github.com/smol-rs/fastrand) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v2.1.0...v2.1.1)

---
updated-dependencies:
- dependency-name: fastrand
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 17:08:35 +00:00
dependabot[bot]
4b8ca674fc build(deps): bump syn from 2.0.75 to 2.0.76 (#33197)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.75 to 2.0.76.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.75...2.0.76)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 17:07:21 +00:00
dependabot[bot]
00ba0dfa2e build(deps): bump libz-sys from 1.1.19 to 1.1.20 (#33194)
Bumps [libz-sys](https://github.com/rust-lang/libz-sys) from 1.1.19 to 1.1.20.
- [Release notes](https://github.com/rust-lang/libz-sys/releases)
- [Commits](https://github.com/rust-lang/libz-sys/compare/1.1.19...1.1.20)

---
updated-dependencies:
- dependency-name: libz-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 16:55:17 +00:00
dependabot[bot]
806d960d38 build(deps): bump serde_json from 1.0.125 to 1.0.127 (#33195)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.125 to 1.0.127.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/1.0.125...1.0.127)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 16:51:58 +00:00
dependabot[bot]
cdedb57aee build(deps): bump cc from 1.1.14 to 1.1.15 (#33193)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.14 to 1.1.15.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.14...cc-v1.1.15)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 16:48:51 +00:00
dependabot[bot]
8f14f7bee6 build(deps): bump flate2 from 1.0.32 to 1.0.33 (#33192)
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.32 to 1.0.33.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.32...1.0.33)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 16:41:57 +00:00
Martin Robinson
7b7020a8d4 layout: Enable flexbox by default on non-legacy layout (#33186)
Flexbox is still very much in progress, but things are working well
enough that we can enable it by default. It improves most pages that use
flexbox now.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-26 13:50:52 +00:00
Mukilan Thiyagarajan
b6d5ac09b0 mach: introduce BuildTarget abstraction (#33114)
Introduce a new `BuildTarget` abstraction to centralize the code for
supporting different ways of choosing the build target (e.g --android,
--target x86_64-linux-android , --target aarch64-linux-ohos). This
is currently handled in an adhoc fashion in different commands (
mach package, install, run) leading to a proliferation of keyword
parameters for the commands and duplicated logic.

The patch introduces a new `allow_target_configuration` decorator to
do the validation and parsing of these parameters into the appropriate
`BuildTarget` subclass, which is now stored as an instance attribute
of the CommandBase class. All the code that previously relied on
`self.cross_compile_target` has been switched to use the BuildTarget.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-26 13:08:21 +00:00
Samson
4397d8a021 Add dom.allow_scripts_to_close_windows pref. (#33187)
It's also present in firefox: https://searchfox.org/mozilla-central/search?q=allow_scripts_to_close_windows

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-26 11:44:47 +00:00
Ben
0e6b55c71d Redesigned minibrowser toolbar to use icons instead of text (#33179)
* Redesigned minibrowser toolbar to use icons instead of text

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>

* Apply suggestions from code review

Address a couple nits

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

---------

Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-26 09:43:40 +00:00
Erik Hennig
e5caa725da Fix a memory leak in components/script/script_runtime.rs and add more leak suppressions (#33175)
* asan: Add suppression for known false positive

Signed-off-by: ede1998 <online@erik-hennig.me>

* fix: re-suppress lazy_static leaks

lazy_static is still used by dependencies and still leaks
from static variables.

Signed-off-by: ede1998 <online@erik-hennig.me>

* fix: Memory leak of Box<NetworkingTaskSource>

Signed-off-by: ede1998 <online@erik-hennig.me>

---------

Signed-off-by: ede1998 <online@erik-hennig.me>
2024-08-26 07:33:23 +00:00
Daniel Adams
c028b5c299 webxr: Implement XRBoundedReferenceSpace (#33176)
* Implement XRBoundedReferenceSpace

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

* Update expectations

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

* Update interfaces

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

* Add missing pref condition on IDL interface

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-25 23:53:39 +00:00
Samson
e0e562137c Add fallback value for data['message'] (#33185)
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-08-25 21:54:51 +00:00
Taym Haddadi
a3f5a8482d Fix panic in abort-block-bfcache.window.js (#33173)
* Fix panic in abort-block-bfcache.window.js

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Update test expectation

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-25 19:37:44 +00:00
Samson
88d8770214 Use global exports from derives (#33169)
* pub reexport *Traceable

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

* reexport `HasParent` for derives

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

* reexport DomObject, Reflector, MutDomObject

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

* fmt

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

* Update lib.rs

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

* Update lib.rs

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

* Update lib.rs

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-08-25 13:58:09 +00:00
eri
6357998ede DevTools: Inspect node styles (#33025)
* feat: retrieve applied styles

Signed-off-by: eri <eri@inventati.org>

* feat: preliminary style showing

Signed-off-by: eri <eri@inventati.org>

* chore: some style tests

Signed-off-by: eri <eri@inventati.org>

* feat: edit style rules

Signed-off-by: eri <eri@inventati.org>

* feat: css database

Signed-off-by: eri <eri@inventati.org>

* feat: computed styles

Signed-off-by: eri <eri@inventati.org>

* feat: inherited styles

Signed-off-by: eri <eri@inventati.org>

* feat: get stylesheet styles

Signed-off-by: eri <eri@inventati.org>

* feat: all styles in inspector

Signed-off-by: eri <eri@inventati.org>

* feat: multiple stylesheets

Signed-off-by: eri <eri@inventati.org>

* refactor: clean up

Signed-off-by: eri <eri@inventati.org>

* Some minor cleanup

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

---------

Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-25 09:30:23 +00:00
Nolan Lawson
67e2bb0ee6 script: fix querySelector returning the root (#33174)
Signed-off-by: Nolan Lawson <nolan@nolanlawson.com>
2024-08-25 09:16:26 +00:00
Cristian Brinza
c79d9e68a3 Use webrender UploadMethod::Immediate with ANGLE (#33177)
* Use webrender UploadMethod::Immediate with ANGLE

Signed-off-by: crbrz <cristianb@gmail.com>

* Added comment with Gecko link

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-08-25 05:43:06 +00:00
Servo WPT Sync
6caaa0c955 Update web-platform-tests to revision b'd988aeeb33edc4d452899921799b8bed69fff65d' (#33178)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-08-25 01:37:49 +00:00
Martin Robinson
7582afebec script: Update list of non-TS pseudo classes supported by Servo (#33165)
Also remove some code duplication by moving some of the code into the
`Element` impl.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-24 08:43:54 +00:00
Kopanov Anton
ad45fa0a19 script: Fix panic in htmlimageelement.rs using str::find() to find character boundaries. (#32980)
* fix loop with chars().enumerate() by using find()

Signed-off-by: Kopanov Anton <anton.kopanov@ya.ru>

* Add documentation to parser and fix some small issues

- Rename the properties of `Descriptor` so that they are full words
- Use the Rust-parser to parse doubles
- Add documentation and restructure parser to be more readable

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

---------

Signed-off-by: Kopanov Anton <anton.kopanov@ya.ru>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-24 08:22:39 +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
Martin Robinson
2db9032e72 layout: Add support for flex items with position: relative (#33151)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-23 18:11:22 +00:00
dependabot[bot]
b9f02cf773 build(deps): bump quote from 1.0.36 to 1.0.37 (#33167)
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.36 to 1.0.37.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.36...1.0.37)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-23 17:34:15 +00:00
dependabot[bot]
1165190c8e build(deps): bump cc from 1.1.13 to 1.1.14 (#33166)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.13 to 1.1.14.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.13...cc-v1.1.14)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-23 17:20:51 +00:00
Martin Robinson
78e2691d3f shaping: Don't assume there's a space glyph when rendering tabs (#32979)
Previously if a font didn't have a space advance and it was needed to
make advances for tabs, Servo would try to read the advance from the
font. If the font didn't have a space glyph, Servo would panic. This
fixes that issue by making the space advance part of the `FontMetrics`
of a font (like Gecko) and falling back properly if that glyph doesn't
exist. The rendered glyph is still the "space" glyph, but we make
sure to select a font that supports that glyph explicitly.

This prevents a crash, but tabs still aren't handled properly. In
reality, tab stops should be calculated in layout and the size of
the space character of the current font shouldn't come into play.
The addition of the space advance metric will make this easier.

Fixes #32970.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-23 11:17:44 +00:00
Samson
ebdae6094e CI: Add separate Lint&Tidy check and remove test-tidy from linux (#33150)
* Create separate Lint&Tidy check

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

* Remove quick-check as it's not longer relevant

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

* Add clippy to rust-toolchain

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

* fix try parser test expectations

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

* use lint in result

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

* Lint & Tidy -> Lint

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-23 08:58:12 +00:00
Josh Matthews
0afcb83e9f Print reason when tests are skipped. (#33077)
* Print reason when tests are skipped.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Print reason tests are skipped in Servo's WPT formatter

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-23 08:39:39 +00:00
Martin Robinson
e956b53827 layout: Clean up inline layout data structures (#33149)
- Rename `InlineFormattingContextState` to
  `InlineFormattingContextLayout`.
- Have `InlineFormattingContextLayout` hold a reference to the
 `InlineFormattingContext`, so that it does not need to be passed
 around as an argument
- Have `LineItemLayout` hold a reference to
  `InlineFormattingContextLayout` to avoid duplicating so much data.
- Rename some members of `LineItemLayout` to make it clearer what
  they do.
- Give beter names to many lifetimes and combine some that are
  effectively the same.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-08-22 12:05:15 +00:00
Josh Matthews
60ef6bc461 Start marking functions that can transitively trigger a GC (#33144)
* Mark JS reflector wrappers as CanGc.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc from reflect_dom_object_with_proto.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Mark DOM constructors as GC operations.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-22 11:42:36 +00:00
webbeef
9a1051c917 Implement crypto.randomUUID() (#33158)
Signed-off-by: webbeef <me@webbeef.org>
2024-08-22 04:56:37 +00:00
webbeef
663a92a5df make protocol handlers registrable (#33104)
Signed-off-by: webbeef <me@webbeef.org>
2024-08-22 04:11:16 +00:00
Daniel Adams
562d32c051 webxr: Update XRWebGLLayer interface to latest spec (#33157)
* Update XRWebGLLayer interface to latest spec

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

* Add missing spec links

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-22 02:18:58 +00:00
dependabot[bot]
cde10241c3 build(deps): bump flate2 from 1.0.31 to 1.0.32 (#33141)
* build(deps): bump flate2 from 1.0.31 to 1.0.32

Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.31 to 1.0.32.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.31...1.0.32)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Allow duplicate miniz_oxide.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-08-21 23:28:44 +00:00
A. Wilcox
0e56241c1b background_hang_monitor: Add musl compatibility (#33153)
musl does not have libunwind readily available; even if it did, it has
no concept of ucontext (needing an external lib).  Similar to ohos,
disable the background hang monitor and use the DummySampler.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
2024-08-21 21:38:28 +00:00
Daniel Adams
7501e3e12f webxr: Update XRInputSource interface to latest spec (#33155)
* Update XRInputSource interface to latest spec

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

* Bump webxr version

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

* Add missing spec link

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-21 21:26:29 +00:00
Martin Robinson
56280c6242 layout: Add initial support for bidirectional text (BiDi) (#33148)
This adds supports for right-to-left text assigning bidi levels to all
line items when necessary. This includes support for the `dir` attribute
as well as corresponding CSS properties like `unicode-bidi`. It only
implements right-to-left rendering for inline layout at the moment and
doesn't include support for `dir=auto`. Because of missing features,
this causes quite a few tests to start failing, as references become
incorrect due to right-to-left rendering being active in some cases,
but not others (before it didn't exist at all).

Analysis of most of the new failures:

```
- /css/css-flexbox/gap-001-rtl.html
  /css/css-flexbox/gap-004-rtl.html
 - Require implementing BiDi in Flexbox, because the start and
   end inline margins are opposite the order of items.

- /css/CSS2/bidi-text/direction-applies-to-*.xht
  /css/CSS2/bidi-text/direction-applies-to-002.xht
  /css/CSS2/bidi-text/direction-applies-to-003.xht
  /css/CSS2/bidi-text/direction-applies-to-004.xht
  - Broken due to a bug in tables, not allocating the
    right amount of width for a column.

- /css/css-lists/inline-list.html
  - This fails because we wrongly insert a soft wrap opportunity between the
    start of an inline box and its first content.

- /css/css-text/bidi/bidi-lines-001.html
  /css/css-text/bidi/bidi-lines-002.html
  /css/CSS2/text/bidi-flag-emoji.html
  - We do not fully support unicode-bidi: plaintext

- /css/css-text/text-align/text-align-end-010.html
  /css/css-text/text-align/text-align-justify-006.html
  /css/css-text/text-align/text-align-start-010.html
  /html/dom/elements/global-attributes/*
  - We do not support dir=auto yet.

- /css/css-text/white-space/tab-bidi-001.html
  - Servo doesn't support tab stops

- /css/CSS2/positioning/abspos-block-level-001.html
  /css/css-text/word-break/word-break-normal-ar-000.html
  - Do not yet support RTL layout in block

- /css/css-text/white-space/pre-wrap-018.html
  - Even in RTL contexts, spaces at the end of the line must hang and
    not be reordered

- /css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html
  - We are letting spaces hang with white-space: pre, but they shouldn't
    hang.
```

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-08-21 14:28:54 +00:00
Samson
65bd5a3b99 webgpu: Align writeBuffer with spec (#33147)
* Sync `WriteBuffer`

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

* Set good expectations

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

* Change assert to debug_assert

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-21 11:46:23 +00:00
Simon Wülker
3b8c638a84 Fix floating point errors in table layout (#33098)
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-08-21 10:41:43 +00:00
Daniel Adams
fb22dfb373 webxr: Update XRPose interface to latest spec (#33146)
* Update XRPose interface with missing members

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

* ./mach fmt

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-21 10:41:04 +00:00
Daniel Adams
8e224cb4d3 webxr: Update XRView to latest spec (#33145)
* Add recommendedViewportScale and requestViewportScale

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

* Remove currently unused internal slots

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-21 02:37:58 +00:00
dependabot[bot]
75b817cca3 build(deps): bump unicode-xid from 0.2.4 to 0.2.5 (#33143)
Bumps [unicode-xid](https://github.com/unicode-rs/unicode-xid) from 0.2.4 to 0.2.5.
- [Commits](https://github.com/unicode-rs/unicode-xid/compare/v0.2.4...v0.2.5)

---
updated-dependencies:
- dependency-name: unicode-xid
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-20 17:32:13 +00:00
dependabot[bot]
1492624bb5 build(deps): bump unicode-properties from 0.1.1 to 0.1.2 (#33142)
Bumps [unicode-properties](https://github.com/unicode-rs/unicode-properties) from 0.1.1 to 0.1.2.
- [Commits](https://github.com/unicode-rs/unicode-properties/compare/v0.1.1...v0.1.2)

---
updated-dependencies:
- dependency-name: unicode-properties
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-20 17:18:51 +00:00
Josh Matthews
bc5235827f Various borrow hazard fixes (#33133)
* Reduce the scope of the document tag map borrow.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Reduce scope of borrow when finishing a Response.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Avoid creating a File object while borrowing FormData's data.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Prevent the GC from seeing an uninitialized window proxy slot.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-20 16:06:24 +00:00
Oriol Brufau
c00cd1326a Take into account the intrinsic block size when computing the main size of a column flex container (#33135)
In particular, `main_content_sizes()` now works with columns.

`layout_for_block_content_size()` is now used for both intrinsic sizes
and intrinsic contributions, a IntrinsicSizingMode parameter is added
to choose the behavior.

Also, we consider the main size of a flex item as indefinite if its flex
basis is indefinite and the flex container has an indefinite main size.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-20 11:30:27 +00:00
Taym Haddadi
cf98d8d7ec Update url setters test result (#33134)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-20 10:34:45 +00:00
Daniel Adams
7e4979c852 webxr: Update XRFrame to latest spec (#33102)
* Update IDL+naming, add predictedDisplayTime getter stub

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

* Surface predicted display time

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

* Update WPT expectations

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

* Update todo comment

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-20 08:12:25 +00:00
Taym Haddadi
91adf39de7 Fix panic in embedded-opener-remove-frame (#33122)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-19 20:05:03 +00:00
dependabot[bot]
32a298f3a2 build(deps): bump libc from 0.2.156 to 0.2.158 (#33131)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.156 to 0.2.158.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.158/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.156...0.2.158)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:42:42 +00:00
dependabot[bot]
9e2536c877 build(deps): bump syn from 2.0.74 to 2.0.75 (#33130)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.74 to 2.0.75.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.74...2.0.75)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:38:55 +00:00
dependabot[bot]
40e0052ef7 build(deps): bump webxr from 08a6d70 to 474d538 (#33129)
Bumps [webxr](https://github.com/servo/webxr) from `08a6d70` to `474d538`.
- [Commits](08a6d70ad4...474d53835c)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:27:35 +00:00
dependabot[bot]
6a7d5210e9 build(deps): bump redox_users from 0.4.3 to 0.4.6 (#33127)
Bumps redox_users from 0.4.3 to 0.4.6.

---
updated-dependencies:
- dependency-name: redox_users
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:23:19 +00:00
dependabot[bot]
c5751af926 build(deps): bump ohos-sys from 0.2.1 to 0.2.2 (#33128)
Bumps [ohos-sys](https://github.com/openharmony-rs/ohos-sys) from 0.2.1 to 0.2.2.
- [Changelog](https://github.com/openharmony-rs/ohos-sys/blob/main/CHANGELOG.md)
- [Commits](https://github.com/openharmony-rs/ohos-sys/compare/v0.2.1...v0.2.2)

---
updated-dependencies:
- dependency-name: ohos-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:18:24 +00:00
dependabot[bot]
54cb8d9a36 build(deps): bump tokio from 1.39.2 to 1.39.3 (#33126)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.39.2 to 1.39.3.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.39.2...tokio-1.39.3)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:17:48 +00:00
dependabot[bot]
c5d3c29b79 build(deps): bump arrayvec from 0.7.4 to 0.7.6 (#33125)
Bumps [arrayvec](https://github.com/bluss/arrayvec) from 0.7.4 to 0.7.6.
- [Release notes](https://github.com/bluss/arrayvec/releases)
- [Changelog](https://github.com/bluss/arrayvec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bluss/arrayvec/compare/0.7.4...0.7.6)

---
updated-dependencies:
- dependency-name: arrayvec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 17:14:05 +00:00
Josh Matthews
b3280fe071 Update surfman to fix macOS webgl crashes. (#33124) 2024-08-19 16:31:50 +00:00
Samson
94ff89a5e4 webgpu: Sync various parts of spec (#33009)
* Sync `GPUObjectDescriptorBase` (label is not option anymore)

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

* Sync `GPUFeatureName`

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

* shader_f16 feature is not usable in wgpu so disable it

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

* sync `GPUTextureFormat`

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

* `validate_texture_format_required_features`

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

* Sync `GPUTexture` attributes

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

* Make `entryPoint` in `GPUProgrammableStage` optional

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

* Set good expectations

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

* Bad expectations because naga does not support cons declarations

Also fail on firefox, where skipped before due to missing device features

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

* Bad expectation, also fails on firefox

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

* Bad expectations, because naga does not support `let pos = positions[vertex_index];`

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

* Set expectation

external texture does not work in firefox too (again naga)

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

* set bad expectations, because naga does not support `enable`

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

* Set bad expectations for, `Texture with '' label has been destroyed`

also fails in firefox with same reason

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

* one bad expectation

also on firefox

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

* expect that also matches firefox

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

* more expect

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

* Use only 1 proc for _webgpu

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

* better doc comment

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-19 14:06:30 +00:00
Martin Robinson
f45c98496e Upgrade font-kit, raqote, and stop using dirs-next (#33120)
`dirs-next` is still used by the version of the `term` crate we are
using, but this also remoes a version of `cstr` so our dependency count
does not change.

A new version of `raqote` hasn't been released, so this depends on the
upstream repository directly. It's been almost 4 months since the
release has been ready -- so it's unclear when it will happen.

Fixes #32801.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-19 12:16:28 +00:00
Martin Robinson
2f6745c0c6 layout: Layout for column flex-basis and minimum automatic size determination (#33068)
This change adds an expensive layout for the determination of minimum
automatic size and flex basis in process of flexbox layout. Currently,
the layout is not cached, so may be performed up to 2 more times than
necessary.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-08-19 10:54:10 +00:00
Cristian Brinza
2a31fddc0b Refactor GlyphStore::iter_glyphs_for_byte_range without recursion (#33074)
* Implement DoubleEndedIterator for EachIndex

Signed-off-by: crbrz <cristianb@gmail.com>

* Refactor GlyphStore::iter_glyphs_for_byte_range without recursion

Signed-off-by: crbrz <cristianb@gmail.com>

* Update WPT result

Signed-off-by: crbrz <cristianb@gmail.com>

* Update WPT legacy result

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-08-19 10:47:09 +00:00
Servo WPT Sync
d59a7f62f8 Update web-platform-tests to revision b'ebe057a1153d34042bac1ff3dc944220876f69ec' (#33116)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-08-19 07:45:30 +00:00
Samson
b5fe99ba5d wpt-tests-to-run -> wpt-args and make them last so they can override already provide (#33115)
d options

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-19 07:29:40 +00:00
Simon Wülker
84b5b64424 Fix incorrect documentation and add track_caller to DomRefCell methods (#33111)
* Fix DomRefCell documentation about panic behaviour

Fixes https://github.com/servo/servo/issues/33099

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

* Annotate DomRefCell::borrow/borrow_mut with #[track_caller]

Fixes https://github.com/servo/servo/issues/27336

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-08-19 07:24:38 +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
Daniel Adams
e078353bf0 Fix race in WebXR WPT test setup (#33112)
* Ensure xr_promise_test only runs after DOMContentLoaded

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

* Update meta expectations

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

* Update meta-legacy-layout expectations

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

* Update manifest

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-18 21:27:05 +00:00
Taym Haddadi
a50e6a503e Remove unnecessary unsafe block (#33109)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-18 16:18:28 +00:00
Taym Haddadi
a24e92778a fix: add error handling to BaseAudioContext::new_inherited (#33023)
* fix: add error handling to BaseAudioContext::new_inherited

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update servo-media

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update test expectations

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Update servo-media

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-18 13:58:43 +00:00
Daniel Adams
1ef3e107bd Add makeXRCompatible for WebGL2, update WebXR WPT expectations (#33097)
* Add makeXRCompatible to WebGLRenderContextBase

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

* Activate webgl2 for webxr wpt, update meta expectations

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

* Update meta legacy layout expectations

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

* Remove no longer existing expectations from meta files

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

* Remove files for fully passing tests

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

* Remove out-of-date expectations from meta legacy layout

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

* Update webgl conformance expectations

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

* Fix test numbering in expectations

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-18 10:37:14 +00:00
Koki Saito
280063eee2 Make string formatting more consistent in CodegenRust.py (#33096)
* fix: Replace string concatenation with f-string

Signed-off-by: Koki Saito <saitoto828@gmail.com>

* fix: Replace substitute method with f-string

Signed-off-by: Koki Saito <saitoto828@gmail.com>

* fix: Cleanup unused function `onFailureInvalidEnumValue`

Signed-off-by: Koki Saito <saitoto828@gmail.com>

* fix: Replace %formatting with f-string

Signed-off-by: Koki Saito <saitoto828@gmail.com>

* fix: Fix some typo

Signed-off-by: Koki Saito <saitoto828@gmail.com>

* fix: Lint

Signed-off-by: Koki Saito <saitoto828@gmail.com>

---------

Signed-off-by: Koki Saito <saitoto828@gmail.com>
Co-authored-by: kokisaito <kosaito@indeed.com>
2024-08-18 05:02:11 +00:00
webbeef
6aee84f0d1 Update data-url to 0.3 (#33103)
Signed-off-by: webbeef <me@webbeef.org>
2024-08-18 04:34:55 +00:00
Koki Saito
db312319ae fix: Replace callargs_is_constructing with is_constructing method (#33101)
Signed-off-by: Koki Saito <saitoto828@gmail.com>
Co-authored-by: kokisaito <kosaito@indeed.com>
2024-08-18 01:48:39 +00:00
Daniel Adams
20273b062a webxr: Update XRSession to latest spec (#33059)
* Add missing XRSession members, initial implementations

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

* Implement supportedFramerates getter

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

* Implement framerate changes, add spec links

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

* Update WPT expectations

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

* ./mach fmt

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

* Add missing spec link

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-17 03:36:52 +00:00
Simon Wülker
f0045a7686 remove usage of legacy numeric operations in script (#33095)
These operations are deprecated and might be removed
in a future rust version. Clippy is also complaining
about them.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-08-16 21:30:13 +00:00
dependabot[bot]
09cac6430b build(deps): bump libc from 0.2.155 to 0.2.156 (#33091)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.155 to 0.2.156.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.156/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.155...0.2.156)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 18:24:28 +00:00
dependabot[bot]
842bd607d4 build(deps): bump bytemuck_derive from 1.7.0 to 1.7.1 (#33086)
Bumps [bytemuck_derive](https://github.com/Lokathor/bytemuck) from 1.7.0 to 1.7.1.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/bytemuck_derive-v1.7.0...bytemuck_derive-v1.7.1)

---
updated-dependencies:
- dependency-name: bytemuck_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 18:22:02 +00:00
dependabot[bot]
a8fbfe712f build(deps): bump webxr from dd76329 to 08a6d70 (#33092)
Bumps [webxr](https://github.com/servo/webxr) from `dd76329` to `08a6d70`.
- [Commits](dd763293a8...08a6d70ad4)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 18:21:27 +00:00
dependabot[bot]
23c2040f2b build(deps): bump cc from 1.1.12 to 1.1.13 (#33093)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.12 to 1.1.13.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.12...cc-v1.1.13)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 18:20:30 +00:00
dependabot[bot]
10e2dc7a63 build(deps): bump bytemuck from 1.16.3 to 1.17.0 (#33090)
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.16.3 to 1.17.0.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.3...v1.17.0)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: indirect
  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>
2024-08-16 17:35:17 +00:00
dependabot[bot]
c6d6823b85 build(deps): bump scc from 2.1.14 to 2.1.16 (#33089)
Bumps [scc](https://github.com/wvwwvwwv/scalable-concurrent-containers) from 2.1.14 to 2.1.16.
- [Changelog](https://github.com/wvwwvwwv/scalable-concurrent-containers/blob/main/CHANGELOG.md)
- [Commits](https://github.com/wvwwvwwv/scalable-concurrent-containers/commits)

---
updated-dependencies:
- dependency-name: scc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 17:31:27 +00:00
dependabot[bot]
4bdf6403d0 build(deps): bump surfman from 0.9.5 to 0.9.6 (#33088)
Bumps [surfman](https://github.com/servo/surfman) from 0.9.5 to 0.9.6.
- [Release notes](https://github.com/servo/surfman/releases)
- [Commits](https://github.com/servo/surfman/commits)

---
updated-dependencies:
- dependency-name: surfman
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 17:28:59 +00:00
Josh Matthews
3829e91662 Handle failed string conversions in console.log. (#33085)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-16 16:49:56 +00:00
Josh Matthews
4df7a1af25 Support HTML parser reentrancy (#32820)
* Update parser interface for reentrancy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove assertions around invoking scripts with active parser.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add regression test.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Run test with normal and async html parser.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-16 16:25:50 +00:00
Mukilan Thiyagarajan
d44c0f7e5d mach: remove unused maven packaging code (#33083)
This code is unused and unmaintained. We can bring it back from version
control if needed in the future.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-16 11:59:05 +00:00
Martin Robinson
0d94a8acd2 layout: Prepare for bidi by guarding all access to writing-mode (#33082)
We want to selectively enable right-to-left writing modes per layout
context. This change makes that possible by allowing access to
`writing-mode` though an interface that always returns the default
horizontal top-to-bottom (implicitly left-to-right) writing mode.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-08-16 11:38:04 +00:00
Josh Matthews
3d3621b652 Update stylo for latest changes. (#33079)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-16 10:47:12 +00:00
Martin Robinson
ce5ebbcf77 legacy-layout: Fix display list building after WebRender upgrade (#33073)
The most recent version of WebRender tracks stacking context offsets in
a different way, which broke legacy layout. It's easier just to track
the stacking context offset in Servo and apply them to the items
manually like we do in non-legacy layout.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-16 10:02:43 +00:00
Hayashi Mikihiro
6816d11f88 replace once_cell (#33080)
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-16 04:49:50 +00:00
Hayashi Mikihiro
4cc1b68546 Remove lazy static (#33078)
* remove from rand

Mutex<OsRng> can be initialized in compile time.

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove from layout_2020

Mutex<()> can be initialize in compile time

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove from media

`IS_MULTIPROCESS` doesn't be used.

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove lazy_static from dependencies

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* rewrite suppressed_leaks_for_asan.txt

For all of lazy_static was replaced with LazyLock.

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-16 03:57:09 +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
Josh Matthews
69185c4af1 Ensure parsers initiated from DOMParser always complete. (#33056)
* Ensure parsers initiated from DOMParser always complete.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add test for parseFromString with async parser.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add expected failure.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-15 23:45:00 +00:00
Josh Matthews
3cc91e655f Remove many explicit reflow calls (#33067)
* Remove explicit reflow for iframe content updates.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove explicit reflow for timers.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove explicit reflow for MouseEvent.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove explicit reflow for key events.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove explicit reflow for document load.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove explicit reflow for iframe load.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Remove unused reflow reasons.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-15 22:20:52 +00:00
Jose Monagas
a34920b605 fix(clippy): Clippy suggestions in components/script/dom/* (#33072)
Signed-off-by: Jose T. Monagas <josetmonagas@proton.me>
Co-authored-by: Jose T. Monagas <josetmonagas@proton.me>
2024-08-15 19:31:30 +00:00
dependabot[bot]
386a067c4b build(deps): bump is-terminal from 0.4.12 to 0.4.13 (#33071)
Bumps [is-terminal](https://github.com/sunfishcode/is-terminal) from 0.4.12 to 0.4.13.
- [Commits](https://github.com/sunfishcode/is-terminal/compare/v0.4.12...v0.4.13)

---
updated-dependencies:
- dependency-name: is-terminal
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 17:22:54 +00:00
dependabot[bot]
0710209557 build(deps): bump serde_json from 1.0.124 to 1.0.125 (#33070)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.124 to 1.0.125.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.124...1.0.125)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 17:00:26 +00:00
dependabot[bot]
bcfc642f2f build(deps): bump cc from 1.1.11 to 1.1.12 (#33069)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.11 to 1.1.12.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.11...cc-v1.1.12)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 16:58:06 +00:00
dependabot[bot]
e4d0af8d91 build(deps): bump serde from 1.0.207 to 1.0.208 (#33066)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.207 to 1.0.208.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.207...v1.0.208)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 16:53:21 +00:00
Hayashi Mikihiro
016ff5dfa6 Replace lazy_static crate with std::sync::LazyLock in layout and config (#33065)
* replace in layout_thread_2020

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in layout_thread

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in layout

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in config

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in config_plugins

The macro of config_plugins require Send trait bounds

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-15 16:28:04 +00:00
Taym Haddadi
c01b733523 Update codegen for GetOpener:inRealms in Bindings.conf (#33062)
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-08-15 13:42:50 +00:00
Hayashi Mikihiro
86c4e014b4 Replace the lazy_static crate with std::sync::LazyLock in components/shared (#33060)
* replace in pub_domains.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in embedder/resources.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in base/id.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in net/lib.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove lazy_static from components/shared

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-15 12:05:29 +00:00
Cristian Brinza
8f82b2a7cb Use FontInstanceFlags::SUBPIXEL_POSITION for font instances on Windows (#33045)
Signed-off-by: crbrz <cristianb@gmail.com>
2024-08-15 10:25:57 +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
Daniel Adams
353ceb0ffb Update WebXR WPT expectations (#33058)
* Enable the dom.webxr.test pref for webxr WPT tests

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

* Update webxr test expectations

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

* Fix erroneous timeouts

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

* Readd stable timeout

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-15 09:09:15 +00:00
Martin Robinson
8159f03288 layout: Support start and end values for flexbox align-self (#33032)
These are similar to `flex-start` and `flex-end`, but in `wrap-reverse`
situations, they are the opposite.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-08-15 08:20:41 +00:00
Samson
a6638c1952 Update mozjs and use release libz-sys (#33048)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-15 00:32:30 +00:00
Daniel Adams
825d6f10e9 webxr: Update hand input to match latest spec (#32958)
* Update IDLs

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

* Update XRHand and XRJointSpace methods/bindings

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

* Implement fillJointRadii

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

* Implement fillPoses

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

* Formatting

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

* Update test expectations

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

* Tidy, missing spec link

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

* Remove idlharness expectation files, update hands pref

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

* Update interfaces

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

* XRJointPose interface

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

* XRHand interface

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-14 22:45:45 +00:00
Martin Robinson
057873c94a Remove unused constant from components/net/fetch/methods.rs (#33054)
This was revealed by the recent switch to `LazyLock`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-14 18:35:13 +00:00
dependabot[bot]
c438bfddd0 build(deps): bump indexmap from 2.3.0 to 2.4.0 (#33053)
Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.3.0 to 2.4.0.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.3.0...2.4.0)

---
updated-dependencies:
- dependency-name: indexmap
  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>
2024-08-14 17:27:23 +00:00
dependabot[bot]
6b0680c779 build(deps): bump web-sys from 0.3.69 to 0.3.70 (#33052)
Bumps [web-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.69 to 0.3.70.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: web-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-14 17:24:15 +00:00
dependabot[bot]
d3209040ce build(deps): bump cc from 1.1.10 to 1.1.11 (#33051)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.10 to 1.1.11.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.10...cc-v1.1.11)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-14 17:19:39 +00:00
dependabot[bot]
cfbc10aefe build(deps): bump wasm-bindgen-futures from 0.4.42 to 0.4.43 (#33050)
Bumps [wasm-bindgen-futures](https://github.com/rustwasm/wasm-bindgen) from 0.4.42 to 0.4.43.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: wasm-bindgen-futures
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-14 17:15:27 +00:00
Hayashi Mikihiro
ad85dd10e3 Replace lazy_static with std::sync::LazyLock in components/fonts (#33049)
* replace in shaper.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in android/font_list.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in ohos/font_list.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove lazy_lock from components/fonts

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-14 16:20:54 +00:00
Martin Robinson
7633bdccd2 layout: Initial implementation of flex-direction: column and column-reverse (#33031)
This change removes restrictions on using the column layout mode of
flexbox and adds an initial implementation of sizing for that flex
direction. There's a lot of missing pieces still, but in some cases this
does render column flexbox.

In particular, there are now two code paths for preferred widths
(intrinsic size) calcuation: one in the main axis (row) and one in
the cross axis (column) corresponding to the flex direciton with
horizontal writing modes.

In addition, `FlexItemBox::inline_content_sizes` is removed in favor of
making `sizing::outer_inline` /
`IndependentFormattingContext::outer_inline_content_sizes` generic
enough to handle using a different value for auto minimum sizes, which
flexbox needs.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-08-14 14:25:09 +00:00
Simon Wülker
c059bab6f4 Dont use lazy static to construct mutexes (#33047)
* Remove usage of lazy-static in background_hang_monitor

The lazy-static crate was only used to construct a mutex,
but since Mutex::new is const this can be done at compiletime
instead.

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

* Remove usage of lazy-static in servoshell

Lazy-static was only used to construct a mutex, but
since Mutex::new is const this can simply be done at
compiletime.

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-08-14 13:42:01 +00:00
Martin Robinson
d941d2fd67 layout: Convert the FragmentTree to physical geometry (#33030)
This converts all geometry in the FragmentTree into physical geometry,
doing conversions ahead of time instead of when traversing the fragment
tree. This is necessary to properly implement BiDi in Servo as we need
to know what side borders are on in mixed RTL and LTR contexts.

In addition, fragments are laid out in a particular context and only
that context knows its writing mode. There were issues where were using
one writing mode to lay out and another to convert to phyisical
coordinates. This isn't an issue now since we only use the default
writing mode, but starts to be an issue with BiDi text.

Closes #25564.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-14 12:22:06 +00:00
Hayashi Mikihiro
65f90ff1fd Replace the lazy_static crate with std::sync::LazyLock in components/net (#33046)
* replace in net/fetch/methods.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in net/hosts.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in net/async_runtime.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in net/tests/main.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove lazy_static crate from components/net

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-14 12:15:55 +00:00
Martin Robinson
6be99241c6 Fix warnings after latest rust upgrade (#33043)
This fixes various unused code warnings after the recent rust upgrade.
Some of the dead code is maintained, as it is quite likely that it will
be used in future changes.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-14 07:00:16 +00:00
dependabot[bot]
380348e4df build(deps): bump tower-service from 0.3.2 to 0.3.3 (#33041)
Bumps [tower-service](https://github.com/tower-rs/tower) from 0.3.2 to 0.3.3.
- [Release notes](https://github.com/tower-rs/tower/releases)
- [Commits](https://github.com/tower-rs/tower/compare/tower-service-0.3.2...tower-service-0.3.3)

---
updated-dependencies:
- dependency-name: tower-service
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-14 04:53:36 +00:00
Jonathan Schwender
3aef023368 ohos: Fix x86_64-unknown-linux-ohos (#33029)
* ohos: Fix compilation for x86_64

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

* ohos: Use the SDK compiler-wrapper

When compiling for x86_64-unknown-linux-ohos without the compiler
wrapper, for some reason mozjs_sys will be refercing a wrong mangled symbol
resulting in the following error when loading the .so at runtime:

```
_ZNSt3__111this_thread9sleep_forERKNS_6chrono8durationIxNS_5ratioILl1ELl1000000000EEEEE: symbol not found
```

This problem does not occur when compiling for aarch64 or when using the compiler wrapper.
In this case the correct symbol
`_ZNSt4__n111this_thread9sleep_forERKNS_6chrono8durationIxNS_5ratioILl1ELl1000000000EEEEE`
is referenced.
It's unclear why manually passing the flags via CFLAGS / CXXFLAGS does not work.

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

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-08-14 01:30:04 +00:00
Martin Robinson
478d95d245 Dedupliate syn (#33038)
This is the last step toward removing our use of `syn` version
1. It does three things:

1. Upgrades `async-recursion` to a newer version that uses `syn` 2.
2. Removes the use of `enum-iterator` that was only used to produce a
   trivial list of enum names. This reduces the number of crates we
   dependo on by 2.
3. Upgrades `media` to a version which no longer uses `syn` 1

Fixes #33034.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-13 21:21:47 +00:00
dependabot[bot]
fb6b56cdda build(deps): bump cpufeatures from 0.2.12 to 0.2.13 (#33035)
Bumps [cpufeatures](https://github.com/RustCrypto/utils) from 0.2.12 to 0.2.13.
- [Commits](https://github.com/RustCrypto/utils/compare/cpufeatures-v0.2.12...cpufeatures-v0.2.13)

---
updated-dependencies:
- dependency-name: cpufeatures
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 20:29:04 +00:00
dependabot[bot]
c922ab4b52 build(deps): bump serde from 1.0.206 to 1.0.207 (#33040)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.206 to 1.0.207.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.206...v1.0.207)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 18:50:22 +00:00
dependabot[bot]
a0a83bad96 build(deps): bump js-sys from 0.3.69 to 0.3.70 (#33039)
Bumps [js-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.69 to 0.3.70.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: js-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 18:44:37 +00:00
dependabot[bot]
0c276aeea5 build(deps): bump scc from 2.1.13 to 2.1.14 (#33037)
Bumps [scc](https://github.com/wvwwvwwv/scalable-concurrent-containers) from 2.1.13 to 2.1.14.
- [Changelog](https://github.com/wvwwvwwv/scalable-concurrent-containers/blob/main/CHANGELOG.md)
- [Commits](https://github.com/wvwwvwwv/scalable-concurrent-containers/commits)

---
updated-dependencies:
- dependency-name: scc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 17:54:12 +00:00
dependabot[bot]
89c456b6d1 build(deps): bump wasm-bindgen from 0.2.92 to 0.2.93 (#33036)
Bumps [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) from 0.2.92 to 0.2.93.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

---
updated-dependencies:
- dependency-name: wasm-bindgen
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 17:54:08 +00:00
Martin Robinson
3c19982040 ci: Only export WPT test changes on the main branch (#33033)
This ensures that the WPT export job only runs on chnages that target
the `main` branch. This makes it so changes to WPT tests in temporary
branches aren't upstreamed.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-13 15:39:35 +00:00
Martin Robinson
8582678e4b Properly handle subpixel units when dividing space between flex lines (#32913)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-08-13 15:11:01 +00:00
danik292
5d6840873a clippy: Fix missing indentation in comments and remove on unecessary cast (#33026)
* Add missing indendations in comments.

Signed-off-by: Daniel Frantes <danfrantes@seznam.cz>

* Fix test tidy error

Signed-off-by: Daniel Frantes <danfrantes@seznam.cz>

---------

Signed-off-by: Daniel Frantes <danfrantes@seznam.cz>
2024-08-13 11:28:09 +00:00
Ashwin Naren
ea5cf75169 clippy: Fix various clippy warnings throughout the code (#33003)
* replace u64::max_value() with u64::MAX

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed redundant import

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* Fixed dereference

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* Fixed a probable bug

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed imports

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed dereference

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* dereference formatting

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed unnessicary number imports

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed unnessicary number imports

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed excess borrow

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* ran mach fmt

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed doc comment

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed deref on an immutable reference

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed minor syntax error

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* reverted clamping

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* formatting

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* reverted final clamp

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Co-authored-by: Ashwin Naren <ashwin@pixelators.org>
2024-08-13 05:16:47 +00:00
Daniel Adams
0d137d276a webxr: Add missing IDL members from AR Module (#33007)
* Add missing IDL members from AR module

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

* Update test expectations

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

* ./mach fmt

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-13 04:28:40 +00:00
dependabot[bot]
4744debdfd build(deps): bump serde_json from 1.0.122 to 1.0.124 (#33021)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.122 to 1.0.124.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.122...v1.0.124)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 22:26:48 +00:00
dependabot[bot]
2d52b51e76 build(deps): bump xcursor from 0.3.6 to 0.3.8 (#33019)
Bumps [xcursor](https://github.com/esposm03/xcursor-rs) from 0.3.6 to 0.3.8.
- [Commits](https://github.com/esposm03/xcursor-rs/commits)

---
updated-dependencies:
- dependency-name: xcursor
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 17:11:08 +00:00
dependabot[bot]
f33190ae79 build(deps): bump mio from 1.0.1 to 1.0.2 (#33020)
Bumps [mio](https://github.com/tokio-rs/mio) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 17:06:59 +00:00
dependabot[bot]
26cd4a84e5 build(deps): bump serde from 1.0.205 to 1.0.206 (#33018)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.205 to 1.0.206.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.205...v1.0.206)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 17:04:48 +00:00
dependabot[bot]
3f1149fbdd build(deps): bump scc from 2.1.9 to 2.1.13 (#33016)
Bumps [scc](https://github.com/wvwwvwwv/scalable-concurrent-containers) from 2.1.9 to 2.1.13.
- [Changelog](https://github.com/wvwwvwwv/scalable-concurrent-containers/blob/main/CHANGELOG.md)
- [Commits](https://github.com/wvwwvwwv/scalable-concurrent-containers/commits)

---
updated-dependencies:
- dependency-name: scc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 16:57:01 +00:00
dependabot[bot]
d0b5080b5e build(deps): bump syn from 2.0.72 to 2.0.74 (#33014)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.72 to 2.0.74.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.72...2.0.74)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 16:54:54 +00:00
dependabot[bot]
1f3c193339 build(deps): bump core-foundation-sys from 0.8.6 to 0.8.7 (#33017)
Bumps [core-foundation-sys](https://github.com/servo/core-foundation-rs) from 0.8.6 to 0.8.7.
- [Commits](https://github.com/servo/core-foundation-rs/compare/core-foundation-sys-v0.8.6...core-foundation-sys-v0.8.7)

---
updated-dependencies:
- dependency-name: core-foundation-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 16:54:32 +00:00
dependabot[bot]
ebf28fc784 build(deps): bump polling from 3.7.2 to 3.7.3 (#33015)
Bumps [polling](https://github.com/smol-rs/polling) from 3.7.2 to 3.7.3.
- [Release notes](https://github.com/smol-rs/polling/releases)
- [Changelog](https://github.com/smol-rs/polling/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/polling/compare/v3.7.2...v3.7.3)

---
updated-dependencies:
- dependency-name: polling
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 16:51:31 +00:00
dependabot[bot]
93b43703e6 build(deps): bump cc from 1.1.8 to 1.1.10 (#33013)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.8 to 1.1.10.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.8...cc-v1.1.10)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 16:48:35 +00:00
Martin Robinson
564ba5969f layout: Non-auto z-index should always make stacking contexts for flex items (#32961)
Fixes #32756.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-12 12:15:20 +00:00
Samson
d29e937f7e Update Rust to 1.80.1 (#33008)
* Update rust to 1.80.1

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

* Update shell.nix

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-12 11:40:46 +00:00
Taym Haddadi
df8ccafa7c Fix: Return error and avoid panicking in SetOpener function (#33002)
* Fix: Return error and avoid panicking in SetOpener function

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* eturn JSFailed onstead of InvalidState

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update wpt test result

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-08-12 07:58:00 +00:00
Hayashi Mikihiro
a797969efe Replace the lazy_static crate whth std::sync::LazyLock in components/script (#33004)
* replace in str.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace navigator.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace htmlmetaelement.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace document.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace cssstyledeclaration.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace script_runtime.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace window_named_properties.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* reduce dependency lazy_static

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* reduce lazy in script_runtime.rs

 `Mutex::new()`  is const contexts. I think that `JS_ENGINE` is need not lazy initialize.

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-12 07:30:35 +00:00
Josh Matthews
f38d1574bc Allow navigations that include cross-origin redirects to succeed. (#32996)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-12 06:09:45 +00:00
Daniel Adams
5520a9eb50 webaudio: Implement IIRFilterNode (#33001)
* Basic IIRFIlterNode bindings

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

* Add constructor to BaseAudioContext

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

* Update IDL and use statements

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

* Update non-crashing test expectations

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

* Tidy

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

* Add missing spec link

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

* Optimize error checks

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

* Pass context channel count to servo-media

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

* Update test expectations

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

* Update legacy expectations

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

* Add IIRFilterNode in interfaces.html

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

* Update MANIFEST

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-12 00:27:54 +00:00
Servo WPT Sync
1af3ad8a74 Update web-platform-tests to revision b'3b3beee1bf2469013583bafe702f2d4821d76c1f' (#33000)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-08-11 01:31:50 +00:00
dependabot[bot]
71898dae17 build(deps): bump filetime from 0.2.23 to 0.2.24 (#32993)
* build(deps): bump filetime from 0.2.23 to 0.2.24

Bumps [filetime](https://github.com/alexcrichton/filetime) from 0.2.23 to 0.2.24.
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.23...0.2.24)

---
updated-dependencies:
- dependency-name: filetime
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Allow duplicate package.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-08-10 06:30:24 +00:00
Josh Matthews
1a58dba03e Use correct feature name for JS backtraces. (#32998)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-10 04:56:53 +00:00
webbeef
2ebb71f08a Set the cfg properly for the production-stripped profile (#32991)
Signed-off-by: webbeef <me@webbeef.org>
2024-08-09 09:16:51 +00:00
Taym Haddadi
a1d3649f7c Fix ordering of documents (#32574)
* Fix ordering of documents

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* order pipeline ids, get document later, avoid use of document_from_node on iframe because it returns the owner doc

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* Fix build issue
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Use iter::once to avoid allocation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* scope batches of rendering opportunities by pipeline

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com>
2024-08-09 07:41:20 +00:00
dependabot[bot]
c6a6319502 build(deps): bump windows-sys from 0.52.0 to 0.59.0 (#32982)
* build(deps): bump windows-sys from 0.52.0 to 0.59.0

Bumps [windows-sys](https://github.com/microsoft/windows-rs) from 0.52.0 to 0.59.0.
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.52.0...0.59.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

* fix GetDC call to match api change

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-09 06:33:26 +00:00
Josh Matthews
4eae4e29fa Fix incorrect target_os value. (#32984)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-09 04:54:32 +00:00
Samson
24b1404d12 Update wgpu (#32981)
* Update wgpu to 781b54a8b9

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

* expectations

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-08 20:27:16 +00:00
dependabot[bot]
77ce73e4c6 build(deps): bump serde from 1.0.204 to 1.0.205 (#32983)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.204 to 1.0.205.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.204...v1.0.205)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-08 17:08:42 +00:00
ToBinio
8fab6911d1 script: dont unwrap in header set (#32973)
Signed-off-by: tobinio <tobias.frischmann1@gmail.com>
2024-08-08 14:33:54 +00:00
Samson
b8cf0cf9af webgpu: Implement proper async pipeline creation and GPUPipelineError (#32636)
* Add GPUPipelineError

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

* Proper GetBindGroupLayout

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

* Proper Create*PipelineAsync

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

* Expectations

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

* fixups

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

* more good expectations

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-08 11:48:43 +00:00
Taym Haddadi
08eb4faf4d Initial structuredClone implementation (#32960)
* Initial structuredClone implementation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Rename PostMessageOptions to StructuredSerializeOptions

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update wpt test 2020 layout result

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove dublicated StructuredClone implementation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove comment from StructuredSerializeOptions webidl

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2024-08-08 10:12:45 +00:00
Samson
f989d3776e separate Queue&Device Id (#32966)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-08 07:53:17 +00:00
Josh Matthews
a5df51ea56 Refine crown annotations for HTML parser. (#32956)
* Refine crown annotations for HTML parser.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add missing annotation.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-08 07:20:26 +00:00
dependabot[bot]
1379cd5779 build(deps): bump tempfile from 3.11.0 to 3.12.0 (#32965)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.11.0 to 3.12.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/commits)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: indirect
  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>
2024-08-07 17:38:41 +00:00
dependabot[bot]
db23bc7b12 build(deps): bump object from 0.36.2 to 0.36.3 (#32964)
Bumps [object](https://github.com/gimli-rs/object) from 0.36.2 to 0.36.3.
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.2...0.36.3)

---
updated-dependencies:
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 17:33:20 +00:00
dependabot[bot]
206d515c32 build(deps): bump cc from 1.1.7 to 1.1.8 (#32963)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.7 to 1.1.8.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.7...cc-v1.1.8)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 17:24:16 +00:00
newmoneybigbucks
3fca6e015f script: Properly handle removed iframes in GlobalScope::get_referrer (#32782)
Signed-off-by: newmoneybigbucks <newmoneybigbucks@protonmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-07 11:12:19 +00:00
Servo WPT Sync
9cb0e74cdc Update web-platform-tests to revision b'3634d5a63f2fa3969616396d95537c91c3348fe5' (#32959)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-08-07 10:15:56 +00:00
Hayashi Mikihiro
3c271fb298 Update to rust 1.80.0 (#32896)
* Update for nix

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* Update to Rust 1.80.0

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* Rename to BindingMode from BindingAnnotation

https://github.com/rust-lang/rust/pull/124047
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* Remove TypeVariableOriginKind

https://github.com/rust-lang/rust/pull/123016
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* Remove TypeVariableOrigin

https://github.com/rust-lang/rust/pull/124955
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* Remove LintDiagnostic::msg

rust-lang/rust#125410

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* common.rs fmt mistake indents

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* trace_in_no_trace.rs remove mistake space

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* trace_in_no_trace.rs remove mistake head space

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* Workaround for https://github.com/servo/servo/issues/32912

It's dirty but it worked on 2000 runs

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

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-08-07 08:40:18 +00:00
Jonathan Schwender
a3f588832b Bump mozjs-sys to 128.0-6 (#32951)
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2024-08-06 19:18:01 +00:00
dependabot[bot]
d2e620e03e build(deps): bump bytemuck from 1.16.1 to 1.16.3 (#32955)
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.16.1 to 1.16.3.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.1...v1.16.3)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-06 18:09:00 +00:00
dependabot[bot]
63265b8c47 build(deps): bump target-lexicon from 0.12.15 to 0.12.16 (#32954)
Bumps [target-lexicon](https://github.com/bytecodealliance/target-lexicon) from 0.12.15 to 0.12.16.
- [Commits](https://github.com/bytecodealliance/target-lexicon/compare/v0.12.15...v0.12.16)

---
updated-dependencies:
- dependency-name: target-lexicon
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-06 17:52:23 +00:00
Martin Robinson
c9fbe018f1 testing: Trigger a crash more reliably when panicking and hard fail is active (#32947)
Before when handling panics and hard-fail was activated, Servo would
just exit with an error return code. This isn't interpreted as a crash
by the WPT test runner. This change raises a SEGV signal instead, which
means that panics should more reliably be treated as crashes.

This doesn't seem to change any test results, at least any non-flaky
test results. It is necessary for the test in #32782 to work though.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-06 17:43:06 +00:00
dependabot[bot]
89d20fc401 build(deps): bump toml_datetime from 0.6.7 to 0.6.8 (#32953)
Bumps [toml_datetime](https://github.com/toml-rs/toml) from 0.6.7 to 0.6.8.
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.6.7...toml_datetime-v0.6.8)

---
updated-dependencies:
- dependency-name: toml_datetime
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-06 17:20:21 +00:00
dependabot[bot]
49aa129d22 build(deps): bump scc from 2.1.8 to 2.1.9 (#32952)
Bumps [scc](https://github.com/wvwwvwwv/scalable-concurrent-containers) from 2.1.8 to 2.1.9.
- [Changelog](https://github.com/wvwwvwwv/scalable-concurrent-containers/blob/main/CHANGELOG.md)
- [Commits](https://github.com/wvwwvwwv/scalable-concurrent-containers/commits)

---
updated-dependencies:
- dependency-name: scc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-06 17:19:52 +00:00
Samson
68f4b359c5 Add exception to rejection logic in generic_call (#32950)
* exception in JS Promise

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

* EXCEPTION_TO_REJECTION on generic_call

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

* PromiseRejectionEvent should handle promise as object

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

* expectations

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-06 17:12:31 +00:00
Martin Robinson
1d464a576a layout: Add support for align-content: stretch (#32906)
This adds support for `align-content: stretch` by splitting flex line
layout into two phases. The first phase takes place before determing how
much extra space to allocate for stretching items. Then line layout
finishes, which might cause two layouts for items with `align-self:
stretch`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-08-06 10:33:37 +00:00
Taym Haddadi
3800922cde Fix panic in Webrender during shutdown (#32897)
* Fix panic in webrender during shutdown

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Pass webgl_threads_sender to WebGLThreads::exit

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* follow the naming convention and use sender instead of webgl_threads_sender

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Avoid deadlock when webgl_threads is None

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Use tuple matching for webgl_threads and webgl_threads_receiver

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove unused _webgl_threads_sender

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-08-06 10:01:33 +00:00
hatoo
28430bad0e Fix visual_studio.py to call vswhere with -utf8 (#32949)
In Japanese Windows, `vswhere` puts cp932 string in default and fails to
load json in Pyhton.
This fixes it by adding `-utf8` option

Signed-off-by: hatoo <hato2000@gmail.com>
2024-08-06 09:35:05 +00:00
Ngo Iok Ui (Wu Yu Wei)
3f339d6856 webrender_traits: update closure in with_front_buffer to FnOnce (#32946)
Signed-off-by: Wu Wayne <yuweiwu@pm.me>
2024-08-06 06:06:21 +00:00
dependabot[bot]
23df681479 build(deps): bump winapi-util from 0.1.8 to 0.1.9 (#32942)
Bumps [winapi-util](https://github.com/BurntSushi/winapi-util) from 0.1.8 to 0.1.9.
- [Commits](https://github.com/BurntSushi/winapi-util/compare/0.1.8...0.1.9)

---
updated-dependencies:
- dependency-name: winapi-util
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-06 04:40:05 +00:00
eri
b50c1cfaaa Nix: Bump nixpkgs (#32945)
Signed-off-by: eri <eri@inventati.org>
2024-08-05 22:36:31 +00:00
dependabot[bot]
1e30642d75 build(deps): bump ttf-parser from 0.24.0 to 0.24.1 (#32944)
Bumps [ttf-parser](https://github.com/RazrFalcon/ttf-parser) from 0.24.0 to 0.24.1.
- [Changelog](https://github.com/RazrFalcon/ttf-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/RazrFalcon/ttf-parser/commits)

---
updated-dependencies:
- dependency-name: ttf-parser
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 17:49:25 +00:00
dependabot[bot]
83821fdec5 build(deps): bump xml-rs from 0.8.20 to 0.8.21 (#32943)
Bumps [xml-rs](https://github.com/kornelski/xml-rs) from 0.8.20 to 0.8.21.
- [Changelog](https://github.com/kornelski/xml-rs/blob/main/Changelog.md)
- [Commits](https://github.com/kornelski/xml-rs/compare/0.8.20...0.8.21)

---
updated-dependencies:
- dependency-name: xml-rs
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 17:48:01 +00:00
dependabot[bot]
a33b66ade5 build(deps): bump serde_test from 1.0.176 to 1.0.177 (#32941)
Bumps [serde_test](https://github.com/serde-rs/test) from 1.0.176 to 1.0.177.
- [Release notes](https://github.com/serde-rs/test/releases)
- [Commits](https://github.com/serde-rs/test/compare/1.0.176...1.0.177)

---
updated-dependencies:
- dependency-name: serde_test
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 17:32:24 +00:00
dependabot[bot]
551fbdd092 build(deps): bump ppv-lite86 from 0.2.19 to 0.2.20 (#32940)
Bumps [ppv-lite86](https://github.com/cryptocorrosion/cryptocorrosion) from 0.2.19 to 0.2.20.
- [Commits](https://github.com/cryptocorrosion/cryptocorrosion/commits)

---
updated-dependencies:
- dependency-name: ppv-lite86
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 17:30:59 +00:00
dependabot[bot]
a348e68086 build(deps): bump flate2 from 1.0.30 to 1.0.31 (#32939)
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.30 to 1.0.31.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/commits)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 17:24:58 +00:00
dependabot[bot]
2443b17848 build(deps): bump tempfile from 3.10.1 to 3.11.0 (#32938)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.10.1 to 3.11.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.1...v3.11.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: indirect
  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>
2024-08-05 17:15:05 +00:00
dependabot[bot]
6ae64b2716 build(deps): bump scc from 2.1.7 to 2.1.8 (#32937)
Bumps [scc](https://github.com/wvwwvwwv/scalable-concurrent-containers) from 2.1.7 to 2.1.8.
- [Changelog](https://github.com/wvwwvwwv/scalable-concurrent-containers/blob/main/CHANGELOG.md)
- [Commits](https://github.com/wvwwvwwv/scalable-concurrent-containers/commits)

---
updated-dependencies:
- dependency-name: scc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 17:07:30 +00:00
Mukilan Thiyagarajan
0ce9ce8dc0 mach: Add support for paths with spaces on Windows (#32936)
The default user name in Windows installations is of the form "FirstName
LastName", so it seems likely that there will be spaces in the user's
path. Based on my testing on Windows 11, the only Servo's bootstrap
script has trouble dealing with spaces in paths. This patch fixes that
by quoting such paths correctly. Our direct and indirect dependencies
seem to handle these without issue and Servo does build and run
correctly with this patch.

In this patch, the logic for gstreamer bootstrap now uses powershell
instead of directly invoking msiexec.exe via cmd.exe as I was unable to
get the installer to run correctly, even with quoting. Some extra hacks
were necessary to propagate the exit code correctly to mach.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-05 14:42:21 +00:00
Martin Robinson
f1602005a0 deps: Upgrade to WebRender 0.65 (#32930)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-05 14:35:21 +00:00
eri
babc844c93 DevTools: Allow modification of attributes (#32888)
* feat: allow modification of attributes

Signed-off-by: eri <eri@inventati.org>

* fix: tidiness

Signed-off-by: eri <eri@inventati.org>

* feat: clean walker name generation

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: eri <eri@inventati.org>

* fix: missed out parameter

Signed-off-by: eri <eri@inventati.org>

---------

Signed-off-by: eri <eri@inventati.org>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-05 10:24:01 +00:00
Ngo Iok Ui (Wu Yu Wei)
4d49b04668 Add surface methods to RenderingContext (#32933)
Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2024-08-05 10:21:36 +00:00
Martin Robinson
45aa296b26 build: Fix a print statement when repackaging GStreamer (#32932)
I neglected to put make a string a formatted string, which means that
the variable won't be included in the output properly.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-05 09:28:13 +00:00
Martin Robinson
10b06f0129 layout: Improve documentation and code structure in FlexItemBox::automatic_min_size (#32911)
This change add specification text to comments and restructres the code
a bit to better match the specification. In addition, a the
`establishes_scroll_container()` helper is used instead of looking at
overflow directly. It should not change behavior at all.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-05 09:24:31 +00:00
Samson
5e59988c87 webgpu: Use wgpu's instead of string errors and update limits handling (#32925)
* Use wgpu specific errors

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

* fixup expect

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

* WIP

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

* Fix records erasing enforcerange

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

* page can already be destroyed

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

* Support more limits

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

* Set good results

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

* Set OK (not PASS) expect CRASH

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

* fixup expectation

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

* bad expectations

https://github.com/gfx-rs/wgpu/issues/6075
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* set bad expectation

render bundleencoder needs to be rewritten

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-04 17:19:46 +00:00
Martin Robinson
b366a02318 build: Speed up first run after build on macOS (#32928)
GStreamer has to process plugins each time they are added when
initializing. When those files have changed, this triggers macOS
security protections which can add many seconds to access time. This
change eliminates that problem after the first packaging of libraries by
skipping packaging if everything is up-to-date and not overwriting the
dylibs everytime.

In addition, it moves a lot of the code for packaging GStreamer
libraries on macOS into the `gstreamer` module and adds type-safety and
comments to the Python.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-04 12:00:15 +00:00
Mukilan Thiyagarajan
8052027dd4 ci: allow android builds on forks to skip keystore configuration (#32927)
Our build.gradle configuration already defaults to using the debug
keystore when the keystore is not configured so only the CI needs this
fix.

Fixes #32922

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-04 06:35:49 +00:00
Cristian Brinza
7c2c383bb1 Fix save to image on Windows (#32914)
* Read pixels in same format (gl::RGBA) as the texture

Signed-off-by: crbrz <cristianb@gmail.com>

* Add read pixels test

Signed-off-by: crbrz <cristianb@gmail.com>

* Use patched surfman

Signed-off-by: crbrz <cristianb@gmail.com>

* Update surfman to 0.9.5

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
2024-08-03 20:04:26 +00:00
Daniel Adams
bb176514c6 Pass AppInfo to OpenXrDiscovery (#32926)
Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-03 19:33:45 +00:00
Ben
f3fe11c382 Enabled WAV decoding support in gstreamer (#32924)
Signed-off-by: Benjamin Vincent Schulenburg <bennyschulenburg@gmx.de>
2024-08-03 16:28:00 +00:00
Samson
f3bec0aed3 bindings: Convert certain Exceptions into Promise rejections (#32923)
* Impl promise exception to rejection for methods

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

* Impl promise exception to rejection for getters

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

* Impl promise exception to rejection for static methods

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

* Add tests for exception to rejection

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

* Expectations

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-03 12:58:37 +00:00
Daniel Adams
fd83281657 Implement WebXR Gamepads Module (#32860)
* Expose gamepad attribute on XRInputSource

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

* Tidy, add spec links

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

* Update WPT test expectations

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

* Update gamepad state on InputChanged event

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

* Pin webxr commit

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

* Apply gamepad updates during frame updates

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

* Drain input frame map

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

* Don't store gamepad as option

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-08-03 12:51:44 +00:00
dependabot[bot]
0672eca749 build(deps): bump malloc_size_of_derive from 0.1.2 to 0.1.3 (#32917)
* build(deps): bump malloc_size_of_derive from 0.1.2 to 0.1.3

Bumps [malloc_size_of_derive](https://github.com/bholley/malloc_size_of_derive) from 0.1.2 to 0.1.3.
- [Commits](https://github.com/bholley/malloc_size_of_derive/commits)

---
updated-dependencies:
- dependency-name: malloc_size_of_derive
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate synstructure.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-08-03 05:12:47 +00:00
dependabot[bot]
1e510e8de7 build(deps): bump regex from 1.10.5 to 1.10.6 (#32918)
Bumps [regex](https://github.com/rust-lang/regex) from 1.10.5 to 1.10.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.10.5...1.10.6)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 17:47:32 +00:00
dependabot[bot]
69a716a4ce build(deps): bump bytes from 1.7.0 to 1.7.1 (#32919)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 17:42:19 +00:00
dependabot[bot]
3699aa0c18 build(deps): bump serde_json from 1.0.121 to 1.0.122 (#32916)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.121 to 1.0.122.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.121...v1.0.122)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 17:39:00 +00:00
Martin Robinson
72b3fd56e1 script: Fix two build warnings about unused imports (#32910)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-08-02 06:50:47 +00:00
Delan Azabani
974c9dc89a layout: Compute intrinsic sizes for flex items and flex containers (#32854)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-02 06:45:11 +00:00
Samson
7495ba20a5 Select servo feature on servo_arc (#32909)
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-08-02 05:41:52 +00:00
Erik Hennig
5963695664 fix: Memory leak from CreateProxyWindowHandler (#32773)
* fix: Memory leak from CreateProxyWindowHandler

Signed-off-by: ede1998 <online@erik-hennig.me>

* fix: memory leak in WindowProxy

Signed-off-by: ede1998 <online@erik-hennig.me>

* fix: Memory leak in WindowProxyHandler through static

Signed-off-by: ede1998 <online@erik-hennig.me>

---------

Signed-off-by: ede1998 <online@erik-hennig.me>
2024-08-01 21:16:49 +00:00
dependabot[bot]
501950c2e3 build(deps): bump indexmap from 2.2.6 to 2.3.0 (#32908)
Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.2.6 to 2.3.0.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.2.6...2.3.0)

---
updated-dependencies:
- dependency-name: indexmap
  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>
2024-08-01 17:57:23 +00:00
Chocolate Pie
92866ab911 enhance: Add support for unsafe-eval and wasm-unsafe-eval (#32893)
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
2024-08-01 17:26:44 +00:00
Samson
2cf207ddc8 Free some space on android runners (#32907)
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-08-01 15:46:31 +00:00
Samson
0ff4398380 Update mozjs to fix enforcerange for 64bit numbers (#32905)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-08-01 08:00:41 +00:00
dependabot[bot]
b4e1ec4412 build(deps): bump bytemuck from 1.16.1 to 1.16.3 (#32902)
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.16.1 to 1.16.3.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.1...v1.16.3)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-31 16:49:39 +00:00
dependabot[bot]
b94e7e00a9 build(deps): bump bytes from 1.6.1 to 1.7.0 (#32901)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: indirect
  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>
2024-07-31 16:45:14 +00:00
dependabot[bot]
4a7b50fedb build(deps): bump target-lexicon from 0.12.15 to 0.12.16 (#32900)
Bumps [target-lexicon](https://github.com/bytecodealliance/target-lexicon) from 0.12.15 to 0.12.16.
- [Commits](https://github.com/bytecodealliance/target-lexicon/compare/v0.12.15...v0.12.16)

---
updated-dependencies:
- dependency-name: target-lexicon
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-31 16:30:25 +00:00
Oriol Brufau
ca6169990e Implement gaps in flexbox layout (#32891)
As per https://drafts.csswg.org/css-align/#gaps

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-31 07:25:54 +00:00
Oriol Brufau
f86493cd7e Enable flexbox for css-align tests (#32890)
Some css-align features like gaps or alignment properties need to have
some effect on flex layout.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-30 22:01:58 +00:00
dependabot[bot]
c69d59259e build(deps): bump ppv-lite86 from 0.2.17 to 0.2.19 (#32894)
Bumps [ppv-lite86](https://github.com/cryptocorrosion/cryptocorrosion) from 0.2.17 to 0.2.19.
- [Commits](https://github.com/cryptocorrosion/cryptocorrosion/commits/ppv-lite86-0.2.19)

---
updated-dependencies:
- dependency-name: ppv-lite86
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-30 17:31:06 +00:00
dependabot[bot]
506096222f build(deps): bump toml_datetime from 0.6.7 to 0.6.8 (#32895)
Bumps [toml_datetime](https://github.com/toml-rs/toml) from 0.6.7 to 0.6.8.
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.6.7...toml_datetime-v0.6.8)

---
updated-dependencies:
- dependency-name: toml_datetime
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-30 17:30:46 +00:00
Martin Robinson
a64f75b62f layout: Fix display of new text in textarea elements (#32886)
Previously `<textarea>` was just displaying node contents, which is the
original text content, not the one updated by later typing. This change
fixes that issue.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-30 14:39:17 +00:00
eri
c06a6a764e DevTools: Inline text and clean whitespace (#32884)
* feat: inline text contents

Signed-off-by: eri <eri@inventati.org>

* feat: filter whitespace only nodes

Signed-off-by: eri <eri@inventati.org>

* chore: cleanup

Signed-off-by: eri <eri@inventati.org>

* fix: url fix

Signed-off-by: eri <eri@inventati.org>

* fix: review fixes

Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-30 10:18:21 +00:00
Martin Robinson
e23dc0bf6f layout: Port border-image support for legacy layout (#32874)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-30 06:41:23 +00:00
Samson
29a4cca42d Update mozjs again (#32882)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-29 20:42:14 +00:00
dependabot[bot]
a295c3e8aa build(deps): bump serde_json from 1.0.120 to 1.0.121 (#32881)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.120 to 1.0.121.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.120...v1.0.121)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-29 17:36:01 +00:00
dependabot[bot]
4fa1daa245 build(deps): bump tokio from 1.39.1 to 1.39.2 (#32879)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.39.1 to 1.39.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.39.1...tokio-1.39.2)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-29 17:03:32 +00:00
dependabot[bot]
15f7db273f build(deps): bump cc from 1.1.6 to 1.1.7 (#32878)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.6 to 1.1.7.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.6...cc-v1.1.7)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-29 16:59:10 +00:00
dependabot[bot]
d8c09b8b14 build(deps): bump num_enum from 0.7.2 to 0.7.3 (#32876)
Bumps [num_enum](https://github.com/illicitonion/num_enum) from 0.7.2 to 0.7.3.
- [Commits](https://github.com/illicitonion/num_enum/compare/0.7.2...0.7.3)

---
updated-dependencies:
- dependency-name: num_enum
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-29 16:53:46 +00:00
dependabot[bot]
33bf31f212 build(deps): bump webxr from 89d7027 to 93ee726 (#32877)
Bumps [webxr](https://github.com/servo/webxr) from `89d7027` to `93ee726`.
- [Commits](89d702763d...93ee726f84)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-29 16:53:41 +00:00
Samson
c5fe64a594 webgpu: update wgpu again (#32873)
* Update wgpu

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

* expect

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-29 13:55:56 +00:00
Samson
976850d92d Fix debugmozjs compilation (#32875)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-29 12:05:02 +00:00
Samson
d132a0273d Update mozjs (SpiderMonkey) to 128.0 (#32769)
* Update mozjs

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

* Fix changed readTransfer callback

https://bugzilla.mozilla.org/show_bug.cgi?id=1842713
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Use NewExternalArrayBuffer from glue

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

* Fix columnorigin and filename being in latin1

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

* fixup newexternalarray

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

* Float16 (this might require more work for codegen support)

https://bugzilla.mozilla.org/show_bug.cgi?id=1833647
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* js.strict is removed

https://bugzilla.mozilla.org/show_bug.cgi?id=1621603
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* asm options are now somewhere else

https://hg.mozilla.org/mozilla-central/rev/26045c88e3972957087d535e7f259e08857bd2a2
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Comment out offthread compilation

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

* Set NDK to 26

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

* Fix 1-origin handling

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

* Expect `FinalizationRegistry` interface

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

* Good expectations

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

* more expectations

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

* Add `WeakRef` to interfaces expectation

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

* mozjs upgrade: fixes for Android

Android NDK's layout has changed in r26 and 'lib64' no longer exists
under `toolchain/llvm/prebuilt/linux-x86_64`. The libraries that used to
be it are now present in `lib` folder itself.

This patch updates the build configuration to use the `lib` folder
instead when configuring the LIBCLANG_PATH environment variable.

This patch also updates to a newer mozjs version that includes fixes for
linker errors faced on Android (see #32769).

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Patch libz-sys & update mozjs

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

* update NDK version in README

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Use servo/mozjs

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

* Update mozjs again

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-29 07:20:15 +00:00
shanehandley
ed8def2896 Add the type IDL attribute to htmlfieldsetelement (#32869)
* Add the type IDL attribute to htmlfieldsetelement

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix missing idlharness test expectations

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-07-28 15:01:01 +00:00
shanehandley
bc75bf4cfa Remove treatment of whitespace in the construction of a for data entry list, move it to the encoding stage (#32868)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-07-28 11:37:53 +00:00
dependabot[bot]
9f151faf1d build(deps): bump webxr from 11a3727 to 89d7027 (#32865)
Bumps [webxr](https://github.com/servo/webxr) from `11a3727` to `89d7027`.
- [Commits](11a3727637...89d702763d)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-26 20:13:58 +00:00
dependabot[bot]
bdc07eab75 build(deps): bump version_check from 0.9.4 to 0.9.5 (#32864)
Bumps [version_check](https://github.com/SergioBenitez/version_check) from 0.9.4 to 0.9.5.
- [Commits](https://github.com/SergioBenitez/version_check/compare/v0.9.4...v0.9.5)

---
updated-dependencies:
- dependency-name: version_check
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-26 17:01:03 +00:00
Martin Robinson
b6f1e3b22d dependencies: Upgrade cookie and rename Servo's Cookie to ServoCookie (#32861)
This changes updates to the new version of the `cookie` crate in Servo
which no longer uses the old `time@0.1` data types. This requires using
a new version of `time` while we transition off of the old one. This is
the first step in that process.

In addition, the overloading of the `cookie::Cookie` name was causing a
great deal of confusion, so I've renamed the Servo wrapper to
`ServoCookie` like we do with `ServoUrl`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-26 16:13:39 +00:00
Luke Warlow
8f377a0cb1 Partially implement dialog.show() (#32681)
Signed-off-by: Luke Warlow <lwarlow@igalia.com>
2024-07-26 16:03:25 +00:00
eri
902bf57331 DevTools: Show HTML tree (#32655)
* feat: watch root node

Signed-off-by: eri <eri@inventati.org>

* reafactor: divide inspector in components

Signed-off-by: eri <eri@inventati.org>

* feat: add css properties actor

Signed-off-by: eri <eri@inventati.org>

* feat: accesibility actor

Signed-off-by: eri <eri@inventati.org>

* feat: layout actor

Signed-off-by: eri <eri@inventati.org>

* feat: network parent and refactor

Signed-off-by: eri <eri@inventati.org>

* feat: progress on the inspector messages

Signed-off-by: eri <eri@inventati.org>

* feat: more progress on inspector

Signed-off-by: eri <eri@inventati.org>

* feat: try to fix nodes showing

Signed-off-by: eri <eri@inventati.org>

* feat: initial dom tree

Signed-off-by: eri <eri@inventati.org>

* feat: some more messages

Signed-off-by: eri <eri@inventati.org>

* feat: clean and add documentation

Signed-off-by: eri <eri@inventati.org>

* refactor: add more docs and clean

Signed-off-by: eri <eri@inventati.org>

* fix: restore deleted node attributes field

Signed-off-by: eri <eri@inventati.org>

* Apply suggestions from code review

Fix a few nits in comments

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

---------

Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-26 15:17:54 +00:00
Martin Robinson
f7448b5d61 Remove the WebXR dependency on ancient time@0.1 crate (#32862)
`webxr` depends on a very old verison of `time`, which allowed serializing
monotonic clock output. This isn't possible on all platforms, so newer
versions of `time` do not allow this. In order to stop using the old
0.1 versions of `time` we have to stop relying on times passed from `webxr`
to Servo. This change does that, at the cost of removing the XR
profiling feature. It has to be rewritten in another way in the `webxr`
crate.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-26 13:53:34 +00:00
Rémy SAISSY
eac54183c1 clippy: components/script/realms (#32859)
Signed-off-by: Rémy Saissy <remy.saissy@gmail.com>
2024-07-26 10:15:02 +00:00
dependabot[bot]
bc1c71bd4d build(deps): bump serde_spanned from 0.6.6 to 0.6.7 (#32857)
Bumps [serde_spanned](https://github.com/toml-rs/toml) from 0.6.6 to 0.6.7.
- [Commits](https://github.com/toml-rs/toml/compare/serde_spanned-v0.6.6...serde_spanned-v0.6.7)

---
updated-dependencies:
- dependency-name: serde_spanned
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-25 17:15:00 +00:00
dependabot[bot]
f91792d9c3 build(deps): bump env_filter from 0.1.1 to 0.1.2 (#32856)
Bumps [env_filter](https://github.com/rust-cli/env_logger) from 0.1.1 to 0.1.2.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/env_filter-v0.1.1...env_filter-v0.1.2)

---
updated-dependencies:
- dependency-name: env_filter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-25 17:12:00 +00:00
dependabot[bot]
4afa382733 build(deps): bump toml_datetime from 0.6.6 to 0.6.7 (#32855)
Bumps [toml_datetime](https://github.com/toml-rs/toml) from 0.6.6 to 0.6.7.
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.6.6...toml_datetime-v0.6.7)

---
updated-dependencies:
- dependency-name: toml_datetime
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-25 17:08:15 +00:00
Samson
ad74bfc4ea webgpu: Update wgpu to 22.0 (#32827)
* Update wgpu to c0e7c1ef94

This is few commits ahead of wgpu 22.0

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

* Make it compile

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

* Move usage checking to device timeline as per spec

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

* Add logging (trace) of WEBGPU messages

This is very useful when debugging

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

* update wgpu again

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

* set good

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

* skip `webgpu:api,operation,memory_sync,texture,same_subresource` for flakyness

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

* rm r.json

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-25 08:27:26 +00:00
dependabot[bot]
450aebc839 build(deps): bump gstreamer from 0.22.6 to 0.22.7 (#32851)
Bumps gstreamer from 0.22.6 to 0.22.7.

---
updated-dependencies:
- dependency-name: gstreamer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-24 18:48:58 +00:00
dependabot[bot]
d53962abd5 build(deps): bump object from 0.36.1 to 0.36.2 (#32852)
Bumps [object](https://github.com/gimli-rs/object) from 0.36.1 to 0.36.2.
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.1...0.36.2)

---
updated-dependencies:
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-24 18:47:04 +00:00
Rémy SAISSY
bf8decbffb clippy: ports/servoshell/desktop (#32847)
Signed-off-by: Rémy Saissy <remy.saissy@gmail.com>
2024-07-24 18:30:06 +00:00
Martin Robinson
f2fbe44dc9 dependencies: Upgrade tokio, ipc-channel, and mio (#32844)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-24 18:28:29 +00:00
Mukilan Thiyagarajan
dee03bf297 Bump nixpkgs and add cargo-deny in shell.nix (#32842)
* build: bump the nixpkgs snapshot

We need Android NDK r26c for the SM upgrade (#32769) and the fix in
nixpkgs to make r26 NDKs function correctly (NixOS/nixpkgs#298285). Both
of those are not available in the snapshot of nixpkgs we use currently.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* add cargo-deny to shell.nix

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-24 17:59:54 +00:00
dependabot[bot]
33a48f76fb build(deps): bump webxr from bacb22f to 11a3727 (#32848)
Bumps [webxr](https://github.com/servo/webxr) from `bacb22f` to `11a3727`.
- [Commits](bacb22faec...11a3727637)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-24 17:41:21 +00:00
Rémy SAISSY
7ace7b43dc clippy: components/canvas/canvas_data.rs (#32843)
Signed-off-by: Rémy Saissy <remy.saissy@gmail.com>
2024-07-24 15:49:11 +00:00
Martin Robinson
1906741704 layout: Add support for propagating baselines from flexbox (#32841)
Some tests are still broken due to missing preferred widths calculation
for flexbox and also for missing column layout.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2024-07-24 14:38:03 +00:00
Martin Robinson
569fd5d8b5 Upgrade stylo to 2024-07-16 (#32812)
* Upgrade stylo to 2024-07-16

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

* Use the new `dom` crate from stylo

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

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-07-24 14:37:08 +00:00
valadaptive
60e65c175d Implement the aspect-ratio property for replaced elements (#32800)
* Add WPT tests for box-sizing with aspect-ratio

Signed-off-by: valadaptive <valadaptive@protonmail.com>

* Implement `aspect-ratio` for replaced elements

There are two regressions because we don't implement `object-fit`, and
one because we don't properly represent non-available <img>s with `alt`
attributes.

Signed-off-by: valadaptive <valadaptive@protonmail.com>

---------

Signed-off-by: valadaptive <valadaptive@protonmail.com>
2024-07-24 11:40:23 +00:00
Daniel Adams
e425ad0cb7 Remove googlevr feature (#32840)
* Remove googlevr feature

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

* Remove googlevr and oculusvr from python scripts

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

* Remove vr checks entirely

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-07-24 08:00:50 +00:00
dependabot[bot]
b6652f88d1 build(deps): bump jobserver from 0.1.31 to 0.1.32 (#32839)
Bumps [jobserver](https://github.com/rust-lang/jobserver-rs) from 0.1.31 to 0.1.32.
- [Commits](https://github.com/rust-lang/jobserver-rs/compare/0.1.31...0.1.32)

---
updated-dependencies:
- dependency-name: jobserver
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-23 17:23:52 +00:00
dependabot[bot]
69b16e02c4 build(deps): bump env_filter from 0.1.0 to 0.1.1 (#32837)
Bumps [env_filter](https://github.com/rust-cli/env_logger) from 0.1.0 to 0.1.1.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/env_filter-v0.1.0...env_filter-v0.1.1)

---
updated-dependencies:
- dependency-name: env_filter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-23 17:06:34 +00:00
Delan Azabani
e8cf751e11 Clarify the Code of Conduct (closes servo/servo.org#164) (#32835) 2024-07-23 09:12: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
dependabot[bot]
2a31e62e2c build(deps): bump libloading from 0.8.4 to 0.8.5 (#32832)
Bumps [libloading](https://github.com/nagisa/rust_libloading) from 0.8.4 to 0.8.5.
- [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.4...0.8.5)

---
updated-dependencies:
- dependency-name: libloading
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-23 03:55:23 +00:00
dependabot[bot]
835e4f4926 build(deps): bump pathfinder_simd from 0.5.3 to 0.5.4 (#32833)
Bumps [pathfinder_simd](https://github.com/servo/pathfinder) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/servo/pathfinder/releases)
- [Commits](https://github.com/servo/pathfinder/commits/pathfinder_simd-v0.5.4)

---
updated-dependencies:
- dependency-name: pathfinder_simd
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 17:33:36 +00:00
dependabot[bot]
47d702edc3 build(deps): bump syn from 2.0.71 to 2.0.72 (#32830)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.71 to 2.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.71...2.0.72)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 17:28:24 +00:00
dependabot[bot]
753dedbeba build(deps): bump arrayref from 0.3.7 to 0.3.8 (#32831)
Bumps [arrayref](https://github.com/droundy/arrayref) from 0.3.7 to 0.3.8.
- [Commits](https://github.com/droundy/arrayref/commits)

---
updated-dependencies:
- dependency-name: arrayref
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 17:27:57 +00:00
Jonathan Schwender
f040b821a3 ohos: Detect installed fonts (#32731)
* ohos: Add `ohos_mock` cfg.

This allows using the Linux build together with the `ohos`
font code, using the fonts ship in the `previewer` directory of the OH SDK.

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

* ohos: Detect installed fonts

Scan the systems font folder to detect installed fonts,
derive their associated font names and generate the font list
based on that.

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

* Use hardcoded filepaths for HMOS Color emojis

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

* Also support parsing OH 4.x Noto fonts

Currently we don't have an easy way to test the OH version
from the fonts module, so the parsing code has to be extended.
Once the OH 5.0 beta has a reliable fontconfig.json filemap,
then we can probably get rid of most of the parsing code,
and hardcode the OH 4.x Note fonts as a fallback.

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>
2024-07-22 14:03:26 +00:00
Mukilan Thiyagarajan
b5482e34c0 compositor: propagate scroll events across pipelines (#32829)
Currently we don't propagate the scroll events across pipeline and
scroll only nodes contained within the nearest pipeline that passes hit
test at a gived point. This causes iframes to "capture" the scroll and
halt the scrolling process once the iframe has been scrolled all the
way. The expected behaviour is that the parent page begins to scroll
once the iframe has been scrolled fully.

The issue is present in both desktop and mobile, but was more noticeable
on mobile, especially on the default servo.org page, because of the relative
sizes of the YouTube video's iframe wrt to the parent.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-22 12:42:44 +00:00
shanehandley
45eabad169 Implement URL::parse() (#32819)
* Implement URL::parse()

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* fix: Make handling more idiomatic

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-07-22 08:48:16 +00:00
Mukilan Thiyagarajan
a007baa4cf deps: switch to tikv-jemallocator crates in Cargo.toml (#32828)
`jemallocator` and `jemallocator-sys` crates are same as the `tikv-*`
versions and these aliases were maintained for historical reasons, based
on crates.io documentation. For newer projects, it is recommended to use
the `tikv-` versions of the crate. Even though Servo is not a new
project, it makes sense to switch to the newer version for the sake of
clarity.

Also, more importantly, `tikv-jemallocator` has new release (0.6.0)
which includes a fix for #32720. There doesn't seem to be a
corresponding version publised for the `jemallocator` crate.

Fixes #32720

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-22 07:55:46 +00:00
Samson
f6dc35f11d chore: Update WebGPU CTS (#32825)
* Update WebGPU CTS to 50b6e7a743

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

* expect

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-21 16:19:43 +00:00
Servo WPT Sync
2c4b96b872 Update web-platform-tests to revision b'5af3e9c2a2aba76ade00f0dbc3486e50a74a4506' (#32824)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-07-21 07:59:39 +00:00
shanehandley
a7a380777d Remove a comment related to a TODO which has already been done. (#32822)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-07-21 04:58:27 +00:00
Samson
b471f6473f Remove failure breaks from webgpu thread (#32814)
* Remove breaks from webgpu requests

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

* expect

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

* limit,out_of_range TIMEOUT->FAIL

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-20 19:57:53 +00:00
Daniel Adams
2c17de7fa7 Gamepad: Implement GamepadHapticActuator (#32046)
* Implement Servo side of GamepadHapticActuator

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

* Get build working

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

* Create effect handling on embedder side

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

* Update tracing for GamepadHapticEffect

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

* Update gilrs to point to commit with effect complete event

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

* Implement playing and preempting haptic effects

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

* Update IDL to add trigger rumble

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

* Update WPT expectations

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

* Handle stopping haptic effects from reset()

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

* ./mach fmt, fix test-tidy issues

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

* Add extra validity checks for trigger rumble

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

* Retrieve supported haptic effects from embedder

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

* Fix test expectations

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

* Add missing spec link, pin gilrs commit

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

* servoshell cargo formatting

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

* Fix Cargo.toml

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

* Additional comments, realm proof, naming

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

* ./mach fmt

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

* Update gilrs rev to gilrs-core 0.5.12 release

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

* Implement sequence ids for gamepad haptic promises

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

* Take playing effect promise instead of cloning

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

* Implement listener for reset function

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

* Fix Cargo.lock

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

* Restructure IPC listeners, add comments, handle visibility change

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

* Check that haptic effect still exists before handling ff completion event

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

* Visibility steps, add InRealm bindings for promises

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

* Add Gamepad EmbedderMsg arms to egl servo_glue

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-07-20 06:29:27 +00:00
Daniel Adams
9212ed203a Enable OpenXR backend from the WebXR crate (#32817)
* Enable OpenXR backend from the WebXR crate

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

* Ensure openxr feature is only included on windows

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

* Add cfgs for OpenXR usages

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

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
2024-07-20 06:24:40 +00:00
dependabot[bot]
a29e5c8115 build(deps): bump cc from 1.1.5 to 1.1.6 (#32815)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.5 to 1.1.6.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.5...cc-v1.1.6)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-19 17:01:17 +00:00
Rodion Borovyk
4bf5024ee0 fix a couple of simple clipy warnings (#32813)
Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
2024-07-19 13:18:34 +00:00
Martin Robinson
5eb77592ea layout: Reduce the complexity of FlexLine::layout (#32810)
Instead of a complex combination of iterators, use a flatter iteration
design when laying out a flex line.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2024-07-19 10:37:29 +00:00
rachaelspooky
8b3c9b744a Fix 5 clippy warnings (#32808)
Signed-off-by: Rachael Gentry <rachael.l.gentry@gmail.com>
2024-07-19 04:04:42 +00:00
dependabot[bot]
a6048c46d2 build(deps): bump thiserror from 1.0.62 to 1.0.63 (#32805)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.62 to 1.0.63.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.62...1.0.63)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-18 17:03:57 +00:00
dependabot[bot]
f28b5419ab build(deps): bump wayland-cursor from 0.31.4 to 0.31.5 (#32806)
Bumps [wayland-cursor](https://github.com/smithay/wayland-rs) from 0.31.4 to 0.31.5.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-cursor
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-18 17:02:17 +00:00
dependabot[bot]
627f0b4f61 build(deps): bump xcursor from 0.3.5 to 0.3.6 (#32804)
Bumps [xcursor](https://github.com/esposm03/xcursor-rs) from 0.3.5 to 0.3.6.
- [Commits](https://github.com/esposm03/xcursor-rs/commits)

---
updated-dependencies:
- dependency-name: xcursor
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-18 16:52:33 +00:00
valadaptive
bb5ace7929 Bump stylo and enable aspect-ratio tests (#32803)
Signed-off-by: valadaptive <valadaptive@protonmail.com>
2024-07-18 13:28:39 +00:00
valadaptive
f6c9714286 Fix sizing of replaced elements with min/max sizes (#32777)
If a (min/max)-(height/width) property is set, we still need to respect
the intrinsic ratio of the element if it exists. The previous code was
simply clamping the element size after doing the sizing calculations
once, but this leads to an incorrect aspect ratio.

Signed-off-by: valadaptive <valadaptive@protonmail.com>
2024-07-18 07:07:13 +00:00
Delan Azabani
1b1f79305e flex: handle ‘align-self: [ first | last ]? && baseline’ (#32787)
* flex: handle ‘align-self: baseline’

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* FIXME: css/css-flexbox/align-items-baseline-overflow-non-visible.html

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Fix baseline selection

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Fix baseline calculation with padding/border/margin

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Fix compile errors and warnings

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Implement ‘align-self: last baseline’

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Fix bug where non-baseline-aligned items affected max baseline

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Update expectations

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Rename method

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-18 07:03:29 +00:00
Samson
34eed29037 Less nesting in webgpu response (#32799)
* Remove Option wrap of WebGPUResponse

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

* Replace WebGPUResponseResult with WebGPUResponse

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-17 20:37:52 +00:00
Chocolate Pie
1223335547 enhance: Implement CanvasRenderingContext2D.measureText (#32704)
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-17 19:20:18 +00:00
dependabot[bot]
d82232d549 build(deps): bump wayland-client from 0.31.4 to 0.31.5 (#32798)
Bumps [wayland-client](https://github.com/smithay/wayland-rs) from 0.31.4 to 0.31.5.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-client
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-17 17:17:41 +00:00
dependabot[bot]
62c3d30b3d build(deps): bump wayland-scanner from 0.31.3 to 0.31.4 (#32797)
Bumps [wayland-scanner](https://github.com/smithay/wayland-rs) from 0.31.3 to 0.31.4.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-scanner
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-17 17:08:50 +00:00
dependabot[bot]
f8ebbdc0d1 build(deps): bump tokio from 1.38.0 to 1.38.1 (#32794)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.38.0 to 1.38.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.38.0...tokio-1.38.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-17 17:05:57 +00:00
dependabot[bot]
26beacdabd build(deps): bump wayland-backend from 0.3.5 to 0.3.6 (#32795)
Bumps [wayland-backend](https://github.com/smithay/wayland-rs) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-17 17:02:42 +00:00
Danila Matveev
e4ad1d3ab9 [clippy] Rename enum FormSubmitter and its elements (#32791)
* [clippy] Renames enum FormSubmitter and its elements

Signed-off-by: Danila Matveev <usurname.r@gmail.com>

* fmt

Signed-off-by: Danila Matveev <usurname.r@gmail.com>

---------

Signed-off-by: Danila Matveev <usurname.r@gmail.com>
2024-07-17 16:46:32 +00:00
Martin Robinson
882a855b8c Convert layout to use Gecko's alignment style representation (#32790)
Signed-off-by: Nico Burns <nico@nicoburns.com>
Co-authored-by: Nico Burns <nico@nicoburns.com>
2024-07-17 14:18:55 +00:00
Danila Matveev
a0d2b36ad8 clippy: Fix four warnings (#32789)
* Fixes 4 clippy rules

Signed-off-by: Danila Matveev <usurname.r@gmail.com>

* Rollbacks changes in range.rs and silences clippy::neg_cmp_op_on_partial_ord

Signed-off-by: Danila Matveev <usurname.r@gmail.com>

* Fixes a fmt issue

Signed-off-by: Danila Matveev <usurname.r@gmail.com>

---------

Signed-off-by: Danila Matveev <usurname.r@gmail.com>
2024-07-17 09:05:02 +00:00
Nico Burns
5fd0d2f17b Mark flexbox-mbp-horiz-003 tests as only failing on linux (#32762)
Signed-off-by: Nico Burns <nico@nicoburns.com>
2024-07-17 07:49:41 +00:00
dependabot[bot]
bc1bf82f78 build(deps): bump webxr from 88fd368 to bacb22f (#32788)
Bumps [webxr](https://github.com/servo/webxr) from `88fd368` to `bacb22f`.
- [Commits](88fd368d1c...bacb22faec)

---
updated-dependencies:
- dependency-name: webxr
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-16 19:51:12 +00:00
Samson
946af8450c Update WebGPU CTS (#32783)
* Update CTS to 20425f60bb

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

* expect

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-07-16 17:24:52 +00:00
Delan Azabani
039631cfa5 layout: Properly handle min/max cross container size (#32785)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-16 12:14:02 +00:00
Ville Lindholm
80559c829b Bump mozjs version (#32786)
Signed-off-by: Ville Lindholm <ville@lindholm.dev>
2024-07-16 10:13:48 +00:00
Danila Matveev
0189b89fd1 Fixes typo in clippy::enum_variant_names (#32784)
Signed-off-by: Danila Matveev <optician_owl@fastmail.com>
Signed-off-by: Danila Matveev <usurname.r@gmail.com>
2024-07-16 09:59:12 +00:00
dependabot[bot]
d5171c068c build(deps): bump setuptools from 68.2.2 to 70.0.0 in /python (#32781)
Bumps [setuptools](https://github.com/pypa/setuptools) from 68.2.2 to 70.0.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v68.2.2...v70.0.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 18:57:33 +00:00
dependabot[bot]
ddf3bb4957 build(deps): bump document-features from 0.2.8 to 0.2.10 (#32780)
Bumps [document-features](https://github.com/slint-ui/document-features) from 0.2.8 to 0.2.10.
- [Release notes](https://github.com/slint-ui/document-features/releases)
- [Changelog](https://github.com/slint-ui/document-features/blob/master/CHANGELOG.md)
- [Commits](https://github.com/slint-ui/document-features/commits)

---
updated-dependencies:
- dependency-name: document-features
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 17:27:52 +00:00
dependabot[bot]
bb201fb4ec build(deps): bump bytes from 1.6.0 to 1.6.1 (#32779)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 17:15:23 +00:00
dependabot[bot]
025b831862 build(deps): bump cc from 1.1.1 to 1.1.5 (#32778)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.1 to 1.1.5.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.1...cc-v1.1.5)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 17:11:08 +00:00
Samson
e761b7d711 Auto merge all WPT and dependabot PRs (#32775)
* Auto merge all WPT and dependabot PRs

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

* Adjust name of action

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

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-15 12:44:47 +00:00
Servo WPT Sync
968474a9fd Update web-platform-tests to revision b'f3dd9cba239a9655951ee62ec4dafc8fe37df2c5' (#32774)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-07-14 09:16:30 +00:00
Patrycja
3118542a9e Use mallinfo only on target_env=gnu (#32772)
mallinfo isn't available on musl, causing linking issues on build;
make sure related functions are built only for GNU Libc

Signed-off-by: Patrycja Rosa <git@ptrcnull.me>
2024-07-14 07:20:52 +00:00
Jonathan Schwender
cd394af018 Bump duplicated nix to 0.29 (#32764)
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-13 07:48:01 +00:00
dependabot[bot]
d667b79739 build(deps): bump thiserror from 1.0.61 to 1.0.62 (#32768)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.61...1.0.62)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-12 16:55:03 +00:00
dependabot[bot]
2fc0fd1312 build(deps): bump syn from 2.0.70 to 2.0.71 (#32767)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.70 to 2.0.71.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.70...2.0.71)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-12 16:50:52 +00:00
dependabot[bot]
42eb93624c build(deps): bump cc from 1.1.0 to 1.1.1 (#32765)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.0...cc-v1.1.1)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-12 16:43:20 +00:00
Samson
91ca727eb9 webgpu: Divide message code into separate files (#32700)
* Spilt webgpu ipc messages even more

* Add license to mod.rs

* file docs
2024-07-12 11:01:15 +00:00
Ngo Iok Ui (Wu Yu Wei)
40bac8c3df script: document.visibilityState and document.hidden (#32635)
* Squashed commit of the following:

commit 5e0ea9996cb0d8137c3e1cd04487a1065b61289d
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Thu Jul 11 13:37:51 2024 +0900

    Move lint to new_inherited

    Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

commit a8cbfb1eef2650d153ef41c232d9e80e1118fc37
Merge: b819968f3e 7a33f8f008
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Thu Jul 11 13:32:18 2024 +0900

    Merge branch 'main' into visibility

commit b819968f3eaa361c8a2cf3af679943ae2065ab32
Merge: eda2ec4c22 1c6b74e1f1
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 9 14:26:43 2024 +0900

    Merge branch 'main' into visibility

commit eda2ec4c225c63236d6851ea525455cad8874ce5
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Thu Jul 4 14:25:05 2024 +0900

    Include page-visibility tests to wpt

commit 9da7b4ee39b141e59e4a21a64445c4b08499463f
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Thu Jul 4 12:50:40 2024 +0900

    Add TODO comment for future update

commit 11f55fea3ead0c8fa07f16557a63cc6a77c15c3f
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Wed Jul 3 11:01:51 2024 +0900

    Add spaces between steps

commit 408c3e51f25867e85f894cd77a6355bc32f2aa00
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 2 18:33:53 2024 +0900

    Update MANIFEST.json

commit 679fe4ffdd28554b11b4018395fac22a08ccbc34
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 2 18:27:02 2024 +0900

    Add VisibilityStateEntry to mozilla/interfaces.html

commit 4a456a2b4a473fa795274edf56ecf660616f90eb
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 2 14:28:11 2024 +0900

    Update meta results

commit cd191447ff61de392526e00c13f765c2df7a269e
Merge: 7ff480a698 ad01342f00
Author: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
Date:   Tue Jul 2 13:47:49 2024 +0900

    Merge branch 'main' into visibility

commit 7ff480a698413ac5526edfb1b8731373bb9d04ae
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Tue Jul 2 13:12:44 2024 +0900

    Update description text of update_visibility_state

commit 0e496b7bce4fd5476a1919737b00e8f0c9e2fdc8
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Tue Jul 2 12:59:40 2024 +0900

    Add specification link to VisibilityStateEntry methods

commit 3e4a061450621bd17f19ff81099dd4daaeaea478
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Tue Jul 2 12:31:53 2024 +0900

    Add descriptive text to each step

commit 8bbdfcae97db5002b09e5f5ecec6ae80d080dc95
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Fri Jun 28 19:15:34 2024 +0900

    mach fmt

commit dc1c7a4aec6aba56af7afcfee6feadbee242a643
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Fri Jun 28 19:01:00 2024 +0900

    Add update_visibility_state

commit 6aa18143319044dc084a9585ab064cd853bccc21
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Fri Jun 28 16:06:25 2024 +0900

    Add VisibilityStateEntry.webidl

commit 638ae3cd563004334d35cc3fbdc1f918d29833d0
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Fri Jun 28 13:39:29 2024 +0900

    Add visibilityState and hidden in Document.webidl

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

* Move creation into reflect call

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2024-07-12 08:32:25 +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
496ce717c5 Move legacy layout behind a feature flag (#32759)
* Move legacy layout behind a feature flag

For now the new feature flag would still be enabled by default,
but disabling the `layout_2013` feature, gives the following
binary size improvements for servoshell on Linux:
- in debug mode from 1278MB -> 1201 MB
- in release mode from 144MB -> 140MB
- in production mode from 108MB -> 106MB

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

* Update components/servo/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.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-07-11 13:24:52 +00:00
Martin Robinson
4907e89656 canvas: Remove as much usage of font-kit as possible (#32758)
Do font selection using Servo's font backend, which is shared with the
rest of layout. In addition, delay the creation of the `font-kit` font
until just before rendering with `raqote`. The idea is that when
`raqote` is no longer used, we can drop the `font-kit` dependency.

This change has the side-effect of fixing text rendering in canvas,
adding support for font fallback in canvas, and also correcting a bug in
font selection with size overrides.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-11 04:25:38 +00:00
Bumsoo Kim
c6cb7ee981 script: Use the new C string literal in the DOM bindings (#32741)
* simple conversion to cstrings using as_ptr()

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

* replaced byte strings with c strings using new helper functions

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

* changed &[u8] type parameters to &CStr

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

---------

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>
2024-07-11 04:18:54 +00:00
Ngo Iok Ui (Wu Yu Wei)
3e163bfcdb shell: set no-wgl flag in servoshell instead (#32753)
* Set no-wgl flag in servoshell instead

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

* Remove unused comment

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2024-07-10 14:50:27 +00:00
dependabot[bot]
313536fd82 build(deps): bump cc from 1.0.106 to 1.1.0 (#32746)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.0.106 to 1.1.0.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.0.106...cc-v1.1.0)

---
updated-dependencies:
- dependency-name: cc
  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>
2024-07-10 14:50:11 +00:00
dependabot[bot]
f455321f84 build(deps): bump syn from 2.0.69 to 2.0.70 (#32749)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.69 to 2.0.70.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.69...2.0.70)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 12:15:14 +00:00
dependabot[bot]
fc34137fda build(deps): bump vergen from 8.3.1 to 8.3.2 (#32748)
Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.3.1 to 8.3.2.
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/commits)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 12:15:05 +00:00
dependabot[bot]
0c362329c3 build(deps): bump hyper from 0.14.29 to 0.14.30 (#32750)
Bumps [hyper](https://github.com/hyperium/hyper) from 0.14.29 to 0.14.30.
- [Release notes](https://github.com/hyperium/hyper/releases)
- [Changelog](https://github.com/hyperium/hyper/blob/v0.14.30/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper/compare/v0.14.29...v0.14.30)

---
updated-dependencies:
- dependency-name: hyper
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 12:15:04 +00:00
dependabot[bot]
1ec1207099 build(deps): bump darling from 0.20.9 to 0.20.10 (#32747)
Bumps [darling](https://github.com/TedDriggs/darling) from 0.20.9 to 0.20.10.
- [Release notes](https://github.com/TedDriggs/darling/releases)
- [Changelog](https://github.com/TedDriggs/darling/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TedDriggs/darling/commits/v0.20.10)

---
updated-dependencies:
- dependency-name: darling
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 12:14:54 +00:00
atbrakhi
c6443f74a4 Remove unused implementation (#32754)
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2024-07-10 10:57:49 +00:00
dependabot[bot]
097b9a3d0b build(deps): bump uuid from 1.9.1 to 1.10.0 (#32751)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.9.1...1.10.0)

---
updated-dependencies:
- dependency-name: uuid
  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>
2024-07-10 03:20:33 +00:00
atbrakhi
a3bb8048fc use au in inline (#32728)
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2024-07-09 19:18:59 +00:00
eri
33f3c34d28 DevTools: Display console messages and errors (#32727)
* feat: add streams to browsing context

* feat: console now works!

* feat: order console messages

* feat: add streams to new browsing contexts

* fix: apply suggestions

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-07-09 18:27:47 +00:00
Delan Azabani
34d9be70f9 Update in-tree docs to point to the new book (#32743)
* Update in-tree docs to point to the new book

* Revive build setup section in README as quickstart guide

* Apply feedback about titles
2024-07-09 15:42:00 +00:00
Josh Matthews
72e6a1f007 Remove media element state changes triggered by network responses (#32643)
* Do not change media element ready state when network response is complete.

* Do not fire multiple error events for the same media content.

* Inform media backend when media response is complete.

* Continue delaying the load event when a complete media response is received.

* Only mark a media response as complete when the response is the active one.

* Update expectations for imagebitmap tests using video element.

* Update fetch ORB video test expectations.

* Update media CSS selector test expectation for non-implemented feature.

* Update expectations for media element tests that now work.

* Updat expected result for failing reftest.

* Update expected failure for test that loads an audio file in a video element.

* Update media test expectation for unimplemented track feature.

* Do not process media element ready state changes that are unchanged.

* Reset media element ready state to Current when playback finishes.

* Set media element ready state to Enough when appropriate player event is received.

* Update test expectations.
2024-07-09 06:48:44 +00:00
石蕊 (Pi-Cla)
f29dd64a7b Fix more clippy (#32740) 2024-07-09 04:47:43 +00:00
dependabot[bot]
4e1f623666 build(deps): bump target-lexicon from 0.12.14 to 0.12.15 (#32737)
Bumps [target-lexicon](https://github.com/bytecodealliance/target-lexicon) from 0.12.14 to 0.12.15.
- [Commits](https://github.com/bytecodealliance/target-lexicon/compare/v0.12.14...v0.12.15)

---
updated-dependencies:
- dependency-name: target-lexicon
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-09 03:57:54 +00:00
dependabot[bot]
1c6b74e1f1 build(deps): bump clipboard-win from 5.3.1 to 5.4.0 (#32736)
Bumps [clipboard-win](https://github.com/DoumanAsh/clipboard-win) from 5.3.1 to 5.4.0.
- [Commits](https://github.com/DoumanAsh/clipboard-win/commits)

---
updated-dependencies:
- dependency-name: clipboard-win
  dependency-type: indirect
  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>
2024-07-08 21:09:33 +00:00
dependabot[bot]
84ec017625 build(deps): bump gilrs-core from 0.5.12 to 0.5.13 (#32733)
Bumps [gilrs-core](https://gitlab.com/gilrs-project/gilrs) from 0.5.12 to 0.5.13.
- [Commits](https://gitlab.com/gilrs-project/gilrs/compare/gilrs-core-v0.5.12...gilrs-core-v0.5.13)

---
updated-dependencies:
- dependency-name: gilrs-core
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 20:33:20 +00:00
dependabot[bot]
b7d9415a4a build(deps): bump cc from 1.0.104 to 1.0.106 (#32739)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.0.104 to 1.0.106.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.0.104...cc-v1.0.106)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 17:32:44 +00:00
dependabot[bot]
7a8cdcd4ca build(deps): bump syn from 2.0.68 to 2.0.69 (#32738)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.68 to 2.0.69.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.68...2.0.69)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 17:31:36 +00:00
dependabot[bot]
b919ac0dad build(deps): bump serde from 1.0.203 to 1.0.204 (#32735)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.203 to 1.0.204.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.203...v1.0.204)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 17:25:57 +00:00
dependabot[bot]
d8283d1a42 build(deps): bump gilrs from 0.10.7 to 0.10.8 (#32734)
Bumps [gilrs](https://gitlab.com/gilrs-project/gilrs) from 0.10.7 to 0.10.8.
- [Commits](https://gitlab.com/gilrs-project/gilrs/compare/v0.10.7...v0.10.8)

---
updated-dependencies:
- dependency-name: gilrs
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 17:21:42 +00:00
Martin Robinson
77e9e3deba fonts: Add support for generic font families and font size configuration (#32673)
This adds support for generic font families in Servo and allows for
configuration of them as well as their default font sizes. One
interesting fix here is that now monospace default to 13px, like it does
in other browsers.

In addition to that, this exposes a new interface in Stylo which allows
setting a default style. This is quite useful for fonts, but also for
other kinds of default style settings -- like text zoom.

Fixes #8371.
Fixes #14773.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-08 17:17:48 +00:00
cybai (Haku)
956b7f62e0 Avoid unnecessary clones for URLs (#32694) 2024-07-08 16:11:55 +00:00
atbrakhi
d9b99723f5 Remove unused ToWebRender implementation (#32729) 2024-07-08 16:10:34 +00:00
Jonathan Schwender
8cd1e22f8d android/ohos: fonts: Ignore ascii case when searching for font family (#32725)
The input for this function commonly comes from a `LowercaseString`,
while our actual font family name has cases.
Since font family lookup should be case-neutral, we do a compare
ignoring the ascii case.
I'm not too familiar with the CSS standard so I'm not 100% sure
if this is sufficient, or if we need to use a different method
to compare strings for arbitrary non-ascii font names.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-08 13:53:41 +00:00
Martin Robinson
89944bd330 layout: Improve layout of table captions (#32695)
- Instead of treating captions as a `BlockFormattingContext`, treat it as
  a `NonReplacedFormattingContext`, which allows reusing flow layout for
  captions -- fixing some issues with sizing.
- Pass in the proper size of the containing block when laying out,
  fixing margin calculation.
- Follow the unspecified rules about how various size properties on
  captions affect their size.
- Improve linebreaking around atomics, which is tested by
  caption-related tests. This fixes intrinsic size calculation regarding
  soft wrap opportunities around atomic and also makes the code making
  these actual soft wrap opportunities a bit better.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-08 12:58:38 +00:00
eri
2888193cfe DevTools: Replace camel case variable names (#32726)
* refactor: rename to snake case

* refactor: more renaming

* chore: format

* chore: clean
2024-07-08 11:18:35 +00:00
Mukilan Thiyagarajan
b243457ccc ci: fix security issue in try job workflow (#32724)
This [issue][1] was reported by GitHub user @RedYetiDev via the Security
Advisory reporting mechanism on GitHub. The fix is also based on their
proposed solution.

The issue is that `refs/pull/{pr_number}/head` points to the latest
commit of a PR and so it could be different than the commit that was
reviewed when the try label was applied. The fix is to use the exact commit
sha at the point when the try job is triggered, which is available in
the `github` context as  `github.event.pull_request.head.sha`.

[1]: https://github.com/servo/servo/security/advisories/GHSA-fxqr-xgh8-3577

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com>
2024-07-08 10:08:23 +00:00
Martin Robinson
099b5607b9 readme: Clarify that rust and cargo must be in your path after rustup runs (#32722)
Fixes #32670.
2024-07-08 08:54:01 +00:00
Mukilan Thiyagarajan
24639bb540 android: sign release APK with a custom key. (#32721)
This PR adds support for signing all APKs we produce on the CI
with a custom signing key. Currently the logic falls back to
the debug key (which is generated by AGP and not persistent) if
the environment variable for the keystore is not set. This allows
local developer builds to work without requiring a key store.
Once #32720 is resolved, we could sign just the production builds
and remove the conditional logic.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-08 08:36:00 +00:00
Ngo Iok Ui (Wu Yu Wei)
6cb95827a3 Set compositor's cursor_pos properly (#32718) 2024-07-08 07:41:27 +00:00
Keith Cirkel
db4cba4d6d Add customElements.getName (#32715)
* Add customElements.getName

* rebaseline
2024-07-07 15:22:57 +00:00
Servo WPT Sync
816359583c Update web-platform-tests to revision b'4e3b5de2eb8218cf18a1674618994efeb96e2cc0' (#32717)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-07-07 07:23:54 +00:00
Bumsoo Kim
141a594e23 Replace null-byte terminated string literals with C-string literals (#32716)
* simple conversion from byte string to c-string

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

* convert byte strings to c-strings to c_char ptr

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

---------

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>
2024-07-06 20:14:15 +00:00
Samson
59d0f1fe1a script: Impl cloning of JSPrincipals (#32706)
* Impl cloning of JSPrincipals

* bincode as workspace dependency

* Update mozjs and cc
2024-07-06 10:25:38 +00:00
dependabot[bot]
5a9dc98f07 build(deps): bump egui_glow in the egui-related group (#32712)
Bumps the egui-related group with 1 update: [egui_glow](https://github.com/emilk/egui).


Updates `egui_glow` from 0.28.0 to 0.28.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.28.0...0.28.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>
2024-07-06 07:24:25 +00:00
Alex Touchet
1e5c844eb5 Add more crates to egui Dependabot group (#32711) 2024-07-06 05:51:31 +00:00
dependabot[bot]
438e99ca9a build(deps): bump the egui-related group with 2 updates (#32708)
Bumps the egui-related group with 2 updates: [egui](https://github.com/emilk/egui) and [egui-winit](https://github.com/emilk/egui).


Updates `egui` from 0.28.0 to 0.28.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.28.0...0.28.1)

Updates `egui-winit` from 0.28.0 to 0.28.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.28.0...0.28.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
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-05 20:06:46 +00:00
dependabot[bot]
fabd7a178f build(deps): bump emath from 0.28.0 to 0.28.1 (#32710)
Bumps [emath](https://github.com/emilk/egui) from 0.28.0 to 0.28.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.28.0...0.28.1)

---
updated-dependencies:
- dependency-name: emath
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-05 16:43:07 +00:00
dependabot[bot]
a16666db03 build(deps): bump ab_glyph from 0.2.27 to 0.2.28 (#32709)
Bumps [ab_glyph](https://github.com/alexheretic/ab-glyph) from 0.2.27 to 0.2.28.
- [Release notes](https://github.com/alexheretic/ab-glyph/releases)
- [Commits](https://github.com/alexheretic/ab-glyph/compare/ab-glyph-0.2.27...ab-glyph-0.2.28)

---
updated-dependencies:
- dependency-name: ab_glyph
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-05 16:37:56 +00:00
Martin Robinson
7eac599aa1 fonts: Stop using Stylesheet::effective_font_face_rules (#32699)
This function doesn't exist in upstream Stylo and is fairly unecessary.
Removing it will help reduce the difference between downstream Stylo and
upstream Stylo.
2024-07-04 21:53:14 +00:00
Martin Robinson
0f2139be27 layout_2013: Remove code preventing writing mode assertion failures (#32698)
It's actually kind of useful that this code crashes, as it points out a
problem. Additionally, we aren't going to be maintaining Layout 2013 any
longer so it is very unlikely that these bugs will ever be fixed. This
allows us to reduce our diff with upstream Stylo.

Closes #30577.
2024-07-04 21:08:02 +00:00
dependabot[bot]
10326f7e0f build(deps): bump wayland-cursor from 0.31.3 to 0.31.4 (#32701)
Bumps [wayland-cursor](https://github.com/smithay/wayland-rs) from 0.31.3 to 0.31.4.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-cursor
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-04 18:24:17 +00:00
Martin Robinson
4b63043c6a clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
Samson
99c1f886b8 webgpu: Update wgpu and revamp RenderPass (#32665)
* Update wgpu and revamp RenderPass

* Set good expectations

* Set one bad expectation

* send_render_command

* small fixups

* docs

* doc

* Put RenderPass inside PassState

* Use Pass enum for ComputePass too

* fix docs
2024-07-04 12:16:42 +00:00
Martin Robinson
26624a109f clippy: Fix a bunch of warnings in script (#32680)
This is just a portion of the errors that are remaining to be fixed.
2024-07-04 11:40:23 +00:00
Jonathan Schwender
93fdb8263d Make task_info as macos specific (#32693)
rust-analyzer breaks on Linux (when invoked without mach), because it
tries to compile the c files, and doesn't find `mach_init.h`
Since we don't need task_info on non-mac platforms, just make the
crate empty on other platforms.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-04 09:21:49 +00:00
eri
fb1c57da3e DevTools: Add parser tool (#32684)
* feat: add devtools parser tool

* feat: improve documentation
2024-07-04 09:15:31 +00:00
newmoneybigbucks
aae66cc33c Updated all kill_*_id functions defined in indentityhub.rs to free_*_id naming format for issue 32685 (#32688)
Signed-off-by: newmoneybigbucks <newmoneybigbucks@protonmail.com>
2024-07-04 09:03:13 +00:00
dependabot[bot]
42f42b39cc build(deps): bump wayland-client from 0.31.3 to 0.31.4 (#32691)
Bumps [wayland-client](https://github.com/smithay/wayland-rs) from 0.31.3 to 0.31.4.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-client
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-04 08:29:54 +00:00
dependabot[bot]
44c4fe32c4 build(deps): bump wayland-scanner from 0.31.2 to 0.31.3 (#32690)
Bumps [wayland-scanner](https://github.com/smithay/wayland-rs) from 0.31.2 to 0.31.3.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: wayland-scanner
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-04 08:27:40 +00:00
dependabot[bot]
81f40400b7 build(deps): bump windows_i686_gnullvm from 0.52.5 to 0.52.6 (#32689)
Bumps [windows_i686_gnullvm](https://github.com/microsoft/windows-rs) from 0.52.5 to 0.52.6.
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

---
updated-dependencies:
- dependency-name: windows_i686_gnullvm
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-04 08:26:33 +00:00
Martin Robinson
e14e079fff servoshell: Update all egui dependencies and group them for dependabot (#32683)
This updates egui, making the necessary changes to maintain behavior. In
addition, it groups dependencies so that they are updated in a single PR
by dependabot, avoiding manual work.
2024-07-04 06:36:19 +00:00
派卡 (pi-cla)
650af7db92 webgpu: Remove mutex around Identities (#32682) 2024-07-03 18:39:45 +00:00
Martin Robinson
959ffad99a layout: Add support for table captions (#32657)
This adds initial support for table captions. To do this, the idea of
the table wrapper becomes a bit more concrete. Even so, the wrapper is
still reponsible for allocating space for the grid's border and padding,
as those properties are specified on the wrapper and not grid in CSS.

In order to account for this weirdness of HTML/CSS captions and grid are
now laid out and placed with a negative offset in the table wrapper
content rect.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-07-03 18:24:19 +00:00
dependabot[bot]
f8e4ae6040 build(deps): bump sctk-adwaita from 0.8.1 to 0.8.3 (#32679)
Bumps [sctk-adwaita](https://github.com/PolyMeilex/sctk-adwaita) from 0.8.1 to 0.8.3.
- [Release notes](https://github.com/PolyMeilex/sctk-adwaita/releases)
- [Changelog](https://github.com/PolyMeilex/sctk-adwaita/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PolyMeilex/sctk-adwaita/commits)

---
updated-dependencies:
- dependency-name: sctk-adwaita
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 17:44:15 +00:00
dependabot[bot]
70697adeb9 build(deps): bump zerocopy from 0.7.34 to 0.7.35 (#32678)
Bumps [zerocopy](https://github.com/google/zerocopy) from 0.7.34 to 0.7.35.
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/commits)

---
updated-dependencies:
- dependency-name: zerocopy
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-03 17:40:08 +00:00
Martin Robinson
4e79ac5701 layout: Allow rendering LineItems independent of inline box (#32666)
Refactor inline layout to allow rendering line items in the second stage
to be rendered in any order, independent of their parent inline box.
This will allow line items to be reordered, effectively allowing the
splitting of inline boxes, for the purposes of BiDi and any other inline
reordering feature.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-07-03 15:15:31 +00:00
atbrakhi
4357751f28 use au in TextFragment (#32653) 2024-07-03 07:27:08 +00:00
dependabot[bot]
fe58a5f0a3 build(deps): bump idna from 1.0.1 to 1.0.2 (#32669)
Bumps [idna](https://github.com/servo/rust-url) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/idna-v1.0.1...idna-v1.0.2)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-02 17:42:17 +00:00
dependabot[bot]
a958a0bb40 build(deps): bump serde_json from 1.0.119 to 1.0.120 (#32668)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.119 to 1.0.120.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.119...v1.0.120)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-02 17:32:09 +00:00
atbrakhi
044ab3eeab fix clippy warning (#32667) 2024-07-02 14:59:46 +00:00
Samson
c0105de82b webgpu: Implement ShaderCompilationInfo (#32642)
* ShaderCompilationInfo

* expectations

* Handle CompilationInfo promise in GPUShaderModule

* Fix my english
2024-07-02 13:39:06 +00:00
Jonathan Schwender
bd0a5eb4b7 Add production-stripped cargo profile (#32651)
* Add production-stripped cargo profile

Stripping the binary significantly reduces the size
significantly (in my tests to about 1/3 of the original size).
Enabling lto and setting `codegen-units = 1` allows further size
optimizations at the cost of increased compile-time.

Probably not everyone wants a stripped binary, since it makes
backtraces less useful.

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

* Move lto and cgu option to production profile

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

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-02 13:05:24 +00:00
Samson
7b324074b5 mark test/wpt as vendored in .gitattributes (#32663)
although expectation and _mozilla test are ours
2024-07-02 11:23:18 +00:00
dependabot[bot]
ad01342f00 build(deps): bump mime_guess from 2.0.4 to 2.0.5 (#32660)
* build(deps): bump mime_guess from 2.0.4 to 2.0.5

Bumps [mime_guess](https://github.com/abonander/mime_guess) from 2.0.4 to 2.0.5.
- [Commits](https://github.com/abonander/mime_guess/commits)

---
updated-dependencies:
- dependency-name: mime_guess
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove libloading from servo-tidy.toml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Touchet <alextouchet@outlook.com>
2024-07-01 18:29:06 +00:00
dependabot[bot]
7ed5e804b5 build(deps): bump serde_json from 1.0.118 to 1.0.119 (#32661)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.118 to 1.0.119.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.118...v1.0.119)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 17:43:39 +00:00
dependabot[bot]
67e13e4991 build(deps): bump object from 0.36.0 to 0.36.1 (#32658)
Bumps [object](https://github.com/gimli-rs/object) from 0.36.0 to 0.36.1.
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.0...0.36.1)

---
updated-dependencies:
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 17:34:48 +00:00
Mukilan Thiyagarajan
0615428aa9 android: fix application name used in ./mach run (#32652)
This patch also switches the code to python format strings
so that the application name can be interpolated where
needed.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-01 08:10:00 +00:00
Servo WPT Sync
e2e7476404 Sync WPT with upstream (30-06-2024) (#32649)
* Update web-platform-tests to revision b'639fa536940371f833fbbcc10104e20f435f9777'

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>

* Delete tests/wpt/meta/css/css-values/cap-invalidation.html.ini

* Update css-font-face.https.sub.tentative.html.ini

---------

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-06-30 11:14:33 +00:00
dependabot[bot]
3a0f564916 build(deps): bump log from 0.4.21 to 0.4.22 (#32638)
Bumps [log](https://github.com/rust-lang/log) from 0.4.21 to 0.4.22.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.21...0.4.22)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 17:02:51 +00:00
dependabot[bot]
14ef3f55aa build(deps): bump zerovec from 0.10.3 to 0.10.4 (#32639)
Bumps [zerovec](https://github.com/unicode-org/icu4x) from 0.10.3 to 0.10.4.
- [Release notes](https://github.com/unicode-org/icu4x/releases)
- [Changelog](https://github.com/unicode-org/icu4x/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unicode-org/icu4x/commits)

---
updated-dependencies:
- dependency-name: zerovec
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 17:01:11 +00:00
dependabot[bot]
40878c654e build(deps): bump ab_glyph from 0.2.26 to 0.2.27 (#32637)
Bumps [ab_glyph](https://github.com/alexheretic/ab-glyph) from 0.2.26 to 0.2.27.
- [Release notes](https://github.com/alexheretic/ab-glyph/releases)
- [Commits](https://github.com/alexheretic/ab-glyph/compare/ab-glyph-0.2.26...ab-glyph-0.2.27)

---
updated-dependencies:
- dependency-name: ab_glyph
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 16:54:53 +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
Mu Xian Ming
a7ebc28738 Replace null-byte terminated string literals with C-string literals (#32631)
Signed-off-by: Mu Xianming <mu.xianming@lmwn.com>
Co-authored-by: Mu Xianming <mu.xianming@lmwn.com>
2024-06-28 12:19:11 +00:00
Martin Robinson
adc0fc984d layout: Make geom.rs logical geoemetry types more ergonomic (#32633)
Make using the logical geometry types more ergonomic by having them all
implement `Copy` (at most 4 64-bit numbers), similar to what `euclid`
does. In addition add an implementation of `Neg` for `LogicalVec` and
`LogicalSides` as it will be used in upcoming table implementation code.
2024-06-28 08:20:50 +00:00
Samson
e9cf4d4971 webgpu: Update wgpu and revamp computepass (#32575)
* Do not wait on drop, but rather wake poller thread

* Update wgpu and render stuff

* Set some good expectations

* Update wgpu again

* handle IPC error as warning

* More good expectations

* Some more expectations

CTS does not match the spec: https://github.com/gpuweb/cts/issues/3806

* This expectations are due to other changes in servo

also happening on main

* Explain error_command_encoders and remove RefCell around it

* fixup

* store validness of passes

* More good expectations

* More docs

* this assert is wrong

* This is even more right per CTS/spec

Only Command encoder state errors are allowed here, but wgpu does not exposes them.

* More good expectations

* One bad expectation

* Fix my english
2024-06-28 04:49:35 +00:00
atbrakhi
fced0b4940 use au in AtomicLineItem (#32630) 2024-06-27 11:12:32 +00:00
Delan Azabani
9ff900e166 CONTRIBUTING: add AI contributions policy (#32287)
* CONTRIBUTING: add AI contributions policy

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* Be more explicit about how the policy may be revised

* Reword point about copyright issues

* Fix missing word in ethical issues

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-06-27 06:05:07 +00:00
Manuel Rego Casasnovas
574a22a6cd Avoid Esc shortcut to close Servo (#32603)
* Avoid Esc shortcut to close Servo

Keep Esc shortcut to leave fullscreen, but avoid to close Servo
(as this is not common in other similar apps,
and can be shortcut used in some web apps for other things).

* Send Esc to the page
2024-06-27 03:43:05 +00:00
dependabot[bot]
aa99c85645 build(deps): bump either from 1.12.0 to 1.13.0 (#32627)
Bumps [either](https://github.com/rayon-rs/either) from 1.12.0 to 1.13.0.
- [Commits](https://github.com/rayon-rs/either/compare/1.12.0...1.13.0)

---
updated-dependencies:
- dependency-name: either
  dependency-type: indirect
  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>
2024-06-27 03:39:11 +00:00
Martin Robinson
da2de4fc68 html: Parse a comma-separated list of faces in the <font> tag (#32622)
This change parses a comma-separated list of faces in the `<font>` tag
and also moves the parsing code from `stylo` to Servo. This means that
the servo-specific code can be removed from stylo decreasing the
differences between Gecko and Servo's version of `stylo`.
2024-06-26 18:28:35 +00:00
dependabot[bot]
47678a61b9 build(deps): bump the gstreamer-related group with 2 updates (#32626)
Bumps the gstreamer-related group with 2 updates: [glib](https://github.com/gtk-rs/gtk-rs-core) and [glib-macros](https://github.com/gtk-rs/gtk-rs-core).


Updates `glib` from 0.19.8 to 0.19.9
- [Release notes](https://github.com/gtk-rs/gtk-rs-core/releases)
- [Changelog](https://github.com/gtk-rs/gtk-rs-core/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gtk-rs/gtk-rs-core/compare/0.19.8...0.19.9)

Updates `glib-macros` from 0.19.8 to 0.19.9
- [Release notes](https://github.com/gtk-rs/gtk-rs-core/releases)
- [Changelog](https://github.com/gtk-rs/gtk-rs-core/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gtk-rs/gtk-rs-core/compare/0.19.8...0.19.9)

---
updated-dependencies:
- dependency-name: glib
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gstreamer-related
- dependency-name: glib-macros
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: gstreamer-related
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 16:40:34 +00:00
Martin Robinson
e16291f14e layout: Enable parallel layout for tables (#32477)
This simply wraps row and column-based layout of table sells in a
`par_iter()` unconditionally enabling parallel layout for tables. In the
future we can choose to adjust the conditions under which layout is done
in parallel.
2024-06-26 16:33:48 +00:00
Oriol Brufau
f055964792 Switch replaced layout to app units (#32625) 2024-06-26 16:19:24 +00:00
Mukilan Thiyagarajan
a730469b70 script: Implement the FontFaceSet DOM API (#32576)
Add a skeleton implementation of FontFaceSet interface with support
for resolving the `document.fonts.ready` Promise when the loading of
web fonts is completed.

This change exposes new failures in the web platform tests.

These were ERROR before the change because `document.fonts.ready` caused
a `ReferenceError` causing the tests to be aborted and they now FAIL:
- /css/CSS2/linebox/vertical-align-top-bottom-001.html
- /css/css-flexbox/flex-one-sets-flex-basis-to-zero-px.html
- /css/css-fonts/generic-family-keywords-001.html
- /css/css-fonts/math-script-level-and-math-style/math-script-level-004.tentative.html
- /css/css-fonts/math-script-level-and-math-style/math-script-level-002.tentative.html
- /css/css-text/text-autospace/text-autospace-ligature-001.html
- /css/css-values/calc-size/calc-size-width.tentative.html

These were TIMEOUT before the change because `document.fonts.ready` was
a ReferenceError and the tests were asynchronous (reftest-wait). These now
FAIL because the assertions are now executed after fonts are loaded:
- /css/css-fonts/matching/fixed-stretch-style-over-weight.html
- /css/css-fonts/matching/range-descriptor-reversed.html
- /css/css-fonts/matching/stretch-distance-over-weight-distance.html
- /css/css-fonts/matching/style-ranges-over-weight-direction.html
- /css/css-fonts/variations/variable-box-font.html
- /css/css-fonts/variations/variable-gpos-m2b.html
- /css/css-fonts/variations/variable-gsub.html
- /css/css-fonts/variations/variable-opsz-size-adjust.html
- /css/css-position/sticky/position-sticky-change-top.html
- /css/css-position/sticky/position-sticky-fixed-ancestor.html
- /css/css-position/sticky/position-sticky-flexbox.html
- /css/css-position/sticky/position-sticky-grid.html
- /css/css-position/sticky/position-sticky-inline.html
- /css/css-position/sticky/position-sticky-rendering.html
- /css/css-position/sticky/position-sticky-stacking-context.html
- /css/css-position/sticky/position-sticky-table-td-left.html
- /css/css-position/sticky/position-sticky-table-td-right.html
- /css/css-position/sticky/position-sticky-table-tfoot-bottom.html
- /css/css-position/sticky/position-sticky-table-th-right.html
- /css/css-position/sticky/position-sticky-table-thead-top.html
- /css/css-position/sticky/position-sticky-table-tr-bottom.html
- /css/css-position/sticky/position-sticky-table-tr-top.html
- /css/css-position/sticky/position-sticky-writing-modes.html
- /css/css-pseudo/marker-intrinsic-contribution-001.html
- /css/css-text/hyphens/hyphens-character.html

These tests now PASS due to this patch:
* FAIL -> PASS
  - /html/canvas/element/text/2d.text.draw.fill.maxWidth.fontface.html
  - /html/canvas/element/text/2d.text.measure.width.empty.html
* TIMEOUT -> PASS
  - /css/css-fonts/variations/font-descriptor-range-reversed.html
  - /css/css-fonts/variations/variable-opsz.html
  - /css/css-position/sticky/position-sticky-table-th-left.html
* ERROR -> PASS
  - /css/css-fonts/generic-family-keywords-002.html
  - /css/css-fonts/generic-family-keywords-003.html
* These two tests only PASS in Layout 2020:
  - /css/CSS2/positioning/inline-static-position-001.html
  - /css/cssom-view/getBoundingClientRect-empty-inline.html

These two tests have subtests that PASS intermittenttly:
- /fetch/metadata/generated/css-font-face.sub.tentative.html
- /css/css-fonts/generic-family-keywords-001.html

These tests are new TIMEOUTS that used to FAIL because
`documents.fonts.ready` was undefined:
- /resource-timing/TAO-match.html
- /resource-timing/content-type.html
- /resource-timing/nextHopProtocol-is-tao-protected.https.html

The failure in `/resize-observer/change-layout-in-error.html` could be
due to an issue in the ResizeObserver implementation that is now exposed
with this change, but this needs more investigation.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-06-26 09:44:47 +00:00
Martin Robinson
7ea894774f Add a directory listing feature for file URLs (#32580)
Signed-off-by: Bobulous <Bobulous@users.noreply.github.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Bobulous <Bobulous@users.noreply.github.com>
2024-06-26 08:02:50 +00:00
dependabot[bot]
b3d99a607f build(deps): bump bitflags from 2.5.0 to 2.6.0 (#32613)
Bumps [bitflags](https://github.com/bitflags/bitflags) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/2.5.0...2.6.0)

---
updated-dependencies:
- dependency-name: bitflags
  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>
2024-06-26 01:54:50 +00:00
dependabot[bot]
7a76f4ed20 build(deps): bump zerovec-derive from 0.10.2 to 0.10.3 (#32611)
Bumps [zerovec-derive](https://github.com/unicode-org/icu4x) from 0.10.2 to 0.10.3.
- [Release notes](https://github.com/unicode-org/icu4x/releases)
- [Changelog](https://github.com/unicode-org/icu4x/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unicode-org/icu4x/commits)

---
updated-dependencies:
- dependency-name: zerovec-derive
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 18:53:06 +00:00
dependabot[bot]
b42208a20e build(deps): bump zerovec from 0.10.2 to 0.10.3 (#32614)
Bumps [zerovec](https://github.com/unicode-org/icu4x) from 0.10.2 to 0.10.3.
- [Release notes](https://github.com/unicode-org/icu4x/releases)
- [Changelog](https://github.com/unicode-org/icu4x/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unicode-org/icu4x/commits)

---
updated-dependencies:
- dependency-name: zerovec
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 17:55:33 +00:00
dependabot[bot]
e51c15d84f build(deps): bump icu_properties from 1.5.0 to 1.5.1 (#32612)
Bumps [icu_properties](https://github.com/unicode-org/icu4x) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/unicode-org/icu4x/releases)
- [Changelog](https://github.com/unicode-org/icu4x/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unicode-org/icu4x/commits)

---
updated-dependencies:
- dependency-name: icu_properties
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 17:39:07 +00:00
dependabot[bot]
3a30fa9977 build(deps): bump serde_json from 1.0.117 to 1.0.118 (#32609)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.117 to 1.0.118.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.117...v1.0.118)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 17:18:53 +00:00
dependabot[bot]
92378ac3d6 build(deps): bump serde_bytes from 0.11.14 to 0.11.15 (#32610)
Bumps [serde_bytes](https://github.com/serde-rs/bytes) from 0.11.14 to 0.11.15.
- [Release notes](https://github.com/serde-rs/bytes/releases)
- [Commits](https://github.com/serde-rs/bytes/compare/0.11.14...0.11.15)

---
updated-dependencies:
- dependency-name: serde_bytes
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 17:18:08 +00:00
dependabot[bot]
6d3c67d469 build(deps): bump uuid from 1.9.0 to 1.9.1 (#32608)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.9.0...1.9.1)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 17:14:47 +00:00
Oriol Brufau
7b6aa64aca Clean up some unused dependencies (#32600) 2024-06-25 13:02:59 +00:00
dependabot[bot]
52e6e59ebd build(deps): bump uuid from 1.8.0 to 1.9.0 (#32589)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.8.0...1.9.0)

---
updated-dependencies:
- dependency-name: uuid
  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>
2024-06-25 12:27:03 +00:00
Oriol Brufau
a972e5c200 Switch flex layout to app units (#32599) 2024-06-25 07:05:16 +00:00
ItsSunnyMonster
42e090a1eb clippy: fix some warnings in desktop and some components (#32583)
* clippy: fix some warnings in ports/servoshell/desktop

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* style: fix formatting

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* clippy: fix warnings in bluetooth, devtools and servo components

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* clippy: remove comments

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

---------

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>
2024-06-25 07:04:23 +00:00
dependabot[bot]
6738902d45 build(deps): bump lazy_static from 1.4.0 to 1.5.0 (#32591)
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.4.0...1.5.0)

---
updated-dependencies:
- dependency-name: lazy_static
  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>
2024-06-24 22:48:38 +00:00
Oriol Brufau
b1fdfb88bb Upgrade stylo to 2024-05-31 (#32474)
* Upgrade stylo to 2024-05-31

* Fixup for https://phabricator.services.mozilla.com/D211731

* Fixup for https://phabricator.services.mozilla.com/D207779

* Fixup for https://phabricator.services.mozilla.com/D207781

* Update test expectations
2024-06-24 20:03:50 +00:00
dependabot[bot]
680735ed73 build(deps): bump syn from 2.0.67 to 2.0.68 (#32588)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.67 to 2.0.68.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.67...2.0.68)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 17:33:35 +00:00
dependabot[bot]
75423656d4 build(deps): bump libloading from 0.8.3 to 0.8.4 (#32590)
Bumps [libloading](https://github.com/nagisa/rust_libloading) from 0.8.3 to 0.8.4.
- [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.3...0.8.4)

---
updated-dependencies:
- dependency-name: libloading
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 17:28:43 +00:00
Martin Robinson
e331cc67c3 mach: Expose a --skip-static-analysis to mach boostrap (#32587)
This should speed up runners which just need to run the WPT tests.

Fixes #32582.
2024-06-24 17:13:09 +00:00
Martin Robinson
30dad2565f android: Rename the Android app to reflect servo.org ownership and servoshell (#32554)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-06-24 15:39:57 +00:00
Jonathan Schwender
7d7574373b android: Use location_bar_input_to_url instead of re-implementing (#32586)
We can use the same function as the desktop version

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-06-24 15:25:07 +00:00
Jonathan Schwender
26bbfe9b55 Make crown optional (#32494)
* Make `crown` optional

Add the optional `--use-crown` flag to mach

* --use-crown for all platforms in CI

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

* Add documentation for `--use-crown`

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

* Update python/servo/command_base.py

Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Raise Error if CARGO_BUILD_RUSTC conflicts with --use-crown

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

* add dummy RUSTFLAG to trigger re-checking

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>
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
2024-06-24 11:46:43 +00:00
Erik Hennig
8121c98834 Add suppression comments + Suppress lazy_static (#32584)
Co-authored-by: Jonas Zeunert <jonas@zeunert.org>
2024-06-23 17:21:16 +00:00
Servo WPT Sync
62b230e85d Update web-platform-tests to revision b'f46bf6aa167e2838a8b93501a1a998ffde90d879' (#32581)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2024-06-23 06:21:30 +00:00
dependabot[bot]
130eef300b build(deps): bump syn from 2.0.66 to 2.0.67 (#32579)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.66 to 2.0.67.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.66...2.0.67)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 17:41:36 +00:00
dependabot[bot]
56d4759993 build(deps): bump proc-macro2 from 1.0.85 to 1.0.86 (#32577)
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.85...1.0.86)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 17:02:35 +00:00
dependabot[bot]
a084813a1f build(deps): bump displaydoc from 0.2.4 to 0.2.5 (#32578)
Bumps [displaydoc](https://github.com/yaahc/displaydoc) from 0.2.4 to 0.2.5.
- [Changelog](https://github.com/yaahc/displaydoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yaahc/displaydoc/commits/v0.2.5)

---
updated-dependencies:
- dependency-name: displaydoc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 17:00:18 +00:00
eri
5eb8813448 DevTools: Implement watcher actor (#32509)
* feat: base for watcher

* feat: some more watcher tests

* feat: implement getWatcher

* refactor: clean up getWatcher

* feat: implement watchTargets

* feat: implement watchResources

* feat: very messy watchTargets fix

* refactor: clean browsing context

* feat: target configuration

* refactor: start cleanup

* refactor: more doc coments

* refactor: clean browsing context
2024-06-21 16:06:55 +00:00
atbrakhi
26c585a0c5 use app unit in box_fragement (#32349) 2024-06-21 14:54:21 +00:00
Martin Robinson
66edef8065 layout: Simplify Contents a little (#32487)
Instead of duplicating some of `NonReplacedContents` in `Contents`,
divide it into either replaced and non-replaced content, since this is
how the layout system processes `Contents` always. In addition, stop
using `TryInto` to match replaced or non-replaced contents, as it is
quite confusing to handle an `Err` as a success case.
2024-06-21 10:13:31 +00:00
Martin Robinson
44064b1439 layout: Add very basic support for showing text in input boxes (#32365)
This only paints text in input fields. Selection and cursor are still
not painted.

In addition to adding this feature, the change also updates the
user-agent.css with the latest from the HTML specification. Extra
padding and extraneous settings (such as a bogus line-height and
min-height) are also removed from servo.css. This leads to some new
passes.

There are some new passes, this introduces failures as inserting text
reveals issues that were hidden before. Notably:

- failures in `/html/editing/editing-0/spelling-and-grammar-checking/`:
  We do not support spell-checking.
- Most of the rest of the new failures are missing features of input
  boxes that are also missing in legacy layout.
2024-06-20 10:13:50 +00:00
Jonathan Schwender
3d6accbbe3 android: Remove serde-json build-dependency (#32573)
There is no need to add `serde-json` as a
build-dependency (which causes serde to be built
twice when cross-compiling - once for host and once
for the target)

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2024-06-20 08:50:15 +00:00
Mukilan Thiyagarajan
ee2acaeacf config: fix panic in PrefValue to [f64; 4] conversion (#32571)
The `Iterator::all` method consumes the input iterator `f` so when
we reuse `f` in `f.flatten().collect()` it yields an empty Vector
in the case where all the elements are successfully converted using
try_into(). This causes out of bounds access when indexing into
the resulting Vector to extract the individual components.

Fixes #32570.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-06-20 08:47:13 +00:00
Gregory Terzian
64b872ec0d add codeowners file, set gterzian as owner for components/script (#32568) 2024-06-20 08:37:58 +00:00
Jonathan Schwender
7957d11b5d ohos: Add fallback font for serif (#32555)
The fallback behavior seems to have changed recently.
Now we need to explicitly add a fallback for `serif`
otherwise no font is selected.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-06-20 06:51:38 +00:00
Mukilan Thiyagarajan
cc1c31ef3f crown: remove references to workspace manifest (#32567)
The way our shell.nix works requires crown's Cargo.toml to be
self-contained so that it can be built as a nix derivation in
isolation.

Fixes #32552.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-06-20 06:50:50 +00:00
Samson
bf99cf7f30 Proper GPUDevice cleanup (#32520)
* Make device cleanup right

* Use weakref for GPUDevice in globalscope

* No need to destroy device on drop

* DeviceReason early return

* make remove_gpu_device to be the only way to remove device
2024-06-20 05:56:59 +00:00
11376 changed files with 483752 additions and 200347 deletions

View File

@@ -34,4 +34,3 @@ RUSTC_BOOTSTRAP = "crown,script,style_tests"
[build]
rustdocflags = ["--document-private-items"]
rustc = "crown"

2
.gitattributes vendored
View File

@@ -1,5 +1,5 @@
* text=auto eol=lf
tests/* linguist-vendored
tests/wpt/** linguist-vendored
# Denote all files that are truly binary and should not be modified.
*.png binary

4
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,4 @@
# Reviewers for the Servo project
/components/script/ @gterzian

View File

@@ -15,6 +15,15 @@ updates:
- "glib*"
- "gobject*"
- "gstreamer*"
groups:
egui-related:
patterns:
- "ecolor"
- "egui"
- "egui-winit"
- "egui_glow"
- "emath"
- "epaint"
ignore:
# Ignore all stylo crates as their upgrades are coordinated via companion PRs.
- dependency-name: servo_atoms

View File

@@ -30,33 +30,32 @@ jobs:
matrix:
arch: ['aarch64-linux-android', 'armv7-linux-androideabi', 'i686-linux-android', 'x86_64-linux-android']
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: false
large-packages: false
swap-storage: false
- uses: actions/checkout@v4
if: github.event_name != 'issue_comment' && github.event_name != 'pull_request_target'
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 2
# This is necessary to checkout the pull request if this run was triggered
# via an `issue_comment` action on a pull request.
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'issue_comment' || github.event_name == 'pull_request_target'
if: github.event_name == 'pull_request_target'
with:
ref: refs/pull/${{ github.event.issue.number || github.event.number }}/head
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip virtualenv
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
run: sudo apt update && python3 ./mach bootstrap --skip-lints
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
@@ -70,12 +69,23 @@ jobs:
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
ndk-version: r26c
- name: Setup Key Store for APK Signing
env:
KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
if: ${{ env.KEYSTORE_BASE64 != '' }}
run: |
APK_SIGNING_KEY_STORE_PATH="${PWD}/servo_keystore.jks"
echo "${KEYSTORE_BASE64}" | base64 -d > "${APK_SIGNING_KEY_STORE_PATH}"
echo "APK_SIGNING_KEY_STORE_PATH=${APK_SIGNING_KEY_STORE_PATH}" >> ${GITHUB_ENV}
- name: Build (arch ${{ matrix.arch }} profile ${{ inputs.profile }})
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
APK_SIGNING_KEY_STORE_PASS: ${{ secrets.APK_SIGNING_KEY_STORE_PASS }}
APK_SIGNING_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
APK_SIGNING_KEY_PASS: ${{ secrets.APK_SIGNING_KEY_PASS }}
run: |
python3 ./mach build --locked --android --target ${{ matrix.arch }} --${{ inputs.profile }}
python3 ./mach build --use-crown --locked --target ${{ matrix.arch }} --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-android-${{ matrix.arch }}
# TODO: This is disabled since APK crashes during startup.
# See https://github.com/servo/servo/issues/31134

View File

@@ -0,0 +1,18 @@
name: Automerge Dependabot & WPT Updates
on: pull_request
permissions:
pull-requests: read
jobs:
auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'servo-wpt-sync' }}
steps:
- name: Approve the PR & enable auto-merge
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.SERVO_DEPENDABOT_TOKEN }}

12
.github/workflows/dco-merge-group.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# Mostly copied from https://github.com/onnx/onnx/blob/main/.github/workflows/dco_merge_group.yml
# Because of https://github.com/dcoapp/app/issues/199
name: DCO
on:
merge_group:
jobs:
DCO:
runs-on: ubuntu-latest
steps:
- run: echo "dummy DCO workflow (it won't run any check actually) to trigger by merge_group in order to enable merge queue"

View File

@@ -1,22 +0,0 @@
name: Approve & merge successful dependabot patch upgrade PRs
on: pull_request
permissions:
pull-requests: read
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
- name: Approve the PR & enable auto-merge
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.SERVO_DEPENDABOT_TOKEN}}

View File

@@ -8,7 +8,7 @@ on:
profile:
required: true
type: string
wpt-tests-to-run:
wpt-args:
required: true
type: string
wpt-layout:
@@ -37,7 +37,7 @@ jobs:
profile: ${{ inputs.profile }}
wpt-layout: ${{ inputs.wpt-layout }}
unit-tests: ${{ inputs.unit-tests }}
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
wpt-args: ${{ inputs.wpt-args }}
linux:
if: ${{ inputs.workflow == 'linux' }}
@@ -48,7 +48,13 @@ jobs:
profile: ${{ inputs.profile }}
wpt-layout: ${{ inputs.wpt-layout }}
unit-tests: ${{ inputs.unit-tests }}
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
wpt-args: ${{ inputs.wpt-args }}
lint:
if: ${{ inputs.workflow == 'lint' }}
name: Lint
uses: ./.github/workflows/lint.yml
secrets: inherit
android:
if: ${{ inputs.workflow == 'android' }}

View File

@@ -17,7 +17,7 @@ jobs:
run: |
python3 -m pip install --upgrade pip
sudo apt update
python3 ./mach bootstrap
python3 ./mach bootstrap --skip-lints
- name: Set LIBCLANG_PATH # This is needed for bindgen in mozangle.
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- name: Compile docs

59
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Lint
on:
workflow_call:
workflow_dispatch:
env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 2 # This is necessary for `test-tidy`.
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2 # This is necessary for `test-tidy`.
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip
- name: Bootstrap dependencies
run: |
sudo apt update
python3 ./mach bootstrap
# TODO: Do GitHub anotaions
# TODO: Fail on warnings
- name: Clippy
run: |
python3 ./mach cargo-clippy --use-crown --locked
- name: Tidy
run: python3 ./mach test-tidy --no-progress --all

View File

@@ -5,7 +5,7 @@ on:
profile:
required: true
type: string
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -55,7 +55,7 @@ jobs:
python3 -m pip install --upgrade pip
sudo apt update
sudo apt install -qy --no-install-recommends mesa-vulkan-drivers
python3 ./mach bootstrap
python3 ./mach bootstrap --skip-lints
- name: Sync from upstream WPT
if: ${{ inputs.wpt-sync-from-upstream }}
run: |
@@ -67,13 +67,13 @@ jobs:
python3 ./mach test-wpt \
$WPT_LAYOUT_ARG \
$WPT_ALWAYS_SUCCEED_ARG \
${{ inputs.wpt-tests-to-run }} \
--${{ inputs.profile }} --processes $(nproc) --timeout-multiplier 2 \
--total-chunks ${{ env.max_chunk_id }} --this-chunk ${{ matrix.chunk_id }} \
--log-raw wpt-full-logs/linux-${{ inputs.wpt-layout }}/raw/${{ matrix.chunk_id }}.log \
--log-wptreport wpt-full-logs/linux-${{ inputs.wpt-layout }}/wptreport/${{ matrix.chunk_id }}.json \
--log-raw-unexpected wpt-filtered-logs/linux-${{ inputs.wpt-layout }}/${{ matrix.chunk_id }}.log \
--filter-intermittents wpt-filtered-logs/linux-${{ inputs.wpt-layout }}/${{ matrix.chunk_id }}.json
--filter-intermittents wpt-filtered-logs/linux-${{ inputs.wpt-layout }}/${{ matrix.chunk_id }}.json \
${{ inputs.wpt-args }}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Archive results (filtered)

View File

@@ -6,7 +6,7 @@ on:
required: false
default: "release"
type: string
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -35,7 +35,7 @@ on:
default: "release"
type: choice
options: ["release", "debug", "production"]
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -59,59 +59,92 @@ on:
env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
jobs:
# Runs the underlying job (“workload”) on a self-hosted runner if available,
# with the help of a `runner-select` job and a `runner-timeout` job.
runner-select:
uses: ./.github/workflows/self-hosted-runner-select.yml
secrets: inherit
with:
# Ubuntu 22.04 has glibc 2.34 so the binaries produced
# won't run on systems with older glibc e.g wpt.fyi
# runners which still use 20.04.
github-hosted-runner-label: ubuntu-${{ inputs.upload && '20.04' || '22.04' }}
self-hosted-image-name: servo-ubuntu2204
force-github-hosted-runner: ${{ inputs.upload }}
runner-timeout:
needs:
- runner-select
uses: ./.github/workflows/self-hosted-runner-timeout.yml
secrets: inherit
with:
selected-runner-label: ${{ needs.runner-select.outputs.selected-runner-label }}
is-self-hosted: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
build:
name: Linux Build
# Ubuntu 22.04 has glibc 2.34 so the binaries produced
# won't run on systems with older glibc e.g wpt.fyi
# runners which still use 20.04.
runs-on: ubuntu-${{ inputs.upload && '20.04' || '22.04' }}
needs:
- runner-select
name: Linux Build [${{ needs.runner-select.outputs.unique-id }}]
runs-on: ${{ needs.runner-select.outputs.selected-runner-label }}
steps:
- if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: |
echo SCCACHE_GHA_ENABLED=true >> $GITHUB_ENV
echo RUSTC_WRAPPER=sccache >> $GITHUB_ENV
echo CCACHE=sccache >> $GITHUB_ENV
echo CARGO_INCREMENTAL=0 >> $GITHUB_ENV
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 2 # This is necessary for `test-tidy`.
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name != 'pull_request_target' }}
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name == 'pull_request_target' }}
with:
ref: refs/pull/${{ github.event.number }}/head
fetch-depth: 2 # This is necessary for `test-tidy`.
ref: ${{ github.event.pull_request.head.sha }}
# Faster checkout for self-hosted runner that uses prebaked repo.
- if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name != 'pull_request_target' }}
run: git fetch --depth=1 origin $GITHUB_SHA
- if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name == 'pull_request_target' }}
run: git fetch --depth=1 origin ${{ github.event.pull_request.head.sha }}
- if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
# Same as `git switch --detach FETCH_HEAD`, but fixes up dirty working
# trees, in case the runner image was baked with a dirty working tree.
run: |
git switch --detach
git reset --hard FETCH_HEAD
# Install missing tools in a GitHub-hosted runner.
- name: Run sccache-cache
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
uses: mozilla-actions/sccache-action@v0.0.4
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
if: ${{ !inputs.upload }} # not needed on ubuntu 20.04 used for nightly
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) && !inputs.upload }} # not needed on ubuntu 20.04 used for nightly
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- uses: actions/setup-python@v5
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
with:
python-version: '3.10'
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Bootstrap Python
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: python3 -m pip install --upgrade pip
- name: Bootstrap dependencies
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: |
sudo apt update
python3 ./mach bootstrap
- name: Tidy
run: python3 ./mach test-tidy --no-progress --all
python3 ./mach bootstrap --skip-lints
# Always install crown, even on self-hosted runners, because it is tightly
# coupled to the rustc version, and we may have the wrong version if the
# commit we are building uses a different rustc version.
- name: Install crown
run: cargo install --path support/crown
- name: Build (${{ inputs.profile }})
run: |
python3 ./mach build --locked --${{ inputs.profile }}
python3 ./mach build --use-crown --locked --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-linux
- name: Smoketest
run: xvfb-run python3 ./mach smoketest --${{ inputs.profile }}
@@ -161,7 +194,7 @@ jobs:
needs: ["build"]
uses: ./.github/workflows/linux-wpt.yml
with:
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
wpt-args: ${{ inputs.wpt-args }}
profile: ${{ inputs.profile }}
wpt-sync-from-upstream: ${{ inputs.wpt-sync-from-upstream }}
wpt-layout: "layout-2020"
@@ -173,7 +206,7 @@ jobs:
needs: ["build"]
uses: ./.github/workflows/linux-wpt.yml
with:
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
wpt-args: ${{ inputs.wpt-args }}
profile: ${{ inputs.profile }}
wpt-sync-from-upstream: ${{ inputs.wpt-sync-from-upstream }}
wpt-layout: "layout-2013"

View File

@@ -3,7 +3,7 @@ name: Mac WPT Tests
on:
workflow_call:
inputs:
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -45,19 +45,20 @@ jobs:
run: |
gtar -xzf target.tar.gz
python3 -m pip install --upgrade pip
python3 ./mach bootstrap
python3 ./mach bootstrap --skip-lints
- name: Smoketest
run: python3 ./mach smoketest --${{ inputs.profile }}
- name: Run tests
run: |
mkdir -p wpt-filtered-logs/macos-${{ inputs.wpt-layout }}
mkdir -p wpt-full-logs/macos-${{ inputs.wpt-layout }}
python3 ./mach test-wpt $WPT_COMMAND_LINE_ARG ${{ inputs.wpt-tests-to-run }} \
python3 ./mach test-wpt $WPT_COMMAND_LINE_ARG \
--${{ inputs.profile }} --processes $(sysctl -n hw.logicalcpu) --timeout-multiplier 8 \
--total-chunks ${{ env.max_chunk_id }} --this-chunk ${{ matrix.chunk_id }} \
--log-raw wpt-full-logs/macos-${{ inputs.wpt-layout }}/${{ matrix.chunk_id }}.log \
--log-raw-unexpected wpt-filtered-logs/macos-${{ inputs.wpt-layout }}/${{ matrix.chunk_id }}.log \
--filter-intermittents wpt-filtered-logs/macos-${{ inputs.wpt-layout }}/${{ matrix.chunk_id }}.json
${{ inputs.wpt-args }}
- name: Archive results (filtered)
uses: actions/upload-artifact@v4
if: ${{ always() }}

View File

@@ -7,7 +7,7 @@ on:
required: false
default: "release"
type: string
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -32,7 +32,7 @@ on:
default: "release"
type: choice
options: ["release", "debug", "production"]
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -76,27 +76,19 @@ jobs:
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: refs/pull/${{ github.event.number }}/head
ref: ${{ github.event.pull_request.head.sha }}
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap
run: |
python3 -m pip install --upgrade pip
python3 ./mach bootstrap
python3 ./mach bootstrap --skip-lints
brew install gnu-tar
- name: Build (${{ inputs.profile }})
run: |
python3 ./mach build --locked --${{ inputs.profile }}
python3 ./mach build --use-crown --locked --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-macos
- name: Smoketest
uses: nick-fields/retry@v3
@@ -158,7 +150,7 @@ jobs:
with:
profile: ${{ inputs.profile }}
wpt-layout: "layout-2020"
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
wpt-args: ${{ inputs.wpt-args }}
secrets: inherit
wpt-2013:
@@ -169,5 +161,5 @@ jobs:
with:
profile: ${{ inputs.profile }}
wpt-layout: "layout-2013"
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
wpt-args: ${{ inputs.wpt-args }}
secrets: inherit

View File

@@ -38,6 +38,11 @@ jobs:
wpt-layout: ${{ github.event_name == 'pull_request' && 'none' || '2020' }}
secrets: inherit
lint:
name: Lint
uses: ./.github/workflows/lint.yml
secrets: inherit
build-android:
name: Android
if: ${{ github.event_name != 'pull_request' }}
@@ -64,6 +69,7 @@ jobs:
- "build-linux"
- "build-android"
- "build-ohos"
- "lint"
steps:
- name: Merge build timings
uses: actions/upload-artifact/merge@v4

View File

@@ -29,35 +29,27 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
arch: ['aarch64-unknown-linux-ohos']
arch: ['aarch64-unknown-linux-ohos', 'x86_64-unknown-linux-ohos']
steps:
- uses: actions/checkout@v4
if: github.event_name != 'issue_comment' && github.event_name != 'pull_request_target'
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 2
# This is necessary to checkout the pull request if this run was triggered
# via an `issue_comment` action on a pull request.
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'issue_comment' || github.event_name == 'pull_request_target'
if: github.event_name == 'pull_request_target'
with:
ref: refs/pull/${{ github.event.issue.number || github.event.number }}/head
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip virtualenv
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
run: sudo apt update && python3 ./mach bootstrap --skip-lints
- name: Setup OpenHarmony SDK
id: setup_sdk
uses: openharmony-rs/setup-ohos-sdk@v0.1

View File

@@ -2,6 +2,7 @@ name: WPT Export
on:
pull_request_target:
types: ['opened', 'synchronize', 'reopened', 'edited', 'closed']
branches: ['main']
jobs:
upstream:

View File

@@ -1,16 +0,0 @@
# This action is meant as a quick check to be run when pushing to
# branches on forks. This allows forks to test the build and unit
# tests automatically without opening a pull request.
name: Quick check
on:
push:
branches-ignore:
["main", "auto", "try", "try-*", "dependabot/**"]
jobs:
build-linux:
name: Linux
if: github.repository != 'servo/servo' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/linux.yml
with:
unit-tests: true

View File

@@ -0,0 +1,98 @@
name: Select Self-hosted Runner
on:
workflow_call:
inputs:
github-hosted-runner-label:
required: true
type: string
self-hosted-image-name:
required: true
type: string
self-hosted-runner-scope:
required: false
type: string
default: /orgs/${{ github.repository_owner }}/actions/runners
monitor-api-base-url:
required: false
type: string
default: https://ci0.servo.org
force-github-hosted-runner:
required: false
type: boolean
default: false
outputs:
unique-id:
value: ${{ jobs.runner-select.outputs.unique-id }}
selected-runner-label:
value: ${{ jobs.runner-select.outputs.selected-runner-label }}
is-self-hosted:
value: ${{ jobs.runner-select.outputs.is-self-hosted }}
jobs:
# Selects a self-hosted runner if available, or else a GitHub-hosted runner.
# We generate a unique id for the workload, then ask our monitor API to
# reserve a self-hosted runner for us.
runner-select:
name: Select Runner
runs-on: ubuntu-latest
outputs:
unique-id: ${{ steps.select.outputs.unique_id }}
selected-runner-label: ${{ steps.select.outputs.selected_runner_label }}
is-self-hosted: ${{ steps.select.outputs.is_self_hosted }}
steps:
- name: Select and reserve best available runner
id: select
run: |
github_hosted_runner_label='${{ inputs.github-hosted-runner-label }}'
self_hosted_image_name='${{ inputs.self-hosted-image-name }}'
self_hosted_runner_scope='${{ inputs.self-hosted-runner-scope }}'
monitor_api_base_url='${{ inputs.monitor-api-base-url }}'
set -euo pipefail
fall_back_to_github_hosted() {
echo 'Falling back to GitHub-hosted runner'
echo "selected_runner_label=$github_hosted_runner_label" | tee -a $GITHUB_OUTPUT
echo 'is_self_hosted=false' | tee -a $GITHUB_OUTPUT
exit 0
}
# Generate a unique id that allows the workload job to find the runner
# we are reserving for it (via runner labels), and allows the timeout
# job to find the workload job run (via the jobs friendly name), even
# if there are multiple instances in the workflow call tree.
unique_id=$(uuidgen)
echo "unique_id=$unique_id" | tee -a $GITHUB_OUTPUT
# Disable self-hosted runners by creating a repository variable named
# NO_SELF_HOSTED_RUNNERS with any non-empty value.
# <https://github.com/servo/servo/settings/variables/actions>
if [ -n '${{ vars.NO_SELF_HOSTED_RUNNERS }}' ]; then
echo 'NO_SELF_HOSTED_RUNNERS is set!'
# fall_back_to_github_hosted
fi
if [ '${{ inputs.force-github-hosted-runner }}' = true ]; then
echo 'inputs.force-github-hosted-runner is set!'
fall_back_to_github_hosted
fi
# Use the monitor API to reserve a runner. If we get an object with
# runner details, we succeeded. If we get null, we failed.
take_runner_url=$monitor_api_base_url/$self_hosted_image_name/$unique_id/${{ github.repository }}/${{ github.run_id }}
result=$(mktemp)
echo
echo POST "$take_runner_url"
if ! curl -sS --fail-with-body --connect-timeout 5 --max-time 30 -X POST "$take_runner_url" \
-H 'Authorization: Bearer ${{ secrets.SERVO_CI_MONITOR_API_TOKEN }}' > $result \
|| ! jq -e . $result > /dev/null; then
cat $result
echo
echo
echo 'No self-hosted runners available!'
fall_back_to_github_hosted
fi
echo
echo "selected_runner_label=reserved-for:$unique_id" | tee -a $GITHUB_OUTPUT
echo 'is_self_hosted=true' | tee -a $GITHUB_OUTPUT

View File

@@ -0,0 +1,39 @@
name: Detect Self-hosted Runner Timeout
on:
workflow_call:
inputs:
selected-runner-label:
required: true
type: string
is-self-hosted:
required: true
type: boolean
jobs:
# In the unlikely event a self-hosted runner was selected and reserved but it
# goes down before the workload starts, cancel the workflow run.
runner-timeout:
if: ${{ inputs.is-self-hosted }}
name: Detect Runner Timeout
runs-on: ubuntu-latest
steps:
- name: Wait a bit
run: sleep 30
- name: Cancel if workload job is still queued
run: |
run_url=/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
if [ "$(gh api "$run_url/jobs" \
| jq -er --arg id '${{ inputs.unique-id }}' \
'.jobs[] | select(.name | contains("[" + $id + "]")) | .status'
)" = queued ]; then
echo 'Timeout waiting for runner assignment!'
echo 'Hint: does this repo have permission to access the runner group?'
echo 'Hint: https://github.com/organizations/servo/settings/actions/runner-groups'
echo
echo 'Cancelling workflow run'
gh api "$run_url/cancel" --method POST
exit 1
fi

View File

@@ -82,9 +82,6 @@ jobs:
python-version: '3.10'
- uses: actions/checkout@v4
with:
# This is necessary to checkout the pull request if this run was triggered
# via an `label` action on a pull request.
ref: refs/pull/${{ github.event.number }}/head
sparse-checkout: |
python/servo/try_parser.py
sparse-checkout-cone-mode: false
@@ -139,7 +136,7 @@ jobs:
wpt-layout: ${{ matrix.wpt_layout }}
profile: ${{ matrix.profile }}
unit-tests: ${{ matrix.unit_tests }}
wpt-tests-to-run: ${{ matrix.wpt_tests_to_run }}
wpt-args: ${{ matrix.wpt_args }}
results:
name: Results

View File

@@ -10,7 +10,7 @@ on:
default: "release"
type: choice
options: ["release", "debug", "production"]
wpt-tests-to-run:
wpt-args:
default: ""
required: false
type: string
@@ -75,7 +75,7 @@ jobs:
if (context.eventName == "workflow_dispatch") {
// WPT-related overrides only affect Linux currently, as tests don't run by default on other platforms.
configuration.matrix[0].wpt_layout = "${{ inputs.wpt-layout }}" || "none";
configuration.matrix[0].wpt_tests_to_run = "${{ inputs.wpt-tests-to-run }}" || "";
configuration.matrix[0].wpt_args = "${{ inputs.wpt-args }}" || "";
let unit_tests = Boolean(${{ inputs.unit-tests }});
let profile = '${{ inputs.profile }}';
@@ -103,7 +103,7 @@ jobs:
wpt-layout: ${{ matrix.wpt_layout }}
profile: ${{ matrix.profile }}
unit-tests: ${{ matrix.unit_tests }}
wpt-tests-to-run: ${{ matrix.wpt_tests_to_run }}
wpt-args: ${{ matrix.wpt_args }}
build-result:
name: Result
@@ -113,6 +113,7 @@ jobs:
needs: [ "decision", "build" ]
steps:
- name: Merge build timings
continue-on-error: true
uses: actions/upload-artifact/merge@v4
with:
name: cargo-timings

View File

@@ -42,61 +42,105 @@ env:
# clang_sys will search msys path before Program Files\LLVM
# so we need to override this behaviour until we update clang-sys
# https://github.com/KyleMayes/clang-sys/issues/150
LIBCLANG_PATH: C:\\Program Files\\LLVM\\bin
LIBCLANG_PATH: C:\Program Files\LLVM\bin
RUSTUP_WINDOWS_PATH_ADD_BIN: 1
jobs:
# Runs the underlying job (“workload”) on a self-hosted runner if available,
# with the help of a `runner-select` job and a `runner-timeout` job.
runner-select:
uses: ./.github/workflows/self-hosted-runner-select.yml
secrets: inherit
with:
github-hosted-runner-label: windows-2022
self-hosted-image-name: servo-windows10
runner-timeout:
needs:
- runner-select
uses: ./.github/workflows/self-hosted-runner-timeout.yml
secrets: inherit
with:
selected-runner-label: ${{ needs.runner-select.outputs.selected-runner-label }}
is-self-hosted: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
build:
name: Windows Build
runs-on: windows-2022
needs:
- runner-select
name: Windows Build [${{ needs.runner-select.outputs.unique-id }}]
runs-on: ${{ needs.runner-select.outputs.selected-runner-label }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
- if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name != 'pull_request_target' }}
uses: actions/checkout@v4
- if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name == 'pull_request_target' }}
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.number }}/head
fetch-depth: 2
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
# Faster checkout for self-hosted runner that uses prebaked repo.
- if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name != 'pull_request_target' }}
run: git fetch --depth=1 origin $env:GITHUB_SHA
- if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) && github.event_name == 'pull_request_target' }}
run: git fetch --depth=1 origin ${{ github.event.pull_request.head.sha }}
- if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
# Same as `git switch --detach FETCH_HEAD`, but fixes up dirty working
# trees, in case the runner image was baked with a dirty working tree.
run: |
git switch --detach
git reset --hard FETCH_HEAD
- name: ccache
# FIXME: “Error: Restoring cache failed: Error: Unable to locate executable file: sh.”
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
uses: hendrikmuhs/ccache-action@v1.2
# Install missing tools in a GitHub-hosted runner.
# Workaround for https://github.com/actions/runner-images/issues/10001:
- name: Upgrade llvm
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: choco upgrade llvm
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install wixtoolset
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: |
choco install wixtoolset
echo "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/setup-python@v5
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
with:
python-version: "3.10"
- name: Bootstrap
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: |
python -m pip install --upgrade pip
python mach fetch
python mach bootstrap-gstreamer
cargo install --path support/crown
# For some reason WiX isn't currently on the GitHub runner path. This is a
# temporary workaround until that is fixed.
- name: Add WiX to Path
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: |
"$env:WIX\bin" >> $env:GITHUB_PATH
# Always install crown, even on self-hosted runners, because it is tightly
# coupled to the rustc version, and we may have the wrong version if the
# commit we are building uses a different rustc version.
- name: Install crown
run: cargo install --path support/crown --force
- name: Debug logging for incremental builds
if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
run: |
cat C:\init\incremental_build_debug.txt
echo "`$env:LIBCLANG_PATH now = $env:LIBCLANG_PATH"
echo "`$env:PATH now = $env:PATH"
- name: Build (${{ inputs.profile }})
run: |
python mach build --locked --${{ inputs.profile }}
python mach build --use-crown --locked --${{ inputs.profile }}
cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse
- name: Copy resources
if: ${{ ! fromJSON(needs.runner-select.outputs.is-self-hosted) }}
# GitHub-hosted runners check out the repo on D: drive.
run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse
- name: Smoketest
run: python mach smoketest --${{ inputs.profile }}

4
.gitignore vendored
View File

@@ -12,6 +12,7 @@
/python/_venv*
/python/tidy/servo_tidy.egg-info
/tests/wpt/sync
/tests/dromaeo/dromaeo
*.pkl
*.pyc
*.swp
@@ -22,9 +23,10 @@
.coverage
.DS_Store
Servo.app
servo.pftrace
.config.mk.last
/glfw
capture_webrender/
webrender-captures/
/screenshots
# Allow CSV files to be used as resources in tests

View File

@@ -1,6 +1,6 @@
# Code of Conduct
The Servo Project follows the [**Rust Code of Conduct**](https://www.rust-lang.org/policies/code-of-conduct), with two differences.
The Servo Project follows the [**Rust Code of Conduct**](https://www.rust-lang.org/policies/code-of-conduct), with the differences below.
Our code of conduct applies to the [Servo Zulip channels](https://servo.zulipchat.com/), [GitHub repositories](https://github.com/servo), and all official Servo venues, rather than the Rust project.

View File

@@ -1,78 +1,5 @@
# Contributing to Servo
Servo welcomes contribution from everyone. Here are the guidelines if you are
thinking of helping us:
## Contributions
Contributions to Servo or its dependencies should be made in the form of GitHub
pull requests. Each pull request will be reviewed by a core contributor
(someone with permission to land patches) and either landed in the main tree or
given feedback for changes that would be required. All contributions should
follow this format, even those from core contributors.
Should you wish to work on an issue, please claim it first by commenting on
the GitHub issue that you want to work on it. This is to prevent duplicated
efforts from contributors on the same issue.
Head over to [Servo Starters](https://starters.servo.org/) to find
good tasks to start with. If you come across words or jargon that do not make
sense, please check [the glossary](docs/glossary.md) first. If there's no
matching entry, please make a pull request to add one with the content `TODO`
so we can correct that!
See [`HACKING_QUICKSTART.md`](docs/HACKING_QUICKSTART.md) for more information
on how to start working on Servo.
## Pull request checklist
- Branch from the main branch and, if needed, rebase to the current main branch
before submitting your pull request. If it doesn't merge cleanly with main
you may be asked to rebase your changes.
- Commits should be as small as possible, while ensuring that each commit is
correct independently (i.e., each commit should compile and pass tests).
- Commits should be accompanied by a Developer Certificate of Origin
(http://developercertificate.org) sign-off, which indicates that you (and
your employer if applicable) agree to be bound by the terms of the
[project license](LICENSE). In git, this is the `-s` option to `git commit`.
- If your patch is not getting reviewed or you need a specific person to review
it, you can @-reply a reviewer asking for a review in the pull request or a
comment, or you can ask for a review in [the Servo chat](https://servo.zulipchat.com/).
- Add tests relevant to the fixed bug or new feature. For a DOM change this
will usually be a web platform test; for layout, a reftest. See our [testing
guide](https://github.com/servo/servo/wiki/Testing) for more information.
For specific git instructions, see [GitHub workflow 101](https://github.com/servo/servo/wiki/Github-workflow).
## Running tests in pull requests
When you push to a pull request, GitHub automatically checks that your changes have no compilation, lint, or tidy errors.
To run unit tests or Web Platform Tests against a pull request, add one or more of the labels below to your pull request. If you do not have permission to add labels to your pull request, add a comment on your bug requesting that they be added.
| Label | Effect |
|---|---|
| `T-full` | Unit tests: Linux, macOS, Windows<br>Layout tests: Linux, macOS<br>Legacy layout tests: Linux, macOS |
| `T-linux-wpt-2013` | Unit tests: Linux<br>Legacy layout tests: Linux |
| `T-linux-wpt-2020` | Unit tests: Linux<br>Layout tests: Linux |
| `T-macos` | Unit tests: macOS |
| `T-windows` | Unit tests: Windows |
## Conduct
Servo Code of Conduct is published at <https://servo.org/coc/>.
## Communication
Servo contributors frequent the [Servo Zulip chat](https://servo.zulipchat.com/).
## Technical Steering Committee
Technical oversight of the Servo Project is provided by the
[Technical Steering Committee](https://github.com/servo/project/blob/main/governance/tsc/README.md).
Moved to the Servo book:
- [Contributing to Servo](https://book.servo.org/contributing.html)

2121
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,18 +25,20 @@ background_hang_monitor_api = { path = "components/shared/background_hang_monito
backtrace = "0.3"
base = { path = "components/shared/base" }
base64 = "0.21.7"
bitflags = "2.5"
bincode = "1"
bitflags = "2.6"
bluetooth_traits = { path = "components/shared/bluetooth" }
byteorder = "1.5"
canvas_traits = { path = "components/shared/canvas" }
cfg-if = "1.0.0"
chrono = { version = "0.4", features = ["serde"] }
compositing_traits = { path = "components/shared/compositing" }
content-security-policy = { version = "0.5", features = ["serde"] }
cookie = "0.12"
cookie = { package = "cookie", version = "0.18" }
crossbeam-channel = "0.5"
cssparser = { version = "0.34", features = ["serde"] }
darling = { version = "0.20", default-features = false }
data-url = "0.1.0"
data-url = "0.3"
devtools_traits = { path = "components/shared/devtools" }
embedder_traits = { path = "components/shared/embedder" }
encoding_rs = "0.8"
@@ -56,7 +58,7 @@ gstreamer-gl-sys = "0.22"
gstreamer-sys = "0.22"
gstreamer-video = "0.22"
headers = "0.3"
html5ever = "0.27"
html5ever = "0.28"
http = "0.2"
hyper = "0.14"
hyper-rustls = { version = "0.24", default-features = false, features = ["acceptor", "http1", "http2", "logging", "tls12", "webpki-tokio"] }
@@ -64,21 +66,22 @@ hyper_serde = { path = "components/hyper_serde" }
icu_segmenter = "1.5.0"
image = "0.24"
imsz = "0.2"
indexmap = { version = "2.2.6", features = ["std"] }
indexmap = { version = "2.5.0", features = ["std"] }
ipc-channel = "0.18"
itertools = "0.13"
jemalloc-sys = "0.5.4"
jemallocator = "0.5.4"
tikv-jemalloc-sys = "0.6.0"
tikv-jemallocator = "0.6.0"
keyboard-types = "0.7"
lazy_static = "1.4"
libc = "0.2"
log = "0.4"
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-05-15", features = ["servo"] }
mach2 = "0.4"
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
malloc_size_of_derive = "0.1"
mime = "0.3.13"
mime_guess = "2.0.3"
mime_guess = "2.0.5"
mozangle = "0.5.1"
net_traits = { path = "components/shared/net" }
nix = "0.29"
num-traits = "0.2"
num_cpus = "1.1.0"
parking_lot = "0.12"
@@ -95,51 +98,55 @@ rustls = { version = "0.21.12", features = ["dangerous_configuration"] }
rustls-pemfile = "1.0.4"
script_layout_interface = { path = "components/shared/script_layout" }
script_traits = { path = "components/shared/script" }
selectors = { git = "https://github.com/servo/stylo", branch = "2024-05-15" }
serde = "1.0.203"
selectors = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
serde = "1.0.209"
serde_bytes = "0.11"
serde_json = "1.0"
servo-media = { git = "https://github.com/servo/media" }
servo-media-dummy = { git = "https://github.com/servo/media" }
servo-media-gstreamer = { git = "https://github.com/servo/media" }
servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-05-15" }
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-05-15" }
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-05-15" }
servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
smallbitvec = "2.5.3"
smallvec = "1.13"
sparkle = "0.1.26"
string_cache = "0.8"
string_cache_codegen = "0.5"
style = { git = "https://github.com/servo/stylo", branch = "2024-05-15", features = ["servo"] }
style_config = { git = "https://github.com/servo/stylo", branch = "2024-05-15" }
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-05-15", features = ["servo"] }
# NOTE: the sm-angle feature only enables ANGLE on Windows, not other platforms!
surfman = { version = "0.9", features = ["chains", "sm-angle", "sm-angle-default"] }
style = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
style_config = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-07-16" }
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
surfman = { version = "0.9.8", features = ["chains"] }
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
synstructure = "0.13"
thin-vec = "0.2.13"
time = "0.1.41"
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-05-15" }
time_03 = { package = "time", version = "0.3", features = ["large-dates", "serde"] }
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
tokio = "1"
tokio-rustls = "0.24"
tungstenite = "0.20"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
tracing-perfetto = "0.1.1"
uluru = "3.0"
unicode-bidi = "0.3.15"
unicode-properties = { version = "0.1.1", features = ["emoji"] }
unicode-properties = { version = "0.1.2", features = ["emoji"] }
unicode-script = "0.5"
unicode-segmentation = "1.1.0"
url = "2.5"
uuid = { version = "1.8.0", features = ["v4"] }
uuid = { version = "1.10.0", features = ["v4"] }
webdriver = "0.49.0"
webpki-roots = "0.25"
webrender = { git = "https://github.com/servo/webrender", branch = "0.64", features = ["capture"] }
webrender_api = { git = "https://github.com/servo/webrender", branch = "0.64" }
webrender = { git = "https://github.com/servo/webrender", branch = "0.65", features = ["capture"] }
webrender_api = { git = "https://github.com/servo/webrender", branch = "0.65" }
webrender_traits = { path = "components/shared/webrender" }
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "d0a5e48aa7e84683114c3870051cc414ae92ac03" }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "d0a5e48aa7e84683114c3870051cc414ae92ac03" }
windows-sys = "0.52"
xi-unicode = "0.1.0"
xml5ever = "0.18"
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "0e352f5b3448236b6cbebcd146d0606b00cb3806" }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "0e352f5b3448236b6cbebcd146d0606b00cb3806" }
windows-sys = "0.59"
xi-unicode = "0.3.0"
xml5ever = "0.19"
[profile.release]
opt-level = 3
@@ -151,6 +158,12 @@ debug-assertions = true
[profile.production]
inherits = "release"
debug-assertions = false
lto = "thin"
codegen-units = 1
[profile.production-stripped]
inherits = "production"
strip = true
[patch.crates-io]
# If you need to temporarily test Servo with a local fork of some upstream
@@ -162,6 +175,7 @@ debug-assertions = false
#
# [patch."https://github.com/servo/stylo"]
# derive_common = { path = "../stylo/derive_common" }
# dom = { path = "../stylo/dom" }
# malloc_size_of = { path = "../stylo/malloc_size_of" }
# selectors = { path = "../stylo/selectors" }
# servo_arc = { path = "../stylo/servo_arc" }
@@ -174,6 +188,12 @@ debug-assertions = false
# style_traits = { path = "../stylo/style_traits" }
# to_shmem = { path = "../stylo/to_shmem" }
#
# Or for WebRender:
#
# [patch."https://github.com/servo/webrender"]
# webrender = { path = "../webrender/webrender" }
# webrender_api = { path = "../webrender/webrender_api" }
#
# Or for another Git dependency:
#
# [patch."https://github.com/servo/<repository>"]

210
README.md
View File

@@ -4,79 +4,50 @@ Servo is a prototype web browser engine written in the
[Rust](https://github.com/rust-lang/rust) language. It is currently developed on
64-bit macOS, 64-bit Linux, 64-bit Windows, and Android.
Servo welcomes contribution from everyone. See
[`CONTRIBUTING.md`](CONTRIBUTING.md) and [`HACKING_QUICKSTART.md`](docs/HACKING_QUICKSTART.md)
for help getting started.
Servo welcomes contribution from everyone. Check out [The Servo Book](https://book.servo.org) to get started, or go to [servo.org](https://servo.org/) for news and guides.
Visit the [Servo Project page](https://servo.org/) for news and guides.
## Getting started
## Getting Servo
``` sh
git clone https://github.com/servo/servo
cd servo
```
- Your CARGO_HOME needs to point to (or be in) the same drive as your
Servo repository ([#28530](https://github.com/servo/servo/issues/28530)).
- The Servo repository is big! If you have an unreliable network connection, consider
[making a shallow clone](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/).
## Build Setup
* [macOS](#macos)
* [Linux](#Linux)
* [Windows](#windows)
* [Android](https://github.com/servo/servo/wiki/Building-for-Android)
If these instructions fail or you would like to install dependencies
manually, try the [manual build setup][manual-build].
For more detailed build instructions, see the Servo book under [Setting up your environment](https://book.servo.org/hacking/setting-up-your-environment.html), [Building Servo](https://book.servo.org/hacking/building-servo.html), and [Building for Android](https://book.servo.org/hacking/building-for-android.html).
### macOS
- Ensure that the version showed by `python --version` is >= 3.10:
- Install [Xcode](https://developer.apple.com/xcode/)
- Install [Homebrew](https://brew.sh/)
- Run `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- Run `./mach bootstrap`<br/>
*Note: This will install the recommended version of GStreamer globally on your system.*
- Download and install [`python`](https://www.python.org/downloads/macos/), [Xcode](https://developer.apple.com/xcode/), and [`brew`](https://brew.sh/)
- Install `rustup`: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- Restart your shell to make sure `cargo` is available
- Install the other dependencies: `./mach bootstrap`
- Build servoshell: `./mach build`
### Linux
- Run `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- Install Python (version >= 3.10):
- **Debian-like:** Run `sudo apt install python3-pip python3-venv`
- **Fedora:** Run `sudo dnf install python3 python3-pip python3-devel`
- **Arch:** Run `sudo pacman -S --needed python python-pip`
- **Gentoo:** Run `sudo emerge dev-python/pip`
- Run `./mach bootstrap`
- Install `curl` and `python`:
- Arch: `sudo pacman -S --needed curl python python-pip`
- Debian, Ubuntu: `sudo apt install curl python3-pip python3-venv`
- Fedora: `sudo dnf install curl python3 python3-pip python3-devel`
- Gentoo: `sudo emerge net-misc/curl dev-python/pip`
- Install `rustup`: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- Restart your shell to make sure `cargo` is available
- Install the other dependencies: `./mach bootstrap`
- Build servoshell: `./mach build`
### Windows
- Download and run [`rustup-init.exe`](https://win.rustup.rs/)
- Make sure to select *Quick install via the Visual Studio Community
installer* or otherwise install Visual Studio 2022.
- In the *Visual Studio Installer* ensure the following components are installed for Visual Studio 2022:
- **Windows 10 SDK (10.0.19041.0)** (`Microsoft.VisualStudio.Component.Windows10SDK.19041`)
- **MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)** (`Microsoft.VisualStudio.Component.VC.Tools.x86.x64`)
- **C++ ATL for latest v143 build tools (x86 & x64)** (`Microsoft.VisualStudio.Component.VC.ATL`)
- **C++ MFC for latest v143 build tools (x86 & x64)** (`Microsoft.VisualStudio.Component.VC.ATLMFC`)
- Install [chocolatey](https://chocolatey.org/)
- Install [Python 3.11](https://www.python.org/downloads/windows/)
- Run `mach bootstrap`
+ *This will install CMake, Git, and Ninja via choco in an
Administrator console. Allow the scripts to run and once
the operation finishes, close the new console.*
- Run `refreshenv`
See also [Windows Troubleshooting Tips][windows-tips].
- Download and install [`python`](https://www.python.org/downloads/windows/), [`choco`](https://chocolatey.org/install#individual), and [`rustup`](https://win.rustup.rs/)
- Be sure to select *Quick install via the Visual Studio Community installer*
- In the Visual Studio Installer, ensure the following components are installed:
- **Windows 10 SDK (10.0.19041.0)** (`Microsoft.VisualStudio.Component.Windows10SDK.19041`)
- **MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)** (`Microsoft.VisualStudio.Component.VC.Tools.x86.x64`)
- **C++ ATL for latest v143 build tools (x86 & x64)** (`Microsoft.VisualStudio.Component.VC.ATL`)
- **C++ MFC for latest v143 build tools (x86 & x64)** (`Microsoft.VisualStudio.Component.VC.ATLMFC`)
- Restart your shell to make sure `cargo` is available
- Install the other dependencies: `.\mach bootstrap`
- Build servoshell: `.\mach build`
### Android
- Ensure that the following environment variables are set:
- `ANDROID_SDK_ROOT`
- `ANDROID_NDK_ROOT`: `$ANDROID_SDK_ROOT/ndk/25.2.9519653/`
- `ANDROID_NDK_ROOT`: `$ANDROID_SDK_ROOT/ndk/26.2.11394342/`
`ANDROID_SDK_ROOT` can be any directory (such as `~/android-sdk`).
All of the Android build dependencies will be installed there.
- Install the latest version of the [Android command-line
@@ -87,130 +58,9 @@ See also [Windows Troubleshooting Tips][windows-tips].
sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install
"build-tools;33.0.2" \
"emulator" \
"ndk;25.2.9519653" \
"ndk;26.2.11394342" \
"platform-tools" \
"platforms;android-33" \
"system-images;android-33;google_apis;x86_64"
```
For information about building and running the Android build, see
the [Android documentation][android-docs].
## Building
Servo is built with [Cargo](https://crates.io/), the Rust package manager.
We also use Mozilla's Mach tools to orchestrate the build and other tasks.
You can call Mach like this:
On Unix systems:
```
./mach [command] [arguments]
```
On Windows Commandline:
```
mach.bat [command] [arguments]
```
The examples below will use Unix, but the same applies to Windows.
### The Rust compiler
Servo's build system uses rustup.rs to automatically download a Rust compiler.
This is a specific version of Rust Nightly determined by the
[`rust-toolchain.toml`](https://github.com/servo/servo/blob/main/rust-toolchain.toml) file.
### Normal build
To build Servo in development mode.
This is useful for development, but the resulting binary is very slow:
``` sh
./mach build --dev
./mach run tests/html/about-mozilla.html
```
### Release build
For benchmarking, performance testing, or real-world use.
Add the `--release` flag to create an optimized build:
``` sh
./mach build --release
./mach run --release tests/html/about-mozilla.html
```
### Android build
For an armv7 Android build run the following command.
```shell
./mach build --android
```
### Checking for build errors, without building
If youre making changes to one crate that cause build errors in another crate,
consider this instead of a full build:
```sh
./mach check
```
It will run `cargo check`, which runs the analysis phase of the compiler
(and so shows build errors if any) but skips the code generation phase.
This can be a lot faster than a full build,
though of course it doesnt produce a binary you can run.
## Running
Run Servo with the command:
```sh
./servo [url] [arguments] # if you run with nightly build
./mach run [url] [arguments] # if you run with mach
# For example
./mach run https://www.google.com
```
### Commandline Arguments
- `-p INTERVAL` turns on the profiler and dumps info to the console every
`INTERVAL` seconds
- `-s SIZE` sets the tile size for painting; defaults to 512
- `-z` disables all graphical output; useful for running JS / layout tests
- `-Z help` displays useful output to debug servo
### Keyboard Shortcuts
- `Ctrl`+`L` opens URL prompt (`Cmd`+`L` on Mac)
- `Ctrl`+`R` reloads current page (`Cmd`+`R` on Mac)
- `Ctrl`+`-` zooms out (`Cmd`+`-` on Mac)
- `Ctrl`+`=` zooms in (`Cmd`+`=` on Mac)
- `Alt`+`left arrow` goes backwards in the history (`Cmd`+`left arrow` on Mac)
- `Alt`+`right arrow` goes forwards in the history (`Cmd`+`right arrow` on Mac)
- `Esc` or `Ctrl`+`Q` exits Servo (`Cmd`+`Q` on Mac)
### Runtime dependencies
#### Linux
* `GStreamer` >=1.18
* `gst-plugins-base` >=1.18
* `gst-plugins-good` >=1.18
* `gst-plugins-bad` >=1.18
* `gst-plugins-ugly` >=1.18
* `libXcursor`
* `libXrandr`
* `libXi`
* `libxkbcommon`
* `vulkan-loader`
## Developing
There are lots of mach commands you can use. You can list them with `./mach
--help`.
The generated documentation can be found on https://doc.servo.org/servo/index.html
[manual-build]: https://github.com/servo/servo/wiki/Building#manual-build-setup
[windows-tips]: https://github.com/servo/servo/wiki/Building#troubleshooting-the-windows-build
[android-docs]: https://github.com/servo/servo/wiki/Building-for-Android
- Follow the instructions above for the platform you are building on

View File

@@ -13,8 +13,8 @@ path = "lib.rs"
use-system-allocator = ["libc"]
[target.'cfg(not(any(windows, target_env = "ohos")))'.dependencies]
jemallocator = { workspace = true }
jemalloc-sys = { workspace = true }
tikv-jemallocator = { workspace = true }
tikv-jemalloc-sys = { workspace = true }
libc = { workspace = true, optional = true }
[target.'cfg(windows)'.dependencies]

View File

@@ -13,7 +13,7 @@ pub use crate::platform::*;
mod platform {
use std::os::raw::c_void;
pub use jemallocator::Jemalloc as Allocator;
pub use tikv_jemallocator::Jemalloc as Allocator;
/// Get the size of a heap block.
///
@@ -21,12 +21,12 @@ mod platform {
///
/// Passing a non-heap allocated pointer to this function results in undefined behavior.
pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize {
jemallocator::usable_size(ptr)
tikv_jemallocator::usable_size(ptr)
}
/// Memory allocation APIs compatible with libc
pub mod libc_compat {
pub use jemalloc_sys::{free, malloc, realloc};
pub use tikv_jemalloc_sys::{free, malloc, realloc};
}
}

View File

@@ -22,12 +22,9 @@ libc = { workspace = true }
log = { workspace = true }
serde_json = { workspace = true }
[dev-dependencies]
lazy_static = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies]
mach2 = "0.4"
[target.'cfg(all(target_os = "linux", not(any(target_arch = "arm", target_arch = "aarch64"))))'.dependencies]
nix = { version = "0.27", features = ["signal"] }
[target.'cfg(all(target_os = "linux", not(any(target_arch = "arm", target_arch = "aarch64", target_env = "ohos", target_env = "musl"))))'.dependencies]
nix = { workspace = true, features = ["signal"] }
unwind-sys = "0.1.4"

View File

@@ -98,12 +98,25 @@ impl BackgroundHangMonitorRegister for HangMonitorRegister {
let sampler = crate::sampler_mac::MacOsSampler::new_boxed();
#[cfg(all(
target_os = "linux",
not(any(target_arch = "arm", target_arch = "aarch64"))
not(any(
target_arch = "arm",
target_arch = "aarch64",
target_env = "ohos",
target_env = "musl"
)),
))]
let sampler = crate::sampler_linux::LinuxSampler::new_boxed();
#[cfg(any(
target_os = "android",
all(target_os = "linux", any(target_arch = "arm", target_arch = "aarch64"))
all(
target_os = "linux",
any(
target_arch = "arm",
target_arch = "aarch64",
target_env = "ohos",
target_env = "musl"
)
)
))]
let sampler = crate::sampler::DummySampler::new_boxed();

View File

@@ -8,7 +8,12 @@ pub mod background_hang_monitor;
mod sampler;
#[cfg(all(
target_os = "linux",
not(any(target_arch = "arm", target_arch = "aarch64"))
not(any(
target_arch = "arm",
target_arch = "aarch64",
target_env = "ohos",
target_env = "musl"
))
))]
mod sampler_linux;
#[cfg(target_os = "macos")]

View File

@@ -17,9 +17,7 @@ use background_hang_monitor_api::{
use base::id::TEST_PIPELINE_ID;
use ipc_channel::ipc;
lazy_static::lazy_static! {
static ref SERIAL: Mutex<()> = Mutex::new(());
}
static SERIAL: Mutex<()> = Mutex::new(());
#[test]
fn test_hang_monitoring() {

View File

@@ -6,7 +6,7 @@ use std::collections::HashMap;
use std::error::Error;
use std::sync::Arc;
const NOT_SUPPORTED_ERROR: &'static str = "Error! Not supported platform!";
const NOT_SUPPORTED_ERROR: &str = "Error! Not supported platform!";
#[derive(Clone, Debug)]
pub struct EmptyAdapter {}

View File

@@ -11,18 +11,17 @@ name = "canvas"
path = "lib.rs"
[features]
no-wgl = ["surfman/sm-no-wgl"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
xr-profile = ["webxr-api/profile", "time"]
[dependencies]
app_units = { workspace = true }
bitflags = { workspace = true }
byteorder = { workspace = true }
canvas_traits = { workspace = true }
crossbeam-channel = { workspace = true }
cssparser = { workspace = true }
euclid = { workspace = true }
font-kit = { version = "0.13" }
font-kit = { version = "0.14" }
fnv = { workspace = true }
fonts = { path = "../fonts" }
half = "2"
@@ -31,15 +30,17 @@ log = { workspace = true }
lyon_geom = "1.0.4"
net_traits = { workspace = true }
num-traits = { workspace = true }
parking_lot = { workspace = true }
pathfinder_geometry = "0.5"
pixels = { path = "../pixels" }
raqote = "0.8.4"
range = { path = "../range" }
raqote = { git = "https://github.com/jrmuizel/raqote", rev = "64716c8" }
servo_arc = { workspace = true }
sparkle = { workspace = true }
style = { workspace = true }
style_traits = { workspace = true }
surfman = { workspace = true }
time = { workspace = true, optional = true }
unicode-script = { workspace = true }
webrender = { workspace = true }
webrender_api = { workspace = true }
webrender_traits = { workspace = true }

View File

@@ -5,23 +5,22 @@
use std::mem;
use std::sync::Arc;
use app_units::Au;
use canvas_traits::canvas::*;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use euclid::{point2, vec2};
use font_kit::family_name::FamilyName;
use font_kit::font::Font;
use font_kit::metrics::Metrics;
use font_kit::properties::{Properties, Stretch, Style, Weight};
use font_kit::source::SystemSource;
use fonts::{FontCacheThread, FontContext, FontTemplateRefMethods};
use euclid::default::{Box2D, Point2D, Rect, Size2D, Transform2D, Vector2D};
use euclid::point2;
use fonts::{
ByteIndex, FontBaseline, FontCacheThread, FontContext, FontGroup, FontMetrics, FontRef,
GlyphInfo, GlyphStore, ShapingFlags, ShapingOptions, LAST_RESORT_GLYPH_ADVANCE,
};
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
use log::{debug, error, warn};
use log::{debug, warn};
use num_traits::ToPrimitive;
use range::Range;
use servo_arc::Arc as ServoArc;
use style::color::AbsoluteColor;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font;
use style_traits::values::ToCss;
use unicode_script::Script;
use webrender_api::units::{DeviceIntSize, RectExt as RectExt_};
use webrender_api::{ImageData, ImageDescriptor, ImageDescriptorFlags, ImageFormat, ImageKey};
use webrender_traits::ImageUpdate;
@@ -232,10 +231,78 @@ impl<'a> PathBuilderRef<'a> {
}
}
// TODO(pylbrecht)
// This defines required methods for DrawTarget of azure and raqote
// The prototypes are derived from azure's methods.
// TODO: De-abstract now that Azure is removed?
#[derive(Debug, Default)]
struct UnshapedTextRun<'a> {
font: Option<FontRef>,
script: Script,
string: &'a str,
}
impl<'a> UnshapedTextRun<'a> {
fn script_and_font_compatible(&self, script: Script, other_font: &Option<FontRef>) -> bool {
if self.script != script {
return false;
}
match (&self.font, other_font) {
(Some(font_a), Some(font_b)) => font_a.identifier() == font_b.identifier(),
(None, None) => true,
_ => false,
}
}
fn into_shaped_text_run(self) -> Option<TextRun> {
let font = self.font?;
if self.string.is_empty() {
return None;
}
let word_spacing = Au::from_f64_px(
font.glyph_index(' ')
.map(|glyph_id| font.glyph_h_advance(glyph_id))
.unwrap_or(LAST_RESORT_GLYPH_ADVANCE),
);
let options = ShapingOptions {
letter_spacing: None,
word_spacing,
script: self.script,
flags: ShapingFlags::empty(),
};
let glyphs = font.shape_text(self.string, &options);
Some(TextRun { font, glyphs })
}
}
pub struct TextRun {
pub font: FontRef,
pub glyphs: Arc<GlyphStore>,
}
impl TextRun {
fn bounding_box(&self) -> Rect<f32> {
let mut bounding_box = None;
let mut bounds_offset: f32 = 0.;
let glyph_ids = self
.glyphs
.iter_glyphs_for_byte_range(&Range::new(ByteIndex(0), self.glyphs.len()))
.map(GlyphInfo::id);
for glyph_id in glyph_ids {
let bounds = self.font.typographic_bounds(glyph_id);
let amount = Vector2D::new(bounds_offset, 0.);
let bounds = bounds.translate(amount);
let initiated_bbox = bounding_box.get_or_insert_with(|| {
let origin = Point2D::new(bounds.min_x(), 0.);
Box2D::new(origin, origin).to_rect()
});
bounding_box = Some(initiated_bbox.union(&bounds));
bounds_offset = bounds.max_x();
}
bounding_box.unwrap_or_default()
}
}
// This defines required methods for a DrawTarget (currently only implemented for raqote). The
// prototypes are derived from the now-removed Azure backend's methods.
pub trait GenericDrawTarget {
fn clear_rect(&mut self, rect: &Rect<f32>);
fn copy_surface(
@@ -268,9 +335,7 @@ pub trait GenericDrawTarget {
fn fill(&mut self, path: &Path, pattern: Pattern, draw_options: &DrawOptions);
fn fill_text(
&mut self,
font: &Font,
point_size: f32,
text: &str,
text_runs: Vec<TextRun>,
start: Point2D<f32>,
pattern: &Pattern,
draw_options: &DrawOptions,
@@ -455,7 +520,85 @@ impl<'a> CanvasData<'a> {
}
}
// https://html.spec.whatwg.org/multipage/#text-preparation-algorithm
pub fn fill_text_with_size(
&mut self,
text: String,
x: f64,
y: f64,
max_width: Option<f64>,
is_rtl: bool,
size: f64,
) {
// > Step 2: Replace all ASCII whitespace in text with U+0020 SPACE characters.
let text = replace_ascii_whitespace(text);
// > Step 3: Let font be the current font of target, as given by that object's font
// > attribute.
let Some(ref font_style) = self.state.font_style else {
return;
};
let font_group = self
.font_context
.font_group_with_size(font_style.clone(), Au::from_f64_px(size));
let mut font_group = font_group.write();
let Some(first_font) = font_group.first(&self.font_context) else {
warn!("Could not render canvas text, because there was no first font.");
return;
};
let runs = self.build_unshaped_text_runs(&text, &mut font_group);
// TODO: This doesn't do any kind of line layout at all. In particular, there needs
// to be some alignment along a baseline and also support for bidi text.
let shaped_runs: Vec<_> = runs
.into_iter()
.filter_map(UnshapedTextRun::into_shaped_text_run)
.collect();
let total_advance = shaped_runs
.iter()
.map(|run| run.glyphs.total_advance())
.sum::<Au>()
.to_f64_px();
// > Step 6: If maxWidth was provided and the hypothetical width of the inline box in the
// > hypothetical line box is greater than maxWidth CSS pixels, then change font to have a
// > more condensed font (if one is available or if a reasonably readable one can be
// > synthesized by applying a horizontal scale factor to the font) or a smaller font, and
// > return to the previous step.
//
// TODO: We only try decreasing the font size here. Eventually it would make sense to use
// other methods to try to decrease the size, such as finding a narrower font or decreasing
// spacing.
if let Some(max_width) = max_width {
let new_size = (max_width / total_advance * size).floor().max(5.);
if total_advance > max_width && new_size != size {
self.fill_text_with_size(text, x, y, Some(max_width), is_rtl, new_size);
return;
}
}
// > Step 7: Find the anchor point for the line of text.
let start = self.find_anchor_point_for_line_of_text(
x as f32,
y as f32,
&first_font.metrics,
total_advance as f32,
is_rtl,
);
// > Step 8: Let result be an array constructed by iterating over each glyph in the inline box
// > from left to right (if any), adding to the array, for each glyph, the shape of the glyph
// > as it is in the inline box, positioned on a coordinate space using CSS pixels with its
// > origin is at the anchor point.
self.drawtarget.fill_text(
shaped_runs,
start,
&self.state.fill_style,
&self.state.draw_options,
);
}
/// <https://html.spec.whatwg.org/multipage/#text-preparation-algorithm>
pub fn fill_text(
&mut self,
text: String,
@@ -464,77 +607,138 @@ impl<'a> CanvasData<'a> {
max_width: Option<f64>,
is_rtl: bool,
) {
// Step 2.
let text = replace_ascii_whitespace(text);
// Step 3.
let point_size = self
.state
.font_style
.as_ref()
.map_or(10., |style| style.font_size.computed_size().px());
let font_style = self.state.font_style.as_ref();
let font = font_style.map_or_else(
|| load_system_font_from_style(None),
|style| {
let font_group = self.font_context.font_group(ServoArc::new(style.clone()));
let font = font_group
.write()
.first(&self.font_context)
.expect("couldn't find font");
Font::from_bytes(font.template.data(), 0)
.ok()
.or_else(|| load_system_font_from_style(Some(style)))
},
);
let font = match font {
Some(f) => f,
None => {
error!("Couldn't load desired font or system fallback.");
return;
},
};
let font_width = font_width(&text, point_size, &font);
// Step 6.
let max_width = max_width.map(|width| width as f32);
let (width, scale_factor) = match max_width {
Some(max_width) if max_width > font_width => (max_width, 1.),
Some(max_width) => (font_width, max_width / font_width),
None => (font_width, 1.),
let Some(ref font_style) = self.state.font_style else {
return;
};
// Step 7.
let start = self.text_origin(x as f32, y as f32, &font.metrics(), width, is_rtl);
// TODO: Bidi text layout
let old_transform = self.get_transform();
self.set_transform(
&old_transform
.pre_translate(vec2(start.x, 0.))
.pre_scale(scale_factor, 1.)
.pre_translate(vec2(-start.x, 0.)),
);
// Step 8.
self.drawtarget.fill_text(
&font,
point_size,
&text,
start,
&self.state.fill_style,
&self.state.draw_options,
);
self.set_transform(&old_transform);
let size = font_style.font_size.computed_size();
self.fill_text_with_size(text, x, y, max_width, is_rtl, size.px() as f64);
}
fn text_origin(
/// <https://html.spec.whatwg.org/multipage/#text-preparation-algorithm>
/// <https://html.spec.whatwg.org/multipage/#dom-context-2d-measuretext>
pub fn measure_text(&mut self, text: String) -> TextMetrics {
// > Step 2: Replace all ASCII whitespace in text with U+0020 SPACE characters.
let text = replace_ascii_whitespace(text);
let Some(ref font_style) = self.state.font_style else {
return TextMetrics::default();
};
let font_group = self.font_context.font_group(font_style.clone());
let mut font_group = font_group.write();
let font = font_group
.first(&self.font_context)
.expect("couldn't find font");
let ascent = font.metrics.ascent.to_f32_px();
let descent = font.metrics.descent.to_f32_px();
let runs = self.build_unshaped_text_runs(&text, &mut font_group);
let shaped_runs: Vec<_> = runs
.into_iter()
.filter_map(UnshapedTextRun::into_shaped_text_run)
.collect();
let total_advance = shaped_runs
.iter()
.map(|run| run.glyphs.total_advance())
.sum::<Au>()
.to_f32_px();
let bounding_box = shaped_runs
.iter()
.map(TextRun::bounding_box)
.reduce(|a, b| {
let amount = Vector2D::new(a.max_x(), 0.);
let bounding_box = b.translate(amount);
a.union(&bounding_box)
})
.unwrap_or_default();
let FontBaseline {
ideographic_baseline,
alphabetic_baseline,
hanging_baseline,
} = match font.get_baseline() {
Some(baseline) => baseline,
None => FontBaseline {
hanging_baseline: ascent * HANGING_BASELINE_DEFAULT,
ideographic_baseline: -descent * IDEOGRAPHIC_BASELINE_DEFAULT,
alphabetic_baseline: 0.,
},
};
let anchor_x = match self.state.text_align {
TextAlign::End => total_advance,
TextAlign::Center => total_advance / 2.,
TextAlign::Right => total_advance,
_ => 0.,
};
let anchor_y = match self.state.text_baseline {
TextBaseline::Top => ascent,
TextBaseline::Hanging => hanging_baseline,
TextBaseline::Ideographic => ideographic_baseline,
TextBaseline::Middle => (ascent - descent) / 2.,
TextBaseline::Alphabetic => alphabetic_baseline,
TextBaseline::Bottom => -descent,
};
TextMetrics {
width: total_advance,
actual_boundingbox_left: anchor_x - bounding_box.min_x(),
actual_boundingbox_right: bounding_box.max_x() - anchor_x,
actual_boundingbox_ascent: bounding_box.max_y() - anchor_y,
actual_boundingbox_descent: anchor_y - bounding_box.min_y(),
font_boundingbox_ascent: ascent - anchor_y,
font_boundingbox_descent: descent + anchor_y,
em_height_ascent: ascent - anchor_y,
em_height_descent: descent + anchor_y,
hanging_baseline: hanging_baseline - anchor_y,
alphabetic_baseline: alphabetic_baseline - anchor_y,
ideographic_baseline: ideographic_baseline - anchor_y,
}
}
fn build_unshaped_text_runs<'b>(
&self,
text: &'b str,
font_group: &mut FontGroup,
) -> Vec<UnshapedTextRun<'b>> {
let mut runs = Vec::new();
let mut current_text_run = UnshapedTextRun::default();
let mut current_text_run_start_index = 0;
for (index, character) in text.char_indices() {
// TODO: This should ultimately handle emoji variation selectors, but raqote does not yet
// have support for color glyphs.
let script = Script::from(character);
let font = font_group.find_by_codepoint(&self.font_context, character, None);
if !current_text_run.script_and_font_compatible(script, &font) {
let previous_text_run = mem::replace(
&mut current_text_run,
UnshapedTextRun {
font: font.clone(),
script,
..Default::default()
},
);
current_text_run_start_index = index;
runs.push(previous_text_run)
}
current_text_run.string =
&text[current_text_run_start_index..index + character.len_utf8()];
}
runs.push(current_text_run);
runs
}
/// Find the *anchor_point* for the given parameters of a line of text.
/// See <https://html.spec.whatwg.org/multipage/#text-preparation-algorithm>.
fn find_anchor_point_for_line_of_text(
&self,
x: f32,
y: f32,
metrics: &Metrics,
metrics: &FontMetrics,
width: f32,
is_rtl: bool,
) -> Point2D<f32> {
@@ -551,13 +755,15 @@ impl<'a> CanvasData<'a> {
_ => 0.,
};
let ascent = metrics.ascent.to_f32_px();
let descent = metrics.descent.to_f32_px();
let anchor_y = match self.state.text_baseline {
TextBaseline::Top => metrics.ascent,
TextBaseline::Hanging => metrics.ascent * HANGING_BASELINE_DEFAULT,
TextBaseline::Ideographic => -metrics.descent * IDEOGRAPHIC_BASELINE_DEFAULT,
TextBaseline::Middle => (metrics.ascent - metrics.descent) / 2.,
TextBaseline::Top => ascent,
TextBaseline::Hanging => ascent * HANGING_BASELINE_DEFAULT,
TextBaseline::Ideographic => -descent * IDEOGRAPHIC_BASELINE_DEFAULT,
TextBaseline::Middle => (ascent - descent) / 2.,
TextBaseline::Alphabetic => 0.,
TextBaseline::Bottom => -metrics.descent,
TextBaseline::Bottom => -descent,
};
point2(x + anchor_x, y + anchor_y)
@@ -1140,7 +1346,7 @@ impl<'a> CanvasData<'a> {
}
pub fn set_font(&mut self, font_style: FontStyleStruct) {
self.state.font_style = Some(font_style)
self.state.font_style = Some(ServoArc::new(font_style))
}
pub fn set_text_align(&mut self, text_align: TextAlign) {
@@ -1239,7 +1445,7 @@ pub struct CanvasPaintState<'a> {
pub shadow_offset_y: f64,
pub shadow_blur: f64,
pub shadow_color: Color,
pub font_style: Option<FontStyleStruct>,
pub font_style: Option<ServoArc<FontStyleStruct>>,
pub text_align: TextAlign,
pub text_baseline: TextBaseline,
}
@@ -1330,71 +1536,6 @@ impl RectExt for Rect<u32> {
}
}
fn to_font_kit_family(font_family: &font::SingleFontFamily) -> FamilyName {
match font_family {
font::SingleFontFamily::FamilyName(family_name) => {
FamilyName::Title(family_name.to_css_string())
},
font::SingleFontFamily::Generic(generic) => match generic {
font::GenericFontFamily::Serif => FamilyName::Serif,
font::GenericFontFamily::SansSerif => FamilyName::SansSerif,
font::GenericFontFamily::Monospace => FamilyName::Monospace,
font::GenericFontFamily::Fantasy => FamilyName::Fantasy,
font::GenericFontFamily::Cursive => FamilyName::Cursive,
// TODO: There is no FontFamily::SystemUi.
font::GenericFontFamily::SystemUi => unreachable!("system-ui should be disabled"),
font::GenericFontFamily::None => unreachable!("Shouldn't appear in computed values"),
},
}
}
fn load_system_font_from_style(font_style: Option<&FontStyleStruct>) -> Option<Font> {
let mut properties = Properties::new();
let style = match font_style {
Some(style) => style,
None => return load_default_system_fallback_font(&properties),
};
let family_names = style
.font_family
.families
.iter()
.map(to_font_kit_family)
.collect::<Vec<_>>();
let properties = properties
.style(match style.font_style {
font::FontStyle::NORMAL => Style::Normal,
font::FontStyle::ITALIC => Style::Italic,
_ => {
// TODO: support oblique angle.
Style::Oblique
},
})
.weight(Weight(style.font_weight.value()))
.stretch(Stretch(style.font_stretch.to_percentage().0));
let font_handle = match SystemSource::new().select_best_match(&family_names, properties) {
Ok(handle) => handle,
Err(e) => {
error!("error getting font handle for style {:?}: {}", style, e);
return load_default_system_fallback_font(properties);
},
};
match font_handle.load() {
Ok(f) => Some(f),
Err(e) => {
error!("error loading font for style {:?}: {}", style, e);
load_default_system_fallback_font(properties)
},
}
}
fn load_default_system_fallback_font(properties: &Properties) -> Option<Font> {
SystemSource::new()
.select_best_match(&[FamilyName::SansSerif], properties)
.ok()?
.load()
.ok()
}
fn replace_ascii_whitespace(text: String) -> String {
text.chars()
.map(|c| match c {
@@ -1403,18 +1544,3 @@ fn replace_ascii_whitespace(text: String) -> String {
})
.collect()
}
// TODO: This currently calculates the width using just advances and doesn't
// determine the fallback font in case a character glyph isn't found.
fn font_width(text: &str, point_size: f32, font: &Font) -> f32 {
let metrics = font.metrics();
let mut width = 0.;
for c in text.chars() {
if let Some(glyph_id) = font.glyph_for_char(c) {
if let Ok(advance) = font.advance(glyph_id) {
width += advance.x() * point_size / metrics.units_per_em as f32;
}
}
}
width
}

View File

@@ -234,6 +234,10 @@ impl<'a> CanvasPaintThread<'a> {
Canvas2dMsg::Ellipse(ref center, radius_x, radius_y, rotation, start, end, ccw) => self
.canvas(canvas_id)
.ellipse(center, radius_x, radius_y, rotation, start, end, ccw),
Canvas2dMsg::MeasureText(text, sender) => {
let metrics = self.canvas(canvas_id).measure_text(text);
sender.send(metrics).unwrap();
},
Canvas2dMsg::RestoreContext => self.canvas(canvas_id).restore_context_state(),
Canvas2dMsg::SaveContext => self.canvas(canvas_id).save_context_state(),
Canvas2dMsg::SetLineWidth(width) => self.canvas(canvas_id).set_line_width(width),

View File

@@ -2,23 +2,36 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::cell::RefCell;
use std::collections::HashMap;
use canvas_traits::canvas::*;
use cssparser::color::clamp_unit_f32;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use euclid::Angle;
use font_kit::font::Font;
use fonts::{ByteIndex, FontIdentifier, FontTemplateRefMethods};
use log::warn;
use lyon_geom::Arc;
use range::Range;
use raqote::PathOp;
use style::color::AbsoluteColor;
use crate::canvas_data;
use crate::canvas_data::{
Backend, CanvasPaintState, Color, CompositionOp, DrawOptions, Filter, GenericDrawTarget,
GenericPathBuilder, GradientStop, GradientStops, Path, SourceSurface, StrokeOptions,
self, Backend, CanvasPaintState, Color, CompositionOp, DrawOptions, Filter, GenericDrawTarget,
GenericPathBuilder, GradientStop, GradientStops, Path, SourceSurface, StrokeOptions, TextRun,
};
use crate::canvas_paint_thread::AntialiasMode;
thread_local! {
/// The shared font cache used by all canvases that render on a thread. It would be nicer
/// to have a global cache, but it looks like font-kit uses a per-thread FreeType, so
/// in order to ensure that fonts are particular to a thread we have to make our own
/// cache thread local as well.
static SHARED_FONT_CACHE: RefCell<HashMap<FontIdentifier, Font>> = RefCell::default();
}
#[derive(Default)]
pub struct RaqoteBackend;
impl Backend for RaqoteBackend {
@@ -508,43 +521,61 @@ impl GenericDrawTarget for raqote::DrawTarget {
fn fill_text(
&mut self,
font: &Font,
point_size: f32,
text: &str,
text_runs: Vec<TextRun>,
start: Point2D<f32>,
pattern: &canvas_data::Pattern,
options: &DrawOptions,
draw_options: &DrawOptions,
) {
let mut start = pathfinder_geometry::vector::vec2f(start.x, start.y);
let mut ids = Vec::new();
let mut positions = Vec::new();
for c in text.chars() {
let id = match font.glyph_for_char(c) {
Some(id) => id,
None => {
warn!("Skipping non-existent glyph {}", c);
continue;
},
};
ids.push(id);
positions.push(Point2D::new(start.x(), start.y()));
let advance = match font.advance(id) {
Ok(advance) => advance,
Err(e) => {
warn!("Skipping glyph {} with missing advance: {:?}", c, e);
continue;
},
};
start += advance * point_size / 24. / 96.;
let mut advance = 0.;
for run in text_runs.iter() {
let mut positions = Vec::new();
let glyphs = &run.glyphs;
let ids: Vec<_> = glyphs
.iter_glyphs_for_byte_range(&Range::new(ByteIndex(0), glyphs.len()))
.map(|glyph| {
let glyph_offset = glyph.offset().unwrap_or(Point2D::zero());
positions.push(Point2D::new(
advance + start.x + glyph_offset.x.to_f32_px(),
start.y + glyph_offset.y.to_f32_px(),
));
advance += glyph.advance().to_f32_px();
glyph.id()
})
.collect();
// TODO: raqote uses font-kit to rasterize glyphs, but font-kit fails an assertion when
// using color bitmap fonts in the FreeType backend. For now, simply do not render these
// type of fonts.
if run.font.has_color_bitmap_or_colr_table() {
continue;
}
let template = &run.font.template;
SHARED_FONT_CACHE.with(|font_cache| {
let identifier = template.identifier();
if !font_cache.borrow().contains_key(&identifier) {
let Ok(font) = Font::from_bytes(template.data(), identifier.index()) else {
return;
};
font_cache.borrow_mut().insert(identifier.clone(), font);
}
let font_cache = font_cache.borrow();
let Some(font) = font_cache.get(&identifier) else {
return;
};
self.draw_glyphs(
font,
run.font.descriptor.pt_size.to_f32_px(),
&ids,
&positions,
&pattern.source(),
draw_options.as_raqote(),
);
})
}
self.draw_glyphs(
font,
point_size,
&ids,
&positions,
&pattern.source(),
options.as_raqote(),
);
}
fn fill_rect(

View File

@@ -51,11 +51,6 @@ use webxr_api::{
use crate::webgl_limits::GLLimitsDetect;
#[cfg(feature = "xr-profile")]
fn to_ms(ns: u64) -> f64 {
ns as f64 / 1_000_000.
}
struct GLContextData {
ctx: Context,
gl: Rc<Gl>,
@@ -373,7 +368,10 @@ impl WebGLThread {
WebGLMsg::SwapBuffers(swap_ids, sender, sent_time) => {
self.handle_swap_buffers(swap_ids, sender, sent_time);
},
WebGLMsg::Exit => {
WebGLMsg::Exit(sender) => {
if let Err(e) = sender.send(()) {
warn!("Failed to send response to WebGLMsg::Exit ({e})");
}
return true;
},
}
@@ -829,14 +827,6 @@ impl WebGLThread {
#[allow(unused)]
let mut end_swap = 0;
#[cfg(feature = "xr-profile")]
{
end_swap = time::precise_time_ns();
println!(
"WEBXR PROFILING [swap buffer]:\t{}ms",
to_ms(end_swap - start_swap)
);
}
completed_sender.send(end_swap).unwrap();
}
@@ -1054,7 +1044,7 @@ impl WebGLImpl {
gl.clear_color(r, g, b, a);
},
WebGLCommand::ClearDepth(depth) => {
let value = depth.max(0.).min(1.) as f64;
let value = depth.clamp(0., 1.) as f64;
state.depth_clear_value = value;
gl.clear_depth(value)
},
@@ -1093,7 +1083,7 @@ impl WebGLImpl {
state.restore_depth_invariant(gl);
},
WebGLCommand::DepthRange(near, far) => {
gl.depth_range(near.max(0.).min(1.) as f64, far.max(0.).min(1.) as f64)
gl.depth_range(near.clamp(0., 1.) as f64, far.clamp(0., 1.) as f64)
},
WebGLCommand::Disable(cap) => match cap {
gl::SCISSOR_TEST => {
@@ -2886,8 +2876,8 @@ fn flip_pixels_y(
// Clamp a size to the current GL context's max viewport
fn clamp_viewport(gl: &Gl, size: Size2D<u32>) -> Size2D<u32> {
let mut max_viewport = [i32::max_value(), i32::max_value()];
let mut max_renderbuffer = [i32::max_value()];
let mut max_viewport = [i32::MAX, i32::MAX];
let mut max_renderbuffer = [i32::MAX];
#[allow(unsafe_code)]
unsafe {
gl.get_integer_v(gl::MAX_VIEWPORT_DIMS, &mut max_viewport);

View File

@@ -1,6 +1,5 @@
[package]
name = "compositing"
build = "build.rs"
version.workspace = true
authors.workspace = true
license.workspace = true
@@ -31,6 +30,7 @@ ipc-channel = { workspace = true }
keyboard-types = { workspace = true }
libc = { workspace = true }
log = { workspace = true }
net = { path = "../net" }
net_traits = { workspace = true }
pixels = { path = "../pixels" }
profile_traits = { workspace = true }
@@ -41,10 +41,11 @@ servo_geometry = { path = "../geometry" }
servo_url = { path = "../url" }
style_traits = { workspace = true }
time = { workspace = true }
tracing = { workspace = true }
webrender = { workspace = true }
webrender_api = { workspace = true }
webrender_traits = { workspace = true }
webxr = { git = "https://github.com/servo/webxr" }
[build-dependencies]
toml = "0.5"
[dev-dependencies]
surfman = { workspace = true }

View File

@@ -1,52 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::env;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
fn main() {
let lockfile_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap())
.join("..")
.join("..")
.join("Cargo.lock");
let revision_file_path =
Path::new(&env::var_os("OUT_DIR").unwrap()).join("webrender_revision.rs");
let mut lockfile = String::new();
File::open(lockfile_path)
.expect("Cannot open lockfile")
.read_to_string(&mut lockfile)
.expect("Failed to read lockfile");
match toml::from_str::<toml::value::Table>(&lockfile) {
Ok(result) => {
let packages = result
.get("package")
.expect("Cargo lockfile should contain package list");
match *packages {
toml::Value::Array(ref arr) => {
let source = arr
.iter()
.find(|pkg| {
pkg.get("name").and_then(|name| name.as_str()).unwrap_or("") ==
"webrender"
})
.and_then(|pkg| pkg.get("source").and_then(|source| source.as_str()))
.unwrap_or("unknown");
let parsed: Vec<&str> = source.split('#').collect();
let revision = if parsed.len() > 1 { parsed[1] } else { source };
let mut revision_module_file = File::create(revision_file_path).unwrap();
write!(&mut revision_module_file, "\"{}\"", revision).unwrap();
},
_ => panic!("Cannot find package definitions in lockfile"),
}
},
Err(e) => panic!("{}", e),
}
}

View File

@@ -11,6 +11,7 @@ use std::iter::once;
use std::rc::Rc;
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use base::cross_process_instant::CrossProcessInstant;
use base::id::{PipelineId, TopLevelBrowsingContextId, WebViewId};
use base::{Epoch, WebRenderEpochToU16};
use compositing_traits::{
@@ -34,6 +35,7 @@ use script_traits::{
};
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use tracing::{span, Level};
use webrender::{CaptureBits, RenderApi, Transaction};
use webrender_api::units::{
DeviceIntPoint, DeviceIntSize, DevicePoint, DeviceRect, LayoutPoint, LayoutRect, LayoutSize,
@@ -215,6 +217,10 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
/// The [`Instant`] of the last animation tick, used to avoid flooding the Constellation and
/// ScriptThread with a deluge of animation ticks.
last_animation_tick: Instant,
/// The string representing the version of Servo that is running. This is used to tag
/// WebRender capture output.
version_string: String,
}
#[derive(Clone, Copy)]
@@ -350,13 +356,14 @@ pub enum CompositeTarget {
}
impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
fn new(
pub fn new(
window: Rc<Window>,
state: InitialCompositorState,
composite_target: CompositeTarget,
exit_after_load: bool,
convert_mouse_to_touch: bool,
top_level_browsing_context_id: TopLevelBrowsingContextId,
version_string: String,
) -> Self {
let embedder_coordinates = window.get_coordinates();
let mut webviews = WebViewManager::default();
@@ -377,7 +384,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.show(top_level_browsing_context_id)
.expect("Infallible due to add");
IOCompositor {
let compositor = IOCompositor {
embedder_coordinates: window.get_coordinates(),
window,
port: state.receiver,
@@ -415,27 +422,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
pending_frames: 0,
waiting_on_present: false,
last_animation_tick: Instant::now(),
}
}
version_string,
};
pub fn create(
window: Rc<Window>,
state: InitialCompositorState,
composite_target: CompositeTarget,
exit_after_load: bool,
convert_mouse_to_touch: bool,
top_level_browsing_context_id: TopLevelBrowsingContextId,
) -> Self {
let compositor = IOCompositor::new(
window,
state,
composite_target,
exit_after_load,
convert_mouse_to_touch,
top_level_browsing_context_id,
);
// Make sure the GL state is OK
compositor.assert_gl_framebuffer_complete();
compositor
}
@@ -693,6 +682,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
/// Accept messages from content processes that need to be relayed to the WebRender
/// instance in the parent process.
#[tracing::instrument(skip(self))]
fn handle_webrender_message(&mut self, msg: ForwardedToCompositorMsg) {
match msg {
ForwardedToCompositorMsg::Layout(ScriptToCompositorMsg::SendInitialTransaction(
@@ -780,6 +770,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
display_list_descriptor,
);
let span = span!(Level::TRACE, "ScriptToCompositorMsg::BuiltDisplayList");
let _enter = span.enter();
let pipeline_id = display_list_info.pipeline_id;
let details = self.pipeline_details(pipeline_id.into());
details.most_recent_display_list_epoch = Some(display_list_info.epoch);
@@ -1550,6 +1542,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
None => return,
};
self.cursor_pos = cursor;
let event = MouseMoveEvent(result.point_in_viewport, Some(result.node.into()), 0);
let msg = ConstellationMsg::ForwardEvent(result.pipeline_id, event);
if let Err(e) = self.constellation_chan.send(msg) {
@@ -1807,19 +1800,31 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
ScrollLocation::Start | ScrollLocation::End => scroll_location,
};
let hit_test_result = match self.hit_test_at_point(cursor) {
Some(result) => result,
None => return None,
};
let hit_test_results =
self.hit_test_at_point_with_flags_and_pipeline(cursor, HitTestFlags::FIND_ALL, None);
let pipeline_details = match self.pipeline_details.get_mut(&hit_test_result.pipeline_id) {
Some(details) => details,
None => return None,
};
pipeline_details
.scroll_tree
.scroll_node_or_ancestor(&hit_test_result.scroll_tree_node, scroll_location)
.map(|(external_id, offset)| (hit_test_result.pipeline_id, external_id, offset))
// Iterate through all hit test results, processing only the first node of each pipeline.
// This is needed to propagate the scroll events from a pipeline representing an iframe to
// its ancestor pipelines.
let mut previous_pipeline_id = None;
for CompositorHitTestResult {
pipeline_id,
scroll_tree_node,
..
} in hit_test_results.iter()
{
if previous_pipeline_id.replace(pipeline_id) != Some(pipeline_id) {
let scroll_result = self
.pipeline_details
.get_mut(pipeline_id)?
.scroll_tree
.scroll_node_or_ancestor(scroll_tree_node, scroll_location);
if let Some((external_id, offset)) = scroll_result {
return Some((*pipeline_id, external_id, offset));
}
}
}
None
}
/// If there are any animations running, dispatches appropriate messages to the constellation.
@@ -2053,6 +2058,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
/// Returns Ok if composition was performed or Err if it was not possible to composite for some
/// reason. When the target is [CompositeTarget::SharedMemory], the image is read back from the
/// GPU and returned as Ok(Some(png::Image)), otherwise we return Ok(None).
#[tracing::instrument(skip(self))]
fn composite_specific_target(
&mut self,
target: CompositeTarget,
@@ -2142,10 +2148,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
// ones that the paint metrics recorder is expecting. In that case, we get the current
// time, inform layout about it and remove the pending metric from the list.
if !self.pending_paint_metrics.is_empty() {
let paint_time = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_nanos() as u64;
let paint_time = CrossProcessInstant::now();
let mut to_remove = Vec::new();
// For each pending paint metrics pipeline id
for (id, pending_epoch) in &self.pending_paint_metrics {
@@ -2233,7 +2236,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
Some(Image {
width: img.width(),
height: img.height(),
format: PixelFormat::RGB8,
format: PixelFormat::RGBA8,
bytes: ipc::IpcSharedMemory::from_bytes(&img),
id: None,
cors_status: CorsStatus::Safe,
@@ -2256,7 +2259,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
FramebufferUintLength::new(width),
FramebufferUintLength::new(height),
);
let dynamic_image = DynamicImage::ImageRgb8(img);
let dynamic_image = DynamicImage::ImageRgba8(img);
if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::Png) {
error!("Failed to save {} ({}).", path, e);
}
@@ -2268,6 +2271,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
},
};
let span = span!(Level::TRACE, "ConstellationMsg::ReadyToPresent");
let _enter = span.enter();
// Notify embedder that servo is ready to present.
// Embedder should call `present` to tell compositor to continue rendering.
self.waiting_on_present = true;
@@ -2292,7 +2297,10 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.map(|info| info.framebuffer_id())
}
#[tracing::instrument(skip(self))]
pub fn present(&mut self) {
let span = span!(Level::TRACE, "Compositor Present Surface");
let _enter = span.enter();
if let Err(err) = self.rendering_context.present() {
warn!("Failed to present surface: {:?}", err);
}
@@ -2354,6 +2362,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
);
}
#[tracing::instrument(skip(self))]
pub fn receive_messages(&mut self) -> bool {
// Check for new messages coming from the other threads in the system.
let mut compositor_messages = vec![];
@@ -2380,6 +2389,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
true
}
#[tracing::instrument(skip(self))]
pub fn perform_updates(&mut self) -> bool {
if self.shutdown_state == ShutdownState::FinishedShuttingDown {
return false;
@@ -2476,42 +2486,25 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.iter()
.filter_map(|val| {
val.as_ref()
.map(|dir| dir.join("capture_webrender").join(&capture_id))
.map(|dir| dir.join("webrender-captures").join(&capture_id))
.ok()
})
.find(|val| match create_dir_all(val) {
Ok(_) => true,
Err(err) => {
eprintln!("Unable to create path '{:?}' for capture: {:?}", &val, err);
false
},
});
.find(|val| create_dir_all(val).is_ok());
match available_path {
Some(capture_path) => {
let revision_file_path = capture_path.join("wr.txt");
let Some(capture_path) = available_path else {
eprintln!("Couldn't create a path for WebRender captures.");
return;
};
debug!(
"Trying to save webrender capture under {:?}",
&revision_file_path
);
self.webrender_api
.save_capture(capture_path, CaptureBits::all());
println!("Saving WebRender capture to {capture_path:?}");
self.webrender_api
.save_capture(capture_path.clone(), CaptureBits::all());
match File::create(revision_file_path) {
Ok(mut file) => {
let revision = include!(concat!(env!("OUT_DIR"), "/webrender_revision.rs"));
if let Err(err) = write!(&mut file, "{}", revision) {
eprintln!("Unable to write webrender revision: {:?}", err)
}
},
Err(err) => eprintln!(
"Capture triggered, creating webrender revision info skipped: {:?}",
err
),
}
},
None => eprintln!("Unable to locate path to save captures"),
let version_file_path = capture_path.join("servo-version.txt");
if let Err(error) = File::create(version_file_path)
.and_then(|mut file| write!(file, "{}", self.version_string))
{
eprintln!("Unable to write servo version for WebRender Capture: {error:?}");
}
}
}

View File

@@ -5,8 +5,8 @@
use std::rc::Rc;
use gleam::gl::{self, Gl};
use image::RgbImage;
use log::trace;
use image::RgbaImage;
use log::{trace, warn};
use servo_geometry::FramebufferUintLength;
pub struct RenderTargetInfo {
@@ -105,7 +105,7 @@ impl RenderTargetInfo {
y: i32,
width: FramebufferUintLength,
height: FramebufferUintLength,
) -> RgbImage {
) -> RgbaImage {
let width = width.get() as usize;
let height = height.get() as usize;
// For some reason, OSMesa fails to render on the 3rd
@@ -121,13 +121,17 @@ impl RenderTargetInfo {
y,
width as gl::GLsizei,
height as gl::GLsizei,
gl::RGB,
gl::RGBA,
gl::UNSIGNED_BYTE,
);
let gl_error = self.gl.get_error();
if gl_error != gl::NO_ERROR {
warn!("GL error code 0x{gl_error:x} set after read_pixels");
}
// flip image vertically (texture is upside down)
let orig_pixels = pixels.clone();
let stride = width * 3;
let stride = width * 4;
for y in 0..height {
let dst_start = y * stride;
let src_start = (height - y - 1) * stride;
@@ -135,7 +139,7 @@ impl RenderTargetInfo {
pixels[dst_start..dst_start + stride].clone_from_slice(&src_slice[..stride]);
}
RgbImage::from_raw(width as u32, height as u32, pixels).expect("Flipping image failed!")
RgbaImage::from_raw(width as u32, height as u32, pixels).expect("Flipping image failed!")
}
}
@@ -148,3 +152,57 @@ impl Drop for RenderTargetInfo {
self.gl.delete_framebuffers(&self.framebuffer_ids);
}
}
#[cfg(test)]
mod test {
use gleam::gl;
use image::Rgba;
use servo_geometry::FramebufferUintLength;
use surfman::{Connection, ContextAttributeFlags, ContextAttributes, Error, GLApi, GLVersion};
use super::RenderTargetInfo;
#[test]
#[allow(unsafe_code)]
fn test_read_pixels() -> Result<(), Error> {
let connection = Connection::new()?;
let adapter = connection.create_software_adapter()?;
let mut device = connection.create_device(&adapter)?;
let context_descriptor = device.create_context_descriptor(&ContextAttributes {
version: GLVersion::new(3, 0),
flags: ContextAttributeFlags::empty(),
})?;
let mut context = device.create_context(&context_descriptor, None)?;
let gl = match connection.gl_api() {
GLApi::GL => unsafe { gl::GlFns::load_with(|s| device.get_proc_address(&context, s)) },
GLApi::GLES => unsafe {
gl::GlesFns::load_with(|s| device.get_proc_address(&context, s))
},
};
device.make_context_current(&context)?;
{
const WIDTH: FramebufferUintLength = FramebufferUintLength::new(16);
const HEIGHT: FramebufferUintLength = FramebufferUintLength::new(16);
let render_target = RenderTargetInfo::new(gl, WIDTH, HEIGHT);
render_target.bind();
render_target
.gl
.clear_color(12.0 / 255.0, 34.0 / 255.0, 56.0 / 255.0, 78.0 / 255.0);
render_target.gl.clear(gl::COLOR_BUFFER_BIT);
let img = render_target.read_back_from_gpu(0, 0, WIDTH, HEIGHT);
assert_eq!(img.width(), WIDTH.get());
assert_eq!(img.height(), HEIGHT.get());
let expected_pixel: Rgba<u8> = Rgba([12, 34, 56, 78]);
assert!(img.pixels().all(|&p| p == expected_pixel));
}
device.destroy_context(&mut context)?;
Ok(())
}
}

View File

@@ -12,6 +12,7 @@ use embedder_traits::{EmbedderProxy, EventLoopWaker};
use euclid::Scale;
use keyboard_types::KeyboardEvent;
use libc::c_void;
use net::protocols::ProtocolRegistry;
use script_traits::{
GamepadEvent, MediaSessionActionType, MouseButton, TouchEventType, TouchId, TraversalDirection,
WheelDelta,
@@ -222,6 +223,17 @@ pub trait EmbedderMethods {
fn get_user_agent_string(&self) -> Option<String> {
None
}
/// Returns the version string of this embedder.
fn get_version_string(&self) -> Option<String> {
None
}
/// Returns the protocol handlers implemented by that embedder.
/// They will be merged with the default internal ones.
fn get_protocol_handlers(&self) -> ProtocolRegistry {
ProtocolRegistry::default()
}
}
#[derive(Clone, Copy, Debug)]

View File

@@ -14,7 +14,6 @@ path = "lib.rs"
embedder_traits = { workspace = true }
euclid = { workspace = true }
getopts = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
num_cpus = { workspace = true }
serde = { workspace = true, features = ["derive"] }
@@ -26,4 +25,4 @@ style_config = { workspace = true }
url = { workspace = true }
[target.'cfg(not(target_os = "android"))'.dependencies]
dirs-next = "2.0"
dirs = "5.0"

View File

@@ -15,7 +15,7 @@ use std::path::PathBuf;
not(target_os = "android")
))]
pub fn default_config_dir() -> Option<PathBuf> {
let mut config_dir = ::dirs_next::config_dir().unwrap();
let mut config_dir = ::dirs::config_dir().unwrap();
config_dir.push("servo");
config_dir.push("default");
Some(config_dir)
@@ -30,14 +30,14 @@ pub fn default_config_dir() -> Option<PathBuf> {
pub fn default_config_dir() -> Option<PathBuf> {
// FIXME: use `config_dir()` ($HOME/Library/Preferences)
// instead of `data_dir()` ($HOME/Library/Application Support) ?
let mut config_dir = ::dirs_next::data_dir().unwrap();
let mut config_dir = ::dirs::data_dir().unwrap();
config_dir.push("Servo");
Some(config_dir)
}
#[cfg(target_os = "windows")]
pub fn default_config_dir() -> Option<PathBuf> {
let mut config_dir = ::dirs_next::config_dir().unwrap();
let mut config_dir = ::dirs::config_dir().unwrap();
config_dir.push("Servo");
Some(config_dir)
}

View File

@@ -10,12 +10,11 @@ use std::fs::{self, File};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{RwLock, RwLockReadGuard};
use std::sync::{LazyLock, RwLock, RwLockReadGuard};
use std::{env, process};
use euclid::Size2D;
use getopts::{Matches, Options};
use lazy_static::lazy_static;
use log::error;
use serde::{Deserialize, Serialize};
use servo_geometry::DeviceIndependentPixel;
@@ -735,7 +734,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
let legacy_layout = opt_match.opt_present("legacy-layout");
if legacy_layout {
set_pref!(layout.legacy_layout, true);
set_pref!(layout.flexbox.enabled, true);
}
let opts = Opts {
@@ -789,9 +787,7 @@ pub enum ArgumentParsingResult {
// Make Opts available globally. This saves having to clone and pass
// opts everywhere it is used, which gets particularly cumbersome
// when passing through the DOM structures.
lazy_static! {
static ref OPTIONS: RwLock<Opts> = RwLock::new(default_opts());
}
static OPTIONS: LazyLock<RwLock<Opts>> = LazyLock::new(|| RwLock::new(default_opts()));
pub fn set_options(opts: Opts) {
MULTIPROCESS.store(opts.multiprocess, Ordering::SeqCst);

View File

@@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::collections::HashMap;
use std::convert::TryInto;
use std::fmt;
use std::str::FromStr;
use std::sync::RwLock;
@@ -158,9 +157,8 @@ impl From<PrefValue> for [f64; 4] {
fn from(other: PrefValue) -> [f64; 4] {
match other {
PrefValue::Array(values) if values.len() == 4 => {
let mut f = values.into_iter().map(|v| v.try_into());
if f.all(|v| v.is_ok()) {
let f = f.flatten().collect::<Vec<f64>>();
let f = values.into_iter().map(Into::into).collect::<Vec<f64>>();
if f.len() == 4 {
[f[0], f[1], f[2], f[3]]
} else {
panic!(
@@ -197,16 +195,16 @@ impl fmt::Display for PrefError {
impl std::error::Error for PrefError {}
pub struct Accessor<P, V> {
pub getter: Box<dyn Fn(&P) -> V + Sync>,
pub getter: Box<dyn Fn(&P) -> V + Sync + Send>,
#[allow(clippy::type_complexity)]
pub setter: Box<dyn Fn(&mut P, V) + Sync>,
pub setter: Box<dyn Fn(&mut P, V) + Sync + Send>,
}
impl<P, V> Accessor<P, V> {
pub fn new<G, S>(getter: G, setter: S) -> Self
where
G: Fn(&P) -> V + Sync + 'static,
S: Fn(&mut P, V) + Sync + 'static,
G: Fn(&P) -> V + Sync + Send + 'static,
S: Fn(&mut P, V) + Sync + Send + 'static,
{
Accessor {
getter: Box::new(getter),

View File

@@ -5,27 +5,25 @@
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::convert::{TryFrom, TryInto};
use std::sync::LazyLock;
use embedder_traits::resources::{self, Resource};
use gen::Prefs;
use lazy_static::lazy_static;
use log::warn;
use serde_json::{self, Value};
use crate::pref_util::Preferences;
pub use crate::pref_util::{PrefError, PrefValue};
lazy_static! {
static ref PREFS: Preferences<'static, Prefs> = {
let def_prefs: Prefs = serde_json::from_str(&resources::read_string(Resource::Preferences))
.expect("Failed to initialize config preferences.");
let result = Preferences::new(def_prefs, &gen::PREF_ACCESSORS);
for (key, value) in result.iter() {
set_stylo_pref_ref(&key, &value);
}
result
};
}
static PREFS: LazyLock<Preferences<'static, Prefs>> = LazyLock::new(|| {
let def_prefs: Prefs = serde_json::from_str(&resources::read_string(Resource::Preferences))
.expect("Failed to initialize config preferences.");
let result = Preferences::new(def_prefs, &gen::PREF_ACCESSORS);
for (key, value) in result.iter() {
set_stylo_pref_ref(&key, &value);
}
result
});
/// A convenience macro for accessing a preference value using its static path.
/// Passing an invalid path is a compile-time error.
@@ -165,6 +163,14 @@ mod gen {
std::cmp::max(num_cpus::get() * 3 / 4, 1) as i64
}
fn default_font_size() -> i64 {
16
}
fn default_monospace_font_size() -> i64 {
13
}
fn black() -> i64 {
0x000000
}
@@ -188,6 +194,23 @@ mod gen {
foreground_color: i64,
}
},
fonts: {
#[serde(default)]
default: String,
#[serde(default)]
serif: String,
#[serde(default)]
#[serde(rename = "fonts.sans-serif")]
sans_serif: String,
#[serde(default)]
monospace: String,
#[serde(default = "default_font_size")]
#[serde(rename = "fonts.default-size")]
default_size: i64,
#[serde(default = "default_monospace_font_size")]
#[serde(rename = "fonts.default-monospace-size")]
default_monospace_size: i64,
},
css: {
animations: {
testing: {
@@ -215,6 +238,7 @@ mod gen {
enabled: bool,
}
},
allow_scripts_to_close_windows: bool,
canvas_capture: {
enabled: bool,
},
@@ -375,6 +399,9 @@ mod gen {
layers: {
enabled: bool,
},
openxr: {
enabled: bool,
},
sessionavailable: bool,
#[serde(rename = "dom.webxr.unsafe-assume-user-intent")]
unsafe_assume_user_intent: bool,
@@ -483,12 +510,6 @@ mod gen {
shared_memory: {
enabled: bool,
},
strict: {
debug: {
enabled: bool,
},
enabled: bool,
},
throw_on_asmjs_validation_failure: {
enabled: bool,
},
@@ -551,6 +572,9 @@ mod gen {
#[serde(rename = "network.http-cache.disabled")]
disabled: bool,
},
local_directory_listing: {
enabled: bool,
},
mime: {
sniff: bool,
}

View File

@@ -108,13 +108,12 @@ impl Build {
let num_prefs = self.path_map.len();
self.output.extend(quote! {
lazy_static::lazy_static! {
pub static ref #gen_accessors: std::collections::HashMap<String, #accessor_type> = {
pub static #gen_accessors: std::sync::LazyLock<std::collections::HashMap<String, #accessor_type>> =
std::sync::LazyLock::new(|| {
let mut map = std::collections::HashMap::with_capacity(#num_prefs);
#(#values)*
map
};
}
});
});
}

View File

@@ -33,7 +33,6 @@ ipc-channel = { workspace = true }
keyboard-types = { workspace = true }
log = { workspace = true }
media = { path = "../media" }
metrics = { path = "../metrics" }
net = { path = "../net" }
net_traits = { workspace = true }
parking_lot = { workspace = true }
@@ -49,6 +48,7 @@ webgpu = { path = "../webgpu" }
webrender = { workspace = true }
webrender_api = { workspace = true }
webrender_traits = { workspace = true }
tracing = { workspace = true }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
[target.'cfg(any(target_os="macos", all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64"))))'.dependencies]

View File

@@ -152,7 +152,9 @@ use servo_config::{opts, pref};
use servo_rand::{random, Rng, ServoRng, SliceRandom};
use servo_url::{Host, ImmutableOrigin, ServoUrl};
use style_traits::CSSPixel;
use webgpu::{self, WebGPU, WebGPURequest};
use tracing::{span, Level};
use webgpu::swapchain::WGPUImageMap;
use webgpu::{self, WebGPU, WebGPURequest, WebGPUResponse};
use webrender::{RenderApi, RenderApiSender};
use webrender_api::DocumentId;
use webrender_traits::{WebRenderNetApi, WebRenderScriptApi, WebrenderExternalImageRegistry};
@@ -218,7 +220,7 @@ struct WebrenderWGPU {
webrender_external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
/// WebGPU data that supplied to Webrender for rendering
wgpu_image_map: Arc<Mutex<HashMap<u64, webgpu::PresentationData>>>,
wgpu_image_map: WGPUImageMap,
}
/// Servo supports multiple top-level browsing contexts or “webviews”, so `Constellation` needs to
@@ -551,7 +553,7 @@ pub struct InitialConstellationState {
/// User agent string to report in network requests.
pub user_agent: Cow<'static, str>,
pub wgpu_image_map: Arc<Mutex<HashMap<u64, webgpu::PresentationData>>>,
pub wgpu_image_map: WGPUImageMap,
}
/// Data needed for webdriver
@@ -881,7 +883,7 @@ where
.event_loops
.get(host)
.ok_or("Trying to get an event-loop from an unknown browsing context group")
.map(|event_loop| event_loop.clone())
.cloned()
}
fn set_event_loop(
@@ -1059,7 +1061,6 @@ where
.map(|threads| threads.pipeline()),
webxr_registry: self.webxr_registry.clone(),
player_context: self.player_context.clone(),
event_loop_waker: None,
user_agent: self.user_agent.clone(),
});
@@ -1332,6 +1333,7 @@ where
}
}
#[tracing::instrument(skip(self))]
fn handle_request_from_compositor(&mut self, message: FromCompositorMsg) {
trace_msg_from_compositor!(message, "{message:?}");
match message {
@@ -1544,6 +1546,8 @@ where
self.set_webview_throttled(webview_id, throttled);
},
FromCompositorMsg::ReadyToPresent(webview_ids) => {
let span = span!(Level::TRACE, "FromCompositorMsg::ReadyToPresent");
let _enter = span.enter();
self.embedder_proxy
.send((None, EmbedderMsg::ReadyToPresent(webview_ids)));
},
@@ -2069,7 +2073,7 @@ where
match request {
FromScriptMsg::RequestAdapter(response_sender, options, ids) => match webgpu_chan {
None => {
if let Err(e) = response_sender.send(None) {
if let Err(e) = response_sender.send(WebGPUResponse::None) {
warn!("Failed to send request adapter message: {}", e)
}
},
@@ -2644,6 +2648,7 @@ where
ipc::channel().expect("Failed to create IPC channel!");
let (storage_ipc_sender, storage_ipc_receiver) =
ipc::channel().expect("Failed to create IPC channel!");
let mut webgl_threads_receiver = None;
debug!("Exiting core resource threads.");
if let Err(e) = self
@@ -2710,9 +2715,12 @@ where
}
if let Some(webgl_threads) = self.webgl_threads.as_ref() {
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
webgl_threads_receiver = Some(receiver);
debug!("Exiting WebGL thread.");
if let Err(e) = webgl_threads.exit() {
warn!("Exit WebGL Thread failed ({})", e);
if let Err(e) = webgl_threads.exit(sender) {
warn!("Exit WebGL Thread failed ({e})");
}
}
@@ -2733,6 +2741,14 @@ where
if let Err(e) = storage_ipc_receiver.recv() {
warn!("Exit storage thread failed ({:?})", e);
}
if self.webgl_threads.is_some() {
if let Err(e) = webgl_threads_receiver
.expect("webgl_threads_receiver to be Some")
.recv()
{
warn!("Exit WebGL thread failed ({:?})", e);
}
}
debug!("Asking compositor to complete shutdown.");
self.compositor_proxy.send(CompositorMsg::ShutdownComplete);

View File

@@ -8,12 +8,12 @@
use base::id::PipelineId;
use crossbeam_channel::Sender;
use http::HeaderMap;
use http::{header, HeaderMap};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use log::warn;
use net::http_loader::{set_default_accept, set_default_accept_language};
use net_traits::request::{Destination, Referrer, RequestBuilder};
use net::http_loader::{set_default_accept_language, DOCUMENT_ACCEPT_HEADER_VALUE};
use net_traits::request::{Referrer, RequestBuilder};
use net_traits::response::ResponseInit;
use net_traits::{
CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseMsg, IpcSend, NetworkError,
@@ -66,7 +66,17 @@ impl NetworkListener {
None,
),
None => {
set_default_accept(Destination::Document, &mut listener.request_builder.headers);
if !listener
.request_builder
.headers
.contains_key(header::ACCEPT)
{
listener
.request_builder
.headers
.insert(header::ACCEPT, DOCUMENT_ACCEPT_HEADER_VALUE);
}
set_default_accept_language(&mut listener.request_builder.headers);
CoreResourceMsg::Fetch(

View File

@@ -21,7 +21,6 @@ use canvas_traits::webgl::WebGLPipeline;
use compositing_traits::{CompositionPipeline, CompositorMsg, CompositorProxy};
use crossbeam_channel::{unbounded, Sender};
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
use embedder_traits::EventLoopWaker;
use fonts::FontCacheThread;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
@@ -202,9 +201,6 @@ pub struct InitialPipelineState {
/// Application window's GL Context for Media player
pub player_context: WindowGLContext,
/// Mechanism to force the compositor to process events.
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
/// User agent string to report in network requests.
pub user_agent: Cow<'static, str>,
}

View File

@@ -64,10 +64,9 @@ impl TimerScheduler {
/// Handle an incoming timer request.
pub fn handle_timer_request(&mut self, request: TimerSchedulerMsg) {
let TimerEventRequest(_, _, _, delay) = request.0;
let schedule = Instant::now() + Duration::from_millis(delay.get());
let event = ScheduledEvent {
request: request.0,
for_time: schedule,
for_time: Instant::now() + delay,
};
self.0.push(event);
}

View File

@@ -237,6 +237,8 @@ mod from_script {
Self::OnDevtoolsStarted(..) => target_variant!("OnDevtoolsStarted"),
Self::ReadyToPresent(..) => target_variant!("ReadyToPresent"),
Self::EventDelivered(..) => target_variant!("EventDelivered"),
Self::PlayGamepadHapticEffect(..) => target_variant!("PlayGamepadHapticEffect"),
Self::StopGamepadHapticEffect(..) => target_variant!("StopGamepadHapticEffect"),
}
}
}

View File

@@ -11,11 +11,11 @@ name = "devtools"
path = "lib.rs"
[build-dependencies]
chrono = "0.4"
chrono = { workspace = true }
[dependencies]
base = { workspace = true }
chrono = "0.4"
chrono = { workspace = true }
crossbeam-channel = { workspace = true }
devtools_traits = { workspace = true }
embedder_traits = { workspace = true }

View File

@@ -2,142 +2,183 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webbrowser.js).
//! Liberally derived from the [Firefox JS implementation](https://searchfox.org/mozilla-central/source/devtools/server/actors/webbrowser.js).
//! Connection point for remote devtools that wish to investigate a particular Browsing Context's contents.
//! Supports dynamic attaching and detaching which control notifications of navigation, etc.
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::net::TcpStream;
use std::time::{SystemTime, UNIX_EPOCH};
use base::id::{BrowsingContextId, PipelineId};
use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications};
use devtools_traits::{DevtoolsPageInfo, NavigationState};
use ipc_channel::ipc::IpcSender;
use devtools_traits::DevtoolScriptControlMsg::{self, GetCssDatabase, WantsLiveNotifications};
use devtools_traits::{ConsoleLog, DevtoolsPageInfo, NavigationState, PageError};
use ipc_channel::ipc::{self, IpcSender};
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::emulation::EmulationActor;
use crate::actors::inspector::accessibility::AccessibilityActor;
use crate::actors::inspector::css_properties::CssPropertiesActor;
use crate::actors::inspector::InspectorActor;
use crate::actors::performance::PerformanceActor;
use crate::actors::profiler::ProfilerActor;
use crate::actors::reflow::ReflowActor;
use crate::actors::stylesheets::StyleSheetsActor;
use crate::actors::tab::TabDescriptorActor;
use crate::actors::thread::ThreadActor;
use crate::actors::timeline::TimelineActor;
use crate::actors::watcher::{SessionContext, SessionContextType, WatcherActor};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
struct BrowsingContextTraits {
isBrowsingContext: bool,
struct FrameUpdateReply {
from: String,
#[serde(rename = "type")]
type_: String,
frames: Vec<FrameUpdateMsg>,
}
#[derive(Serialize)]
struct AttachedTraits {
reconfigure: bool,
#[serde(rename_all = "camelCase")]
struct FrameUpdateMsg {
id: u32,
is_top_level: bool,
url: String,
title: String,
}
#[derive(Serialize)]
struct ResourceAvailableReply {
from: String,
#[serde(rename = "type")]
type_: String,
resources: Vec<ResourceAvailableMsg>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ResourceAvailableMsg {
#[serde(rename = "hasNativeConsoleAPI")]
has_native_console_api: Option<bool>,
name: String,
#[serde(rename = "newURI")]
new_uri: Option<String>,
resource_type: String,
time: u64,
title: Option<String>,
url: Option<String>,
}
#[derive(Serialize)]
struct ConsoleMsg {
from: String,
#[serde(rename = "type")]
type_: String,
resources: Vec<ConsoleMessageResource>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ConsoleMessageResource {
message: ConsoleLog,
resource_type: String,
}
#[derive(Serialize)]
struct PageErrorMsg {
from: String,
#[serde(rename = "type")]
type_: String,
resources: Vec<PageErrorResource>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct PageErrorResource {
page_error: PageError,
resource_type: String,
}
#[derive(Serialize)]
struct TabNavigated {
from: String,
#[serde(rename = "type")]
type_: String,
url: String,
title: Option<String>,
#[serde(rename = "nativeConsoleAPI")]
native_console_api: bool,
state: String,
is_frame_switching: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct BrowsingContextTraits {
frames: bool,
logInPage: bool,
canRewind: bool,
is_browsing_context: bool,
log_in_page: bool,
navigation: bool,
supports_top_level_target_flag: bool,
watchpoints: bool,
}
#[derive(Serialize)]
struct BrowsingContextAttachedReply {
from: String,
#[serde(rename = "type")]
type_: String,
threadActor: String,
cacheDisabled: bool,
javascriptEnabled: bool,
traits: AttachedTraits,
}
#[derive(Serialize)]
struct BrowsingContextDetachedReply {
from: String,
#[serde(rename = "type")]
type_: String,
}
#[derive(Serialize)]
struct ReconfigureReply {
from: String,
}
#[derive(Serialize)]
struct ListFramesReply {
from: String,
frames: Vec<FrameMsg>,
}
#[derive(Serialize)]
struct FrameMsg {
id: u32,
url: String,
title: String,
parentID: u32,
}
#[derive(Serialize)]
struct ListWorkersReply {
from: String,
workers: Vec<WorkerMsg>,
}
#[derive(Serialize)]
struct WorkerMsg {
id: u32,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BrowsingContextActorMsg {
actor: String,
title: String,
url: String,
outerWindowID: u32,
browsingContextId: u32,
consoleActor: String,
/*emulationActor: String,
inspectorActor: String,
timelineActor: String,
profilerActor: String,
performanceActor: String,
styleSheetsActor: String,*/
#[serde(rename = "outerWindowID")]
outer_window_id: u32,
#[serde(rename = "browsingContextID")]
browsing_context_id: u32,
is_top_level_target: bool,
traits: BrowsingContextTraits,
// Implemented actors
accessibility_actor: String,
console_actor: String,
css_properties_actor: String,
inspector_actor: String,
reflow_actor: String,
style_sheets_actor: String,
thread_actor: String,
// Part of the official protocol, but not yet implemented.
/*storageActor: String,
memoryActor: String,
framerateActor: String,
reflowActor: String,
cssPropertiesActor: String,
animationsActor: String,
webExtensionInspectedWindowActor: String,
accessibilityActor: String,
screenshotActor: String,
changesActor: String,
webSocketActor: String,
manifestActor: String,*/
// animations_actor: String,
// changes_actor: String,
// framerate_actor: String,
// manifest_actor: String,
// memory_actor: String,
// network_content_actor: String,
// objects_manager: String,
// performance_actor: String,
// resonsive_actor: String,
// storage_actor: String,
// tracer_actor: String,
// web_extension_inspected_window_actor: String,
// web_socket_actor: String,
}
/// The browsing context actor encompasses all of the other supporting actors when debugging a web
/// view. To this extent, it contains a watcher actor that helps when communicating with the host,
/// as well as resource actors that each perform one debugging function.
pub(crate) struct BrowsingContextActor {
pub name: String,
pub title: RefCell<String>,
pub url: RefCell<String>,
pub active_pipeline: Cell<PipelineId>,
pub browsing_context_id: BrowsingContextId,
pub accessibility: String,
pub console: String,
pub _emulation: String,
pub _inspector: String,
pub _timeline: String,
pub _profiler: String,
pub _performance: String,
pub _styleSheets: String,
pub css_properties: String,
pub inspector: String,
pub reflow: String,
pub style_sheets: String,
pub thread: String,
pub _tab: String,
pub streams: RefCell<HashMap<StreamId, TcpStream>>,
pub browsing_context_id: BrowsingContextId,
pub active_pipeline: Cell<PipelineId>,
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
pub streams: RefCell<HashMap<StreamId, TcpStream>>,
pub watcher: String,
}
impl Actor for BrowsingContextActor {
@@ -149,89 +190,17 @@ impl Actor for BrowsingContextActor {
&self,
_registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
id: StreamId,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"reconfigure" => {
if let Some(options) = msg.get("options").and_then(|o| o.as_object()) {
if let Some(val) = options.get("performReload") {
if val.as_bool().unwrap_or(false) {
let _ = self
.script_chan
.send(DevtoolScriptControlMsg::Reload(self.active_pipeline.get()));
}
}
}
let _ = stream.write_json_packet(&ReconfigureReply { from: self.name() });
ActorMessageStatus::Processed
},
// https://docs.firefox-dev.tools/backend/protocol.html#listing-browser-tabs
// (see "To attach to a _targetActor_")
"attach" => {
let msg = BrowsingContextAttachedReply {
from: self.name(),
type_: "tabAttached".to_owned(),
threadActor: self.thread.clone(),
cacheDisabled: false,
javascriptEnabled: true,
traits: AttachedTraits {
reconfigure: false,
frames: true,
logInPage: false,
canRewind: false,
watchpoints: false,
},
};
if stream.write_json_packet(&msg).is_err() {
return Ok(ActorMessageStatus::Processed);
}
self.streams
.borrow_mut()
.insert(id, stream.try_clone().unwrap());
self.script_chan
.send(WantsLiveNotifications(self.active_pipeline.get(), true))
.unwrap();
ActorMessageStatus::Processed
},
"detach" => {
let msg = BrowsingContextDetachedReply {
from: self.name(),
type_: "detached".to_owned(),
};
let _ = stream.write_json_packet(&msg);
self.cleanup(id);
ActorMessageStatus::Processed
},
"listFrames" => {
let msg = ListFramesReply {
from: self.name(),
frames: vec![FrameMsg {
//FIXME: shouldn't ignore pipeline namespace field
id: self.active_pipeline.get().index.0.get(),
parentID: 0,
url: self.url.borrow().clone(),
title: self.title.borrow().clone(),
}],
};
// TODO: Find out what needs to be listed here
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"listWorkers" => {
let msg = ListWorkersReply {
from: self.name(),
workers: vec![],
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
@@ -255,61 +224,69 @@ impl BrowsingContextActor {
script_sender: IpcSender<DevtoolScriptControlMsg>,
actors: &mut ActorRegistry,
) -> BrowsingContextActor {
let emulation = EmulationActor::new(actors.new_name("emulation"));
let name = actors.new_name("target");
let DevtoolsPageInfo { title, url } = page_info;
let accessibility = AccessibilityActor::new(actors.new_name("accessibility"));
let properties = (|| {
let (properties_sender, properties_receiver) = ipc::channel().ok()?;
script_sender.send(GetCssDatabase(properties_sender)).ok()?;
properties_receiver.recv().ok()
})()
.unwrap_or_default();
let css_properties = CssPropertiesActor::new(actors.new_name("css-properties"), properties);
let inspector = InspectorActor {
name: actors.new_name("inspector"),
walker: RefCell::new(None),
pageStyle: RefCell::new(None),
page_style: RefCell::new(None),
highlighter: RefCell::new(None),
script_chan: script_sender.clone(),
browsing_context: name.clone(),
};
let timeline =
TimelineActor::new(actors.new_name("timeline"), pipeline, script_sender.clone());
let reflow = ReflowActor::new(actors.new_name("reflow"));
let profiler = ProfilerActor::new(actors.new_name("profiler"));
let performance = PerformanceActor::new(actors.new_name("performance"));
// the strange switch between styleSheets and stylesheets is due
// to an inconsistency in devtools. See Bug #1498893 in bugzilla
let styleSheets = StyleSheetsActor::new(actors.new_name("stylesheets"));
let thread = ThreadActor::new(actors.new_name("context"));
let DevtoolsPageInfo { title, url } = page_info;
let style_sheets = StyleSheetsActor::new(actors.new_name("stylesheets"));
let tabdesc = TabDescriptorActor::new(actors, name.clone());
let thread = ThreadActor::new(actors.new_name("thread"));
let watcher = WatcherActor::new(
actors,
name.clone(),
SessionContext::new(SessionContextType::BrowserElement),
);
let target = BrowsingContextActor {
name,
script_chan: script_sender,
title: RefCell::new(title),
url: RefCell::new(url.into_string()),
active_pipeline: Cell::new(pipeline),
browsing_context_id: id,
accessibility: accessibility.name(),
console,
_emulation: emulation.name(),
_inspector: inspector.name(),
_timeline: timeline.name(),
_profiler: profiler.name(),
_performance: performance.name(),
_styleSheets: styleSheets.name(),
css_properties: css_properties.name(),
inspector: inspector.name(),
reflow: reflow.name(),
streams: RefCell::new(HashMap::new()),
style_sheets: style_sheets.name(),
_tab: tabdesc.name(),
thread: thread.name(),
streams: RefCell::new(HashMap::new()),
browsing_context_id: id,
active_pipeline: Cell::new(pipeline),
watcher: watcher.name(),
};
actors.register(Box::new(emulation));
actors.register(Box::new(accessibility));
actors.register(Box::new(css_properties));
actors.register(Box::new(inspector));
actors.register(Box::new(timeline));
actors.register(Box::new(profiler));
actors.register(Box::new(performance));
actors.register(Box::new(styleSheets));
actors.register(Box::new(thread));
actors.register(Box::new(reflow));
actors.register(Box::new(style_sheets));
actors.register(Box::new(tabdesc));
actors.register(Box::new(thread));
actors.register(Box::new(watcher));
target
}
@@ -318,21 +295,27 @@ impl BrowsingContextActor {
BrowsingContextActorMsg {
actor: self.name(),
traits: BrowsingContextTraits {
isBrowsingContext: true,
is_browsing_context: true,
frames: true,
log_in_page: false,
navigation: true,
supports_top_level_target_flag: true,
watchpoints: true,
},
title: self.title.borrow().clone(),
url: self.url.borrow().clone(),
//FIXME: shouldn't ignore pipeline namespace field
browsingContextId: self.browsing_context_id.index.0.get(),
browsing_context_id: self.browsing_context_id.index.0.get(),
//FIXME: shouldn't ignore pipeline namespace field
outerWindowID: self.active_pipeline.get().index.0.get(),
consoleActor: self.console.clone(),
/*emulationActor: self.emulation.clone(),
inspectorActor: self.inspector.clone(),
timelineActor: self.timeline.clone(),
profilerActor: self.profiler.clone(),
performanceActor: self.performance.clone(),
styleSheetsActor: self.styleSheets.clone(),*/
outer_window_id: self.active_pipeline.get().index.0.get(),
is_top_level_target: true,
accessibility_actor: self.accessibility.clone(),
console_actor: self.console.clone(),
css_properties_actor: self.css_properties.clone(),
inspector_actor: self.inspector.clone(),
reflow_actor: self.reflow.clone(),
style_sheets_actor: self.style_sheets.clone(),
thread_actor: self.thread.clone(),
}
}
@@ -346,7 +329,7 @@ impl BrowsingContextActor {
if let Some(p) = pipeline {
self.active_pipeline.set(p);
}
*self.url.borrow_mut() = url.as_str().to_owned();
url.as_str().clone_into(&mut self.url.borrow_mut());
if let Some(ref t) = title {
self.title.borrow_mut().clone_from(t);
}
@@ -356,10 +339,11 @@ impl BrowsingContextActor {
type_: "tabNavigated".to_owned(),
url: url.as_str().to_owned(),
title,
nativeConsoleAPI: true,
native_console_api: true,
state: state.to_owned(),
isFrameSwitching: false,
is_frame_switching: false,
};
for stream in self.streams.borrow_mut().values_mut() {
let _ = stream.write_json_packet(&msg);
}
@@ -371,16 +355,70 @@ impl BrowsingContextActor {
}
*self.title.borrow_mut() = title;
}
}
#[derive(Serialize)]
struct TabNavigated {
from: String,
#[serde(rename = "type")]
type_: String,
url: String,
title: Option<String>,
nativeConsoleAPI: bool,
state: String,
isFrameSwitching: bool,
pub(crate) fn frame_update(&self, stream: &mut TcpStream) {
let _ = stream.write_json_packet(&FrameUpdateReply {
from: self.name(),
type_: "frameUpdate".into(),
frames: vec![FrameUpdateMsg {
id: self.browsing_context_id.index.0.get(),
is_top_level: true,
title: self.title.borrow().clone(),
url: self.url.borrow().clone(),
}],
});
}
pub(crate) fn document_event(&self, stream: &mut TcpStream) {
// TODO: This is a hacky way of sending the 3 messages
// Figure out if there needs work to be done here, ensure the page is loaded
for &name in ["dom-loading", "dom-interactive", "dom-complete"].iter() {
let _ = stream.write_json_packet(&ResourceAvailableReply {
from: self.name(),
type_: "resource-available-form".into(),
resources: vec![ResourceAvailableMsg {
has_native_console_api: Some(true),
name: name.into(),
new_uri: None,
resource_type: "document-event".into(),
time: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as u64,
title: Some(self.title.borrow().clone()),
url: Some(self.url.borrow().clone()),
}],
});
}
}
pub(crate) fn console_message(&self, message: ConsoleLog) {
let msg = ConsoleMsg {
from: self.name(),
type_: "resource-available-form".into(),
resources: vec![ConsoleMessageResource {
message,
resource_type: "console-message".into(),
}],
};
for stream in self.streams.borrow_mut().values_mut() {
let _ = stream.write_json_packet(&msg);
}
}
pub(crate) fn page_error(&self, page_error: PageError) {
let msg = PageErrorMsg {
from: self.name(),
type_: "resource-available-form".into(),
resources: vec![PageErrorResource {
page_error,
resource_type: "error-message".into(),
}],
};
for stream in self.streams.borrow_mut().values_mut() {
let _ = stream.write_json_packet(&msg);
}
}
}

View File

@@ -16,7 +16,7 @@ use devtools_traits::EvaluateJSReply::{
ActorValue, BooleanValue, NullValue, NumberValue, StringValue, VoidValue,
};
use devtools_traits::{
CachedConsoleMessage, CachedConsoleMessageTypes, ConsoleAPI, ConsoleMessage,
CachedConsoleMessage, CachedConsoleMessageTypes, ConsoleLog, ConsoleMessage,
DevtoolScriptControlMsg, LogLevel, PageError,
};
use ipc_channel::ipc::{self, IpcSender};
@@ -40,7 +40,7 @@ impl EncodableConsoleMessage for CachedConsoleMessage {
fn encode(&self) -> serde_json::Result<String> {
match *self {
CachedConsoleMessage::PageError(ref a) => serde_json::to_string(a),
CachedConsoleMessage::ConsoleAPI(ref a) => serde_json::to_string(a),
CachedConsoleMessage::ConsoleLog(ref a) => serde_json::to_string(a),
}
}
}
@@ -49,10 +49,11 @@ impl EncodableConsoleMessage for CachedConsoleMessage {
struct StartedListenersTraits;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct StartedListenersReply {
from: String,
nativeConsoleAPI: bool,
startedListeners: Vec<String>,
native_console_api: bool,
started_listeners: Vec<String>,
traits: StartedListenersTraits,
}
@@ -63,46 +64,53 @@ struct GetCachedMessagesReply {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct StopListenersReply {
from: String,
stoppedListeners: Vec<String>,
stopped_listeners: Vec<String>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct AutocompleteReply {
from: String,
matches: Vec<String>,
matchProp: String,
match_prop: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct EvaluateJSReply {
from: String,
input: String,
result: Value,
timestamp: u64,
exception: Value,
exceptionMessage: Value,
helperResult: Value,
exception_message: Value,
helper_result: Value,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct EvaluateJSEvent {
from: String,
r#type: String,
#[serde(rename = "type")]
type_: String,
input: String,
result: Value,
timestamp: u64,
resultID: String,
#[serde(rename = "resultID")]
result_id: String,
exception: Value,
exceptionMessage: Value,
helperResult: Value,
exception_message: Value,
helper_result: Value,
}
#[derive(Serialize)]
struct EvaluateJSAsyncReply {
from: String,
resultID: String,
#[serde(rename = "resultID")]
result_id: String,
}
#[derive(Serialize)]
@@ -133,23 +141,6 @@ impl ConsoleActor {
}
}
fn streams_mut(&self, registry: &ActorRegistry, cb: impl Fn(&mut TcpStream)) {
match &self.root {
Root::BrowsingContext(bc) => registry
.find::<BrowsingContextActor>(bc)
.streams
.borrow_mut()
.values_mut()
.for_each(cb),
Root::DedicatedWorker(worker) => registry
.find::<WorkerActor>(worker)
.streams
.borrow_mut()
.values_mut()
.for_each(cb),
}
}
fn current_unique_id(&self, registry: &ActorRegistry) -> UniqueId {
match &self.root {
Root::BrowsingContext(bc) => UniqueId::Pipeline(
@@ -162,14 +153,14 @@ impl ConsoleActor {
}
}
fn evaluateJS(
fn evaluate_js(
&self,
registry: &ActorRegistry,
msg: &Map<String, Value>,
) -> Result<EvaluateJSReply, ()> {
let input = msg.get("text").unwrap().as_str().unwrap().to_owned();
let (chan, port) = ipc::channel().unwrap();
// FIXME: redesign messages so we don't have to fake pipeline ids when
// FIXME: Redesign messages so we don't have to fake pipeline ids when
// communicating with workers.
let pipeline = match self.current_unique_id(registry) {
UniqueId::Pipeline(p) => p,
@@ -183,7 +174,7 @@ impl ConsoleActor {
))
.unwrap();
//TODO: extract conversion into protocol module or some other useful place
// TODO: Extract conversion into protocol module or some other useful place
let result = match port.recv().map_err(|_| ())? {
VoidValue => {
let mut m = Map::new();
@@ -219,7 +210,7 @@ impl ConsoleActor {
},
StringValue(s) => Value::String(s),
ActorValue { class, uuid } => {
//TODO: make initial ActorValue message include these properties?
// TODO: Make initial ActorValue message include these properties?
let mut m = Map::new();
let actor = ObjectActor::register(registry, uuid);
@@ -233,15 +224,18 @@ impl ConsoleActor {
},
};
//TODO: catch and return exception values from JS evaluation
// TODO: Catch and return exception values from JS evaluation
let reply = EvaluateJSReply {
from: self.name(),
input,
result,
timestamp: 0,
timestamp: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as u64,
exception: Value::Null,
exceptionMessage: Value::Null,
helperResult: Value::Null,
exception_message: Value::Null,
helper_result: Value::Null,
};
std::result::Result::Ok(reply)
}
@@ -258,14 +252,11 @@ impl ConsoleActor {
.or_default()
.push(CachedConsoleMessage::PageError(page_error.clone()));
if id == self.current_unique_id(registry) {
let msg = PageErrorMsg {
from: self.name(),
type_: "pageError".to_owned(),
pageError: page_error,
if let Root::BrowsingContext(bc) = &self.root {
registry
.find::<BrowsingContextActor>(bc)
.page_error(page_error)
};
self.streams_mut(registry, |stream| {
let _ = stream.write_json_packet(&msg);
});
}
}
@@ -275,7 +266,7 @@ impl ConsoleActor {
id: UniqueId,
registry: &ActorRegistry,
) {
let level = match console_message.logLevel {
let level = match console_message.log_level {
LogLevel::Debug => "debug",
LogLevel::Info => "info",
LogLevel::Warn => "warn",
@@ -284,42 +275,30 @@ impl ConsoleActor {
_ => "log",
}
.to_owned();
let console_api = ConsoleLog {
level: level.clone(),
filename: console_message.filename.clone(),
line_number: console_message.line_number as u32,
column_number: console_message.column_number as u32,
time_stamp: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as u64,
arguments: vec![console_message.message.clone()],
};
self.cached_events
.borrow_mut()
.entry(id.clone())
.or_default()
.push(CachedConsoleMessage::ConsoleAPI(ConsoleAPI {
type_: "ConsoleAPI".to_owned(),
level: level.clone(),
filename: console_message.filename.clone(),
lineNumber: console_message.lineNumber as u32,
functionName: "".to_string(), //TODO
timeStamp: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_nanos() as u64,
private: false,
arguments: vec![console_message.message.clone()],
}));
.push(CachedConsoleMessage::ConsoleLog(console_api.clone()));
if id == self.current_unique_id(registry) {
let msg = ConsoleAPICall {
from: self.name(),
type_: "consoleAPICall".to_owned(),
message: ConsoleMsg {
level,
timeStamp: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_nanos() as u64,
arguments: vec![console_message.message],
filename: console_message.filename,
lineNumber: console_message.lineNumber,
columnNumber: console_message.columnNumber,
},
if let Root::BrowsingContext(bc) = &self.root {
registry
.find::<BrowsingContextActor>(bc)
.console_message(console_api)
};
self.streams_mut(registry, |stream| {
let _ = stream.write_json_packet(&msg);
});
}
}
}
@@ -377,7 +356,7 @@ impl Actor for ConsoleActor {
{
true
},
CachedConsoleMessage::ConsoleAPI(_)
CachedConsoleMessage::ConsoleLog(_)
if message_types.contains(CachedConsoleMessageTypes::CONSOLE_API) =>
{
true
@@ -404,8 +383,8 @@ impl Actor for ConsoleActor {
let listeners = msg.get("listeners").unwrap().as_array().unwrap().to_owned();
let msg = StartedListenersReply {
from: self.name(),
nativeConsoleAPI: true,
startedListeners: listeners
native_console_api: true,
started_listeners: listeners
.into_iter()
.map(|s| s.as_str().unwrap().to_owned())
.collect(),
@@ -419,7 +398,7 @@ impl Actor for ConsoleActor {
//TODO: actually implement listener filters that support starting/stopping
let msg = StopListenersReply {
from: self.name(),
stoppedListeners: msg
stopped_listeners: msg
.get("listeners")
.unwrap()
.as_array()
@@ -438,23 +417,23 @@ impl Actor for ConsoleActor {
let msg = AutocompleteReply {
from: self.name(),
matches: vec![],
matchProp: "".to_owned(),
match_prop: "".to_owned(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"evaluateJS" => {
let msg = self.evaluateJS(registry, msg);
let msg = self.evaluate_js(registry, msg);
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"evaluateJSAsync" => {
let resultID = Uuid::new_v4().to_string();
let result_id = Uuid::new_v4().to_string();
let early_reply = EvaluateJSAsyncReply {
from: self.name(),
resultID: resultID.clone(),
result_id: result_id.clone(),
};
// Emit an eager reply so that the client starts listening
// for an async event with the resultID
@@ -468,17 +447,17 @@ impl Actor for ConsoleActor {
return Ok(ActorMessageStatus::Processed);
}
let reply = self.evaluateJS(registry, msg).unwrap();
let reply = self.evaluate_js(registry, msg).unwrap();
let msg = EvaluateJSEvent {
from: self.name(),
r#type: "evaluationResult".to_owned(),
type_: "evaluationResult".to_owned(),
input: reply.input,
result: reply.result,
timestamp: reply.timestamp,
resultID,
result_id,
exception: reply.exception,
exceptionMessage: reply.exceptionMessage,
helperResult: reply.helperResult,
exception_message: reply.exception_message,
helper_result: reply.helper_result,
};
// Send the data from evaluateJS along with a resultID
let _ = stream.write_json_packet(&msg);
@@ -498,29 +477,3 @@ impl Actor for ConsoleActor {
})
}
}
#[derive(Serialize)]
struct ConsoleAPICall {
from: String,
#[serde(rename = "type")]
type_: String,
message: ConsoleMsg,
}
#[derive(Serialize)]
struct ConsoleMsg {
level: String,
timeStamp: u64,
arguments: Vec<String>,
filename: String,
lineNumber: usize,
columnNumber: usize,
}
#[derive(Serialize)]
struct PageErrorMsg {
from: String,
#[serde(rename = "type")]
type_: String,
pageError: PageError,
}

View File

@@ -20,6 +20,7 @@ struct GetDescriptionReply {
// This is only a minimal subset of the properties exposed/expected by Firefox
// (see https://searchfox.org/mozilla-central/source/devtools/shared/system.js#45)
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct SystemInfo {
apptype: String,
// Display version
@@ -30,7 +31,7 @@ struct SystemInfo {
// Firefox major.minor version number, use for compatibility checks
platformversion: String,
// Display name
brandName: String,
brand_name: String,
}
include!(concat!(env!("OUT_DIR"), "/build_id.rs"));
@@ -59,8 +60,8 @@ impl Actor for DeviceActor {
apptype: "servo".to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
appbuildid: BUILD_ID.to_string(),
platformversion: "124.0".to_string(),
brandName: "Servo".to_string(),
platformversion: "125.0".to_string(),
brand_name: "Servo".to_string(),
},
};
let _ = stream.write_json_packet(&msg);
@@ -80,7 +81,7 @@ impl DeviceActor {
pub fn description() -> ActorDescription {
ActorDescription {
category: "actor",
typeName: "device",
type_name: "device",
methods: vec![Method {
name: "getDescription",
request: Value::Null,

View File

@@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::net::TcpStream;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId;
pub struct EmulationActor {
pub name: String,
}
impl Actor for EmulationActor {
fn name(&self) -> String {
self.name.clone()
}
fn handle_message(
&self,
_registry: &ActorRegistry,
_msg_type: &str,
_msg: &Map<String, Value>,
_stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(ActorMessageStatus::Ignored)
}
}
impl EmulationActor {
pub fn new(name: String) -> EmulationActor {
EmulationActor { name }
}
}

View File

@@ -18,7 +18,6 @@ pub struct FramerateActor {
name: String,
pipeline: PipelineId,
script_sender: IpcSender<DevtoolScriptControlMsg>,
is_recording: bool,
ticks: Vec<HighResolutionStamp>,
}
@@ -41,7 +40,7 @@ impl Actor for FramerateActor {
}
impl FramerateActor {
/// return name of actor
/// Return name of actor
pub fn create(
registry: &ActorRegistry,
pipeline_id: PipelineId,

View File

@@ -5,137 +5,38 @@
//! Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js).
use std::cell::RefCell;
use std::collections::HashMap;
use std::net::TcpStream;
use base::id::PipelineId;
use devtools_traits::DevtoolScriptControlMsg::{
GetChildren, GetDocumentElement, GetLayout, GetRootNode, ModifyAttribute,
};
use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo};
use devtools_traits::DevtoolScriptControlMsg;
use devtools_traits::DevtoolScriptControlMsg::GetRootNode;
use ipc_channel::ipc::{self, IpcSender};
use serde::Serialize;
use serde_json::{self, Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::browsing_context::BrowsingContextActor;
use crate::actors::inspector::highlighter::{HighlighterActor, HighlighterMsg};
use crate::actors::inspector::node::NodeInfoToProtocol;
use crate::actors::inspector::page_style::{PageStyleActor, PageStyleMsg};
use crate::actors::inspector::walker::{WalkerActor, WalkerMsg};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
pub struct InspectorActor {
pub name: String,
pub walker: RefCell<Option<String>>,
pub pageStyle: RefCell<Option<String>>,
pub highlighter: RefCell<Option<String>>,
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
pub browsing_context: String,
}
pub mod accessibility;
pub mod css_properties;
pub mod highlighter;
pub mod layout;
pub mod node;
pub mod page_style;
pub mod style_rule;
pub mod walker;
#[derive(Serialize)]
struct GetHighlighterReply {
highligter: HighlighterMsg, // sic.
#[serde(rename_all = "camelCase")]
struct GetPageStyleReply {
from: String,
}
#[derive(Serialize)]
struct HighlighterMsg {
actor: String,
}
struct HighlighterActor {
name: String,
}
pub struct NodeActor {
pub name: String,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
}
#[derive(Serialize)]
struct ShowBoxModelReply {
from: String,
}
#[derive(Serialize)]
struct HideBoxModelReply {
from: String,
}
impl Actor for HighlighterActor {
fn name(&self) -> String {
self.name.clone()
}
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"showBoxModel" => {
let msg = ShowBoxModelReply { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"hideBoxModel" => {
let msg = HideBoxModelReply { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
#[derive(Serialize)]
struct ModifyAttributeReply {
from: String,
}
impl Actor for NodeActor {
fn name(&self) -> String {
self.name.clone()
}
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"modifyAttributes" => {
let target = msg.get("to").unwrap().as_str().unwrap();
let mods = msg.get("modifications").unwrap().as_array().unwrap();
let modifications = mods
.iter()
.map(|json_mod| {
serde_json::from_str(&serde_json::to_string(json_mod).unwrap()).unwrap()
})
.collect();
self.script_chan
.send(ModifyAttribute(
self.pipeline,
registry.actor_to_script(target.to_owned()),
modifications,
))
.unwrap();
let reply = ModifyAttributeReply { from: self.name() };
let _ = stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
page_style: PageStyleMsg,
}
#[derive(Serialize)]
@@ -145,452 +46,24 @@ struct GetWalkerReply {
}
#[derive(Serialize)]
struct WalkerMsg {
actor: String,
root: NodeActorMsg,
}
#[derive(Serialize)]
struct AttrMsg {
namespace: String,
name: String,
value: String,
}
#[derive(Serialize)]
struct NodeActorMsg {
actor: String,
baseURI: String,
parent: String,
nodeType: u16,
namespaceURI: String,
nodeName: String,
numChildren: usize,
name: String,
publicId: String,
systemId: String,
attrs: Vec<AttrMsg>,
pseudoClassLocks: Vec<String>,
isDisplayed: bool,
hasEventListeners: bool,
isDocumentElement: bool,
shortValue: String,
incompleteValue: bool,
}
trait NodeInfoToProtocol {
fn encode(
self,
actors: &ActorRegistry,
display: bool,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
) -> NodeActorMsg;
}
impl NodeInfoToProtocol for NodeInfo {
fn encode(
self,
actors: &ActorRegistry,
display: bool,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
) -> NodeActorMsg {
let actor_name = if !actors.script_actor_registered(self.uniqueId.clone()) {
let name = actors.new_name("node");
let node_actor = NodeActor {
name: name.clone(),
script_chan,
pipeline,
};
actors.register_script_actor(self.uniqueId, name.clone());
actors.register_later(Box::new(node_actor));
name
} else {
actors.script_to_actor(self.uniqueId)
};
NodeActorMsg {
actor: actor_name,
baseURI: self.baseURI,
parent: actors.script_to_actor(self.parent.clone()),
nodeType: self.nodeType,
namespaceURI: self.namespaceURI,
nodeName: self.nodeName,
numChildren: self.numChildren,
name: self.name,
publicId: self.publicId,
systemId: self.systemId,
attrs: self
.attrs
.into_iter()
.map(|attr| AttrMsg {
namespace: attr.namespace,
name: attr.name,
value: attr.value,
})
.collect(),
pseudoClassLocks: vec![], //TODO get this data from script
isDisplayed: display,
hasEventListeners: false, //TODO get this data from script
isDocumentElement: self.isDocumentElement,
shortValue: self.shortValue,
incompleteValue: self.incompleteValue,
}
}
}
struct WalkerActor {
name: String,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
}
#[derive(Serialize)]
struct QuerySelectorReply {
struct SupportsHighlightersReply {
from: String,
value: bool,
}
#[derive(Serialize)]
struct DocumentElementReply {
struct GetHighlighterReply {
from: String,
node: NodeActorMsg,
highlighter: HighlighterMsg,
}
#[derive(Serialize)]
struct ClearPseudoclassesReply {
from: String,
}
#[derive(Serialize)]
struct ChildrenReply {
hasFirst: bool,
hasLast: bool,
nodes: Vec<NodeActorMsg>,
from: String,
}
impl Actor for WalkerActor {
fn name(&self) -> String {
self.name.clone()
}
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"querySelector" => {
let msg = QuerySelectorReply { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"documentElement" => {
let (tx, rx) = ipc::channel().unwrap();
self.script_chan
.send(GetDocumentElement(self.pipeline, tx))
.unwrap();
let doc_elem_info = rx.recv().unwrap().ok_or(())?;
let node =
doc_elem_info.encode(registry, true, self.script_chan.clone(), self.pipeline);
let msg = DocumentElementReply {
from: self.name(),
node,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"clearPseudoClassLocks" => {
let msg = ClearPseudoclassesReply { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"children" => {
let target = msg.get("node").unwrap().as_str().unwrap();
let (tx, rx) = ipc::channel().unwrap();
self.script_chan
.send(GetChildren(
self.pipeline,
registry.actor_to_script(target.to_owned()),
tx,
))
.unwrap();
let children = rx.recv().unwrap().ok_or(())?;
let msg = ChildrenReply {
hasFirst: true,
hasLast: true,
nodes: children
.into_iter()
.map(|child| {
child.encode(registry, true, self.script_chan.clone(), self.pipeline)
})
.collect(),
from: self.name(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
#[derive(Serialize)]
struct GetPageStyleReply {
from: String,
pageStyle: PageStyleMsg,
}
#[derive(Serialize)]
struct PageStyleMsg {
actor: String,
}
struct PageStyleActor {
name: String,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
}
#[derive(Serialize)]
struct GetAppliedReply {
entries: Vec<AppliedEntry>,
rules: Vec<AppliedRule>,
sheets: Vec<AppliedSheet>,
from: String,
}
#[derive(Serialize)]
struct GetComputedReply {
computed: Vec<u32>, //XXX all css props
from: String,
}
#[derive(Serialize)]
struct AppliedEntry {
rule: String,
pseudoElement: Value,
isSystem: bool,
matchedSelectors: Vec<String>,
}
#[derive(Serialize)]
struct AppliedRule {
actor: String,
#[serde(rename = "type")]
type_: String,
href: String,
cssText: String,
line: u32,
column: u32,
parentStyleSheet: String,
}
#[derive(Serialize)]
struct AppliedSheet {
actor: String,
href: String,
nodeHref: String,
disabled: bool,
title: String,
system: bool,
styleSheetIndex: isize,
ruleCount: usize,
}
#[derive(Serialize)]
struct GetLayoutReply {
from: String,
display: String,
position: String,
#[serde(rename = "z-index")]
zIndex: String,
#[serde(rename = "box-sizing")]
boxSizing: String,
// Would be nice to use a proper struct, blocked by
// https://github.com/serde-rs/serde/issues/43
autoMargins: serde_json::value::Value,
#[serde(rename = "margin-top")]
marginTop: String,
#[serde(rename = "margin-right")]
marginRight: String,
#[serde(rename = "margin-bottom")]
marginBottom: String,
#[serde(rename = "margin-left")]
marginLeft: String,
#[serde(rename = "border-top-width")]
borderTopWidth: String,
#[serde(rename = "border-right-width")]
borderRightWidth: String,
#[serde(rename = "border-bottom-width")]
borderBottomWidth: String,
#[serde(rename = "border-left-width")]
borderLeftWidth: String,
#[serde(rename = "padding-top")]
paddingTop: String,
#[serde(rename = "padding-right")]
paddingRight: String,
#[serde(rename = "padding-bottom")]
paddingBottom: String,
#[serde(rename = "padding-left")]
paddingLeft: String,
width: f32,
height: f32,
}
impl Actor for PageStyleActor {
fn name(&self) -> String {
self.name.clone()
}
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"getApplied" => {
//TODO: query script for relevant applied styles to node (msg.node)
let msg = GetAppliedReply {
entries: vec![],
rules: vec![],
sheets: vec![],
from: self.name(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getComputed" => {
//TODO: query script for relevant computed styles on node (msg.node)
let msg = GetComputedReply {
computed: vec![],
from: self.name(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
//TODO: query script for box layout properties of node (msg.node)
"getLayout" => {
let target = msg.get("node").unwrap().as_str().unwrap();
let (tx, rx) = ipc::channel().unwrap();
self.script_chan
.send(GetLayout(
self.pipeline,
registry.actor_to_script(target.to_owned()),
tx,
))
.unwrap();
let ComputedNodeLayout {
display,
position,
zIndex,
boxSizing,
autoMargins,
marginTop,
marginRight,
marginBottom,
marginLeft,
borderTopWidth,
borderRightWidth,
borderBottomWidth,
borderLeftWidth,
paddingTop,
paddingRight,
paddingBottom,
paddingLeft,
width,
height,
} = rx.recv().unwrap().ok_or(())?;
let auto_margins = msg
.get("autoMargins")
.and_then(Value::as_bool)
.unwrap_or(false);
// http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js
let msg = GetLayoutReply {
from: self.name(),
display,
position,
zIndex,
boxSizing,
autoMargins: if auto_margins {
let mut m = Map::new();
let auto = serde_json::value::Value::String("auto".to_owned());
if autoMargins.top {
m.insert("top".to_owned(), auto.clone());
}
if autoMargins.right {
m.insert("right".to_owned(), auto.clone());
}
if autoMargins.bottom {
m.insert("bottom".to_owned(), auto.clone());
}
if autoMargins.left {
m.insert("left".to_owned(), auto);
}
serde_json::value::Value::Object(m)
} else {
serde_json::value::Value::Null
},
marginTop,
marginRight,
marginBottom,
marginLeft,
borderTopWidth,
borderRightWidth,
borderBottomWidth,
borderLeftWidth,
paddingTop,
paddingRight,
paddingBottom,
paddingLeft,
width,
height,
};
let msg = serde_json::to_string(&msg).unwrap();
let msg = serde_json::from_str::<Value>(&msg).unwrap();
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
pub struct InspectorActor {
pub name: String,
pub walker: RefCell<Option<String>>,
pub page_style: RefCell<Option<String>>,
pub highlighter: RefCell<Option<String>>,
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
pub browsing_context: String,
}
impl Actor for InspectorActor {
@@ -610,28 +83,42 @@ impl Actor for InspectorActor {
let pipeline = browsing_context.active_pipeline.get();
Ok(match msg_type {
"getWalker" => {
let (tx, rx) = ipc::channel().unwrap();
self.script_chan.send(GetRootNode(pipeline, tx)).unwrap();
let root_info = rx.recv().unwrap().ok_or(())?;
let name = self
.walker
.borrow()
.clone()
.unwrap_or_else(|| registry.new_name("walker"));
let root = root_info.encode(
registry,
false,
self.script_chan.clone(),
pipeline,
name.clone(),
);
if self.walker.borrow().is_none() {
let walker = WalkerActor {
name: registry.new_name("walker"),
name,
script_chan: self.script_chan.clone(),
pipeline,
root_node: root.clone(),
mutations: RefCell::new(vec![]),
};
let mut walker_name = self.walker.borrow_mut();
*walker_name = Some(walker.name());
registry.register_later(Box::new(walker));
}
let (tx, rx) = ipc::channel().unwrap();
self.script_chan.send(GetRootNode(pipeline, tx)).unwrap();
let root_info = rx.recv().unwrap().ok_or(())?;
let node = root_info.encode(registry, false, self.script_chan.clone(), pipeline);
let msg = GetWalkerReply {
from: self.name(),
walker: WalkerMsg {
actor: self.walker.borrow().clone().unwrap(),
root: node,
root,
},
};
let _ = stream.write_json_packet(&msg);
@@ -639,31 +126,43 @@ impl Actor for InspectorActor {
},
"getPageStyle" => {
if self.pageStyle.borrow().is_none() {
if self.page_style.borrow().is_none() {
let style = PageStyleActor {
name: registry.new_name("pageStyle"),
name: registry.new_name("page-style"),
script_chan: self.script_chan.clone(),
pipeline,
};
let mut pageStyle = self.pageStyle.borrow_mut();
*pageStyle = Some(style.name());
let mut page_style = self.page_style.borrow_mut();
*page_style = Some(style.name());
registry.register_later(Box::new(style));
}
let msg = GetPageStyleReply {
from: self.name(),
pageStyle: PageStyleMsg {
actor: self.pageStyle.borrow().clone().unwrap(),
page_style: PageStyleMsg {
actor: self.page_style.borrow().clone().unwrap(),
traits: HashMap::from([
("fontStretchLevel4".into(), true),
("fontStyleLevel4".into(), true),
("fontVariations".into(), true),
("fontWeightLevel4".into(), true),
]),
},
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
//TODO: this is an old message; try adding highlightable to the root traits instead
// and support getHighlighter instead
//"highlight" => {}
"getHighlighter" => {
"supportsHighlighters" => {
let msg = SupportsHighlightersReply {
from: self.name(),
value: true,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getHighlighterByType" => {
if self.highlighter.borrow().is_none() {
let highlighter_actor = HighlighterActor {
name: registry.new_name("highlighter"),
@@ -675,7 +174,7 @@ impl Actor for InspectorActor {
let msg = GetHighlighterReply {
from: self.name(),
highligter: HighlighterMsg {
highlighter: HighlighterMsg {
actor: self.highlighter.borrow().clone().unwrap(),
},
};

View File

@@ -0,0 +1,132 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! The Accessibility actor is responsible for the Accessibility tab in the DevTools page. Right
//! now it is a placeholder for future functionality.
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
#[derive(Serialize)]
struct BootstrapState {
enabled: bool,
}
#[derive(Serialize)]
struct BootstrapReply {
from: String,
state: BootstrapState,
}
#[derive(Serialize)]
struct GetSimulatorReply {
from: String,
simulator: ActorMsg,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct AccessibilityTraits {
tabbing_order: bool,
}
#[derive(Serialize)]
struct GetTraitsReply {
from: String,
traits: AccessibilityTraits,
}
#[derive(Serialize)]
struct ActorMsg {
actor: String,
}
#[derive(Serialize)]
struct GetWalkerReply {
from: String,
walker: ActorMsg,
}
pub struct AccessibilityActor {
name: String,
}
impl Actor for AccessibilityActor {
fn name(&self) -> String {
self.name.clone()
}
/// The accesibility actor can handle the following messages:
///
/// - `bootstrap`: It is required but it doesn't do anything yet
///
/// - `getSimulator`: Returns a new Simulator actor
///
/// - `getTraits`: Informs the DevTools client about the configuration of the accessibility actor
///
/// - `getWalker`: Returns a new AccessibleWalker actor (not to be confused with the general
/// inspector Walker actor)
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"bootstrap" => {
let msg = BootstrapReply {
from: self.name(),
state: BootstrapState { enabled: false },
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getSimulator" => {
// TODO: Create actual simulator
let simulator = registry.new_name("simulator");
let msg = GetSimulatorReply {
from: self.name(),
simulator: ActorMsg { actor: simulator },
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getTraits" => {
let msg = GetTraitsReply {
from: self.name(),
traits: AccessibilityTraits {
tabbing_order: true,
},
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getWalker" => {
// TODO: Create actual accessible walker
let walker = registry.new_name("accesiblewalker");
let msg = GetWalkerReply {
from: self.name(),
walker: ActorMsg { actor: walker },
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl AccessibilityActor {
pub fn new(name: String) -> Self {
Self { name }
}
}

View File

@@ -0,0 +1,65 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! This actor holds a database of available css properties, their supported values and
//! alternative names
use std::collections::HashMap;
use std::net::TcpStream;
use devtools_traits::CssDatabaseProperty;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
pub struct CssPropertiesActor {
name: String,
properties: HashMap<String, CssDatabaseProperty>,
}
#[derive(Serialize)]
struct GetCssDatabaseReply<'a> {
from: String,
properties: &'a HashMap<String, CssDatabaseProperty>,
}
impl Actor for CssPropertiesActor {
fn name(&self) -> String {
self.name.clone()
}
/// The css properties actor can handle the following messages:
///
/// - `getCSSDatabase`: Returns a big list of every supported css property so that the
/// inspector can show the available options
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"getCSSDatabase" => {
let _ = stream.write_json_packet(&GetCssDatabaseReply {
from: self.name(),
properties: &self.properties,
});
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl CssPropertiesActor {
pub fn new(name: String, properties: HashMap<String, CssDatabaseProperty>) -> Self {
Self { name, properties }
}
}

View File

@@ -0,0 +1,69 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Handles highlighting selected DOM nodes in the inspector. At the moment it only replies and
//! changes nothing on Servo's side.
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{self, Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
pub struct HighlighterMsg {
pub actor: String,
}
pub struct HighlighterActor {
pub name: String,
}
#[derive(Serialize)]
struct ShowReply {
from: String,
value: bool,
}
impl Actor for HighlighterActor {
fn name(&self) -> String {
self.name.clone()
}
/// The highligher actor can handle the following messages:
///
/// - `show`: Enables highlighting for the selected node
///
/// - `hide`: Disables highlighting for the selected node
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"show" => {
let msg = ShowReply {
from: self.name(),
value: true,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"hide" => {
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}

View File

@@ -0,0 +1,88 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! The layout actor informs the DevTools client of the layout properties of the document, such as
//! grids or flexboxes. It acts as a placeholder for now.
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
#[derive(Serialize)]
pub struct LayoutInspectorActorMsg {
actor: String,
}
pub struct LayoutInspectorActor {
name: String,
}
#[derive(Serialize)]
pub struct GetGridsReply {
from: String,
grids: Vec<String>,
}
#[derive(Serialize)]
pub struct GetCurrentFlexboxReply {
from: String,
flexbox: Option<()>,
}
impl Actor for LayoutInspectorActor {
fn name(&self) -> String {
self.name.clone()
}
/// The layout inspector actor can handle the following messages:
///
/// - `getGrids`: Returns a list of CSS grids, non functional at the moment
///
/// - `getCurrentFlexbox`: Returns the active flexbox, non functional at the moment
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"getGrids" => {
let msg = GetGridsReply {
from: self.name(),
// TODO: Actually create a list of grids
grids: vec![],
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getCurrentFlexbox" => {
let msg = GetCurrentFlexboxReply {
from: self.name(),
// TODO: Create and return the current flexbox object
flexbox: None,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl LayoutInspectorActor {
pub fn new(name: String) -> Self {
Self { name }
}
pub fn encodable(&self) -> LayoutInspectorActorMsg {
LayoutInspectorActorMsg { actor: self.name() }
}
}

View File

@@ -0,0 +1,263 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! This actor represents one DOM node. It is created by the Walker actor when it is traversing the
//! document tree.
use std::cell::RefCell;
use std::collections::HashMap;
use std::net::TcpStream;
use base::id::PipelineId;
use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement, ModifyAttribute};
use devtools_traits::{DevtoolScriptControlMsg, NodeInfo};
use ipc_channel::ipc::{self, IpcSender};
use serde::Serialize;
use serde_json::{self, Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::inspector::walker::WalkerActor;
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
/// Text node type constant. This is defined again to avoid depending on `script`, where it is defined originally.
/// See `script::dom::bindings::codegen::Bindings::NodeBinding::NodeConstants`.
const TEXT_NODE: u16 = 3;
/// The maximum length of a text node for it to appear as an inline child in the inspector.
const MAX_INLINE_LENGTH: usize = 50;
#[derive(Serialize)]
struct GetUniqueSelectorReply {
from: String,
value: String,
}
#[derive(Clone, Serialize)]
struct AttrMsg {
name: String,
value: String,
}
#[derive(Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct NodeActorMsg {
pub actor: String,
#[serde(rename = "baseURI")]
base_uri: String,
causes_overflow: bool,
container_type: Option<()>,
pub display_name: String,
display_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_text_child: Option<Box<NodeActorMsg>>,
is_after_pseudo_element: bool,
is_anonymous: bool,
is_before_pseudo_element: bool,
is_direct_shadow_host_child: Option<bool>,
is_displayed: bool,
#[serde(rename = "isInHTMLDocument")]
is_in_html_document: Option<bool>,
is_marker_pseudo_element: bool,
is_native_anonymous: bool,
is_scrollable: bool,
is_shadow_root: bool,
is_top_level_document: bool,
node_name: String,
node_type: u16,
node_value: Option<String>,
pub num_children: usize,
#[serde(skip_serializing_if = "String::is_empty")]
parent: String,
shadow_root_mode: Option<()>,
traits: HashMap<String, ()>,
attrs: Vec<AttrMsg>,
}
pub struct NodeActor {
name: String,
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
pub pipeline: PipelineId,
pub walker: String,
pub style_rules: RefCell<HashMap<(String, usize), String>>,
}
impl Actor for NodeActor {
fn name(&self) -> String {
self.name.clone()
}
/// The node actor can handle the following messages:
///
/// - `modifyAttributes`: Asks the script to change a value in the attribute of the
/// corresponding node
///
/// - `getUniqueSelector`: Returns the display name of this node
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"modifyAttributes" => {
let mods = msg.get("modifications").ok_or(())?.as_array().ok_or(())?;
let modifications: Vec<_> = mods
.iter()
.filter_map(|json_mod| {
serde_json::from_str(&serde_json::to_string(json_mod).ok()?).ok()
})
.collect();
let walker = registry.find::<WalkerActor>(&self.walker);
walker.new_mutations(stream, &self.name, &modifications);
self.script_chan
.send(ModifyAttribute(
self.pipeline,
registry.actor_to_script(self.name()),
modifications,
))
.map_err(|_| ())?;
let reply = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
"getUniqueSelector" => {
let (tx, rx) = ipc::channel().unwrap();
self.script_chan
.send(GetDocumentElement(self.pipeline, tx))
.unwrap();
let doc_elem_info = rx.recv().map_err(|_| ())?.ok_or(())?;
let node = doc_elem_info.encode(
registry,
true,
self.script_chan.clone(),
self.pipeline,
self.walker.clone(),
);
let msg = GetUniqueSelectorReply {
from: self.name(),
value: node.display_name,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
pub trait NodeInfoToProtocol {
fn encode(
self,
actors: &ActorRegistry,
display: bool,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
walker: String,
) -> NodeActorMsg;
}
impl NodeInfoToProtocol for NodeInfo {
fn encode(
self,
actors: &ActorRegistry,
display: bool,
script_chan: IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
walker: String,
) -> NodeActorMsg {
let actor = if !actors.script_actor_registered(self.unique_id.clone()) {
let name = actors.new_name("node");
actors.register_script_actor(self.unique_id, name.clone());
let node_actor = NodeActor {
name: name.clone(),
script_chan: script_chan.clone(),
pipeline,
walker: walker.clone(),
style_rules: RefCell::new(HashMap::new()),
};
actors.register_later(Box::new(node_actor));
name
} else {
actors.script_to_actor(self.unique_id)
};
let name = actors.actor_to_script(actor.clone());
// If a node only has a single text node as a child whith a small enough text,
// return it with this node as an `inlineTextChild`.
let inline_text_child = (|| {
// TODO: Also return if this node is a flex element.
if self.num_children != 1 || self.node_name == "SLOT" {
return None;
}
let (tx, rx) = ipc::channel().ok()?;
script_chan
.send(GetChildren(pipeline, name.clone(), tx))
.unwrap();
let mut children = rx.recv().ok()??;
let child = children.pop()?;
let msg = child.encode(actors, true, script_chan.clone(), pipeline, walker);
// If the node child is not a text node, do not represent it inline.
if msg.node_type != TEXT_NODE {
return None;
}
// If the text node child is too big, do not represent it inline.
if msg.node_value.clone().unwrap_or_default().len() > MAX_INLINE_LENGTH {
return None;
}
Some(Box::new(msg))
})();
NodeActorMsg {
actor,
base_uri: self.base_uri,
causes_overflow: false,
container_type: None,
display_name: self.node_name.clone().to_lowercase(),
display_type: Some("block".into()),
inline_text_child,
is_after_pseudo_element: false,
is_anonymous: false,
is_before_pseudo_element: false,
is_direct_shadow_host_child: None,
is_displayed: display,
is_in_html_document: Some(true),
is_marker_pseudo_element: false,
is_native_anonymous: false,
is_scrollable: false,
is_shadow_root: false,
is_top_level_document: self.is_top_level_document,
node_name: self.node_name,
node_type: self.node_type,
node_value: self.node_value,
num_children: self.num_children,
parent: actors.script_to_actor(self.parent.clone()),
shadow_root_mode: None,
traits: HashMap::new(),
attrs: self
.attrs
.into_iter()
.map(|attr| AttrMsg {
name: attr.name,
value: attr.value,
})
.collect(),
}
}
}

View File

@@ -0,0 +1,351 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! The page style actor is responsible of informing the DevTools client of the different style
//! properties applied, including the attributes and layout of each element.
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::iter::once;
use std::net::TcpStream;
use base::id::PipelineId;
use devtools_traits::DevtoolScriptControlMsg::{GetLayout, GetSelectors};
use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg};
use ipc_channel::ipc::{self, IpcSender};
use serde::Serialize;
use serde_json::{self, Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::inspector::node::NodeActor;
use crate::actors::inspector::style_rule::{AppliedRule, ComputedDeclaration, StyleRuleActor};
use crate::actors::inspector::walker::{find_child, WalkerActor};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
#[derive(Serialize)]
struct GetAppliedReply {
entries: Vec<AppliedEntry>,
from: String,
}
#[derive(Serialize)]
struct GetComputedReply {
computed: HashMap<String, ComputedDeclaration>,
from: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct AppliedEntry {
rule: AppliedRule,
pseudo_element: Option<()>,
is_system: bool,
#[serde(skip_serializing_if = "Option::is_none")]
inherited: Option<String>,
}
#[derive(Serialize)]
#[serde(rename_all = "kebab-case")]
struct GetLayoutReply {
from: String,
display: String,
position: String,
z_index: String,
box_sizing: String,
// Would be nice to use a proper struct, blocked by
// https://github.com/serde-rs/serde/issues/43
auto_margins: serde_json::value::Value,
margin_top: String,
margin_right: String,
margin_bottom: String,
margin_left: String,
border_top_width: String,
border_right_width: String,
border_bottom_width: String,
border_left_width: String,
padding_top: String,
padding_right: String,
padding_bottom: String,
padding_left: String,
width: f32,
height: f32,
}
#[derive(Serialize)]
pub struct IsPositionEditableReply {
pub from: String,
pub value: bool,
}
#[derive(Serialize)]
pub struct PageStyleMsg {
pub actor: String,
pub traits: HashMap<String, bool>,
}
pub struct PageStyleActor {
pub name: String,
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
pub pipeline: PipelineId,
}
impl Actor for PageStyleActor {
fn name(&self) -> String {
self.name.clone()
}
/// The page style actor can handle the following messages:
///
/// - `getApplied`: Returns the applied styles for a node, they represent the explicit css
/// rules set for them, both in the style attribute and in stylesheets.
///
/// - `getComputed`: Returns the computed styles for a node, these include all of the supported
/// css properties calculated values.
///
/// - `getLayout`: Returns the box layout properties for a node.
///
/// - `isPositionEditable`: Informs whether you can change a style property in the inspector.
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"getApplied" => self.get_applied(msg, registry, stream)?,
"getComputed" => self.get_computed(msg, registry, stream)?,
"getLayout" => self.get_layout(msg, registry, stream)?,
"isPositionEditable" => self.is_position_editable(stream),
_ => ActorMessageStatus::Ignored,
})
}
}
impl PageStyleActor {
fn get_applied(
&self,
msg: &Map<String, Value>,
registry: &ActorRegistry,
stream: &mut TcpStream,
) -> Result<ActorMessageStatus, ()> {
let target = msg.get("node").ok_or(())?.as_str().ok_or(())?;
let node = registry.find::<NodeActor>(target);
let walker = registry.find::<WalkerActor>(&node.walker);
let entries: Vec<_> = find_child(
&node.script_chan,
node.pipeline,
target,
registry,
&walker.root_node.actor,
vec![],
|msg| msg.actor == target,
)
.unwrap_or_default()
.into_iter()
.filter_map(|node| {
let inherited = (node.actor != target).then(|| node.actor.clone());
let node_actor = registry.find::<NodeActor>(&node.actor);
// Get the css selectors that match this node present in the currently active stylesheets.
let selectors = (|| {
let (selectors_sender, selector_receiver) = ipc::channel().ok()?;
walker
.script_chan
.send(GetSelectors(
walker.pipeline,
registry.actor_to_script(node.actor.clone()),
selectors_sender,
))
.ok()?;
selector_receiver.recv().ok()?
})()
.unwrap_or_default();
// For each selector (plus an empty one that represents the style attribute)
// get all of the rules associated with it.
let entries =
once(("".into(), usize::MAX))
.chain(selectors)
.filter_map(move |selector| {
let rule = match node_actor.style_rules.borrow_mut().entry(selector) {
Entry::Vacant(e) => {
let name = registry.new_name("style-rule");
let actor = StyleRuleActor::new(
name.clone(),
node_actor.name(),
(!e.key().0.is_empty()).then_some(e.key().clone()),
);
let rule = actor.applied(registry)?;
registry.register_later(Box::new(actor));
e.insert(name);
rule
},
Entry::Occupied(e) => {
let actor = registry.find::<StyleRuleActor>(e.get());
actor.applied(registry)?
},
};
if inherited.is_some() && rule.declarations.is_empty() {
return None;
}
Some(AppliedEntry {
rule,
// TODO: Handle pseudo elements
pseudo_element: None,
is_system: false,
inherited: inherited.clone(),
})
});
Some(entries)
})
.flatten()
.collect();
let msg = GetAppliedReply {
entries,
from: self.name(),
};
let _ = stream.write_json_packet(&msg);
Ok(ActorMessageStatus::Processed)
}
fn get_computed(
&self,
msg: &Map<String, Value>,
registry: &ActorRegistry,
stream: &mut TcpStream,
) -> Result<ActorMessageStatus, ()> {
let target = msg.get("node").ok_or(())?.as_str().ok_or(())?;
let node_actor = registry.find::<NodeActor>(target);
let computed = (|| match node_actor
.style_rules
.borrow_mut()
.entry(("".into(), usize::MAX))
{
Entry::Vacant(e) => {
let name = registry.new_name("style-rule");
let actor = StyleRuleActor::new(name.clone(), target.into(), None);
let computed = actor.computed(registry)?;
registry.register_later(Box::new(actor));
e.insert(name);
Some(computed)
},
Entry::Occupied(e) => {
let actor = registry.find::<StyleRuleActor>(e.get());
Some(actor.computed(registry)?)
},
})()
.unwrap_or_default();
let msg = GetComputedReply {
computed,
from: self.name(),
};
let _ = stream.write_json_packet(&msg);
Ok(ActorMessageStatus::Processed)
}
fn get_layout(
&self,
msg: &Map<String, Value>,
registry: &ActorRegistry,
stream: &mut TcpStream,
) -> Result<ActorMessageStatus, ()> {
let target = msg.get("node").ok_or(())?.as_str().ok_or(())?;
let (computed_node_sender, computed_node_receiver) = ipc::channel().map_err(|_| ())?;
self.script_chan
.send(GetLayout(
self.pipeline,
registry.actor_to_script(target.to_owned()),
computed_node_sender,
))
.unwrap();
let ComputedNodeLayout {
display,
position,
z_index,
box_sizing,
auto_margins,
margin_top,
margin_right,
margin_bottom,
margin_left,
border_top_width,
border_right_width,
border_bottom_width,
border_left_width,
padding_top,
padding_right,
padding_bottom,
padding_left,
width,
height,
} = computed_node_receiver.recv().map_err(|_| ())?.ok_or(())?;
let msg_auto_margins = msg
.get("autoMargins")
.and_then(Value::as_bool)
.unwrap_or(false);
let msg = GetLayoutReply {
from: self.name(),
display,
position,
z_index,
box_sizing,
auto_margins: if msg_auto_margins {
let mut m = Map::new();
let auto = serde_json::value::Value::String("auto".to_owned());
if auto_margins.top {
m.insert("top".to_owned(), auto.clone());
}
if auto_margins.right {
m.insert("right".to_owned(), auto.clone());
}
if auto_margins.bottom {
m.insert("bottom".to_owned(), auto.clone());
}
if auto_margins.left {
m.insert("left".to_owned(), auto);
}
serde_json::value::Value::Object(m)
} else {
serde_json::value::Value::Null
},
margin_top,
margin_right,
margin_bottom,
margin_left,
border_top_width,
border_right_width,
border_bottom_width,
border_left_width,
padding_top,
padding_right,
padding_bottom,
padding_left,
width,
height,
};
let msg = serde_json::to_string(&msg).map_err(|_| ())?;
let msg = serde_json::from_str::<Value>(&msg).map_err(|_| ())?;
let _ = stream.write_json_packet(&msg);
Ok(ActorMessageStatus::Processed)
}
fn is_position_editable(&self, stream: &mut TcpStream) -> ActorMessageStatus {
let msg = IsPositionEditableReply {
from: self.name(),
value: false,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
}
}

View File

@@ -0,0 +1,252 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Liberally derived from <https://searchfox.org/mozilla-central/source/devtools/server/actors/thread-configuration.js>
//! This actor represents one css rule group from a node, allowing the inspector to view it and change it.
//! A group is either the html style attribute or one selector from one stylesheet.
use std::collections::HashMap;
use std::net::TcpStream;
use devtools_traits::DevtoolScriptControlMsg::{
GetAttributeStyle, GetComputedStyle, GetDocumentElement, GetStylesheetStyle, ModifyRule,
};
use ipc_channel::ipc;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::inspector::node::NodeActor;
use crate::actors::inspector::walker::WalkerActor;
use crate::protocol::JsonPacketStream;
use crate::StreamId;
const ELEMENT_STYLE_TYPE: u32 = 100;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AppliedRule {
actor: String,
ancestor_data: Vec<()>,
authored_text: String,
css_text: String,
pub declarations: Vec<AppliedDeclaration>,
href: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
selectors: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
selectors_specificity: Vec<u32>,
#[serde(rename = "type")]
type_: u32,
traits: StyleRuleActorTraits,
}
#[derive(Serialize)]
pub struct IsUsed {
pub used: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AppliedDeclaration {
colon_offsets: Vec<i32>,
is_name_valid: bool,
is_used: IsUsed,
is_valid: bool,
name: String,
offsets: Vec<i32>,
priority: String,
terminator: String,
value: String,
}
#[derive(Serialize)]
pub struct ComputedDeclaration {
matched: bool,
value: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StyleRuleActorTraits {
pub can_set_rule_text: bool,
}
#[derive(Serialize)]
pub struct StyleRuleActorMsg {
from: String,
rule: Option<AppliedRule>,
}
pub struct StyleRuleActor {
name: String,
node: String,
selector: Option<(String, usize)>,
}
impl Actor for StyleRuleActor {
fn name(&self) -> String {
self.name.clone()
}
/// The style rule configuration actor can handle the following messages:
///
/// - `setRuleText`: Applies a set of modifications to the css rules that this actor manages.
/// There is also `modifyProperties`, which has a slightly different API to do the same, but
/// this is preferred. Which one the devtools client sends is decided by the `traits` defined
/// when returning the list of rules.
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"setRuleText" => {
// Parse the modifications sent from the client
let mods = msg.get("modifications").ok_or(())?.as_array().ok_or(())?;
let modifications: Vec<_> = mods
.iter()
.filter_map(|json_mod| {
serde_json::from_str(&serde_json::to_string(json_mod).ok()?).ok()
})
.collect();
// Query the rule modification
let node = registry.find::<NodeActor>(&self.node);
let walker = registry.find::<WalkerActor>(&node.walker);
walker
.script_chan
.send(ModifyRule(
walker.pipeline,
registry.actor_to_script(self.node.clone()),
modifications,
))
.map_err(|_| ())?;
let _ = stream.write_json_packet(&self.encodable(registry));
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl StyleRuleActor {
pub fn new(name: String, node: String, selector: Option<(String, usize)>) -> Self {
Self {
name,
node,
selector,
}
}
pub fn applied(&self, registry: &ActorRegistry) -> Option<AppliedRule> {
let node = registry.find::<NodeActor>(&self.node);
let walker = registry.find::<WalkerActor>(&node.walker);
let (document_sender, document_receiver) = ipc::channel().ok()?;
walker
.script_chan
.send(GetDocumentElement(walker.pipeline, document_sender))
.ok()?;
let node = document_receiver.recv().ok()??;
// Gets the style definitions. If there is a selector, query the relevant stylesheet, if
// not, this represents the style attribute.
let (style_sender, style_receiver) = ipc::channel().ok()?;
let req = match &self.selector {
Some(selector) => {
let (selector, stylesheet) = selector.clone();
GetStylesheetStyle(
walker.pipeline,
registry.actor_to_script(self.node.clone()),
selector,
stylesheet,
style_sender,
)
},
None => GetAttributeStyle(
walker.pipeline,
registry.actor_to_script(self.node.clone()),
style_sender,
),
};
walker.script_chan.send(req).ok()?;
let style = style_receiver.recv().ok()??;
Some(AppliedRule {
actor: self.name(),
ancestor_data: vec![], // TODO: Fill with hierarchy
authored_text: "".into(),
css_text: "".into(), // TODO: Specify the css text
declarations: style
.into_iter()
.filter_map(|decl| {
Some(AppliedDeclaration {
colon_offsets: vec![],
is_name_valid: true,
is_used: IsUsed { used: true },
is_valid: true,
name: decl.name,
offsets: vec![], // TODO: Get the source of the declaration
priority: decl.priority,
terminator: "".into(),
value: decl.value,
})
})
.collect(),
href: node.base_uri.clone(),
selectors: self.selector.iter().map(|(s, _)| s).cloned().collect(),
selectors_specificity: self.selector.iter().map(|_| 1).collect(),
type_: ELEMENT_STYLE_TYPE,
traits: StyleRuleActorTraits {
can_set_rule_text: true,
},
})
}
pub fn computed(
&self,
registry: &ActorRegistry,
) -> Option<HashMap<String, ComputedDeclaration>> {
let node = registry.find::<NodeActor>(&self.node);
let walker = registry.find::<WalkerActor>(&node.walker);
let (style_sender, style_receiver) = ipc::channel().ok()?;
walker
.script_chan
.send(GetComputedStyle(
walker.pipeline,
registry.actor_to_script(self.node.clone()),
style_sender,
))
.ok()?;
let style = style_receiver.recv().ok()??;
Some(
style
.into_iter()
.map(|s| {
(
s.name,
ComputedDeclaration {
matched: true,
value: s.value,
},
)
})
.collect(),
)
}
pub fn encodable(&self, registry: &ActorRegistry) -> StyleRuleActorMsg {
StyleRuleActorMsg {
from: self.name(),
rule: self.applied(registry),
}
}
}

View File

@@ -0,0 +1,341 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! The walker actor is responsible for traversing the DOM tree in various ways to create new nodes
use std::cell::RefCell;
use std::net::TcpStream;
use base::id::PipelineId;
use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement};
use devtools_traits::{AttrModification, DevtoolScriptControlMsg};
use ipc_channel::ipc::{self, IpcSender};
use serde::Serialize;
use serde_json::{self, Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::inspector::layout::{LayoutInspectorActor, LayoutInspectorActorMsg};
use crate::actors::inspector::node::{NodeActorMsg, NodeInfoToProtocol};
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
pub struct WalkerMsg {
pub actor: String,
pub root: NodeActorMsg,
}
pub struct WalkerActor {
pub name: String,
pub script_chan: IpcSender<DevtoolScriptControlMsg>,
pub pipeline: PipelineId,
pub root_node: NodeActorMsg,
pub mutations: RefCell<Vec<(AttrModification, String)>>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct QuerySelectorReply {
from: String,
node: NodeActorMsg,
new_parents: Vec<NodeActorMsg>,
}
#[derive(Serialize)]
struct DocumentElementReply {
from: String,
node: NodeActorMsg,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ChildrenReply {
has_first: bool,
has_last: bool,
nodes: Vec<NodeActorMsg>,
from: String,
}
#[derive(Serialize)]
struct GetLayoutInspectorReply {
actor: LayoutInspectorActorMsg,
from: String,
}
#[derive(Serialize)]
struct WatchRootNodeReply {
#[serde(rename = "type")]
type_: String,
from: String,
node: NodeActorMsg,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct MutationMsg {
attribute_name: String,
new_value: Option<String>,
target: String,
#[serde(rename = "type")]
type_: String,
}
#[derive(Serialize)]
struct GetMutationsReply {
from: String,
mutations: Vec<MutationMsg>,
}
#[derive(Serialize)]
struct GetOffsetParentReply {
from: String,
node: Option<()>,
}
#[derive(Serialize)]
struct NewMutationsReply {
from: String,
#[serde(rename = "type")]
type_: String,
}
impl Actor for WalkerActor {
fn name(&self) -> String {
self.name.clone()
}
/// The walker actor can handle the following messages:
///
/// - `children`: Returns a list of children nodes of the specified node
///
/// - `clearPseudoClassLocks`: Placeholder
///
/// - `documentElement`: Returns the base document element node
///
/// - `getLayoutInspector`: Returns the Layout inspector actor, placeholder
///
/// - `getMutations`: Returns the list of attribute changes since it was last called
///
/// - `getOffsetParent`: Placeholder
///
/// - `querySelector`: Recursively looks for the specified selector in the tree, reutrning the
/// node and its ascendents
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"children" => {
let target = msg.get("node").ok_or(())?.as_str().ok_or(())?;
let (tx, rx) = ipc::channel().map_err(|_| ())?;
self.script_chan
.send(GetChildren(
self.pipeline,
registry.actor_to_script(target.into()),
tx,
))
.map_err(|_| ())?;
let children = rx.recv().map_err(|_| ())?.ok_or(())?;
let msg = ChildrenReply {
has_first: true,
has_last: true,
nodes: children
.into_iter()
.map(|child| {
child.encode(
registry,
true,
self.script_chan.clone(),
self.pipeline,
self.name(),
)
})
.collect(),
from: self.name(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"clearPseudoClassLocks" => {
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"documentElement" => {
let (tx, rx) = ipc::channel().map_err(|_| ())?;
self.script_chan
.send(GetDocumentElement(self.pipeline, tx))
.map_err(|_| ())?;
let doc_elem_info = rx.recv().map_err(|_| ())?.ok_or(())?;
let node = doc_elem_info.encode(
registry,
true,
self.script_chan.clone(),
self.pipeline,
self.name(),
);
let msg = DocumentElementReply {
from: self.name(),
node,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getLayoutInspector" => {
// TODO: Create actual layout inspector actor
let layout = LayoutInspectorActor::new(registry.new_name("layout"));
let actor = layout.encodable();
registry.register_later(Box::new(layout));
let msg = GetLayoutInspectorReply {
from: self.name(),
actor,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getMutations" => {
let msg = GetMutationsReply {
from: self.name(),
mutations: self
.mutations
.borrow_mut()
.drain(..)
.map(|(mutation, target)| MutationMsg {
attribute_name: mutation.attribute_name,
new_value: mutation.new_value,
target,
type_: "attributes".into(),
})
.collect(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getOffsetParent" => {
let msg = GetOffsetParentReply {
from: self.name(),
node: None,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"querySelector" => {
let selector = msg.get("selector").ok_or(())?.as_str().ok_or(())?;
let node = msg.get("node").ok_or(())?.as_str().ok_or(())?;
let mut hierarchy = find_child(
&self.script_chan,
self.pipeline,
&self.name,
registry,
node,
vec![],
|msg| msg.display_name == selector,
)
.map_err(|_| ())?;
hierarchy.reverse();
let node = hierarchy.pop().ok_or(())?;
let msg = QuerySelectorReply {
from: self.name(),
node,
new_parents: hierarchy,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"watchRootNode" => {
let msg = WatchRootNodeReply {
type_: "root-available".into(),
from: self.name(),
node: self.root_node.clone(),
};
let _ = stream.write_json_packet(&msg);
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl WalkerActor {
pub(crate) fn new_mutations(
&self,
stream: &mut TcpStream,
target: &str,
modifications: &[AttrModification],
) {
{
let mut mutations = self.mutations.borrow_mut();
mutations.extend(modifications.iter().cloned().map(|m| (m, target.into())));
}
let _ = stream.write_json_packet(&NewMutationsReply {
from: self.name(),
type_: "newMutations".into(),
});
}
}
/// Recursively searches for a child with the specified selector
/// If it is found, returns a list with the child and all of its ancestors.
/// TODO: Investigate how to cache this to some extent.
pub fn find_child(
script_chan: &IpcSender<DevtoolScriptControlMsg>,
pipeline: PipelineId,
name: &str,
registry: &ActorRegistry,
node: &str,
mut hierarchy: Vec<NodeActorMsg>,
compare_fn: impl Fn(&NodeActorMsg) -> bool + Clone,
) -> Result<Vec<NodeActorMsg>, Vec<NodeActorMsg>> {
let (tx, rx) = ipc::channel().unwrap();
script_chan
.send(GetChildren(
pipeline,
registry.actor_to_script(node.into()),
tx,
))
.unwrap();
let children = rx.recv().unwrap().ok_or(vec![])?;
for child in children {
let msg = child.encode(registry, true, script_chan.clone(), pipeline, name.into());
if compare_fn(&msg) {
hierarchy.push(msg);
return Ok(hierarchy);
};
if msg.num_children == 0 {
continue;
}
match find_child(
script_chan,
pipeline,
name,
registry,
&msg.actor,
hierarchy,
compare_fn.clone(),
) {
Ok(mut hierarchy) => {
hierarchy.push(msg);
return Ok(hierarchy);
},
Err(e) => {
hierarchy = e;
},
}
}
Err(hierarchy)
}

View File

@@ -11,16 +11,18 @@ use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TimelineMemoryReply {
jsObjectSize: u64,
jsStringSize: u64,
jsOtherSize: u64,
domSize: u64,
styleSize: u64,
otherSize: u64,
totalSize: u64,
jsMilliseconds: f64,
nonJSMilliseconds: f64,
js_object_size: u64,
js_string_size: u64,
js_other_size: u64,
dom_size: u64,
style_size: u64,
other_size: u64,
total_size: u64,
js_milliseconds: f64,
#[serde(rename = "nonJSMilliseconds")]
non_js_milliseconds: f64,
}
pub struct MemoryActor {
@@ -57,17 +59,16 @@ impl MemoryActor {
}
pub fn measure(&self) -> TimelineMemoryReply {
//TODO:
TimelineMemoryReply {
jsObjectSize: 1,
jsStringSize: 1,
jsOtherSize: 1,
domSize: 1,
styleSize: 1,
otherSize: 1,
totalSize: 1,
jsMilliseconds: 1.1,
nonJSMilliseconds: 1.1,
js_object_size: 1,
js_string_size: 1,
js_other_size: 1,
dom_size: 1,
style_size: 1,
other_size: 1,
total_size: 1,
js_milliseconds: 1.1,
non_js_milliseconds: 1.1,
}
}
}

View File

@@ -6,7 +6,7 @@
//! Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo.
use std::net::TcpStream;
use std::time::{SystemTime, UNIX_EPOCH};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use chrono::{Local, LocalResult, TimeZone};
use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse};
@@ -24,10 +24,10 @@ struct HttpRequest {
method: Method,
headers: HeaderMap,
body: Option<Vec<u8>>,
startedDateTime: SystemTime,
timeStamp: i64,
connect_time: u64,
send_time: u64,
started_date_time: SystemTime,
time_stamp: i64,
connect_time: Duration,
send_time: Duration,
}
struct HttpResponse {
@@ -44,13 +44,15 @@ pub struct NetworkEventActor {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EventActor {
pub actor: String,
pub url: String,
pub method: String,
pub startedDateTime: String,
pub timeStamp: i64,
pub isXHR: bool,
pub started_date_time: String,
pub time_stamp: i64,
#[serde(rename = "isXHR")]
pub is_xhr: bool,
pub private: bool,
}
@@ -60,28 +62,31 @@ pub struct ResponseCookiesMsg {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ResponseStartMsg {
pub httpVersion: String,
pub remoteAddress: String,
pub remotePort: u32,
pub http_version: String,
pub remote_address: String,
pub remote_port: u32,
pub status: String,
pub statusText: String,
pub headersSize: usize,
pub discardResponseBody: bool,
pub status_text: String,
pub headers_size: usize,
pub discard_response_body: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ResponseContentMsg {
pub mimeType: String,
pub contentSize: u32,
pub transferredSize: u32,
pub discardResponseBody: bool,
pub mime_type: String,
pub content_size: u32,
pub transferred_size: u32,
pub discard_response_body: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ResponseHeadersMsg {
pub headers: usize,
pub headersSize: usize,
pub headers_size: usize,
}
#[derive(Serialize)]
@@ -90,17 +95,19 @@ pub struct RequestCookiesMsg {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RequestHeadersMsg {
headers: usize,
headersSize: usize,
headers_size: usize,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetRequestHeadersReply {
from: String,
headers: Vec<Header>,
headerSize: usize,
rawHeaders: String,
header_size: usize,
raw_headers: String,
}
#[derive(Serialize)]
@@ -110,25 +117,28 @@ struct Header {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetResponseHeadersReply {
from: String,
headers: Vec<Header>,
headerSize: usize,
rawHeaders: String,
header_size: usize,
raw_headers: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetResponseContentReply {
from: String,
content: Option<Vec<u8>>,
contentDiscarded: bool,
content_discarded: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetRequestPostDataReply {
from: String,
postData: Option<Vec<u8>>,
postDataDiscarded: bool,
post_data: Option<Vec<u8>>,
post_data_discarded: bool,
}
#[derive(Serialize)]
@@ -154,10 +164,11 @@ struct Timings {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetEventTimingsReply {
from: String,
timings: Timings,
totalTime: u64,
total_time: u64,
}
#[derive(Serialize)]
@@ -166,9 +177,10 @@ struct SecurityInfo {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetSecurityInfoReply {
from: String,
securityInfo: SecurityInfo,
security_info: SecurityInfo,
}
impl Actor for NetworkEventActor {
@@ -187,12 +199,12 @@ impl Actor for NetworkEventActor {
Ok(match msg_type {
"getRequestHeaders" => {
let mut headers = Vec::new();
let mut rawHeadersString = "".to_owned();
let mut headersSize = 0;
let mut raw_headers_string = "".to_owned();
let mut headers_size = 0;
for (name, value) in self.request.headers.iter() {
let value = &value.to_str().unwrap().to_string();
rawHeadersString = rawHeadersString + name.as_str() + ":" + &value + "\r\n";
headersSize += name.as_str().len() + value.len();
raw_headers_string = raw_headers_string + name.as_str() + ":" + value + "\r\n";
headers_size += name.as_str().len() + value.len();
headers.push(Header {
name: name.as_str().to_owned(),
value: value.to_owned(),
@@ -201,8 +213,8 @@ impl Actor for NetworkEventActor {
let msg = GetRequestHeadersReply {
from: self.name(),
headers,
headerSize: headersSize,
rawHeaders: rawHeadersString,
header_size: headers_size,
raw_headers: raw_headers_string,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
@@ -226,8 +238,8 @@ impl Actor for NetworkEventActor {
"getRequestPostData" => {
let msg = GetRequestPostDataReply {
from: self.name(),
postData: self.request.body.clone(),
postDataDiscarded: false,
post_data: self.request.body.clone(),
post_data_discarded: false,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
@@ -235,24 +247,24 @@ impl Actor for NetworkEventActor {
"getResponseHeaders" => {
if let Some(ref response_headers) = self.response.headers {
let mut headers = vec![];
let mut rawHeadersString = "".to_owned();
let mut headersSize = 0;
let mut raw_headers_string = "".to_owned();
let mut headers_size = 0;
for (name, value) in response_headers.iter() {
headers.push(Header {
name: name.as_str().to_owned(),
value: value.to_str().unwrap().to_owned(),
});
headersSize += name.as_str().len() + value.len();
rawHeadersString.push_str(name.as_str());
rawHeadersString.push(':');
rawHeadersString.push_str(value.to_str().unwrap());
rawHeadersString.push_str("\r\n");
headers_size += name.as_str().len() + value.len();
raw_headers_string.push_str(name.as_str());
raw_headers_string.push(':');
raw_headers_string.push_str(value.to_str().unwrap());
raw_headers_string.push_str("\r\n");
}
let msg = GetResponseHeadersReply {
from: self.name(),
headers,
headerSize: headersSize,
rawHeaders: rawHeadersString,
header_size: headers_size,
raw_headers: raw_headers_string,
};
let _ = stream.write_json_packet(&msg);
}
@@ -278,27 +290,27 @@ impl Actor for NetworkEventActor {
let msg = GetResponseContentReply {
from: self.name(),
content: self.response.body.clone(),
contentDiscarded: self.response.body.is_none(),
content_discarded: self.response.body.is_none(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getEventTimings" => {
// TODO: This is a fake timings msg
let timingsObj = Timings {
let timings_obj = Timings {
blocked: 0,
dns: 0,
connect: self.request.connect_time,
send: self.request.send_time,
connect: self.request.connect_time.as_millis() as u64,
send: self.request.send_time.as_millis() as u64,
wait: 0,
receive: 0,
};
let total = timingsObj.connect + timingsObj.send;
let total = timings_obj.connect + timings_obj.send;
// TODO: Send the correct values for all these fields.
let msg = GetEventTimingsReply {
from: self.name(),
timings: timingsObj,
totalTime: total,
timings: timings_obj,
total_time: total,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
@@ -307,7 +319,7 @@ impl Actor for NetworkEventActor {
// TODO: Send the correct values for securityInfo.
let msg = GetSecurityInfoReply {
from: self.name(),
securityInfo: SecurityInfo {
security_info: SecurityInfo {
state: "insecure".to_owned(),
},
};
@@ -328,13 +340,13 @@ impl NetworkEventActor {
method: Method::GET,
headers: HeaderMap::new(),
body: None,
startedDateTime: SystemTime::now(),
timeStamp: SystemTime::now()
started_date_time: SystemTime::now(),
time_stamp: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_secs() as i64,
send_time: 0,
connect_time: 0,
send_time: Duration::ZERO,
connect_time: Duration::ZERO,
},
response: HttpResponse {
headers: None,
@@ -346,13 +358,13 @@ impl NetworkEventActor {
}
pub fn add_request(&mut self, request: DevtoolsHttpRequest) {
self.request.url = request.url.as_str().to_owned();
request.url.as_str().clone_into(&mut self.request.url);
self.request.method = request.method.clone();
self.request.headers = request.headers.clone();
self.request.body = request.body;
self.request.startedDateTime = request.startedDateTime;
self.request.timeStamp = request.timeStamp;
self.request.started_date_time = request.started_date_time;
self.request.time_stamp = request.time_stamp;
self.request.connect_time = request.connect_time;
self.request.send_time = request.send_time;
self.is_xhr = request.is_xhr;
@@ -372,31 +384,31 @@ impl NetworkEventActor {
let started_datetime_rfc3339 = match Local.timestamp_millis_opt(
self.request
.startedDateTime
.started_date_time
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as i64,
) {
LocalResult::None => "".to_owned(),
LocalResult::Single(dateTime) => dateTime.to_rfc3339().to_string(),
LocalResult::Ambiguous(dateTime, _) => dateTime.to_rfc3339().to_string(),
LocalResult::Single(date_time) => date_time.to_rfc3339().to_string(),
LocalResult::Ambiguous(date_time, _) => date_time.to_rfc3339().to_string(),
};
EventActor {
actor: self.name(),
url: self.request.url.clone(),
method: format!("{}", self.request.method),
startedDateTime: started_datetime_rfc3339,
timeStamp: self.request.timeStamp,
isXHR: self.is_xhr,
started_date_time: started_datetime_rfc3339,
time_stamp: self.request.time_stamp,
is_xhr: self.is_xhr,
private: false,
}
}
pub fn response_start(&self) -> ResponseStartMsg {
// TODO: Send the correct values for all these fields.
let hSizeOption = self.response.headers.as_ref().map(|headers| headers.len());
let hSize = hSizeOption.unwrap_or(0);
let h_size_option = self.response.headers.as_ref().map(|headers| headers.len());
let h_size = h_size_option.unwrap_or(0);
let (status_code, status_message) = self
.response
.status
@@ -406,30 +418,30 @@ impl NetworkEventActor {
});
// TODO: Send the correct values for remoteAddress and remotePort and http_version.
ResponseStartMsg {
httpVersion: "HTTP/1.1".to_owned(),
remoteAddress: "63.245.217.43".to_owned(),
remotePort: 443,
http_version: "HTTP/1.1".to_owned(),
remote_address: "63.245.217.43".to_owned(),
remote_port: 443,
status: status_code.to_string(),
statusText: status_message,
headersSize: hSize,
discardResponseBody: false,
status_text: status_message,
headers_size: h_size,
discard_response_body: false,
}
}
pub fn response_content(&self) -> ResponseContentMsg {
let mut mString = "".to_owned();
let mut m_string = "".to_owned();
if let Some(ref headers) = self.response.headers {
mString = match headers.typed_get::<ContentType>() {
m_string = match headers.typed_get::<ContentType>() {
Some(ct) => ct.to_string(),
_ => "".to_owned(),
};
}
// TODO: Set correct values when response's body is sent to the devtools in http_loader.
ResponseContentMsg {
mimeType: mString,
contentSize: 0,
transferredSize: 0,
discardResponseBody: true,
mime_type: m_string,
content_size: 0,
transferred_size: 0,
discard_response_body: true,
}
}
@@ -457,7 +469,7 @@ impl NetworkEventActor {
}
ResponseHeadersMsg {
headers: headers_size,
headersSize: headers_byte_count,
headers_size: headers_byte_count,
}
}
@@ -467,7 +479,7 @@ impl NetworkEventActor {
});
RequestHeadersMsg {
headers: self.request.headers.len(),
headersSize: size,
headers_size: size,
}
}
@@ -481,7 +493,7 @@ impl NetworkEventActor {
}
}
pub fn total_time(&self) -> u64 {
pub fn total_time(&self) -> Duration {
self.request.connect_time + self.request.send_time
}
}

View File

@@ -11,7 +11,7 @@ use crate::StreamId;
pub struct ObjectActor {
pub name: String,
pub uuid: String,
pub _uuid: String,
}
impl Actor for ObjectActor {
@@ -26,6 +26,7 @@ impl Actor for ObjectActor {
_: &mut TcpStream,
_: StreamId,
) -> Result<ActorMessageStatus, ()> {
// TODO: Handle enumSymbols for console object inspection
Ok(ActorMessageStatus::Ignored)
}
}
@@ -36,7 +37,7 @@ impl ObjectActor {
let name = registry.new_name("object");
let actor = ObjectActor {
name: name.clone(),
uuid: uuid.clone(),
_uuid: uuid.clone(),
};
registry.register_script_actor(uuid, name.clone());

View File

@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// TODO: Is this actor still relevant?
#![allow(dead_code)]
use std::net::TcpStream;
use serde::Serialize;
@@ -16,12 +19,14 @@ pub struct PerformanceActor {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct PerformanceFeatures {
withMarkers: bool,
withMemory: bool,
withTicks: bool,
withAllocations: bool,
withJITOptimizations: bool,
with_markers: bool,
with_memory: bool,
with_ticks: bool,
with_allocations: bool,
#[serde(rename = "withJITOptimizations")]
with_jitoptimizations: bool,
}
#[derive(Serialize)]
@@ -69,11 +74,11 @@ impl Actor for PerformanceActor {
from: self.name(),
traits: PerformanceTraits {
features: PerformanceFeatures {
withMarkers: true,
withMemory: true,
withTicks: true,
withAllocations: true,
withJITOptimizations: true,
with_markers: true,
with_memory: true,
with_ticks: true,
with_allocations: true,
with_jitoptimizations: true,
},
},
};
@@ -104,7 +109,7 @@ impl PerformanceActor {
pub fn description() -> ActorDescription {
ActorDescription {
category: "actor",
typeName: "performance",
type_name: "performance",
methods: vec![Method {
name: "canCurrentlyRecord",
request: Value::Object(

View File

@@ -5,6 +5,7 @@
use std::collections::HashMap;
use std::net::TcpStream;
use log::warn;
use serde::Serialize;
use serde_json::{Map, Value};
use servo_config::pref_util::PrefValue;
@@ -37,7 +38,10 @@ impl Actor for PreferenceActor {
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
let mut key = msg.get("value").unwrap().as_str().unwrap();
let Some(mut key) = msg.get("value").and_then(|v| v.as_str()) else {
warn!("PreferenceActor: handle_message: value is not a string");
return Ok(ActorMessageStatus::Ignored);
};
// Mapping to translate a Firefox preference name onto the corresponding Servo preference name
let pref_name_mapping: HashMap<&str, &str> =

View File

@@ -2,12 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Liberally derived from the [Firefox JS implementation].
//!
//! [Firefox JS implementation]: https://searchfox.org/mozilla-central/source/devtools/server/actors/descriptors/process.js
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::root::DescriptorTraits;
use crate::protocol::JsonPacketStream;
use crate::StreamId;
@@ -17,14 +22,18 @@ struct ListWorkersReply {
workers: Vec<u32>, // TODO: use proper JSON structure.
}
pub struct ProcessActor {
name: String,
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProcessActorMsg {
actor: String,
id: u32,
is_parent: bool,
is_windowless_parent: bool,
traits: DescriptorTraits,
}
impl ProcessActor {
pub fn new(name: String) -> Self {
Self { name }
}
pub struct ProcessActor {
name: String,
}
impl Actor for ProcessActor {
@@ -32,6 +41,9 @@ impl Actor for ProcessActor {
self.name.clone()
}
/// The process actor can handle the following messages:
///
/// - `listWorkers`: Returns a list of web workers, not supported yet.
fn handle_message(
&self,
_registry: &ActorRegistry,
@@ -54,3 +66,19 @@ impl Actor for ProcessActor {
})
}
}
impl ProcessActor {
pub fn new(name: String) -> Self {
Self { name }
}
pub fn encodable(&self) -> ProcessActorMsg {
ProcessActorMsg {
actor: self.name(),
id: 0,
is_parent: true,
is_windowless_parent: false,
traits: Default::default(),
}
}
}

View File

@@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::net::TcpStream;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId;
pub struct ProfilerActor {
name: String,
}
impl Actor for ProfilerActor {
fn name(&self) -> String {
self.name.clone()
}
fn handle_message(
&self,
_registry: &ActorRegistry,
_msg_type: &str,
_msg: &Map<String, Value>,
_stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(ActorMessageStatus::Ignored)
}
}
impl ProfilerActor {
pub fn new(name: String) -> ProfilerActor {
ProfilerActor { name }
}
}

View File

@@ -0,0 +1,48 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! This actor is used for protocol purposes, it forwards the reflow events to clients.
use std::net::TcpStream;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId;
pub struct ReflowActor {
name: String,
}
impl Actor for ReflowActor {
fn name(&self) -> String {
self.name.clone()
}
/// The reflow actor can handle the following messages:
///
/// - `start`: Does nothing yet. This doesn't need a reply like other messages.
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
_stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"start" => {
// TODO: Create an observer on "reflows" events
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl ReflowActor {
pub fn new(name: String) -> Self {
Self { name }
}
}

View File

@@ -2,18 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Connection point for all new remote devtools interactions, providing lists of know actors
//! that perform more specific actions (targets, addons, browser chrome, etc.)
//!
//! Liberally derived from the [Firefox JS implementation].
//!
//! [Firefox JS implementation]: https://searchfox.org/mozilla-central/source/devtools/server/actors/root.js
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
/// Liberally derived from the [Firefox JS implementation]
/// (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js).
/// Connection point for all new remote devtools interactions, providing lists of know actors
/// that perform more specific actions (targets, addons, browser chrome, etc.)
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::device::DeviceActor;
use crate::actors::performance::PerformanceActor;
use crate::actors::process::{ProcessActor, ProcessActorMsg};
use crate::actors::tab::{TabDescriptorActor, TabDescriptorActorMsg};
use crate::actors::worker::{WorkerActor, WorkerMsg};
use crate::protocol::{ActorDescription, JsonPacketStream};
@@ -50,7 +54,6 @@ struct GetRootReply {
#[derive(Serialize)]
struct ListTabsReply {
from: String,
selected: u32,
tabs: Vec<TabDescriptorActorMsg>,
}
@@ -95,7 +98,7 @@ pub struct Types {
#[derive(Serialize)]
struct ListProcessesResponse {
from: String,
processes: Vec<ProcessForm>,
processes: Vec<ProcessActorMsg>,
}
#[derive(Default, Serialize)]
@@ -105,21 +108,11 @@ pub struct DescriptorTraits {
pub(crate) supports_reload_descriptor: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ProcessForm {
actor: String,
id: u32,
is_parent: bool,
is_windowless_parent: bool,
traits: DescriptorTraits,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetProcessResponse {
from: String,
process_descriptor: ProcessForm,
process_descriptor: ProcessActorMsg,
}
pub struct RootActor {
@@ -155,30 +148,21 @@ impl Actor for RootActor {
},
"listProcesses" => {
let process = registry.find::<ProcessActor>(&self.process).encodable();
let reply = ListProcessesResponse {
from: self.name(),
processes: vec![ProcessForm {
actor: self.process.clone(),
id: 0,
is_parent: true,
is_windowless_parent: false,
traits: Default::default(),
}],
processes: vec![process],
};
let _ = stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
// TODO: Unexpected message getTarget for process (when inspecting)
"getProcess" => {
let process = registry.find::<ProcessActor>(&self.process).encodable();
let reply = GetProcessResponse {
from: self.name(),
process_descriptor: ProcessForm {
actor: self.process.clone(),
id: 0,
is_parent: true,
is_windowless_parent: false,
traits: Default::default(),
},
process_descriptor: process,
};
let _ = stream.write_json_packet(&reply);
ActorMessageStatus::Processed
@@ -196,11 +180,9 @@ impl Actor for RootActor {
ActorMessageStatus::Processed
},
// https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#listing-browser-tabs
"listTabs" => {
let actor = ListTabsReply {
from: "root".to_owned(),
selected: 0,
tabs: self
.tabs
.iter()

View File

@@ -12,9 +12,10 @@ use crate::protocol::JsonPacketStream;
use crate::StreamId;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetStyleSheetsReply {
from: String,
styleSheets: Vec<u32>, // TODO: real JSON structure.
style_sheets: Vec<u32>, // TODO: real JSON structure.
}
pub struct StyleSheetsActor {
@@ -37,7 +38,7 @@ impl Actor for StyleSheetsActor {
"getStyleSheets" => {
let msg = GetStyleSheetsReply {
from: self.name(),
styleSheets: vec![],
style_sheets: vec![],
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed

View File

@@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Descriptor actor that represents a web view. It can link a tab to the corresponding watcher
//! actor to enable inspection.
//!
//! Liberally derived from the [Firefox JS implementation].
//!
//! [Firefox JS implementation]: https://searchfox.org/mozilla-central/source/devtools/server/actors/descriptors/tab.js
use std::net::TcpStream;
use serde::Serialize;
@@ -10,17 +17,19 @@ use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::browsing_context::{BrowsingContextActor, BrowsingContextActorMsg};
use crate::actors::root::{DescriptorTraits, RootActor};
use crate::actors::watcher::{WatcherActor, WatcherActorMsg};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
// https://searchfox.org/mozilla-central/source/devtools/server/actors/descriptors/tab.js
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TabDescriptorActorMsg {
actor: String,
browser_id: u32,
#[serde(rename = "browsingContextID")]
browsing_context_id: u32,
is_zombie_tab: bool,
#[serde(rename = "outerWindowID")]
outer_window_id: u32,
selected: bool,
title: String,
@@ -46,6 +55,13 @@ struct GetFaviconReply {
favicon: String,
}
#[derive(Serialize)]
struct GetWatcherReply {
from: String,
#[serde(flatten)]
watcher: WatcherActorMsg,
}
pub struct TabDescriptorActor {
name: String,
browsing_context_actor: String,
@@ -56,6 +72,14 @@ impl Actor for TabDescriptorActor {
self.name.clone()
}
/// The tab actor can handle the following messages:
///
/// - `getTarget`: Returns the surrounding `BrowsingContextActor`.
///
/// - `getFavicon`: Should return the tab favicon, but it is not yet supported.
///
/// - `getWatcher`: Returns a `WatcherActor` linked to the tab's `BrowsingContext`. It is used
/// to describe the debugging capabilities of this tab.
fn handle_message(
&self,
registry: &ActorRegistry,
@@ -83,7 +107,15 @@ impl Actor for TabDescriptorActor {
});
ActorMessageStatus::Processed
},
// TODO: Unexpected message getWatcher when inspecting tab (create watcher actor)
"getWatcher" => {
let ctx_actor = registry.find::<BrowsingContextActor>(&self.browsing_context_actor);
let watcher = registry.find::<WatcherActor>(&ctx_actor.watcher);
let _ = stream.write_json_packet(&GetWatcherReply {
from: self.name(),
watcher: watcher.encodable(),
});
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
@@ -94,7 +126,7 @@ impl TabDescriptorActor {
actors: &mut ActorRegistry,
browsing_context_actor: String,
) -> TabDescriptorActor {
let name = actors.new_name("tabDescription");
let name = actors.new_name("tab-description");
let root = actors.find_mut::<RootActor>("root");
root.tabs.push(name.clone());
TabDescriptorActor {
@@ -105,21 +137,22 @@ impl TabDescriptorActor {
pub fn encodable(&self, registry: &ActorRegistry, selected: bool) -> TabDescriptorActorMsg {
let ctx_actor = registry.find::<BrowsingContextActor>(&self.browsing_context_actor);
let browser_id = ctx_actor.active_pipeline.get().index.0.get();
let browsing_context_id = ctx_actor.browsing_context_id.index.0.get();
let title = ctx_actor.title.borrow().clone();
let url = ctx_actor.url.borrow().clone();
TabDescriptorActorMsg {
actor: self.name(),
browsing_context_id: ctx_actor.browsing_context_id.index.0.get(),
browser_id: ctx_actor.active_pipeline.get().index.0.get(),
browsing_context_id,
browser_id,
is_zombie_tab: false,
outer_window_id: ctx_actor.active_pipeline.get().index.0.get(),
outer_window_id: browser_id,
selected,
title,
traits: DescriptorTraits {
watcher: true,
supports_reload_descriptor: false,
supports_reload_descriptor: true,
},
url,
}

View File

@@ -9,9 +9,10 @@ use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ThreadAttached {
from: String,
#[serde(rename = "type")]
@@ -19,9 +20,9 @@ struct ThreadAttached {
actor: String,
frame: u32,
error: u32,
recordingEndpoint: u32,
executionPoint: u32,
poppedFrames: Vec<PoppedFrameMsg>,
recording_endpoint: u32,
execution_point: u32,
popped_frames: Vec<PoppedFrameMsg>,
why: WhyMsg,
}
@@ -48,11 +49,6 @@ struct ThreadInterruptedReply {
type_: String,
}
#[derive(Serialize)]
struct ReconfigureReply {
from: String,
}
#[derive(Serialize)]
struct SourcesReply {
from: String,
@@ -62,11 +58,6 @@ struct SourcesReply {
#[derive(Serialize)]
enum Source {}
#[derive(Serialize)]
struct VoidAttachedReply {
from: String,
}
pub struct ThreadActor {
name: String,
}
@@ -98,15 +89,15 @@ impl Actor for ThreadActor {
actor: registry.new_name("pause"),
frame: 0,
error: 0,
recordingEndpoint: 0,
executionPoint: 0,
poppedFrames: vec![],
recording_endpoint: 0,
execution_point: 0,
popped_frames: vec![],
why: WhyMsg {
type_: "attached".to_owned(),
},
};
let _ = stream.write_json_packet(&msg);
let _ = stream.write_json_packet(&VoidAttachedReply { from: self.name() });
let _ = stream.write_json_packet(&EmptyReplyMsg { from: self.name() });
ActorMessageStatus::Processed
},
@@ -116,7 +107,7 @@ impl Actor for ThreadActor {
type_: "resumed".to_owned(),
};
let _ = stream.write_json_packet(&msg);
let _ = stream.write_json_packet(&VoidAttachedReply { from: self.name() });
let _ = stream.write_json_packet(&EmptyReplyMsg { from: self.name() });
ActorMessageStatus::Processed
},
@@ -130,14 +121,14 @@ impl Actor for ThreadActor {
},
"reconfigure" => {
let _ = stream.write_json_packet(&ReconfigureReply { from: self.name() });
let _ = stream.write_json_packet(&EmptyReplyMsg { from: self.name() });
ActorMessageStatus::Processed
},
"sources" => {
let msg = SourcesReply {
from: self.name(),
sources: vec![],
sources: vec![], // TODO: Add sources for the debugger here
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed

View File

@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// TODO: Is this actor still relevant?
#![allow(dead_code)]
use std::cell::RefCell;
use std::error::Error;
use std::net::TcpStream;
@@ -63,21 +66,23 @@ struct StopReply {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct TimelineMarkerReply {
name: String,
start: HighResolutionStamp,
end: HighResolutionStamp,
stack: Option<Vec<()>>,
endStack: Option<Vec<()>>,
end_stack: Option<Vec<()>>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct MarkersEmitterReply {
#[serde(rename = "type")]
type_: String,
markers: Vec<TimelineMarkerReply>,
from: String,
endTime: HighResolutionStamp,
end_time: HighResolutionStamp,
}
#[derive(Serialize)]
@@ -312,7 +317,7 @@ impl Emitter {
start: HighResolutionStamp::new(self.start_stamp, payload.start_time),
end: HighResolutionStamp::new(self.start_stamp, payload.end_time),
stack: payload.start_stack,
endStack: payload.end_stack,
end_stack: payload.end_stack,
}
}
@@ -322,7 +327,7 @@ impl Emitter {
type_: "markers".to_owned(),
markers,
from: self.from.clone(),
endTime: HighResolutionStamp::new(self.start_stamp, end_time),
end_time: HighResolutionStamp::new(self.start_stamp, end_time),
};
self.stream.write_json_packet(&reply)?;
@@ -330,25 +335,25 @@ impl Emitter {
let mut lock = self.registry.lock();
let registry = lock.as_mut().unwrap();
let framerate_actor = registry.find_mut::<FramerateActor>(actor_name);
let framerateReply = FramerateEmitterReply {
let framerate_reply = FramerateEmitterReply {
type_: "framerate".to_owned(),
from: framerate_actor.name(),
delta: HighResolutionStamp::new(self.start_stamp, end_time),
timestamps: framerate_actor.take_pending_ticks(),
};
self.stream.write_json_packet(&framerateReply)?;
self.stream.write_json_packet(&framerate_reply)?;
}
if let Some(ref actor_name) = self.memory_actor {
let registry = self.registry.lock().unwrap();
let memory_actor = registry.find::<MemoryActor>(actor_name);
let memoryReply = MemoryEmitterReply {
let memory_reply = MemoryEmitterReply {
type_: "memory".to_owned(),
from: memory_actor.name(),
delta: HighResolutionStamp::new(self.start_stamp, end_time),
measurement: memory_actor.measure(),
};
self.stream.write_json_packet(&memoryReply)?;
self.stream.write_json_packet(&memory_reply)?;
}
Ok(())

View File

@@ -0,0 +1,311 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! The watcher is the main entry point when debugging an element. Right now only web views are supported.
//! It talks to the devtools remote and lists the capabilities of the inspected target, and it serves
//! as a bridge for messages between actors.
//!
//! Liberally derived from the [Firefox JS implementation].
//!
//! [Firefox JS implementation]: https://searchfox.org/mozilla-central/source/devtools/server/actors/descriptors/watcher.js
use std::collections::HashMap;
use std::net::TcpStream;
use log::warn;
use serde::Serialize;
use serde_json::{Map, Value};
use self::network_parent::{NetworkParentActor, NetworkParentActorMsg};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::browsing_context::{BrowsingContextActor, BrowsingContextActorMsg};
use crate::actors::watcher::target_configuration::{
TargetConfigurationActor, TargetConfigurationActorMsg,
};
use crate::actors::watcher::thread_configuration::{
ThreadConfigurationActor, ThreadConfigurationActorMsg,
};
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
pub mod network_parent;
pub mod target_configuration;
pub mod thread_configuration;
/// Describes the debugged context. It informs the server of which objects can be debugged.
/// <https://searchfox.org/mozilla-central/source/devtools/server/actors/watcher/session-context.js>
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SessionContext {
is_server_target_switching_enabled: bool,
supported_targets: HashMap<&'static str, bool>,
supported_resources: HashMap<&'static str, bool>,
context_type: SessionContextType,
}
impl SessionContext {
pub fn new(context_type: SessionContextType) -> Self {
Self {
is_server_target_switching_enabled: false,
// Right now we only support debugging web views (frames)
supported_targets: HashMap::from([
("frame", true),
("process", false),
("worker", false),
("service_worker", false),
("shared_worker", false),
]),
// At the moment we are blocking most resources to avoid errors
// Support for them will be enabled gradually once the corresponding actors start
// working propperly
supported_resources: HashMap::from([
("console-message", true),
("css-change", true),
("css-message", false),
("css-registered-properties", false),
("document-event", false),
("Cache", false),
("cookies", false),
("error-message", true),
("extension-storage", false),
("indexed-db", false),
("local-storage", false),
("session-storage", false),
("platform-message", false),
("network-event", false),
("network-event-stacktrace", false),
("reflow", false),
("stylesheet", false),
("source", false),
("thread-state", false),
("server-sent-event", false),
("websocket", false),
("jstracer-trace", false),
("jstracer-state", false),
("last-private-context-exit", false),
]),
context_type,
}
}
}
#[derive(Serialize)]
pub enum SessionContextType {
BrowserElement,
_ContextProcess,
_WebExtension,
_Worker,
_All,
}
#[derive(Serialize)]
struct WatchTargetsReply {
from: String,
#[serde(rename = "type")]
type_: String,
target: BrowsingContextActorMsg,
}
#[derive(Serialize)]
struct GetParentBrowsingContextIDReply {
from: String,
#[serde(rename = "browsingContextID")]
browsing_context_id: u32,
}
#[derive(Serialize)]
struct GetNetworkParentActorReply {
from: String,
network: NetworkParentActorMsg,
}
#[derive(Serialize)]
struct GetTargetConfigurationActorReply {
from: String,
configuration: TargetConfigurationActorMsg,
}
#[derive(Serialize)]
struct GetThreadConfigurationActorReply {
from: String,
configuration: ThreadConfigurationActorMsg,
}
#[derive(Serialize)]
struct WatcherTraits {
resources: HashMap<&'static str, bool>,
#[serde(flatten)]
targets: HashMap<&'static str, bool>,
}
#[derive(Serialize)]
pub struct WatcherActorMsg {
actor: String,
traits: WatcherTraits,
}
pub struct WatcherActor {
name: String,
browsing_context_actor: String,
network_parent: String,
target_configuration: String,
thread_configuration: String,
session_context: SessionContext,
}
impl Actor for WatcherActor {
fn name(&self) -> String {
self.name.clone()
}
/// The watcher actor can handle the following messages:
///
/// - `watchTargets`: Returns a list of objects to debug. Since we only support web views, it
/// returns the associated `BrowsingContextActor`. Every target sent creates a
/// `target-available-form` event.
///
/// - `watchResources`: Start watching certain resource types. This sends
/// `resource-available-form` events.
///
/// - `getNetworkParentActor`: Returns the network parent actor. It doesn't seem to do much at
/// the moment.
///
/// - `getTargetConfigurationActor`: Returns the configuration actor for a specific target, so
/// that the server can update its settings.
///
/// - `getThreadConfigurationActor`: The same but with the configuration actor for the thread
fn handle_message(
&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
let target = registry.find::<BrowsingContextActor>(&self.browsing_context_actor);
Ok(match msg_type {
"watchTargets" => {
let msg = WatchTargetsReply {
from: self.name(),
type_: "target-available-form".into(),
target: target.encodable(),
};
let _ = stream.write_json_packet(&msg);
target.frame_update(stream);
// Messages that contain a `type` field are used to send event callbacks, but they
// don't count as a reply. Since every message needs to be responded, we send an
// extra empty packet to the devtools host to inform that we successfully received
// and processed the message so that it can continue
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"watchResources" => {
let Some(resource_types) = msg.get("resourceTypes") else {
return Ok(ActorMessageStatus::Ignored);
};
let Some(resource_types) = resource_types.as_array() else {
return Ok(ActorMessageStatus::Ignored);
};
for resource in resource_types {
let Some(resource) = resource.as_str() else {
continue;
};
match resource {
"document-event" => {
target.document_event(stream);
},
"console-message" | "error-message" => {},
_ => warn!("resource {} not handled yet", resource),
}
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
}
ActorMessageStatus::Processed
},
"getParentBrowsingContextID" => {
let browsing_context_id = target.browsing_context_id.index.0.get();
let msg = GetParentBrowsingContextIDReply {
from: self.name(),
browsing_context_id,
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getNetworkParentActor" => {
let network_parent = registry.find::<NetworkParentActor>(&self.network_parent);
let msg = GetNetworkParentActorReply {
from: self.name(),
network: network_parent.encodable(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getTargetConfigurationActor" => {
let target_configuration =
registry.find::<TargetConfigurationActor>(&self.target_configuration);
let msg = GetTargetConfigurationActorReply {
from: self.name(),
configuration: target_configuration.encodable(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
"getThreadConfigurationActor" => {
let thread_configuration =
registry.find::<ThreadConfigurationActor>(&self.thread_configuration);
let msg = GetThreadConfigurationActorReply {
from: self.name(),
configuration: thread_configuration.encodable(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl WatcherActor {
pub fn new(
actors: &mut ActorRegistry,
browsing_context_actor: String,
session_context: SessionContext,
) -> Self {
let network_parent = NetworkParentActor::new(actors.new_name("network-parent"));
let target_configuration =
TargetConfigurationActor::new(actors.new_name("target-configuration"));
let thread_configuration =
ThreadConfigurationActor::new(actors.new_name("thread-configuration"));
let watcher = Self {
name: actors.new_name("watcher"),
browsing_context_actor,
network_parent: network_parent.name(),
target_configuration: target_configuration.name(),
thread_configuration: thread_configuration.name(),
session_context,
};
actors.register(Box::new(network_parent));
actors.register(Box::new(target_configuration));
actors.register(Box::new(thread_configuration));
watcher
}
pub fn encodable(&self) -> WatcherActorMsg {
WatcherActorMsg {
actor: self.name(),
traits: WatcherTraits {
resources: self.session_context.supported_resources.clone(),
targets: self.session_context.supported_targets.clone(),
},
}
}
}

View File

@@ -0,0 +1,58 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
pub struct NetworkParentActorMsg {
actor: String,
}
pub struct NetworkParentActor {
name: String,
}
impl Actor for NetworkParentActor {
fn name(&self) -> String {
self.name.clone()
}
/// The network parent actor can handle the following messages:
///
/// - `setSaveRequestAndResponseBodies`: Doesn't do anything yet
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"setSaveRequestAndResponseBodies" => {
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl NetworkParentActor {
pub fn new(name: String) -> Self {
Self { name }
}
pub fn encodable(&self) -> NetworkParentActorMsg {
NetworkParentActorMsg { actor: self.name() }
}
}

View File

@@ -0,0 +1,101 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Liberally derived from <https://searchfox.org/mozilla-central/source/devtools/server/actors/target-configuration.js>
//! This actor manages the configuration flags that the devtools host can apply to the targets.
use std::collections::HashMap;
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TargetConfigurationTraits {
supported_options: HashMap<&'static str, bool>,
}
#[derive(Serialize)]
pub struct TargetConfigurationActorMsg {
actor: String,
configuration: HashMap<&'static str, bool>,
traits: TargetConfigurationTraits,
}
pub struct TargetConfigurationActor {
name: String,
configuration: HashMap<&'static str, bool>,
supported_options: HashMap<&'static str, bool>,
}
impl Actor for TargetConfigurationActor {
fn name(&self) -> String {
self.name.clone()
}
/// The target configuration actor can handle the following messages:
///
/// - `updateConfiguration`: Receives new configuration flags from the devtools host.
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"updateConfiguration" => {
// TODO: Actually update configuration
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl TargetConfigurationActor {
pub fn new(name: String) -> Self {
Self {
name,
configuration: HashMap::new(),
supported_options: HashMap::from([
("cacheDisabled", false),
("colorSchemeSimulation", false),
("customFormatters", false),
("customUserAgent", false),
("javascriptEnabled", false),
("overrideDPPX", false),
("printSimulationEnabled", false),
("rdmPaneMaxTouchPoints", false),
("rdmPaneOrientation", false),
("recordAllocations", false),
("reloadOnTouchSimulationToggle", false),
("restoreFocus", false),
("serviceWorkersTestingEnabled", false),
("setTabOffline", false),
("touchEventsOverride", false),
("tracerOptions", false),
("useSimpleHighlightersForReducedMotion", false),
]),
}
}
pub fn encodable(&self) -> TargetConfigurationActorMsg {
TargetConfigurationActorMsg {
actor: self.name(),
configuration: self.configuration.clone(),
traits: TargetConfigurationTraits {
supported_options: self.supported_options.clone(),
},
}
}
}

View File

@@ -0,0 +1,67 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Liberally derived from <https://searchfox.org/mozilla-central/source/devtools/server/actors/thread-configuration.js>
//! This actor manages the configuration flags that the devtools host can apply to threads.
use std::collections::HashMap;
use std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::{EmptyReplyMsg, StreamId};
#[derive(Serialize)]
pub struct ThreadConfigurationActorMsg {
actor: String,
}
pub struct ThreadConfigurationActor {
name: String,
_configuration: HashMap<&'static str, bool>,
}
impl Actor for ThreadConfigurationActor {
fn name(&self) -> String {
self.name.clone()
}
/// The thread configuration actor can handle the following messages:
///
/// - `updateConfiguration`: Receives new configuration flags from the devtools host.
fn handle_message(
&self,
_registry: &ActorRegistry,
msg_type: &str,
_msg: &Map<String, Value>,
stream: &mut TcpStream,
_id: StreamId,
) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"updateConfiguration" => {
// TODO: Actually update configuration
let msg = EmptyReplyMsg { from: self.name() };
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
},
_ => ActorMessageStatus::Ignored,
})
}
}
impl ThreadConfigurationActor {
pub fn new(name: String) -> Self {
Self {
name,
_configuration: HashMap::new(),
}
}
pub fn encodable(&self) -> ThreadConfigurationActorMsg {
ThreadConfigurationActorMsg { actor: self.name() }
}
}

View File

@@ -41,12 +41,12 @@ impl WorkerActor {
pub(crate) fn encodable(&self) -> WorkerMsg {
WorkerMsg {
actor: self.name.clone(),
consoleActor: self.console.clone(),
threadActor: self.thread.clone(),
console_actor: self.console.clone(),
thread_actor: self.thread.clone(),
id: self.id.0.to_string(),
url: self.url.to_string(),
traits: WorkerTraits {
isParentInterceptEnabled: false,
is_parent_intercept_enabled: false,
},
type_: self.type_ as u32,
}
@@ -89,8 +89,8 @@ impl Actor for WorkerActor {
let msg = ConnectReply {
from: self.name(),
type_: "connected".to_owned(),
threadActor: self.thread.clone(),
consoleActor: self.console.clone(),
thread_actor: self.thread.clone(),
console_actor: self.console.clone(),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
@@ -136,24 +136,27 @@ struct AttachedReply {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ConnectReply {
from: String,
#[serde(rename = "type")]
type_: String,
threadActor: String,
consoleActor: String,
thread_actor: String,
console_actor: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct WorkerTraits {
isParentInterceptEnabled: bool,
is_parent_intercept_enabled: bool,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct WorkerMsg {
actor: String,
consoleActor: String,
threadActor: String,
console_actor: String,
thread_actor: String,
id: String,
url: String,
traits: WorkerTraits,

View File

@@ -5,11 +5,10 @@
//! An actor-based remote devtools server implementation. Only tested with
//! nightly Firefox versions at time of writing. Largely based on
//! reverse-engineering of Firefox chrome devtool logs and reading of
//! [code](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/).
//! [code](https://searchfox.org/mozilla-central/source/devtools/server).
#![crate_name = "devtools"]
#![crate_type = "rlib"]
#![allow(non_snake_case)]
#![deny(unsafe_code)]
use std::borrow::ToOwned;
@@ -29,7 +28,7 @@ use devtools_traits::{
};
use embedder_traits::{EmbedderMsg, EmbedderProxy, PromptDefinition, PromptOrigin, PromptResult};
use ipc_channel::ipc::{self, IpcSender};
use log::{debug, warn};
use log::{debug, trace, warn};
use serde::Serialize;
use servo_rand::RngCore;
@@ -48,12 +47,11 @@ use crate::actors::worker::{WorkerActor, WorkerType};
use crate::protocol::JsonPacketStream;
mod actor;
/// Corresponds to <http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/>
/// <https://searchfox.org/mozilla-central/source/devtools/server/actors>
mod actors {
pub mod browsing_context;
pub mod console;
pub mod device;
pub mod emulation;
pub mod framerate;
pub mod inspector;
pub mod memory;
@@ -62,12 +60,13 @@ mod actors {
pub mod performance;
pub mod preference;
pub mod process;
pub mod profiler;
pub mod reflow;
pub mod root;
pub mod stylesheets;
pub mod tab;
pub mod thread;
pub mod timeline;
pub mod watcher;
pub mod worker;
}
mod protocol;
@@ -79,24 +78,27 @@ enum UniqueId {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct NetworkEventMsg {
from: String,
#[serde(rename = "type")]
type_: String,
eventActor: EventActor,
event_actor: EventActor,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct NetworkEventUpdateMsg {
from: String,
#[serde(rename = "type")]
type_: String,
updateType: String,
update_type: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct EventTimingsUpdateMsg {
totalTime: u64,
total_time: u64,
}
#[derive(Serialize)]
@@ -105,14 +107,20 @@ struct SecurityInfoUpdateMsg {
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ResponseStartUpdateMsg {
from: String,
#[serde(rename = "type")]
type_: String,
updateType: String,
update_type: String,
response: ResponseStartMsg,
}
#[derive(Serialize)]
pub struct EmptyReplyMsg {
pub from: String,
}
/// Spin up a devtools server that listens for connections on the specified port.
pub fn start_server(port: u16, embedder: EmbedderProxy) -> Sender<DevtoolsControlMsg> {
let (sender, receiver) = unbounded();
@@ -181,13 +189,11 @@ fn run_server(
let actors = registry.create_shareable();
let mut accepted_connections: Vec<TcpStream> = Vec::new();
let mut browsing_contexts: HashMap<BrowsingContextId, String> = HashMap::new();
let mut pipelines: HashMap<PipelineId, BrowsingContextId> = HashMap::new();
let mut actor_requests: HashMap<String, String> = HashMap::new();
let mut actor_workers: HashMap<WorkerId, String> = HashMap::new();
let mut accepted_connections = HashMap::new();
let mut browsing_contexts: HashMap<_, String> = HashMap::new();
let mut pipelines = HashMap::new();
let mut actor_requests = HashMap::new();
let mut actor_workers = HashMap::new();
/// Process the input from a single devtools client until EOF.
fn handle_client(actors: Arc<Mutex<ActorRegistry>>, mut stream: TcpStream, id: StreamId) {
@@ -271,6 +277,7 @@ fn run_server(
// We need separate actor representations for each script global that exists;
// clients can theoretically connect to multiple globals simultaneously.
// TODO: move this into the root or target modules?
#[allow(clippy::too_many_arguments)]
fn handle_new_global(
actors: Arc<Mutex<ActorRegistry>>,
ids: (BrowsingContextId, PipelineId, Option<WorkerId>),
@@ -279,6 +286,7 @@ fn run_server(
pipelines: &mut HashMap<PipelineId, BrowsingContextId>,
actor_workers: &mut HashMap<WorkerId, String>,
page_info: DevtoolsPageInfo,
connections: &HashMap<StreamId, TcpStream>,
) {
let mut actors = actors.lock().unwrap();
@@ -314,10 +322,9 @@ fn run_server(
Root::DedicatedWorker(worker_name)
} else {
pipelines.insert(pipeline, browsing_context);
Root::BrowsingContext(
if let Some(actor) = browsing_contexts.get(&browsing_context) {
actor.to_owned()
} else {
let name = browsing_contexts
.entry(browsing_context)
.or_insert_with(|| {
let browsing_context_actor = BrowsingContextActor::new(
console_name.clone(),
browsing_context,
@@ -327,11 +334,18 @@ fn run_server(
&mut actors,
);
let name = browsing_context_actor.name();
browsing_contexts.insert(browsing_context, name.clone());
actors.register(Box::new(browsing_context_actor));
name
},
)
});
// Add existing streams to the new browsing context
let browsing_context = actors.find::<BrowsingContextActor>(name);
let mut streams = browsing_context.streams.borrow_mut();
for (id, stream) in connections {
streams.insert(*id, stream.try_clone().unwrap());
}
Root::BrowsingContext(name.clone())
};
let console = ConsoleActor {
@@ -456,7 +470,7 @@ fn run_server(
let msg = NetworkEventMsg {
from: console_actor_name,
type_: "networkEvent".to_owned(),
eventActor: actor.event_actor(),
event_actor: actor.event_actor(),
};
for stream in &mut connections {
let _ = stream.write_json_packet(&msg);
@@ -469,7 +483,7 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "requestHeaders".to_owned(),
update_type: "requestHeaders".to_owned(),
};
for stream in &mut connections {
let _ = stream.write_merged_json_packet(&msg, &actor.request_headers());
@@ -478,7 +492,7 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "requestCookies".to_owned(),
update_type: "requestCookies".to_owned(),
};
for stream in &mut connections {
let _ = stream.write_merged_json_packet(&msg, &actor.request_cookies());
@@ -488,7 +502,7 @@ fn run_server(
let msg = ResponseStartUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "responseStart".to_owned(),
update_type: "responseStart".to_owned(),
response: actor.response_start(),
};
@@ -498,10 +512,10 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "eventTimings".to_owned(),
update_type: "eventTimings".to_owned(),
};
let extra = EventTimingsUpdateMsg {
totalTime: actor.total_time(),
total_time: actor.total_time().as_millis() as u64,
};
for stream in &mut connections {
let _ = stream.write_merged_json_packet(&msg, &extra);
@@ -510,7 +524,7 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "securityInfo".to_owned(),
update_type: "securityInfo".to_owned(),
};
let extra = SecurityInfoUpdateMsg {
state: "insecure".to_owned(),
@@ -522,7 +536,7 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "responseContent".to_owned(),
update_type: "responseContent".to_owned(),
};
for stream in &mut connections {
let _ = stream.write_merged_json_packet(&msg, &actor.response_content());
@@ -531,7 +545,7 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name.clone(),
type_: "networkEventUpdate".to_owned(),
updateType: "responseCookies".to_owned(),
update_type: "responseCookies".to_owned(),
};
for stream in &mut connections {
let _ = stream.write_merged_json_packet(&msg, &actor.response_cookies());
@@ -540,7 +554,7 @@ fn run_server(
let msg = NetworkEventUpdateMsg {
from: netevent_actor_name,
type_: "networkEventUpdate".to_owned(),
updateType: "responseHeaders".to_owned(),
update_type: "responseHeaders".to_owned(),
};
for stream in &mut connections {
let _ = stream.write_merged_json_packet(&msg, &actor.response_headers());
@@ -593,13 +607,21 @@ fn run_server(
let mut next_id = StreamId(0);
while let Ok(msg) = receiver.recv() {
debug!("{:?}", msg);
trace!("{:?}", msg);
match msg {
DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::AddClient(stream)) => {
let actors = actors.clone();
let id = next_id;
next_id = StreamId(id.0 + 1);
accepted_connections.push(stream.try_clone().unwrap());
accepted_connections.insert(id, stream.try_clone().unwrap());
// Inform every browsing context of the new stream
for name in browsing_contexts.values() {
let actors = actors.lock().unwrap();
let browsing_context = actors.find::<BrowsingContextActor>(name);
let mut streams = browsing_context.streams.borrow_mut();
streams.insert(id, stream.try_clone().unwrap());
}
thread::Builder::new()
.name("DevtoolsClientHandler".to_owned())
.spawn(move || handle_client(actors, stream.try_clone().unwrap(), id))
@@ -631,6 +653,7 @@ fn run_server(
&mut pipelines,
&mut actor_workers,
pageinfo,
&accepted_connections,
),
DevtoolsControlMsg::FromScript(ScriptToDevtoolsControlMsg::Navigate(
browsing_context,
@@ -667,10 +690,10 @@ fn run_server(
)) => {
let console_message = ConsoleMessage {
message: css_error.msg,
logLevel: LogLevel::Warn,
log_level: LogLevel::Warn,
filename: css_error.filename,
lineNumber: css_error.line as usize,
columnNumber: css_error.column as usize,
line_number: css_error.line as usize,
column_number: css_error.column as usize,
};
handle_console_message(
actors.clone(),
@@ -688,7 +711,7 @@ fn run_server(
)) => {
// copy the accepted_connections vector
let mut connections = Vec::<TcpStream>::new();
for stream in &accepted_connections {
for stream in accepted_connections.values() {
connections.push(stream.try_clone().unwrap());
}
@@ -711,7 +734,7 @@ fn run_server(
DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::ServerExitMsg) => break,
}
}
for connection in &mut accepted_connections {
for connection in accepted_connections.values_mut() {
let _ = connection.shutdown(Shutdown::Both);
}
}

View File

@@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Low-level wire protocol implementation. Currently only supports
//! [JSON packets](https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets).
//! [JSON packets](https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#json-packets).
use std::error::Error;
use std::io::{Read, Write};
@@ -14,9 +14,10 @@ use serde::Serialize;
use serde_json::{self, Value};
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActorDescription {
pub category: &'static str,
pub typeName: &'static str,
pub type_name: &'static str,
pub methods: Vec<Method>,
}
@@ -63,7 +64,7 @@ impl JsonPacketStream for TcpStream {
}
fn read_json_packet(&mut self) -> Result<Option<Value>, String> {
// https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport
// https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#stream-transport
// In short, each JSON packet is [ascii length]:[JSON data of given length]
let mut buffer = vec![];
loop {

View File

@@ -38,7 +38,7 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
quote! (
#s2
impl crate::dom::bindings::inheritance::HasParent for #name {
impl crate::HasParent for #name {
type Parent = #ty;
/// This is used in a type assertion to ensure that
/// the source and webidls agree as to what the parent type is

View File

@@ -40,23 +40,31 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream {
unsafe fn to_jsval(&self,
cx: *mut js::jsapi::JSContext,
rval: js::rust::MutableHandleValue) {
let object = crate::dom::bindings::reflector::DomObject::reflector(self).get_jsobject();
let object = crate::DomObject::reflector(self).get_jsobject();
object.to_jsval(cx, rval)
}
}
impl #impl_generics crate::dom::bindings::reflector::DomObject for #name #ty_generics #where_clause {
impl #impl_generics crate::DomObject for #name #ty_generics #where_clause {
#[inline]
fn reflector(&self) -> &crate::dom::bindings::reflector::Reflector {
fn reflector(&self) -> &crate::Reflector {
self.#first_field_name.reflector()
}
}
impl #impl_generics crate::dom::bindings::reflector::MutDomObject for #name #ty_generics #where_clause {
impl #impl_generics crate::MutDomObject for #name #ty_generics #where_clause {
unsafe fn init_reflector(&self, obj: *mut js::jsapi::JSObject) {
self.#first_field_name.init_reflector(obj);
}
}
impl #impl_generics Eq for #name #ty_generics #where_clause {}
impl #impl_generics PartialEq for #name #ty_generics #where_clause {
fn eq(&self, other: &Self) -> bool {
crate::DomObject::reflector(self) == crate::DomObject::reflector(other)
}
}
};
let mut params = proc_macro2::TokenStream::new();
@@ -74,7 +82,7 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream {
let mut generics = input.generics.clone();
generics.params.push(parse_quote!(
__T: crate::dom::bindings::reflector::DomObject
__T: crate::DomObject
));
let (impl_generics, _, where_clause) = generics.split_for_impl();

View File

@@ -9,7 +9,7 @@ publish.workspace = true
[lib]
name = "fonts"
path = "lib.rs"
test = false
test = true
doctest = false
[dependencies]
@@ -25,7 +25,7 @@ fontsan = { git = "https://github.com/servo/fontsan" }
fonts_traits = { workspace = true }
harfbuzz-sys = "0.6.1"
ipc-channel = { workspace = true }
lazy_static = { workspace = true }
itertools = { workspace = true }
libc = { workspace = true }
log = { workspace = true }
malloc_size_of = { workspace = true }
@@ -36,6 +36,7 @@ range = { path = "../range" }
serde = { workspace = true }
servo_arc = { workspace = true }
servo_atoms = { workspace = true }
servo_config = { path = "../config" }
servo_url = { path = "../url" }
smallvec = { workspace = true, features = ["union"] }
surfman = { workspace = true }
@@ -48,6 +49,9 @@ webrender_api = { workspace = true }
webrender_traits = { workspace = true }
xi-unicode = { workspace = true }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ohos_mock)'] }
[target.'cfg(target_os = "macos")'.dependencies]
byteorder = { workspace = true }
core-foundation = "0.9"
@@ -60,7 +64,7 @@ freetype-sys = { workspace = true }
servo_allocator = { path = "../allocator" }
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
fontconfig_sys = { package = "yeslogic-fontconfig-sys", version = "5" }
fontconfig_sys = { package = "yeslogic-fontconfig-sys", version = "6" }
[target.'cfg(target_os = "android")'.dependencies]
xml-rs = "0.8"
@@ -71,5 +75,5 @@ harfbuzz-sys = { version = "0.6.1", features = ["bundled"] }
[target.'cfg(target_os = "windows")'.dependencies]
harfbuzz-sys = { version = "0.6", features = ["bundled"] }
dwrote = "0.11"
dwrote = "0.11.1"
truetype = { version = "0.47.3", features = ["ignore-invalid-language-ids"] }

View File

@@ -12,15 +12,17 @@ use std::{iter, str};
use app_units::Au;
use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D};
use euclid::num::Zero;
use log::debug;
use malloc_size_of_derive::MallocSizeOf;
use parking_lot::RwLock;
use serde::{Deserialize, Serialize};
use servo_atoms::{atom, Atom};
use smallvec::SmallVec;
use style::computed_values::font_variant_caps;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::{GenericFontFamily, SingleFontFamily};
use style::values::computed::font::{
FamilyName, FontFamilyNameSyntax, GenericFontFamily, SingleFontFamily,
};
use style::values::computed::{FontStretch, FontStyle, FontWeight};
use unicode_script::Script;
use webrender_api::{FontInstanceFlags, FontInstanceKey};
@@ -48,9 +50,11 @@ pub const KERN: u32 = ot_tag!('k', 'e', 'r', 'n');
pub const SBIX: u32 = ot_tag!('s', 'b', 'i', 'x');
pub const CBDT: u32 = ot_tag!('C', 'B', 'D', 'T');
pub const COLR: u32 = ot_tag!('C', 'O', 'L', 'R');
pub const BASE: u32 = ot_tag!('B', 'A', 'S', 'E');
pub const LAST_RESORT_GLYPH_ADVANCE: FractionalPixel = 10.0;
/// Nanoseconds spent shaping text across all layout threads.
static TEXT_SHAPING_PERFORMANCE_COUNTER: AtomicUsize = AtomicUsize::new(0);
// PlatformFont encapsulates access to the platform's font API,
@@ -88,6 +92,7 @@ pub trait PlatformFontMethods: Sized {
fn can_do_fast_shaping(&self) -> bool;
fn metrics(&self) -> FontMetrics;
fn table_for_tag(&self, _: FontTableTag) -> Option<FontTable>;
fn typographic_bounds(&self, _: GlyphId) -> Rect<f32>;
/// Get the necessary [`FontInstanceFlags`]` for this font.
fn webrender_font_instance_flags(&self) -> FontInstanceFlags;
@@ -134,6 +139,9 @@ pub struct FontMetrics {
pub line_gap: Au,
pub zero_horizontal_advance: Option<Au>,
pub ic_horizontal_advance: Option<Au>,
/// The advance of the space character (' ') in this font or if there is no space,
/// the average char advance.
pub space_advance: Au,
}
impl FontMetrics {
@@ -141,20 +149,21 @@ impl FontMetrics {
/// no font can be found.
pub fn empty() -> Self {
Self {
underline_size: Au(0),
underline_offset: Au(0),
strikeout_size: Au(0),
strikeout_offset: Au(0),
leading: Au(0),
x_height: Au(0),
em_size: Au(0),
ascent: Au(0),
descent: Au(0),
max_advance: Au(0),
average_advance: Au(0),
line_gap: Au(0),
underline_size: Au::zero(),
underline_offset: Au::zero(),
strikeout_size: Au::zero(),
strikeout_offset: Au::zero(),
leading: Au::zero(),
x_height: Au::zero(),
em_size: Au::zero(),
ascent: Au::zero(),
descent: Au::zero(),
max_advance: Au::zero(),
average_advance: Au::zero(),
line_gap: Au::zero(),
zero_horizontal_advance: None,
ic_horizontal_advance: None,
space_advance: Au::zero(),
}
}
}
@@ -317,7 +326,6 @@ struct ShapeCacheEntry {
impl Font {
pub fn shape_text(&self, text: &str, options: &ShapingOptions) -> Arc<GlyphStore> {
let this = self as *const Font;
let lookup_key = ShapeCacheEntry {
text: text.to_owned(),
options: *options,
@@ -329,8 +337,7 @@ impl Font {
}
}
let is_single_preserved_newline = text.len() == 1 && text.chars().next() == Some('\n');
let is_single_preserved_newline = text.len() == 1 && text.starts_with('\n');
let start_time = Instant::now();
let mut glyphs = GlyphStore::new(
text.len(),
@@ -346,9 +353,7 @@ impl Font {
self.shape_text_fast(text, options, &mut glyphs);
} else {
debug!("shape_text: Using Harfbuzz.");
self.shaper
.get_or_init(|| Shaper::new(this))
.shape_text(text, options, &mut glyphs);
self.shape_text_harfbuzz(text, options, &mut glyphs);
}
let shaped_text = Arc::new(glyphs);
@@ -364,6 +369,13 @@ impl Font {
shaped_text
}
fn shape_text_harfbuzz(&self, text: &str, options: &ShapingOptions, glyphs: &mut GlyphStore) {
let this = self as *const Font;
self.shaper
.get_or_init(|| Shaper::new(this))
.shape_text(text, options, glyphs);
}
fn can_do_fast_shaping(&self, text: &str, options: &ShapingOptions) -> bool {
options.script == Script::Latin &&
!options.flags.contains(ShapingFlags::RTL_FLAG) &&
@@ -464,6 +476,16 @@ impl Font {
cache.glyph_advances.insert(glyph_id, new_width);
new_width
}
pub fn typographic_bounds(&self, glyph_id: GlyphId) -> Rect<f32> {
self.handle.typographic_bounds(glyph_id)
}
#[allow(unsafe_code)]
pub fn get_baseline(&self) -> Option<FontBaseline> {
let this = self as *const Font;
unsafe { self.shaper.get_or_init(|| Shaper::new(this)).get_baseline() }
}
}
pub type FontRef = Arc<Font>;
@@ -480,9 +502,7 @@ pub struct FontGroup {
}
impl FontGroup {
pub fn new(style: &FontStyleStruct) -> FontGroup {
let descriptor = FontDescriptor::from(style);
pub fn new(style: &FontStyleStruct, descriptor: FontDescriptor) -> FontGroup {
let families: SmallVec<[FontGroupFamily; 8]> = style
.font_family
.families
@@ -507,6 +527,14 @@ impl FontGroup {
codepoint: char,
next_codepoint: Option<char>,
) -> Option<FontRef> {
// Tab characters are converted into spaces when rendering.
// TODO: We should not render a tab character. Instead they should be converted into tab stops
// based upon the width of a space character in inline formatting contexts.
let codepoint = match codepoint {
'\t' => ' ',
_ => codepoint,
};
let options = FallbackFontSelectionOptions::new(codepoint, next_codepoint);
let should_look_for_small_caps = self.descriptor.variant == font_variant_caps::T::SmallCaps &&
@@ -630,10 +658,18 @@ impl FontGroup {
TemplatePredicate: Fn(FontTemplateRef) -> bool,
FontPredicate: Fn(&FontRef) -> bool,
{
iter::once(FontFamilyDescriptor::serif())
.chain(fallback_font_families(options).into_iter().map(|family| {
FontFamilyDescriptor::new(FontFamilyName::from(family), FontSearchScope::Local)
}))
iter::once(FontFamilyDescriptor::default())
.chain(
fallback_font_families(options)
.into_iter()
.map(|family_name| {
let family = SingleFontFamily::FamilyName(FamilyName {
name: family_name.into(),
syntax: FontFamilyNameSyntax::Quoted,
});
FontFamilyDescriptor::new(family, FontSearchScope::Local)
}),
)
.filter_map(|family_descriptor| {
FontGroupFamily {
family_descriptor,
@@ -676,11 +712,8 @@ struct FontGroupFamily {
impl FontGroupFamily {
fn new(family: &SingleFontFamily) -> FontGroupFamily {
let family_descriptor =
FontFamilyDescriptor::new(FontFamilyName::from(family), FontSearchScope::Any);
FontGroupFamily {
family_descriptor,
family_descriptor: FontFamilyDescriptor::new(family.clone(), FontSearchScope::Any),
members: None,
}
}
@@ -768,6 +801,7 @@ impl RunMetrics {
}
}
/// Get the number of nanoseconds spent shaping text across all threads.
pub fn get_and_reset_text_shaping_performance_counter() -> usize {
TEXT_SHAPING_PERFORMANCE_COUNTER.swap(0, Ordering::SeqCst)
}
@@ -782,73 +816,30 @@ pub enum FontSearchScope {
Local,
}
/// A font family name used in font selection.
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub enum FontFamilyName {
/// A specific name such as `"Arial"`
Specific(Atom),
/// A generic name such as `sans-serif`
Generic(Atom),
}
impl FontFamilyName {
pub fn name(&self) -> &str {
match *self {
FontFamilyName::Specific(ref name) => name,
FontFamilyName::Generic(ref name) => name,
}
}
}
impl<'a> From<&'a SingleFontFamily> for FontFamilyName {
fn from(other: &'a SingleFontFamily) -> FontFamilyName {
match *other {
SingleFontFamily::FamilyName(ref family_name) => {
FontFamilyName::Specific(family_name.name.clone())
},
SingleFontFamily::Generic(generic) => FontFamilyName::Generic(match generic {
GenericFontFamily::None => panic!("Shouldn't appear in style"),
GenericFontFamily::Serif => atom!("serif"),
GenericFontFamily::SansSerif => atom!("sans-serif"),
GenericFontFamily::Monospace => atom!("monospace"),
GenericFontFamily::Cursive => atom!("cursive"),
GenericFontFamily::Fantasy => atom!("fantasy"),
GenericFontFamily::SystemUi => atom!("system-ui"),
}),
}
}
}
impl<'a> From<&'a str> for FontFamilyName {
fn from(other: &'a str) -> FontFamilyName {
FontFamilyName::Specific(Atom::from(other))
}
}
/// The font family parameters for font selection.
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct FontFamilyDescriptor {
pub name: FontFamilyName,
pub family: SingleFontFamily,
pub scope: FontSearchScope,
}
impl FontFamilyDescriptor {
pub fn new(name: FontFamilyName, scope: FontSearchScope) -> FontFamilyDescriptor {
FontFamilyDescriptor { name, scope }
pub fn new(family: SingleFontFamily, scope: FontSearchScope) -> FontFamilyDescriptor {
FontFamilyDescriptor { family, scope }
}
fn serif() -> FontFamilyDescriptor {
fn default() -> FontFamilyDescriptor {
FontFamilyDescriptor {
name: FontFamilyName::Generic(atom!("serif")),
family: SingleFontFamily::Generic(GenericFontFamily::None),
scope: FontSearchScope::Local,
}
}
}
pub fn name(&self) -> &str {
self.name.name()
}
pub struct FontBaseline {
pub ideographic_baseline: f32,
pub alphabetic_baseline: f32,
pub hanging_baseline: f32,
}
/// Given a mapping array `mapping` and a value, map that value onto
@@ -884,3 +875,87 @@ pub(crate) fn map_platform_values_to_style_values(mapping: &[(f64, f64)], value:
mapping[mapping.len() - 1].1
}
#[cfg(test)]
mod test {
#[cfg(target_os = "windows")]
#[test]
fn test_shape_text_fast() {
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::sync::Arc;
use app_units::Au;
use euclid::num::Zero;
use servo_url::ServoUrl;
use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
use style::values::computed::{FontStretch, FontStyle, FontWeight};
use unicode_script::Script;
use crate::platform::font::PlatformFont;
use crate::{
Font, FontDescriptor, FontIdentifier, FontTemplate, GlyphStore, PlatformFontMethods,
ShapingFlags, ShapingOptions,
};
let path: PathBuf = [
env!("CARGO_MANIFEST_DIR"),
"tests",
"support",
"dejavu-fonts-ttf-2.37",
"ttf",
"DejaVuSans.ttf",
]
.iter()
.collect();
let identifier = FontIdentifier::Web(ServoUrl::from_file_path(path.clone()).unwrap());
let file = File::open(path).unwrap();
let data: Arc<Vec<u8>> = Arc::new(file.bytes().map(|b| b.unwrap()).collect());
let platform_font =
PlatformFont::new_from_data(identifier.clone(), data.clone(), 0, None).unwrap();
let template = FontTemplate {
identifier,
descriptor: platform_font.descriptor(),
data: Some(data),
stylesheet: None,
};
let descriptor = FontDescriptor {
weight: FontWeight::normal(),
stretch: FontStretch::hundred(),
style: FontStyle::normal(),
variant: FontVariantCaps::Normal,
pt_size: Au::from_px(24),
};
let font = Font::new(
Arc::new(atomic_refcell::AtomicRefCell::new(template)),
descriptor,
None,
)
.unwrap();
let shaping_options = ShapingOptions {
letter_spacing: None,
word_spacing: Au::zero(),
script: Script::Latin,
flags: ShapingFlags::empty(),
};
let text = "WAVE";
assert!(font.can_do_fast_shaping(text, &shaping_options));
let mut expected_glyphs = GlyphStore::new(text.len(), false, false, false);
font.shape_text_harfbuzz(text, &shaping_options, &mut expected_glyphs);
let mut glyphs = GlyphStore::new(text.len(), false, false, false);
font.shape_text_fast(text, &shaping_options, &mut glyphs);
assert_eq!(glyphs.len(), expected_glyphs.len());
assert_eq!(
glyphs.total_advance().to_nearest_px(),
expected_glyphs.total_advance().to_nearest_px()
);
}
}

View File

@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::borrow::ToOwned;
use std::cell::OnceCell;
use std::collections::HashMap;
use std::ops::{Deref, RangeInclusive};
use std::sync::Arc;
@@ -14,23 +15,25 @@ use ipc_channel::ipc::{self, IpcBytesReceiver, IpcBytesSender, IpcReceiver, IpcS
use log::debug;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use servo_config::pref;
use servo_url::ServoUrl;
use style::font_face::{FontFaceRuleData, FontStyle as FontFaceStyle};
use style::values::computed::font::{FixedPoint, FontStyleFixedPoint};
use style::values::computed::font::{
FixedPoint, FontStyleFixedPoint, GenericFontFamily, SingleFontFamily,
};
use style::values::computed::{FontStretch, FontWeight};
use style::values::specified::FontStretch as SpecifiedFontStretch;
use webrender_api::{FontInstanceFlags, FontInstanceKey, FontKey};
use webrender_traits::WebRenderFontApi;
use crate::font::{FontDescriptor, FontFamilyName};
use crate::font::FontDescriptor;
use crate::font_store::FontStore;
use crate::font_template::{
FontTemplate, FontTemplateDescriptor, FontTemplateRef, FontTemplateRefMethods,
};
use crate::platform::font_list::{
for_each_available_family, for_each_variation, system_default_family, LocalFontIdentifier,
SANS_SERIF_FONT_FAMILY,
default_system_generic_font_family, for_each_available_family, for_each_variation,
LocalFontIdentifier,
};
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
@@ -60,7 +63,7 @@ pub struct SerializedFontTemplate {
pub enum Command {
GetFontTemplates(
Option<FontDescriptor>,
FontFamilyName,
SingleFontFamily,
IpcSender<Vec<SerializedFontTemplate>>,
),
GetFontInstance(
@@ -75,43 +78,27 @@ pub enum Command {
Ping,
}
#[derive(Default)]
struct ResolvedGenericFontFamilies {
default: OnceCell<LowercaseFontFamilyName>,
serif: OnceCell<LowercaseFontFamilyName>,
sans_serif: OnceCell<LowercaseFontFamilyName>,
monospace: OnceCell<LowercaseFontFamilyName>,
fantasy: OnceCell<LowercaseFontFamilyName>,
cursive: OnceCell<LowercaseFontFamilyName>,
system_ui: OnceCell<LowercaseFontFamilyName>,
}
/// The font cache thread itself. It maintains a list of reference counted
/// font templates that are currently in use.
struct FontCache {
port: IpcReceiver<Command>,
generic_fonts: HashMap<FontFamilyName, LowercaseString>,
font_data: HashMap<FontIdentifier, Arc<Vec<u8>>>,
local_families: FontStore,
webrender_api: Box<dyn WebRenderFontApi>,
webrender_fonts: HashMap<FontIdentifier, FontKey>,
font_instances: HashMap<(FontKey, Au), FontInstanceKey>,
}
fn populate_generic_fonts() -> HashMap<FontFamilyName, LowercaseString> {
let mut generic_fonts = HashMap::with_capacity(5);
append_map(&mut generic_fonts, "serif", "Times New Roman");
append_map(&mut generic_fonts, "sans-serif", SANS_SERIF_FONT_FAMILY);
append_map(&mut generic_fonts, "cursive", "Apple Chancery");
append_map(&mut generic_fonts, "fantasy", "Papyrus");
append_map(&mut generic_fonts, "monospace", "Menlo");
fn append_map(
generic_fonts: &mut HashMap<FontFamilyName, LowercaseString>,
generic_name: &str,
mapped_name: &str,
) {
let family_name = match system_default_family(generic_name) {
Some(system_default) => LowercaseString::new(&system_default),
None => LowercaseString::new(mapped_name),
};
let generic_name = FontFamilyName::Generic(Atom::from(generic_name));
generic_fonts.insert(generic_name, family_name);
}
generic_fonts
generic_fonts: ResolvedGenericFontFamilies,
}
impl FontCache {
@@ -120,9 +107,9 @@ impl FontCache {
let msg = self.port.recv().unwrap();
match msg {
Command::GetFontTemplates(descriptor_to_match, font_family_name, result) => {
Command::GetFontTemplates(descriptor_to_match, font_family, result) => {
let templates =
self.find_font_templates(descriptor_to_match.as_ref(), &font_family_name);
self.find_font_templates(descriptor_to_match.as_ref(), &font_family);
debug!("Found templates for descriptor {descriptor_to_match:?}: ");
debug!(" {templates:?}");
@@ -192,28 +179,21 @@ impl FontCache {
fn refresh_local_families(&mut self) {
self.local_families.clear();
for_each_available_family(|family_name| {
let family_name = LowercaseString::new(&family_name);
self.local_families.families.entry(family_name).or_default();
self.local_families
.families
.entry(family_name.as_str().into())
.or_default();
});
}
fn transform_family(&self, family_name: &FontFamilyName) -> LowercaseString {
match self.generic_fonts.get(family_name) {
None => LowercaseString::from(family_name),
Some(mapped_family) => (*mapped_family).clone(),
}
}
fn find_font_templates(
&mut self,
descriptor_to_match: Option<&FontDescriptor>,
family_name: &FontFamilyName,
family: &SingleFontFamily,
) -> Vec<FontTemplateRef> {
// TODO(Issue #188): look up localized font family names if canonical name not found
// look up canonical name
// TODO(Issue #192: handle generic font families, like 'serif' and 'sans-serif'.
// if such family exists, try to match style to a font
let family_name = self.transform_family(family_name);
let family_name = self.family_name_for_single_font_family(family);
self.local_families
.families
.get_mut(&family_name)
@@ -267,13 +247,53 @@ impl FontCache {
webrender_font_api.add_font_instance(font_key, pt_size.to_f32_px(), flags)
})
}
pub(crate) fn family_name_for_single_font_family(
&mut self,
family: &SingleFontFamily,
) -> LowercaseFontFamilyName {
let generic = match family {
SingleFontFamily::FamilyName(family_name) => return family_name.name.clone().into(),
SingleFontFamily::Generic(generic) => generic,
};
let resolved_font = match generic {
GenericFontFamily::None => &self.generic_fonts.default,
GenericFontFamily::Serif => &self.generic_fonts.serif,
GenericFontFamily::SansSerif => &self.generic_fonts.sans_serif,
GenericFontFamily::Monospace => &self.generic_fonts.monospace,
GenericFontFamily::Cursive => &self.generic_fonts.cursive,
GenericFontFamily::Fantasy => &self.generic_fonts.fantasy,
GenericFontFamily::SystemUi => &self.generic_fonts.system_ui,
};
resolved_font
.get_or_init(|| {
// First check whether the font is set in the preferences.
let family_name = match generic {
GenericFontFamily::None => pref!(fonts.default),
GenericFontFamily::Serif => pref!(fonts.serif),
GenericFontFamily::SansSerif => pref!(fonts.sans_serif),
GenericFontFamily::Monospace => pref!(fonts.monospace),
_ => String::new(),
};
if !family_name.is_empty() {
return family_name.into();
}
// Otherwise ask the platform for the default family for the generic font.
default_system_generic_font_family(*generic)
})
.clone()
}
}
pub trait FontSource: Clone {
fn find_matching_font_templates(
&self,
descriptor_to_match: Option<&FontDescriptor>,
font_family_name: &FontFamilyName,
font_family_name: &SingleFontFamily,
) -> Vec<FontTemplateRef>;
fn get_system_font_instance(
&self,
@@ -313,7 +333,7 @@ pub enum ComputedFontStyleDescriptor {
/// on the contents of the font itself.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CSSFontFaceDescriptors {
pub family_name: LowercaseString,
pub family_name: LowercaseFontFamilyName,
pub weight: Option<(FontWeight, FontWeight)>,
pub stretch: Option<(FontStretch, FontStretch)>,
pub style: Option<ComputedFontStyleDescriptor>,
@@ -323,7 +343,7 @@ pub struct CSSFontFaceDescriptors {
impl CSSFontFaceDescriptors {
pub fn new(family_name: &str) -> Self {
CSSFontFaceDescriptors {
family_name: LowercaseString::new(family_name),
family_name: family_name.into(),
..Default::default()
}
}
@@ -373,7 +393,7 @@ impl From<&FontFaceRuleData> for CSSFontFaceDescriptors {
.map(|ranges| ranges.iter().map(|range| range.start..=range.end).collect());
CSSFontFaceDescriptors {
family_name: LowercaseString::new(&family_name),
family_name: family_name.into(),
weight,
stretch,
style,
@@ -389,18 +409,15 @@ impl FontCacheThread {
thread::Builder::new()
.name("FontCache".to_owned())
.spawn(move || {
// TODO: Allow users to specify these.
let generic_fonts = populate_generic_fonts();
#[allow(clippy::default_constructed_unit_structs)]
let mut cache = FontCache {
port,
generic_fonts,
font_data: HashMap::new(),
local_families: Default::default(),
webrender_api,
webrender_fonts: HashMap::new(),
font_instances: HashMap::new(),
generic_fonts: Default::default(),
};
cache.refresh_local_families();
@@ -454,13 +471,13 @@ impl FontSource for FontCacheThread {
fn find_matching_font_templates(
&self,
descriptor_to_match: Option<&FontDescriptor>,
font_family_name: &FontFamilyName,
font_family: &SingleFontFamily,
) -> Vec<FontTemplateRef> {
let (response_chan, response_port) = ipc::channel().expect("failed to create IPC channel");
self.chan
.send(Command::GetFontTemplates(
descriptor_to_match.cloned(),
font_family_name.clone(),
font_family.clone(),
response_chan,
))
.expect("failed to send message to font cache thread");
@@ -521,25 +538,19 @@ impl FontSource for FontCacheThread {
}
#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct LowercaseString {
pub struct LowercaseFontFamilyName {
inner: String,
}
impl LowercaseString {
pub fn new(s: &str) -> LowercaseString {
LowercaseString {
inner: s.to_lowercase(),
impl<T: AsRef<str>> From<T> for LowercaseFontFamilyName {
fn from(value: T) -> Self {
LowercaseFontFamilyName {
inner: value.as_ref().to_lowercase(),
}
}
}
impl<'a> From<&'a FontFamilyName> for LowercaseString {
fn from(family_name: &'a FontFamilyName) -> LowercaseString {
LowercaseString::new(family_name.name())
}
}
impl Deref for LowercaseString {
impl Deref for LowercaseFontFamilyName {
type Target = str;
#[inline]
@@ -548,7 +559,7 @@ impl Deref for LowercaseString {
}
}
impl fmt::Display for LowercaseString {
impl fmt::Display for LowercaseFontFamilyName {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.inner.fmt(f)
}

View File

@@ -24,19 +24,19 @@ use style::font_face::{FontFaceSourceFormat, FontFaceSourceFormatKeyword, Source
use style::media_queries::Device;
use style::properties::style_structs::Font as FontStyleStruct;
use style::shared_lock::SharedRwLockReadGuard;
use style::stylesheets::{DocumentStyleSheet, StylesheetInDocument};
use style::stylesheets::{CssRule, DocumentStyleSheet, FontFaceRule, StylesheetInDocument};
use style::values::computed::font::{FamilyName, FontFamilyNameSyntax, SingleFontFamily};
use style::Atom;
use url::Url;
use webrender_api::{FontInstanceKey, FontKey};
use crate::font::{
Font, FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontGroup, FontRef, FontSearchScope,
};
use crate::font_cache_thread::{
CSSFontFaceDescriptors, FontIdentifier, FontSource, LowercaseString,
Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontRef, FontSearchScope,
};
use crate::font_cache_thread::{CSSFontFaceDescriptors, FontIdentifier, FontSource};
use crate::font_store::{CrossThreadFontStore, CrossThreadWebRenderFontStore};
use crate::font_template::{FontTemplate, FontTemplateRef, FontTemplateRefMethods};
use crate::LowercaseFontFamilyName;
static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h)
@@ -170,28 +170,39 @@ impl<S: FontSource> FontContext<S> {
font
}
fn matching_web_font_templates(
&self,
descriptor_to_match: &FontDescriptor,
family_descriptor: &FontFamilyDescriptor,
) -> Option<Vec<FontTemplateRef>> {
if family_descriptor.scope != FontSearchScope::Any {
return None;
}
// Do not look for generic fonts in our list of web fonts.
let SingleFontFamily::FamilyName(ref family_name) = family_descriptor.family else {
return None;
};
self.web_fonts
.read()
.families
.get(&family_name.name.clone().into())
.map(|templates| templates.find_for_descriptor(Some(descriptor_to_match)))
}
/// Try to find matching templates in this [`FontContext`], first looking in the list of web fonts and
/// falling back to asking the [`super::FontCacheThread`] for a matching system font.
pub fn matching_templates(
&self,
descriptor_to_match: &FontDescriptor,
family_descriptor: &FontFamilyDescriptor,
) -> Vec<FontTemplateRef> {
// First try to find an appropriate web font that matches this descriptor.
if family_descriptor.scope == FontSearchScope::Any {
let family_name = LowercaseString::from(&family_descriptor.name);
if let Some(templates) = self
.web_fonts
.read()
.families
.get(&family_name)
.map(|templates| templates.find_for_descriptor(Some(descriptor_to_match)))
{
return templates;
}
}
// If not request a matching font from the system font cache.
self.cache
.matching_templates(descriptor_to_match, family_descriptor)
self.matching_web_font_templates(descriptor_to_match, family_descriptor)
.unwrap_or_else(|| {
self.cache
.matching_templates(descriptor_to_match, family_descriptor)
})
}
/// Create a `Font` for use in layout calculations, from a `FontTemplateData` returned by the
@@ -275,10 +286,14 @@ impl<S: FontSource + Send + 'static> FontContextWebFontMethods for Arc<FontConte
};
let mut number_loading = 0;
stylesheet.effective_font_face_rules(device, guard, |rule| {
let font_face = match rule.font_face() {
Some(font_face) => font_face,
None => return,
for rule in stylesheet.effective_rules(device, guard) {
let CssRule::FontFace(ref lock) = *rule else {
continue;
};
let rule: &FontFaceRule = lock.read_with(guard);
let Some(font_face) = rule.font_face() else {
continue;
};
let sources: Vec<Source> = font_face
@@ -290,7 +305,7 @@ impl<S: FontSource + Send + 'static> FontContextWebFontMethods for Arc<FontConte
.cloned()
.collect();
if sources.is_empty() {
return;
continue;
}
// Fetch all local fonts first, beacause if we try to fetch them later on during the process of
@@ -306,10 +321,13 @@ impl<S: FontSource + Send + 'static> FontContextWebFontMethods for Arc<FontConte
local_fonts
.entry(family_name.name.clone())
.or_insert_with(|| {
let family_name = FontFamilyName::Specific(family_name.name.clone());
let family = SingleFontFamily::FamilyName(FamilyName {
name: family_name.name.clone(),
syntax: FontFamilyNameSyntax::Quoted,
});
self.font_source
.lock()
.find_matching_font_templates(None, &family_name)
.find_matching_font_templates(None, &family)
.first()
.cloned()
});
@@ -334,7 +352,7 @@ impl<S: FontSource + Send + 'static> FontContextWebFontMethods for Arc<FontConte
if let Some(ref synchronous_receiver) = synchronous_receiver {
synchronous_receiver.recv().unwrap();
}
});
}
number_loading
}
@@ -449,7 +467,7 @@ impl<S: FontSource + Send + 'static> FontContextWebFontMethods for Arc<FontConte
struct RemoteWebFontDownloader<FCT: FontSource> {
font_context: Arc<FontContext<FCT>>,
url: ServoArc<Url>,
web_font_family_name: LowercaseString,
web_font_family_name: LowercaseFontFamilyName,
response_valid: Mutex<bool>,
response_data: Mutex<Vec<u8>>,
}
@@ -464,7 +482,7 @@ impl<FCT: FontSource + Send + 'static> RemoteWebFontDownloader<FCT> {
fn download(
url_source: UrlSource,
font_context: Arc<FontContext<FCT>>,
web_font_family_name: LowercaseString,
web_font_family_name: LowercaseFontFamilyName,
state: WebFontDownloadState,
) {
// https://drafts.csswg.org/css-fonts/#font-fetching-requirements
@@ -648,7 +666,7 @@ impl<FCT: FontSource> CachingFontSource<FCT> {
let templates = self
.font_cache_thread
.lock()
.find_matching_font_templates(Some(descriptor_to_match), &family_descriptor.name);
.find_matching_font_templates(Some(descriptor_to_match), &family_descriptor.family);
self.templates.write().insert(cache_key, templates.clone());
templates
@@ -663,7 +681,11 @@ impl<FCT: FontSource> CachingFontSource<FCT> {
if let Some(font_group) = self.resolved_font_groups.read().get(&cache_key) {
return font_group.clone();
}
let font_group = Arc::new(RwLock::new(FontGroup::new(&cache_key.style)));
let mut descriptor = FontDescriptor::from(&*cache_key.style);
descriptor.pt_size = size;
let font_group = Arc::new(RwLock::new(FontGroup::new(&cache_key.style, descriptor)));
self.resolved_font_groups
.write()
.insert(cache_key, font_group.clone());

Some files were not shown because too many files have changed in this diff Show More