Two months in Servo: better inline layout, stable Rust, and more
Two months in Servo: better inline layout, stable Rust, and more! - Servo, the embeddable, independent, memory-safe, modular, parallel web rendering engine

            

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


  
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)


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’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:

hyper_serde (servo/hyper_serde) was moved to components/hyper_serde (@mrobinson, #30803)
device (servo/devices) was merged into components/bluetooth (@mrobinson, #30974)
blurmac (servo/devices) was moved to third_party/blurmac (@mrobinson, #30974)

We’ve also made some dev changes:

the default branch in our main repo is now main (@mrobinson, @atouchet, 23add0c1e5c9c, #30877)
we now target Rust 1.74 stable, marking the first time ever we have built without unstable features (@mrobinson, #30831)
we now require Python 3.10 (@mrobinson, #31088), and you no longer need to install virtualenv (@frewsxcv, #30377)
we’ve fixed problems building Servo on Ubuntu 20.04 (@mrobinson, #31019) and NixOS (@delan, #31052, #31055, #30987)
we now support Visual Studio 2022 on Windows (@mrobinson, #31148), the same version that rustup installs by default

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!






          