Skip to content

Commit 155a553

Browse files
committed
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.
1 parent 96ddd32 commit 155a553

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ h1.fqn {
159159
.main-heading {
160160
display: flex;
161161
flex-wrap: wrap;
162-
justify-content: space-between;
163162
padding-bottom: 6px;
164163
margin-bottom: 15px;
165164
}

src/test/rustdoc-gui/type-declation-overflow.goml

+17
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,20 @@ goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLon
4141
store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth")
4242
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
4343
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})
44+
45+
// Check wrapping for top main-heading h1 and out-of-band.
46+
// On desktop, they wrap when too big.
47+
size: (1100, 800)
48+
goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
49+
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
50+
goto: "file://" + |DOC_PATH| + "/lib2/index.html"
51+
compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ("y"))
52+
// make sure there is a gap between them
53+
compare-elements-position-near-false: (".main-heading h1", ".main-heading .out-of-band", {"x": 550})
54+
55+
// On mobile, they always wrap.
56+
size: (600, 600)
57+
goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
58+
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))
59+
goto: "file://" + |DOC_PATH| + "/lib2/index.html"
60+
compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y"))

0 commit comments

Comments
 (0)