This month in Servo: tables, WOFF2, Outreachy, and more!

2024-03-30 Beginning of the end of legacy layout, runtime filtering of event logs, plus console, canvas, WebGPU, DOM, and CSS improvements.

Servo nightly showing a table with ‘box-shadow’ and WOFF2 web fonts, containing demos of several other new features
Servo now supports tables, box and text shadows, setting fonts on 2D canvases, synthetic small caps, conic and repeating conic gradients, and WOFF2 web fonts.

This month, after surpassing our legacy layout engine in the CSS test suites, we’re proud to share that Servo has surpassed legacy in the whole suite of Web Platform Tests as well!

Servo now supports WOFF2 web fonts (@mrobinson, #31879), ‘box-shadow’ (@mrobinson, #31453), ‘text-shadow’ (@mrobinson, #31734), ‘conic-gradient()’ and ‘repeating-conic-gradient()’ (@mrobinson, #31597), and synthetic small caps (@mrobinson, #31435). ‘text-decoration: line-through’ is also supported on macOS now (@mrobinson, #31756).

In other layout news, tables are now enabled by default (@Loirooriol, #31470), you can now transform <iframe> and <img> (and other inline replaced elements) without wrapping them in a container (@mrobinson, #31833), we now have full support for <div align> and <center> (@Loirooriol, #31423), and ‘text-align: justify’ now takes ‘text-indent’ into account (@mrobinson, #31777).

You can now set the font on 2D canvases (@syvb, #31436), and use several other APIs:

Our dependency upgrades have also surged forward:

Servo now stops loading videos and other media after encountering decode errors (@frereit, #31748), and our docs and dev tooling have been updated to ensure support for WebM and AV1 (@delan, #31687).

Servo no longer crashes when <video poster> fails to load (@sebsebmc, #31447), when interacting with CSS layers in the CSSOM (@Loirooriol, #31481).

We’ve also landed improvements to style invalidation (@mrobinson, #31857), inline layout (@mrobinson, @atbrakhi, @Loirooriol, #31519, #31636, #31641, #31681, #31660, #31896), and table layout (@Loirooriol, @mrobinson, #31430, #31421, #31455, #31487, #31480, #31484, #31506, #31535, #31536, #31578, #31596, #31586, #31613, #31606, #31661, #31619, #31650, #31704, #31803, #31862, #31705, #31831).

As a result of the work done on Servo this month, we’ve made some big strides in our pass rates for CSS tables (+30.4pp to 62.9%), CSS2 margin-padding-clear (+13.2pp to 93.6%), and CSS2 box-display (+10.0pp to 84.4%).

servoshell and debug logging

servoshell has had a good amount of love this month, with a new loading spinner (@frereit, #31713) and a rendering glitch under the location bar now fixed (@delan, #31774). Logging in servoshell is no longer mixed with libservo (@delan, #31439), with the RUST_LOG prefix now being servoshell:: instead of servo::.

Speaking of RUST_LOG, you can now filter event logging in servoshell and the constellation at runtime (@delan, #31657, #31659), with the new RUST_LOG prefixes servoshell<winit@, servoshell<servo@, servoshell>servo@, constellation<compositor@, constellation<script@, and constellation<layout@. For example:

  • to trace all events in the constellation from layout, plus all events from the compositor other than ReadyToPresent:
    RUST_LOG=‘constellation<layout@,constellation<compositor@,constellation<compositor@ReadyToPresent=off’
  • to trace only winit window moved events in servoshell, plus all ordinary servoshell logs at trace level:
    RUST_LOG=‘servoshell,servoshell<=off,servoshell>=off,servoshell<winit@WindowEvent(Moved)’

To learn more about the RUST_LOG syntax, see the env_logger docs, and for the full list of event log targets, see ports/servoshell/tracing.rs and components/constellation/tracing.rs.

To keep things from getting too noisy, @delan likes to use the event logging config below:

RUST_LOG=‘warn,servoshell<,servoshell>,constellation<,servoshell<winit@DeviceEvent=off,servoshell<winit@MainEventsCleared=off,servoshell<winit@NewEvents(Poll)=off,servoshell<winit@NewEvents(WaitCancelled)=off,servoshell<winit@RedrawEventsCleared=off,servoshell<winit@RedrawRequested=off,servoshell<winit@UserEvent=off,servoshell<winit@WindowEvent(CursorMoved)=off,servoshell<winit@WindowEvent(AxisMotion)=off,servoshell<servo@EventDelivered=off,servoshell<servo@ReadyToPresent=off,servoshell>servo@Idle=off,servoshell>servo@MouseWindowMoveEventClass=off,constellation<compositor@LogEntry=off,constellation<compositor@ForwardEvent(MouseMoveEvent)=off,constellation<compositor@ReadyToPresent=off,constellation<compositor@TickAnimation=off,constellation<script@LogEntry=off,servoshell<winit@WindowEvent(Moved)=off’

Comparison of event tracing without (left) and with (right) runtime filtering.

Embedding and dev changes

We’ve now defined a simple policy for reporting security vulnerabilities (@mrego, #31622), though this is subject to change once Servo is no longer purely experimental.

Servo had a pervasive but confusing concept of webviews or pipelines being “visible”, which actually controls whether script runs timers at a heavily limited rate and the compositor pauses animations. We’ve replaced this with the more concrete (but inverted) concept of a webview being “throttled” (@delan, #31816), including in our embedding API, where WebViewVisibilityChanged has been replaced with SetWebViewThrottled (@delan, #31815).

We’ve fixed broken rendering when running Servo in Android emulators (@mukilan, #31727), fixed linking problems with fontsan on Linux (@jschwe, #31810, #31821, fontsan#33, fontsan#34, fontsan#35), and fixed a mozjs build issue (@sagudev, #31889, mozjs#460).

mach fmt now uses stable Rust (@mrobinson, #31441) and should now be much faster on macOS (@mrobinson, #31440). mach doc is now working again, and the spurious “crown” warnings have been fixed (@mrobinson, #31804).

As for try jobs on CI, builds now immediately fail when Cargo.lock is out of date (@Loirooriol, #31720), the test result comments no longer ping random users (@sagudev, #31691), and build artifacts now include the more compact “wptreport” logs (@sagudev, #31616).

We’ve also landed changes to reduce test flakiness in requestAnimationFrame() (@mrobinson, #31561), as well as when the compositor waits for frames (@mrobinson, #31523), when the compositor is shutting down (@mrobinson, #31733), and when loading fonts on macOS (@mrobinson, #31658).

Last but not least, NixOS users can rejoice, as nix-shell will no longer break when Cargo.lock changes (@mukilan, #31825).

Outreachy

Servo is also participating in Outreachy this year! Outreachy is a three-month paid (7000 USD) remote internship program that runs twice a year, with a special focus on open source software. To select interns for Outreachy, there was a contribution period that is now coming to a close, during which contributors have landed a wide range of improvements.

The biggest area of improvement was in code health (@eerii, @MunishMummadi, @sandeepB3, #31521, #31537, #31608, #31685, #31670, #31822), where we have now fixed almost all of our rustdoc (@Aaryakhandelwal, @sandeepB3, @maureenblack, @mnaibei, @oluwatobiss, @azharcodeit, @jahielkomu, @Rhea-Eve, @ektuu, #31582, #31587, #31592, #31617, #31625, #31632, #31640, #31643, #31647, #31654, #31712, #31644, #31708, #31755, #31745, #31738) and clippy errors (@mnaibei, @sandeepB3, @eerii, @zawwz, @richarddushime, @RustAndMetal, @six-shot, @oluwatobiss, @jahielkomu, @Aaryakhandelwal, @ektuu, @azharcodeit, #31508, #31512, #31549, #31566, #31567, #31560, #31562, #31563, #31551, #31568, #31565, #31564, #31548, #31612, #31610, #31611, #31627, #31623, #31628, #31626, #31700, #31710, #31719, #31735, #31758, #31717, #31759, #31769, #31770, #31776, #31778, #31793, #31801, #31800, #31799, #31791, #31811, #31813, #31819, #31784, #31823, #31837, #31818, #31842, #31827, #31849, #31850, #31843, #31852, #31864, #31863, #31853, #31865, #31834, #31876, #31877, #31888, #31878, #31890, #31867, #31893, #31898, #31900, #31891, #31906, #31908, #31907).

One contributor went further, cleaning up the codegen for our DOM bindings (@eerii, #31721, #31711, #31844), improving our dev tooling (@eerii, #31694), and improving our image decoding by replacing per-image threads with a thread pool (@eerii, #31517, #31585)!

Two contributors worked together to pave the way for language-specific behaviour in ‘text-transform’ (@MunishMummadi, @Rhea-Eve, stylo#24, #31737), and other contributors also landed improvements to our docs (@six-shot, @jahielkomu, #31583, #31718), CJK font fallback (@richarddushime, @sandeepB3, #31668, #31670), and the Web Platform Tests (@azharcodeit, @richarddushime, #31534, #31802).

If you are interested in an Outreachy internship, applications for the next round open in August 2024, so be sure to put that in your calendar!

Conferences and events

Rakhi Sharma will be in Seattle on 16 April 2024, speaking about Servo’s achievements at Open Source Summit North America at 14:15 local time (21:15 UTC), then meeting up at the Seattle Rust User Group at 18:00 local time (01:00 UTC). See you there!