diff options
| author | Michael Howell <michael@notriddle.com> | 2022-10-17 13:54:42 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-10-17 19:09:26 -0700 |
| commit | bbac29c0950c780af5a9aea707d4ff30c046be45 (patch) | |
| tree | 40cf235269138787cd4abab7a8af5be204f8efde | |
| parent | 194140bef501ad3acb00d57c20fb80ee34aa1d3b (diff) | |
| download | rust-bbac29c0950c780af5a9aea707d4ff30c046be45.tar.gz rust-bbac29c0950c780af5a9aea707d4ff30c046be45.zip | |
rustdoc: remove CSS `@media (min-width: 701px)`
The two rules within it can and should be done without the separate
media query:
* There ain't no rule saying a viewport can't be `700.5px` wide, since
hardware pixels can be finer than CSS pixels.
* The rule for the first example-wrap child should probably apply
on mobile.
* The rule for the source sidebar is overriden by the mobile rule
setting `max-width: 100vw`, so it can be merged with the rest
of the styles.
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 30 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/storage.js | 2 |
2 files changed, 11 insertions, 21 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 5788363036a..7b6f52b0acf 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -437,6 +437,7 @@ img { .source-sidebar-expanded .source .sidebar { overflow-y: auto; + width: 300px; } .source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) { @@ -1692,31 +1693,20 @@ details.rustdoc-toggle[open] > summary.hideme::after { display: inline-block; } -/* Media Queries */ - -/* -WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY; -If you update this line, then you also need to update the line with the same warning -in storage.js plus the media query with (max-width: 700px) -*/ -@media (min-width: 701px) { - /* In case there is no documentation before a code block, we need to add some margin at the top - to prevent an overlay between the "collapse toggle" and the information tooltip. - However, it's not needed with smaller screen width because the doc/code block is always put - "one line" below. */ - .docblock > .example-wrap:first-child .tooltip { - margin-top: 16px; - } - - .source-sidebar-expanded .source .sidebar { - width: 300px; - } +/* In case there is no documentation before a code block, we need to add some margin at the top +to prevent an overlay between the "collapse toggle" and the information tooltip. +However, it's not needed with smaller screen width because the doc/code block is always put +"one line" below. */ +.docblock > .example-wrap:first-child .tooltip { + margin-top: 16px; } +/* Media Queries */ + /* WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY If you update this line, then you also need to update the line with the same warning -in storage.js plus the media query with (min-width: 701px) +in storage.js */ @media (max-width: 700px) { /* When linking to an item with an `id` (for instance, by clicking a link in the sidebar, diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js index 0c5389d45e5..5fbad357f37 100644 --- a/src/librustdoc/html/static/js/storage.js +++ b/src/librustdoc/html/static/js/storage.js @@ -10,7 +10,7 @@ window.currentTheme = document.getElementById("themeStyle"); window.mainTheme = document.getElementById("mainThemeStyle"); // WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY -// If you update this line, then you also need to update the two media queries with the same +// If you update this line, then you also need to update the media query with the same // warning in rustdoc.css window.RUSTDOC_MOBILE_BREAKPOINT = 701; |
