Skip to content

Commit 668fe2d

Browse files
committed
Add back the column
1 parent 859bbc5 commit 668fe2d

File tree

7 files changed

+32
-64
lines changed

7 files changed

+32
-64
lines changed

src/librustdoc/html/static/css/noscript.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rules.
1111

1212
#copy-path, #sidebar-button, .sidebar-resizer {
1313
/* It requires JS to work so no need to display it in this case. */
14-
display: none;
14+
display: none !important;
1515
}
1616

1717
nav.sub {

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

+15-18
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ img {
391391

392392
.rustdoc.src .sidebar {
393393
flex-basis: 50px;
394+
width: 50px;
394395
border-right: 1px solid;
395396
overflow-x: hidden;
396397
/* The sidebar is by default hidden */
@@ -414,14 +415,14 @@ img {
414415
}
415416

416417
.rustdoc.src .sidebar-resizer {
417-
/* src pages have separate closed flag */
418-
display: none;
418+
/* when closed, place resizer glow on top of the normal src sidebar border (no need to
419+
worry about sidebar) */
420+
left: 49px;
419421
}
420422

421423
.src-sidebar-expanded .src .sidebar-resizer {
422424
/* for src sidebar, gap is already provided by 1px border on sidebar itself, so place resizer
423425
to right of it */
424-
display: block;
425426
left: var(--src-sidebar-width);
426427
}
427428

@@ -437,7 +438,7 @@ img {
437438
}
438439

439440
.sidebar-resizing .sidebar {
440-
position: fixed !important;
441+
position: fixed;
441442
z-index: 100;
442443
}
443444
.sidebar-resizing > body {
@@ -491,21 +492,20 @@ img {
491492
background-color: var(--sidebar-background-color);
492493
}
493494

494-
.src .sidebar {
495-
position: absolute;
496-
top: 0;
497-
bottom: 0;
498-
left: -1000px;
495+
.src .sidebar > * {
496+
visibility: hidden;
499497
}
500498

501499
.src-sidebar-expanded .src .sidebar {
502-
position: sticky;
503-
left: 0;
504500
overflow-y: auto;
505501
flex-basis: var(--src-sidebar-width);
506502
width: var(--src-sidebar-width);
507503
}
508504

505+
.src-sidebar-expanded .src .sidebar > * {
506+
visibility: visible;
507+
}
508+
509509
#all-types {
510510
margin-top: 1em;
511511
}
@@ -1561,15 +1561,9 @@ a.tooltip:hover::after {
15611561
z-index: 1;
15621562
}
15631563
.src #sidebar-button {
1564-
left: 12px;
1564+
left: 8px;
15651565
z-index: 101;
15661566
}
1567-
.src .search-form {
1568-
margin-left: 40px;
1569-
}
1570-
.src-sidebar-expanded .src .search-form {
1571-
margin-left: 0;
1572-
}
15731567
#settings-menu > a, #help-button > a, #sidebar-button > a {
15741568
display: flex;
15751569
align-items: center;
@@ -1879,6 +1873,9 @@ in src-script.js and main.js
18791873
height: 100vh;
18801874
border: 0;
18811875
}
1876+
.src .search-form {
1877+
margin-left: 40px;
1878+
}
18821879

18831880
.sidebar.shown,
18841881
.src-sidebar-expanded .src .sidebar,

tests/rustdoc-gui/huge-logo.goml

-10
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,3 @@ set-window-size: (400, 600)
1111
// offset = size + margin
1212
assert-property: (".mobile-topbar .logo-container", {"offsetWidth": "55", "offsetHeight": 45})
1313
assert-property: (".mobile-topbar .logo-container img", {"offsetWidth": "35", "offsetHeight": 35})
14-
15-
go-to: "file://" + |DOC_PATH| + "/src/huge_logo/lib.rs.html"
16-
17-
set-window-size: (1280, 1024)
18-
assert-property: (".sub-logo-container", {"offsetWidth": "60", "offsetHeight": 60})
19-
20-
set-window-size: (400, 600)
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/rust-logo.goml

-10
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ define-function: (
1111
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
1212
reload:
1313
assert-css: (".rust-logo", {"filter": |filter|})
14-
// Going to the source code page.
15-
go-to: "file://" + |DOC_PATH| + "/src/staged_api/lib.rs.html"
16-
// Changing theme (since it's local files, the local storage works by folder).
17-
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
18-
reload:
19-
assert-css: (".rust-logo", {"filter": |filter|})
2014
// Now we check that the non-rust logos don't have a CSS filter set.
2115
go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html"
2216
// Changing theme on the new page (again...).
@@ -31,10 +25,6 @@ define-function: (
3125
assert-false: ".rust-logo"
3226
assert-false: ".logo-container"
3327
assert-false: ".sub-logo-container"
34-
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
35-
assert-false: ".rust-logo"
36-
assert-false: ".logo-container"
37-
assert-false: ".sub-logo-container"
3828
},
3929
)
4030

tests/rustdoc-gui/sidebar-source-code-display.goml

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ assert-css: ("#sidebar-button", {"display": "none"})
99
javascript: true
1010
reload:
1111
wait-for: "#src-sidebar"
12-
assert-css: ("#src-sidebar", {"position": "absolute", "left": "-1000px"})
12+
assert-css: (".src .sidebar > *", {"visibility": "hidden"})
1313
// Let's expand the sidebar now.
14-
click: "#src-sidebar"
15-
wait-for-css: ("#src-sidebar", {"position": "sticky", "left": "0"})
14+
click: "#sidebar-button"
15+
wait-for-css: (".src .sidebar > *", {"visibility": "visible"})
1616

1717
// We now check that opening the sidebar and clicking a link will leave it open.
1818
// The behavior here on desktop is different than the behavior on mobile,
@@ -32,12 +32,11 @@ define-function: (
3232
"check-colors",
3333
(
3434
theme, color, color_hover, background, background_hover, background_toggle,
35-
background_toggle_hover,
3635
),
3736
block {
3837
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
3938
reload:
40-
wait-for-css: ("#src-sidebar", {"position": "sticky", "left": "0"})
39+
wait-for-css: (".src .sidebar > *", {"visibility": "visible"})
4140
assert-css: (
4241
"#src-sidebar details[open] > .files a.selected",
4342
{"color": |color_hover|, "background-color": |background|},
@@ -108,20 +107,23 @@ call-function: ("check-colors", {
108107
"color_hover": "#000",
109108
"background": "#fff",
110109
"background_hover": "#e0e0e0",
110+
"background_toggle": "rgba(0, 0, 0, 0)",
111111
})
112112
call-function: ("check-colors", {
113113
"theme": "dark",
114114
"color": "#ddd",
115115
"color_hover": "#ddd",
116116
"background": "#333",
117117
"background_hover": "#444",
118+
"background_toggle": "rgba(0, 0, 0, 0)",
118119
})
119120
call-function: ("check-colors", {
120121
"theme": "ayu",
121122
"color": "#c5c5c5",
122123
"color_hover": "#ffb44c",
123124
"background": "#14191f",
124125
"background_hover": "#14191f",
126+
"background_toggle": "rgba(0, 0, 0, 0)",
125127
})
126128

127129
// Now checking on mobile devices.

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ wait-for: "#sidebar-button"
5252
// We check that the sidebar isn't expanded and has the expected width.
5353
assert-css: ("nav.sidebar", {"width": "50px"})
5454
// We now click on the button to expand the sidebar.
55-
click: (10, 10)
55+
click: "#sidebar-button"
5656
// We wait for the sidebar to be expanded.
5757
wait-for-css: (".src-sidebar-expanded nav.sidebar", {"width": "300px"})
5858
assert-css: (".src-sidebar-expanded nav.sidebar a", {"font-size": "14px"})
5959
// We collapse the sidebar.
60-
click: (10, 10)
60+
click: "#sidebar-button"
6161
// We ensure that the class has been removed.
6262
wait-for: "html:not(.src-sidebar-expanded)"
6363
assert: "nav.sidebar"
6464

6565
// Checking that only the path to the current file is "open".
6666
go-to: "file://" + |DOC_PATH| + "/src/lib2/another_folder/sub_mod/mod.rs.html"
6767
// First we expand the sidebar again.
68-
click: (10, 10)
68+
click: "#sidebar-button"
6969
// We wait for the sidebar to be expanded.
7070
wait-for-css: (".src-sidebar-expanded nav.sidebar", {"width": "300px"})
7171
assert: "//*[@class='dir-entry' and @open]/*[text()='lib2']"

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

+6-17
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,13 @@ define-function: (
146146
)
147147
}
148148
)
149-
store-property: ("#src-sidebar > .title", {
149+
store-property: (".src-sidebar-title", {
150150
"offsetHeight": source_sidebar_title_height,
151151
"offsetTop": source_sidebar_title_y,
152152
})
153153
call-function: ("check-sidebar-dir-entry", {
154154
"x": 0,
155-
// border + margin = 6
156-
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
155+
"y": |source_sidebar_title_y| + |source_sidebar_title_height|,
157156
})
158157

159158
// Check the search form
@@ -175,35 +174,25 @@ assert-property: ("#main-content", {"offsetTop": 50})
175174
// 8 = 50 - 34 - 8
176175

177176
// Check the sidebar directory entries have a marker and spacing (tablet).
178-
store-property: ("#src-sidebar > .title", {
177+
store-property: (".src-sidebar-title", {
179178
"offsetHeight": source_sidebar_title_height,
180179
"offsetTop": source_sidebar_title_y,
181180
})
182181
call-function: ("check-sidebar-dir-entry", {
183182
"x": 0,
184-
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
183+
"y": |source_sidebar_title_y| + |source_sidebar_title_height|,
185184
})
186185

187186
// Tiny, phone mobile gets a different display where the logo is stacked on top.
188187
set-window-size: (450, 700)
189188
assert-css: ("nav.sub", {"flex-direction": "column"})
190189

191190
// Check the sidebar directory entries have a marker and spacing (phone).
192-
store-property: ("#src-sidebar > .title", {
191+
store-property: (".src-sidebar-title", {
193192
"offsetHeight": source_sidebar_title_height,
194193
"offsetTop": source_sidebar_title_y,
195194
})
196195
call-function: ("check-sidebar-dir-entry", {
197196
"x": 0,
198-
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
197+
"y": |source_sidebar_title_y| + |source_sidebar_title_height|,
199198
})
200-
201-
// The logo is not present on this page.
202-
assert-false: ".sub-logo-container > img"
203-
204-
// Check the staged-api page instead, which does.
205-
// Now we check that the logo has a bottom margin so it's not stuck to the search input.
206-
go-to: "file://" + |DOC_PATH| + "/src/staged_api/lib.rs.html"
207-
assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"})
208-
store-property: (".sub-logo-container", {"clientHeight": logo_height})
209-
assert-position: (".search-form", {"y": |logo_height| + 8})

0 commit comments

Comments
 (0)