Skip to content

Commit 45d3ed0

Browse files
authored
Unrolled build for rust-lang#115812
Rollup merge of rust-lang#115812 - GuillaumeGomez:merge-settings-into-rustdoc-css, r=notriddle Merge settings.css into rustdoc.css There aren't that many CSS rules in `settings.css`, however quite some code is needed around it, making it more costly than useful. I think it's better to merge into `rustdoc.css` to simplify this. r? `@notriddle`
2 parents 5adddad + 9944f01 commit 45d3ed0

File tree

6 files changed

+64
-76
lines changed

6 files changed

+64
-76
lines changed

src/librustdoc/html/render/context.rs

-3
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
714714
You need to enable JavaScript be able to update your settings.\
715715
</section>\
716716
</noscript>\
717-
<link rel=\"stylesheet\" \
718-
href=\"{static_root_path}{settings_css}\">\
719717
<script defer src=\"{static_root_path}{settings_js}\"></script>\
720718
<link rel=\"preload\" href=\"{static_root_path}{theme_light_css}\" \
721719
as=\"style\">\
@@ -724,7 +722,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
724722
<link rel=\"preload\" href=\"{static_root_path}{theme_ayu_css}\" \
725723
as=\"style\">",
726724
static_root_path = page.get_static_root_path(),
727-
settings_css = static_files::STATIC_FILES.settings_css,
728725
settings_js = static_files::STATIC_FILES.settings_js,
729726
theme_light_css = static_files::STATIC_FILES.theme_light_css,
730727
theme_dark_css = static_files::STATIC_FILES.theme_dark_css,

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

+64
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,70 @@ so that we can apply CSS-filters to change the arrow color in themes */
925925
top: -5px;
926926
}
927927

928+
.setting-line {
929+
margin: 1.2em 0.6em;
930+
}
931+
932+
.setting-radio input, .setting-check input {
933+
margin-right: 0.3em;
934+
height: 1.2rem;
935+
width: 1.2rem;
936+
border: 2px solid var(--settings-input-border-color);
937+
outline: none;
938+
-webkit-appearance: none;
939+
cursor: pointer;
940+
}
941+
.setting-radio input {
942+
border-radius: 50%;
943+
}
944+
945+
.setting-radio span, .setting-check span {
946+
padding-bottom: 1px;
947+
}
948+
949+
.setting-radio {
950+
margin-top: 0.1em;
951+
margin-bottom: 0.1em;
952+
min-width: 3.8em;
953+
padding: 0.3em;
954+
display: inline-flex;
955+
align-items: center;
956+
cursor: pointer;
957+
}
958+
.setting-radio + .setting-radio {
959+
margin-left: 0.5em;
960+
}
961+
962+
.setting-check {
963+
margin-right: 20px;
964+
display: flex;
965+
align-items: center;
966+
cursor: pointer;
967+
}
968+
969+
.setting-radio input:checked {
970+
box-shadow: inset 0 0 0 3px var(--main-background-color);
971+
background-color: var(--settings-input-color);
972+
}
973+
.setting-check input:checked {
974+
background-color: var(--settings-input-color);
975+
border-width: 1px;
976+
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">\
977+
<path d="M7,25L17,32L33,12" fill="none" stroke="black" stroke-width="5"/>\
978+
<path d="M7,23L17,30L33,10" fill="none" stroke="white" stroke-width="5"/></svg>');
979+
}
980+
.setting-radio input:focus, .setting-check input:focus {
981+
box-shadow: 0 0 1px 1px var(--settings-input-color);
982+
}
983+
/* In here we combine both `:focus` and `:checked` properties. */
984+
.setting-radio input:checked:focus {
985+
box-shadow: inset 0 0 0 3px var(--main-background-color),
986+
0 0 2px 2px var(--settings-input-color);
987+
}
988+
.setting-radio input:hover, .setting-check input:hover {
989+
border-color: var(--settings-input-color) !important;
990+
}
991+
928992
/* use larger max-width for help popover, but not for help.html */
929993
#help.popover {
930994
max-width: 600px;

src/librustdoc/html/static/css/settings.css

-63
This file was deleted.

src/librustdoc/html/static/js/main.js

-8
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,6 @@ function browserSupportsHistoryApi() {
176176
return window.history && typeof window.history.pushState === "function";
177177
}
178178

179-
function loadCss(cssUrl) {
180-
const link = document.createElement("link");
181-
link.href = cssUrl;
182-
link.rel = "stylesheet";
183-
document.getElementsByTagName("head")[0].appendChild(link);
184-
}
185-
186179
function preLoadCss(cssUrl) {
187180
// https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload
188181
const link = document.createElement("link");
@@ -210,7 +203,6 @@ function preLoadCss(cssUrl) {
210203
event.preventDefault();
211204
// Sending request for the CSS and the JS files at the same time so it will
212205
// hopefully be loaded when the JS will generate the settings content.
213-
loadCss(getVar("static-root-path") + getVar("settings-css"));
214206
loadScript(getVar("static-root-path") + getVar("settings-js"));
215207
preLoadCss(getVar("static-root-path") + getVar("theme-light-css"));
216208
preLoadCss(getVar("static-root-path") + getVar("theme-dark-css"));

src/librustdoc/html/static_files.rs

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ macro_rules! static_files {
9191

9292
static_files! {
9393
rustdoc_css => "static/css/rustdoc.css",
94-
settings_css => "static/css/settings.css",
9594
noscript_css => "static/css/noscript.css",
9695
normalize_css => "static/css/normalize.css",
9796
main_js => "static/js/main.js",

src/librustdoc/html/templates/page.html

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
data-channel="{{rust_channel}}" {#+ #}
3434
data-search-js="{{files.search_js}}" {#+ #}
3535
data-settings-js="{{files.settings_js}}" {#+ #}
36-
data-settings-css="{{files.settings_css}}" {#+ #}
3736
data-theme-light-css="{{files.theme_light_css}}" {#+ #}
3837
data-theme-dark-css="{{files.theme_dark_css}}" {#+ #}
3938
data-theme-ayu-css="{{files.theme_ayu_css}}" {#+ #}

0 commit comments

Comments
 (0)