Skip to content

Commit

Permalink
Rollup merge of #105320 - notriddle:notriddle/rustdoc-toggle-hideme-2…
Browse files Browse the repository at this point in the history
…, r=GuillaumeGomez

rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles

This code uses a special `hideme` class anyway, so just style that.
  • Loading branch information
matthiaskrgr authored Dec 6, 2022
2 parents c699b05 + 32765fb commit dc07e1b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ h1, h2, h3, h4, h5, h6,
span.since,
a.srclink,
#help-button > a,
details.rustdoc-toggle.top-doc > summary,
details.rustdoc-toggle.non-exhaustive > summary,
summary.hideme,
.scraped-example-list,
/* This selector is for the items listed in the "all items" page. */
ul.all-items {
Expand Down Expand Up @@ -1484,6 +1483,7 @@ details.rustdoc-toggle {
"Expand description" or "Show methods". */
details.rustdoc-toggle > summary.hideme {
cursor: pointer;
font-size: 1rem;
}

details.rustdoc-toggle > summary {
Expand Down Expand Up @@ -1546,13 +1546,6 @@ details.rustdoc-toggle > summary:focus-visible::before {
outline-offset: 1px;
}

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 {
font-size: 1rem;
}

details.non-exhaustive {
margin-bottom: 8px;
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/enum-variants.goml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ goto: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"

assert-css: (".variants > .variant", {"margin": "0px 0px 12px"})
assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"})

assert-css: (
"details.non-exhaustive > summary",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
1 change: 1 addition & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl AsRef<str> for Foo {
///
/// # title!
#[doc(alias = "ThisIsAnAlias")]
#[non_exhaustive]
pub enum WhoLetTheDogOut {
/// Woof!
Woof,
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/toggle-docs.goml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ wait-for: 50
// This is now collapsed so there shouldn't be the "open" attribute on details.
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
assert-text: ("#toggle-all-docs", "[+]")
assert-css: (
"#main-content > details.top-doc > summary",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
click: "#toggle-all-docs"
// Not collapsed anymore so the "open" attribute should be back.
wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})
Expand Down

0 comments on commit dc07e1b

Please sign in to comment.