Two months in Servo: better inline layout, stable Rust, and more!

2024-01-26 Improved control over typography, very early support for sticky positioning and tables, plus updates to our minibrowser and build tooling.

Servo nightly showing support for ‘text-align-last’, ‘text-align: justify’, ‘vertical-align: baseline’, and ‘position: sticky’

Servo has had some exciting changes land in our nightly builds over the last month:

  • as of 2023-12-27, the ‘text-align-last’ property is now supported (@mrobinson, #30905)
  • as of 2023-12-27, ‘text-align: justify’ is now supported (@mrobinson, #30807, #30866)
  • as of 2024-01-09, ‘line-height’ and ‘vertical-align’ are now moderately supported (@mrobinson, #30902)
  • as of 2024-01-24, ‘Event#composedPath()’ is now supported (@gterzian, #31123)
Servo nightly showing rudimentary support for table layouts when the pref is enabled

We’ve started working on support for sticky positioning and tables in the new layout engine, with some very early sticky positioning code landing in 2023-11-30 (@mrobinson, #30686), the CSS tables tests now enabled (@mrobinson, #31131), and rudimentary table layout landing in 2024-01-20 under the layout.tables.enabled pref (@mrobinson, @Loirooriol, @Manishearth, #30799, #30868, #31121).

Geometry in our new layout engine is now being migrated from floating-point coordinates (f32) to fixed-point coordinates (i32 × 1/60) (@atbrakhi, #30825, #30894, #31135), similar to other engines like WebKit and Blink. While floating-point geometry was thought to be better for transformation-heavy content like SVG, the fact that larger values are less precise than smaller values causes a variety of rendering problems and test failures (#29819).

As a result of these changes, we’ve made big strides in our WPT pass rates:

  • CSS2 floats (+3.3pp to 84.9%) and floats-clear (+5.6pp to 78.9%) continue to surge
  • we now surpass legacy layout in the CSS2 linebox tests (61.1% → 87.9%, legacy 86.4%)
  • we now surpass legacy layout in the css-flexbox tests (49.5% → 52.7%, legacy 52.2%)
  • we’ve closed 76% of the gap in key CSS2 tests (79.2% → 82.2%, legacy 83.1%)

Updates, servoshell, and stability

GStreamer has been updated from 0.15 to 0.21 (@mrobinson, #30750), fixing long-standing breakage of video playback. WebGPU has been updated from 0.17 to 0.18 (@sagudev, #30926, #30954), and ANGLE has been updated from April 2019 to August 2023 (@sagudev, #30546).

Servo nightly showing Back and Forward buttons in the minibrowser

Servo’s example browser now has Back and Forward buttons (@atbrakhi, #30805), and no longer shows the incorrect location when navigation takes a long time (@atbrakhi, #30518).

Many stability improvements have landed, including fixes for a crash in inline layout (@atbrakhi, #30897), three WebGPU-related crashes (@lucasMontenegro, @gterzian, @Taym95, #30888, #30989, #31002), a crash in the PerformanceResourceTiming API (@delan, #31063), and several crashes due to script runtimes being dropped in the wrong order (@gterzian, #30896).

CI, code health, and dev changes

The intermittent macOS build failures on CI should now be fixed (@mrobinson, #30975).

Servo now has some preliminary Android build support (@mukilan, #31086), though more work needs to be done before Servo will run on Android.

The long-term effort to simplify how Servo is built continues (@mrobinson, #31075), and we’ve replaced the time crate with chrono and std::time in much of Servo (@Taym95, @augustebaum, #30927, #31020, #30639, #31079). We have also started migrating our DOM bindings to use typed arrays where possible (@gterzian, #30990, #31077, #31087, #31076, #31106), as part of an effort to reduce our unsafe code surface (#30889, #30862).

Several crates have been moved into our main repo:

We’ve also made some dev changes:

Linux build issues

Several people have reported problems building Servo on newer Linux distro versions, particularly with clang 15 or with clang 16. While we’re still working on fixing the underlying issues, there are some workarounds. If your distro lets you install older versions of clang with a package like clang-14, you can tell Servo to use it with:

export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14

Alternatively you can try our new Nix-based dev environment, which should now work on any Linux distro (@delan, #31001). Nix is a package manager with some unusual benefits. Servo can use Nix to find the correct versions of all of its compilers and build dependencies without needing you to install them or run mach bootstrap. All you need to do is install Nix, and export MACH_USE_NIX= to your environment. See the wiki for more details!