This month in Servo: better floats, color-mix(), try job labels, and more!

2023-11-30 Sneak peek into our embedding effort, changes to pull requests, plus nightly updates to browser UI, floats, inline layout, CSS, and tooling.

November has been another exciting month for Servo!

Our nightly example browser, servoshell, is now easier to navigate, accepting URLs without http:// or https:// both in the location bar and on the command line (@atbrakhi, #30148), and should no longer lock up when run with --no-minibrowser (@wusyong, #30598). Local paths can also be given on the command line, and are still preferred when the path points to a file that exists.

Work is now underway to improve our embedding story and prepare Servo for integration with Tauri, starting with precompiled ANGLE for faster initial builds (@atbrakhi), better support for offscreen rendering (@delan, #30767), and support for multiple webviews (@delan, #30648). These changes haven’t landed yet, but once they do, apps will be able to open, move, resize, and interleave Servo with other widgets.

servoshell with a multiple-document interface, showing three overlapping egui windows of different sizes inside a native window

A very early prototype of a Servo-based multiple-document interface (@delan, #30785), taking advantage of upcoming embedding improvements to interleave Servo with egui windows.

Floats and inline layout

We’ve made several improvements to Servo’s inline layout system, which handles the flow and wrapping of text, images, and inline blocks, delivering welcome bumps to our WPT pass rates (@mrobinson, @Loirooriol, @mukilan):

  • 61.4% in the CSS2 linebox test suite (+2.8pp), with better handling of line heights and forced line breaks (#30519)
  • 78.9% in floats (+1.0pp) and 73.3% in floats-clear (+0.5pp), by allowing trailing whitespace to overlap with floats (#30586)
  • 78.1% in normal-flow (+1.1pp), by fixing inlines split by boxes and paving the way for fragments that span boxes (#30608)
  • 82.2% in floats (a further +3.3pp), by fixing the fragmentation of unbreakable fragments that span multiple boxes (#30628)

CSS updates

Several components and dependencies have been upgraded, the biggest being Stylo, our Rust-based CSS engine that is now part of Firefox. We’ve caught up with upstream Stylo by 311 commits, bringing our CSS support from August 2022 to June 2023 (@Loirooriol, @mrobinson, #30646, #30681, #30692, #30748, #30770), and bumped cssparser to 0.31.2 (@Loirooriol, #30771).

As a result, Servo now passes 60.5% of the CSSOM test suite (+3.3pp). We also no longer incorrectly transition properties that are inherently “discrete” (@Loirooriol, #30565), passing a further (net) 294 test cases.

Thanks to the recent work on Stylo by Mozilla and others, Servo now supports color-mix() and the new color spaces from CSS Color 4 (@Loirooriol, #30752)! These new color features allow authors to:

  • select colors from wider gamuts than in sRGB (display-p3, a98-rgb, prophoto-rgb, rec2020)
  • mix colors as if mixing intensities of colored light in real life (srgb-linear, xyz)
  • select a variety of colors with consistent perceived lightness (oklab, lab)
  • select colors with consistent perceived lightness and hue (oklch, lch)

The results of mixing lime and blue in a variety of CSS color spaces, based on a demo from this post. The background color is the same as this blog post mixed with 10% white, or color-mix(in oklch, #121619, white 10%).

Dependency upgrades

Our upgrade efforts also affect the tooling Servo uses. Servo now builds on Ubuntu 22.04 (@mukilan, #30162) and macOS 13 on CI, which in turn has made upgrading LLVM and Python (for mach) more urgent. As a result, we’ve started upgrading Python from 3.10 to 3.12 (@mrobinson, @mukilan, @sagudev, #30638, #30645, #30659, #30685).

But the biggest impact on our ability to keep our dependencies up to date comes from our Rust version. Many pre-version-1 libraries, even in our transitive dependencies, bump their MSRV quite aggressively, sometimes even requiring a nightly compiler. First, we migrated from Rust nightly-2023-02-01 to nightly-03-18 (@mrobinson, #30630), which in turn allowed us to upgrade our network stack (@mrobinson, #30612, #30660). Since then, we’ve started eliminating our usage of unstable Rust features (@mrobinson, #30745, #30742), which should make future Rust upgrades easier.

Pull requests

GitHub pull request label menu, with the new try job labels (T-full, T-linux-wpt-2013, T-linux-wpt-2020, T-macos, T-windows)

You can now run try jobs by adding labels to your pull requests (@mrobinson, #30383, #30647, #30650, #30756). You can even add multiple labels! The old method, where you mention @bors-servo in a comment, has been removed (@mrobinson, #30712), making your pull requests less likely to get spammed with job failures when you post comments on them. For more details, see CONTRIBUTING.md.

Stability

We’ve fixed a panic when no font is found for a run of text, printing a warning instead (@mrobinson, #30581), as well as a panic when creating stacking contexts with zero scale (@mrobinson, #30713). In general, Servo should never panic outside of debug assertions.

We’ve also fixed a bug where paint worklets may access thread-local storage after a script thread gets destroyed (@mrobinson, #30671), which caused intermittent panics in 74 tests.