From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/librustdoc/html/static/css/rustdoc.css | 683 ++++++++++++----------------- 1 file changed, 289 insertions(+), 394 deletions(-) (limited to 'src/librustdoc/html/static/css/rustdoc.css') diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index bb35970eb..1cc954a98 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -132,19 +132,29 @@ h1, h2, h3, h4, h5, h6 { font-weight: 500; } h1, h2, h3, h4 { - margin: 20px 0 15px 0; + margin: 25px 0 15px 0; padding-bottom: 6px; } .docblock h3, .docblock h4, h5, h6 { margin: 15px 0 5px 0; } +.docblock > h2:first-child, +.docblock > h3:first-child, +.docblock > h4:first-child, +.docblock > h5:first-child, +.docblock > h6:first-child { + margin-top: 0; +} h1.fqn { margin: 0; padding: 0; - border-bottom-color: var(--headings-border-bottom-color); -} -h2, h3, h4 { - border-bottom-color: var(--headings-border-bottom-color); + flex-grow: 1; + /* We use overflow-wrap: break-word for Safari, which doesn't recognize + `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */ + overflow-wrap: break-word; + /* Then override it with `anywhere`, which is required to make non-Safari browsers break + more aggressively when we want them to. */ + overflow-wrap: anywhere; } .main-heading { display: flex; @@ -153,9 +163,6 @@ h2, h3, h4 { padding-bottom: 6px; margin-bottom: 15px; } -.main-heading a:hover { - text-decoration: underline; -} #toggle-all-docs { text-decoration: none; } @@ -164,7 +171,7 @@ h2, h3, h4 { Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc) Underlines elsewhere in the documentation break up visual flow and tend to invert section hierarchies. */ -h2, +.content h2, .top-doc .docblock > h3, .top-doc .docblock > h4 { border-bottom: 1px solid var(--headings-border-bottom-color); @@ -177,48 +184,28 @@ h4.code-header { } .code-header { font-weight: 600; - border-bottom-style: none; margin: 0; padding: 0; - margin-top: 0.6em; - margin-bottom: 0.4em; -} -.impl, -.impl-items .method, -.methods .method, -.impl-items .type, -.methods .type, -.impl-items .associatedconstant, -.methods .associatedconstant, -.impl-items .associatedtype, -.methods .associatedtype { - flex-basis: 100%; - font-weight: 600; - position: relative; } +#crate-search, h1, h2, h3, h4, h5, h6, .sidebar, .mobile-topbar, -a.source, .search-input, .search-results .result-name, .item-left > a, .out-of-band, span.since, -details.rustdoc-toggle > summary::before, -.content ul.crate a.crate, a.srclink, -#help-button > button, +#help-button > a, details.rustdoc-toggle.top-doc > summary, -details.rustdoc-toggle.top-doc > summary::before, details.rustdoc-toggle.non-exhaustive > summary, -details.rustdoc-toggle.non-exhaustive > summary::before, .scraped-example-title, .more-examples-toggle summary, .more-examples-toggle .hide-more, .example-links a, /* This selector is for the items listed in the "all items" page. */ -#main-content > ul.docblock > li > a { +ul.all-items { font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif; } @@ -230,14 +217,14 @@ pre.rust a, .sidebar h2 a, .sidebar h3 a, .mobile-topbar h2 a, -.in-band a, +h1 a, .search-results a, .module-item .stab, .import-item .stab, .result-name .primitive > i, .result-name .keyword > i, -.content .method .where, -.content .fn .where, -.content .where.fmt-newline { +.method .where, +.fn .where, +.where.fmt-newline { color: var(--main-color); } @@ -274,7 +261,7 @@ pre.rust a, color: var(--macro-link-color); } -.content span.mod, .content a.mod, .block a.current.mod { +.content span.mod, .content a.mod { color: var(--mod-link-color); } @@ -299,32 +286,14 @@ p { https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */ margin: 0 0 .75em 0; } - -summary { - outline: none; +/* For the last child of a div, the margin will be taken care of + by the margin-top of the next item. */ +p:last-child { + margin: 0; } /* Fix some style changes due to normalize.css 8 */ -td, -th { - padding: 0; -} - -table { - border-collapse: collapse; -} - -button, -input, -optgroup, -select, -textarea { - color: inherit; - font: inherit; - margin: 0; -} - button { /* Buttons on Safari have different default padding than other platforms. Make them the same. */ padding: 1px 6px; @@ -375,9 +344,6 @@ code, pre, a.test-arrow, .code-header { pre { padding: 14px; } -.docblock.item-decl { - margin-left: 0; -} .item-decl pre { overflow-x: auto; } @@ -394,22 +360,11 @@ img { overflow: visible; } -.sub-container { - display: flex; - flex-direction: row; - flex-wrap: nowrap; -} - .sub-logo-container { - display: none; - margin-right: 20px; + line-height: 0; } -.source .sub-logo-container { - display: block; -} - -.source .sub-logo-container > img { +.sub-logo-container > img { height: 60px; width: 60px; object-fit: contain; @@ -421,7 +376,7 @@ img { .sidebar { font-size: 0.875rem; - width: 250px; + width: 200px; min-width: 200px; overflow-y: scroll; position: sticky; @@ -430,15 +385,6 @@ img { left: 0; } -.sidebar-elems, -.sidebar > .location { - padding-left: 24px; -} - -.sidebar .location { - overflow-wrap: anywhere; -} - .rustdoc.source .sidebar { width: 50px; min-width: 0px; @@ -452,10 +398,6 @@ img { overflow-y: hidden; } -.rustdoc.source .sidebar .sidebar-logo { - display: none; -} - .source .sidebar, #sidebar-toggle, #source-sidebar { background-color: var(--sidebar-background-color); } @@ -465,16 +407,15 @@ img { } .source .sidebar > *:not(#sidebar-toggle) { - opacity: 0; visibility: hidden; } .source-sidebar-expanded .source .sidebar { overflow-y: auto; + width: 300px; } .source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) { - opacity: 1; visibility: visible; } @@ -532,22 +473,15 @@ img { width: 100px; } -.location:empty { - border: none; -} - -.location a:first-of-type { - font-weight: 500; -} - -.block ul, .block li { +ul.block, .block li { padding: 0; margin: 0; list-style: none; } .block a, -h2.location a { +.sidebar h2 a, +.sidebar h3 a { display: block; padding: 0.25rem; margin-left: -0.25rem; @@ -557,8 +491,7 @@ h2.location a { } .sidebar h2 { - border-bottom: none; - font-weight: 500; + overflow-wrap: anywhere; padding: 0; margin: 0; margin-top: 0.7rem; @@ -567,11 +500,23 @@ h2.location a { .sidebar h3 { font-size: 1.125rem; /* 18px */ - font-weight: 500; padding: 0; margin: 0; } +.sidebar-elems, +.sidebar > h2 { + padding-left: 24px; +} + +.sidebar a, .sidebar .current { + color: var(--sidebar-link-color); +} +.sidebar .current, +.sidebar a:hover { + background-color: var(--sidebar-current-link-background-color); +} + .sidebar-elems .block { margin-bottom: 2em; } @@ -585,66 +530,61 @@ h2.location a { } .source .content pre.rust { - white-space: pre; overflow: auto; padding-left: 0; } .rustdoc .example-wrap { - display: inline-flex; + display: flex; + position: relative; margin-bottom: 10px; } +/* For the last child of a div, the margin will be taken care of + by the margin-top of the next item. */ +.rustdoc .example-wrap:last-child { + margin-bottom: 0px; +} -.example-wrap { - position: relative; - width: 100%; +.rustdoc .example-wrap > pre { + margin: 0; + flex-grow: 1; + overflow-x: auto; } -.example-wrap > pre.line-number { +.rustdoc .example-wrap > pre.example-line-numbers, +.rustdoc .example-wrap > pre.src-line-numbers { + flex-grow: 0; overflow: initial; + text-align: right; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.example-line-numbers { border: 1px solid; padding: 13px 8px; - text-align: right; border-top-left-radius: 5px; border-bottom-left-radius: 5px; + border-color: var(--example-line-numbers-border-color); } -.example-wrap > pre.rust a:hover { - text-decoration: underline; -} - -.line-numbers { - text-align: right; -} -.rustdoc:not(.source) .example-wrap > pre:not(.line-number) { - width: 100%; - overflow-x: auto; +.src-line-numbers span { + cursor: pointer; + color: var(--src-line-numbers-span-color); } - -.rustdoc:not(.source) .example-wrap > pre.line-numbers { - width: auto; - overflow-x: visible; +.src-line-numbers .line-highlighted { + background-color: var(--src-line-number-highlighted-background-color); } - -.rustdoc .example-wrap > pre { - margin: 0; +.src-line-numbers :target { + background-color: transparent; } .search-loading { text-align: center; } -.content > .example-wrap pre.line-numbers { - position: relative; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.line-numbers span { - cursor: pointer; -} - .docblock-short { overflow-wrap: break-word; overflow-wrap: anywhere; @@ -669,9 +609,6 @@ h2.location a { .docblock h5 { font-size: 1rem; } .docblock h6 { font-size: 0.875rem; } -.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5, .docblock h6 { - border-bottom-color: var(--headings-border-bottom-color); -} .docblock { margin-left: 24px; @@ -683,33 +620,9 @@ h2.location a { overflow-x: auto; } -.content .out-of-band { +.out-of-band { flex-grow: 0; font-size: 1.125rem; - font-weight: normal; - float: right; -} - -.method > .code-header, .trait-impl > .code-header { - max-width: calc(100% - 41px); - display: block; -} - -.content .in-band { - flex-grow: 1; - margin: 0px; - padding: 0px; - /* We use overflow-wrap: break-word for Safari, which doesn't recognize - `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */ - overflow-wrap: break-word; - /* Then override it with `anywhere`, which is required to make non-Safari browsers break - more aggressively when we want them to. */ - overflow-wrap: anywhere; - background-color: var(--main-background-color); -} - -.in-band > code, .in-band > .code-header { - display: inline-block; } .docblock code, .docblock-short code, @@ -726,6 +639,7 @@ pre, .rustdoc.source .example-wrap { width: calc(100% - 2px); overflow-x: auto; display: block; + border-collapse: collapse; } .docblock table td { @@ -740,38 +654,21 @@ pre, .rustdoc.source .example-wrap { border: 1px solid var(--border-color); } -.content .item-list { - list-style-type: none; - padding: 0; -} - -.content > .methods > .method { - font-size: 1rem; - position: relative; -} /* Shift "where ..." part of method or fn definition down a line */ -.content .method .where, -.content .fn .where, -.content .where.fmt-newline { +.method .where, +.fn .where, +.where.fmt-newline { display: block; font-size: 0.875rem; } .item-info { display: block; -} - -.content .item-info code { - font-size: 0.875rem; -} - -.content .item-info { - position: relative; margin-left: 24px; } -.content .impl-items .docblock, .content .impl-items .item-info { - margin-bottom: .6em; +.item-info code { + font-size: 0.875rem; } #main-content > .item-info { @@ -780,16 +677,24 @@ pre, .rustdoc.source .example-wrap { } nav.sub { + flex-grow: 1; + flex-flow: row nowrap; + margin: 4px 0 25px 0; + display: flex; + align-items: center; +} +.search-form { position: relative; - font-size: 1rem; + display: flex; + height: 34px; flex-grow: 1; - margin-bottom: 25px; } .source nav.sub { + margin: 0 0 15px 0; +} +.source .search-form { margin-left: 32px; } -nav.sum { text-align: right; } -nav.sub form { display: inline; } a { text-decoration: none; @@ -805,9 +710,7 @@ a { display: initial; } -.in-band:hover > .anchor, .impl:hover > .anchor, .method.trait-impl:hover > .anchor, -.type.trait-impl:hover > .anchor, .associatedconstant.trait-impl:hover > .anchor, -.associatedtype.trait-impl:hover > .anchor { +.impl:hover > .anchor, .trait-impl:hover > .anchor { display: inline-block; position: absolute; } @@ -831,12 +734,16 @@ h2.small-section-header > .anchor { content: '§'; } -.docblock a:not(.srclink):not(.test-arrow):not(.scrape-help):hover, -.docblock-short a:not(.srclink):not(.test-arrow):not(.scrape-help):hover, .item-info a { +.main-heading a:hover, +.example-wrap > pre.rust a:hover, +.all-items a:hover, +.docblock a:not(.test-arrow):not(.scrape-help):hover, +.docblock-short a:not(.test-arrow):not(.scrape-help):hover, +.item-info a { text-decoration: underline; } -.block a.current.crate { font-weight: 500; } +.crate.block a.current { font-weight: 500; } /* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap as much as needed on mobile (see @@ -876,15 +783,6 @@ table, padding-right: 1.25rem; } -.search-container { - position: relative; - display: flex; - height: 34px; - margin-top: 4px; -} -.search-container > * { - height: 100%; -} .search-results-title { margin-top: 0; white-space: nowrap; @@ -922,6 +820,9 @@ table, /* Removes default arrow from firefox */ text-indent: 0.01px; background-color: var(--main-background-color); + color: inherit; + line-height: 1.5; + font-weight: 500; } /* cancel stylistic differences in padding in firefox for "appearance: none"-style (or equivalent)