]> git.lizzy.rs Git - rust.git/commit
rustdoc: use CSS containment to speed up render
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>
Tue, 27 Sep 2022 16:21:24 +0000 (09:21 -0700)
committerJacob Hoffman-Andrews <github@hoffman-andrews.com>
Tue, 27 Sep 2022 16:21:24 +0000 (09:21 -0700)
commit8846c0853d8687fda0e5f23f6687b03b243980ee
tree7fb3859bd65934465a58f09f3231639b98e24492
parent57ee5cf5a93923dae9c98bffb11545fc3a31368d
rustdoc: use CSS containment to speed up render

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Containment

This affected layout a little and required adjustments to the CSS to
keep spacing the same. In particular, the margins of adjacent items
usually overlap with each other. However, when an item has contain:
layout, any margins of child nodes push out the size of the item itself.
This was making spacing between items a little too big. To solve that, I
removed margins in some places: in particular for certain classes that
often occur at the end of a `details.rustdoc-toggle` block, I removed
their bottom margin. Generally, the margins provided by the next item
down are sufficient.

Also remove an unnecessary margin-top on .code-header.
src/librustdoc/html/static/css/rustdoc.css
src/test/rustdoc-gui/sidebar-mobile-scroll.goml