Skip to content

Commit 231cd0f

Browse files
authored
Rollup merge of #96939 - GuillaumeGomez:settings-css, r=notriddle
Fix settings page CSS In #96741, I moved the CSS loading outside of `settings.js`. The result was that on the settings page, there isn't the settings CSS anymore: ![Screenshot from 2022-05-11 11-09-24](https://user-images.githubusercontent.com/3050060/167817969-6750931b-3e6e-4178-b5a9-ee3851e983be.png) I also used this opportunity to remove unused CSS rules (we don't have `<select>` elements anymore in the settings). cc `@jsha` r? `@notriddle`
2 parents 80e1dec + dd6bb09 commit 231cd0f

File tree

3 files changed

+10
-39
lines changed

3 files changed

+10
-39
lines changed

Diff for: src/librustdoc/html/render/context.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
596596
|buf: &mut Buffer| {
597597
write!(
598598
buf,
599-
"<script defer src=\"{}settings{}.js\"></script>",
600-
page.static_root_path.unwrap_or(""),
601-
page.resource_suffix
599+
"<link rel=\"stylesheet\" type=\"text/css\" \
600+
href=\"{root_path}settings{suffix}.css\">\
601+
<script defer src=\"{root_path}settings{suffix}.js\"></script>",
602+
root_path = page.static_root_path.unwrap_or(""),
603+
suffix = page.resource_suffix,
602604
)
603605
},
604606
&self.shared.style_files,

Diff for: src/librustdoc/html/static/css/settings.css

-36
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,6 @@
5656
position: absolute;
5757
}
5858

59-
.select-wrapper {
60-
float: right;
61-
position: relative;
62-
height: 27px;
63-
min-width: 25%;
64-
}
65-
66-
.select-wrapper select {
67-
appearance: none;
68-
-moz-appearance: none;
69-
-webkit-appearance: none;
70-
background: none;
71-
border: 2px solid #ccc;
72-
padding-right: 28px;
73-
width: 100%;
74-
}
75-
76-
.select-wrapper img {
77-
pointer-events: none;
78-
position: absolute;
79-
right: 0;
80-
bottom: 0;
81-
background: #ccc;
82-
height: 100%;
83-
width: 28px;
84-
padding: 0px 4px;
85-
}
86-
87-
.select-wrapper select option {
88-
color: initial;
89-
}
90-
9159
.slider {
9260
position: absolute;
9361
cursor: pointer;
@@ -96,7 +64,6 @@
9664
right: 0;
9765
bottom: 0;
9866
background-color: #ccc;
99-
-webkit-transition: .3s;
10067
transition: .3s;
10168
}
10269

@@ -108,7 +75,6 @@
10875
left: 4px;
10976
bottom: 4px;
11077
background-color: white;
111-
-webkit-transition: .3s;
11278
transition: .3s;
11379
}
11480

@@ -121,8 +87,6 @@ input:focus + .slider {
12187
}
12288

12389
input:checked + .slider:before {
124-
-webkit-transform: translateX(19px);
125-
-ms-transform: translateX(19px);
12690
transform: translateX(19px);
12791
}
12892

Diff for: src/test/rustdoc-gui/settings.goml

+5
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,8 @@ assert: ".setting-line.hidden #theme"
6565
// We check their text as well.
6666
assert-text: ("#preferred-dark-theme .setting-name", "Preferred dark theme")
6767
assert-text: ("#preferred-light-theme .setting-name", "Preferred light theme")
68+
69+
// Now we go to the settings page to check that the CSS is loaded as expected.
70+
goto: file://|DOC_PATH|/settings.html
71+
wait-for: "#settings"
72+
assert-css: (".setting-line .toggle", {"width": "45px", "margin-right": "20px"})

0 commit comments

Comments
 (0)