Skip to content

Commit 9960e9f

Browse files
authored
Rollup merge of #109973 - GuillaumeGomez:logo-display-very-small-screen, r=notriddle
rustdoc: Improve logo display very small screen Before: ![Screenshot from 2023-04-05 16-56-33](https://user-images.githubusercontent.com/3050060/230125438-c63c8de1-923c-4534-adf1-bdef02e402a9.png) After: ![Screenshot from 2023-04-05 16-57-17](https://user-images.githubusercontent.com/3050060/230125467-d3d46878-373a-4f8a-8554-1bb8c4baf46d.png) r? `@notriddle`
2 parents fe20ae0 + 8f5404d commit 9960e9f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/librustdoc/html/static/css/rustdoc.css

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
3. Copy the filenames with updated suffixes from the directory.
77
*/
88

9+
:root {
10+
--nav-sub-mobile-padding: 8px;
11+
}
12+
913
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
1014
@font-face {
1115
font-family: 'Fira Sans';
@@ -1726,7 +1730,7 @@ in main.js
17261730

17271731
.source nav.sub {
17281732
margin: 0;
1729-
padding: 8px;
1733+
padding: var(--nav-sub-mobile-padding);
17301734
}
17311735
}
17321736

@@ -1783,6 +1787,7 @@ in main.js
17831787
.sub-logo-container > img {
17841788
height: 35px;
17851789
width: 35px;
1790+
margin-bottom: var(--nav-sub-mobile-padding);
17861791
}
17871792
}
17881793

tests/rustdoc-gui/huge-logo.goml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ size: (1280, 1024)
1818
assert-property: (".sub-logo-container", {"offsetWidth": "60", "offsetHeight": 60})
1919

2020
size: (400, 600)
21-
assert-property: (".sub-logo-container", {"offsetWidth": "35", "offsetHeight": 35})
21+
// 43 because 35px + 8px of margin
22+
assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"})
23+
assert-property: (".sub-logo-container", {"offsetWidth": "35", "offsetHeight": 43})

tests/rustdoc-gui/source-code-page.goml

+5
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,8 @@ call-function: ("check-sidebar-dir-entry", {
216216
"x": 0,
217217
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
218218
})
219+
220+
// Now we check that the logo has a bottom margin so it's not stuck to the search input.
221+
assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"})
222+
store-property: (logo_height, ".sub-logo-container", "clientHeight")
223+
assert-position: (".search-form", {"y": |logo_height| + 8})

0 commit comments

Comments
 (0)