This month in Servo: :is(), :where(), grid layout, parallel flexbox, and more!
2024-12-09 Plus shadow DOM buffs, smaller binaries, and new SubtleCrypto algorithms (HMAC, AES-GCM, AES-KW, PBKDF2).
Servo now supports :is() and :where() selectors (@mrobinson, #34066), parallel layout for flexbox (@mrobinson, #34132), and experimentally, CSS grid layout (@nicoburns, @taniishkaa, #32619, #34352, #34421)!
To try our new grid layout support, run Servo with --pref layout.grid.enabled
.
We’ve added support for two key Shadow DOM interfaces, the shadowRoot property on Element (@simonwuelker, #34306) and the innerHTML property on ShadowRoot (@simonwuelker, #34335).
We’ve also landed ‘justify-self’ on positioned elements (@chickenleaf, #34235), form submission with <input type=image> (@shanehandley, #34203), DataTransfer (@Gae24, #34205), the close() method on ImageBitmap (@simonwuelker, #34124), plus several new SubtleCrypto API features:
- crypto.subtle.deriveKey() (@simonwuelker, #34185)
- wrapKey() and unwrapKey() (@msub2, #34262)
- “HMAC” algorithm in generateKey() (@simonwuelker, #34278), sign(), verify() (@simonwuelker, #34223), and deriveKey(
"get key length"
) (@simonwuelker, #34230) - “AES-GCM” algorithm in encrypt(), decrypt(), generateKey(), and importKey() (@simonwuelker, #34269)
- “AES-KW” algorithm in generateKey(), importKey(), wrapKey(), and unwrapKey() (@msub2, #34262)
- “PBKDF2” (@simonwuelker, #34164) and “HKDF” (@simonwuelker, #34200) algorithms in deriveBits()
On OpenHarmony, we’ve landed keyboard input and the IME (@jschwe, @jdm, @mukilan, #34188), touch fling gestures (@jschwe, @mrobinson, #33219), and additional CJK fallback fonts (@jschwe, #34410). You can now build for OpenHarmony on a Windows machine (@jschwe, #34113), and build errors have been improved (@jschwe, #34267).
More engine changes
You can now scroll the viewport and scrollable elements with your pointer anywhere in the area, not just when hovering over actual content (@mrobinson, @mukilan, #34347).
--unminify-js
, a very useful feature for diagnosing Servo bugs in real websites, now supports module scripts (@jdm, #34206).
We’ve fixed the behaviour of offsetLeft and offsetTop relative to <body> with ‘position: static’ (@nicoburns, @Loirooriol, #32761), which also required spec changes (@nicoburns, @Loirooriol, w3c/csswg-drafts#10549). We’ve also fixed several layout bugs around:
- ‘object-fit’ when ‘aspect-ratio’ is set (@Loirooriol, #34413)
- clientWidth and friends on floats and replaced inlines (@Loirooriol, #34083)
- ‘align-items’ and ‘align-self: stretch’ (@mrobinson, @Loirooriol, #34162)
- main axis free space in flexbox (@mrobinson, #34150)
- min- and max-content block sizes of replaced elements (@Loirooriol, #34284)
- sizing of non-replaced positioned elements with ‘place-self’ (@taniishkaa, #34264)
The getClientRects() method on Element now correctly returns a DOMRectList (@chickenleaf, #34025).
Stylo has been updated to 2024-11-01 (@Loirooriol, #34322), and we’ve landed some changes to prepare our fork of Stylo for publishing releases on crates.io (@mrobinson, @nicoburns, #34332, #34353).
We’ve also made more progress towards splitting up our massive script
crate (@jdm, @sagudev, #34357, #34356, #34163), which will eventually allow Servo to be built (and rebuilt) much faster.
Performance improvements
In addition to parallel layout for flexbox (@mrobinson, #34132), we’ve landed several other performance improvements:
- faster layout for ‘column’ flex containers (@Loirooriol, @mrobinson, #34346)
- faster caching of intrinsic sizes (@Loirooriol, #34384)
- caching of font template matches (@mukilan, @mrobinson, #34325)
- fixed warnings and memory leak when WebRender is running late (@mrobinson, @mukilan, #34305)
We’ve also landed some changes to reduce Servo’s binary size:
- legacy layout is no longer built by default (@jschwe, #34290)
- Servo no longer depends on
sparkle
, onlyglow
andgleam
(@sagudev, #33918, #34292) - Servo can now be built without WebXR support (@wusyong, @augustkline, @jdm, @sagudev, #34241, #34348)
- servoshell can now be built without WebXR on OpenHarmony and Android (@jschwe, #34242), with more platforms to come
- plus some progress towards a build-time feature flag for WebGPU (@atbrakhi, #34415)
Servo’s tracing-based profiling support (--features tracing-perfetto
or tracing-hitrace
) now supports filtering events via an environment variable (@delan, #34236, #34256), and no longer includes events from non-Servo crates by default (@delan, #34209).
Note that when the filter matches some span or event, it will also match all of its descendants for now, but this is a limitation we intend to fix.
Most of the events supported by the old interval profiler have been ported to tracing (@delan, #34238, #34337). ScriptParseHTML and ScriptParseXML events no longer count the time spent doing layout and script while parsing, reducing them to more realistic times (@delan, #34273), while ScriptEvaluate events now count the time spent running scripts in timers, DOM event listeners, and many other situations (@delan, #34286), increasing them to more realistic times.
We’ve added new tracing events for display list building (@atbrakhi, #34392), flex layout, inline layout, and font loading (@delan, #34392). This will help us diagnose performance issues around things like caching and relayout for ‘stretch’ in flex layout, shaping text runs, and font template creation.
For developers
Hacking on Servo is now easier, with our new --profile medium
build mode in Cargo (@jschwe, #34035).
medium
is more optimised than debug
, but unlike release
, it supports debuggers, line numbers in backtraces, and incremental builds.
Servo now uses CODEOWNERS to list reviewers that are experts in parts of our main repo. This should make it much easier to find reviewers that know how to review your code, and helps us maximise the quality of our code reviews by allowing reviewers to specialise.
Donations
Thanks again for your generous support! We are now receiving 4291 USD/month (+2.1% over October) in recurring donations. We are no longer accepting donations on LFX — if you were donating there, please move your recurring donations to GitHub or Open Collective.
Servo is also on thanks.dev, and already fifteen GitHub users that depend on Servo are sponsoring us there. If you use Servo libraries like url, html5ever, selectors, or cssparser, signing up for thanks.dev could be a good way for you (or your employer) to give back to the community.
With this money, we’ve been able to cover our web hosting and self-hosted CI runners for Windows and Linux builds. When the time comes, we’ll also be able to afford macOS runners and perf bots, as well as additional Outreachy interns next year! As always, use of these funds will be decided transparently in the Technical Steering Committee. For more details, head to our Sponsorship page.
Conferences and blogs
- Servo Revival: 2023-2024 — Manuel Rego wrote about Igalia’s role in getting Servo back to life, and now thriving, over the past two years
- Porting Servo to OpenHarmony — Jonathan Schwender spoke at GOSIM China 2024 about the work we’ve done towards supporting OpenHarmony in Servo
- Taming concurrency with (in)-formal methods in Servo — Gregory Terzian spoke at GOSIM China 2024 about using TLA+ to help us correctly implement concurrent algorithms like the HTML event loop in Servo