Skip to content

Commit

Permalink
Rollup merge of rust-lang#104425 - notriddle:notriddle/main-heading-j…
Browse files Browse the repository at this point in the history
…ustify-content, r=GuillaumeGomez

rustdoc: remove no-op CSS `.main-header { justify-content }`

This rule was added in 152e888 to push the out-of-band content to the right while allowing it to line wrap when it got too big. The idea was that the justification rule would fill the space between the `<h1>` element and the `<div class="out-of-band">` element.

A later commit, 3cb03cb, flattened the in-band element into the `<h1>`, copying the `flex-grow` rule. This means the `<h1>` element now grows to fill the space, so there's no need to justify-content any more.

This commit also adds a test case for this.
  • Loading branch information
matthiaskrgr authored Nov 16, 2022
2 parents c523171 + 155a553 commit 6a28c50
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ h1.fqn {
.main-heading {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding-bottom: 6px;
margin-bottom: 15px;
}
Expand Down
17 changes: 17 additions & 0 deletions src/test/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,20 @@ goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLon
store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth")
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})

// Check wrapping for top main-heading h1 and out-of-band.
// On desktop, they wrap when too big.
size: (1100, 800)
goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
goto: "file://" + |DOC_PATH| + "/lib2/index.html"
compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ("y"))
// make sure there is a gap between them
compare-elements-position-near-false: (".main-heading h1", ".main-heading .out-of-band", {"x": 550})

// On mobile, they always wrap.
size: (600, 600)
goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
goto: "file://" + |DOC_PATH| + "/lib2/index.html"
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))

0 comments on commit 6a28c50

Please sign in to comment.