Skip to content

Commit 0f29824

Browse files
committedSep 2, 2022
rustdoc: put in rule to get alignment in desktop and mobile layouts
1 parent 6f95c89 commit 0f29824

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

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

+5
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,11 @@ in storage.js plus the media query with (min-width: 701px)
20072007
#main-content > div > details.rustdoc-toggle > summary::before {
20082008
left: -11px;
20092009
}
2010+
2011+
/* Align summary-nested and unnested item-info gizmos. */
2012+
.content .impl-items > .item-info {
2013+
margin-left: 34px;
2014+
}
20102015
}
20112016

20122017
@media print {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test ensures that the "item-info" looks about the same
2+
// whether or not it's inside a toggle.
3+
goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html
4+
5+
// First, we try it in "desktop" mode.
6+
size: (1200, 870)
7+
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
8+
// Next, we try it in "mobile" mode (max-width: 700px).
9+
size: (650, 650)
10+
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))

‎src/test/rustdoc-gui/src/lib2/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,13 @@ where
170170
type Output;
171171
fn index(&self, index: Idx) -> &Self::Output;
172172
}
173+
174+
pub struct ItemInfoAlignmentTest;
175+
176+
impl ItemInfoAlignmentTest {
177+
/// This method has docs
178+
#[deprecated]
179+
pub fn foo() {}
180+
#[deprecated]
181+
pub fn bar() {}
182+
}

0 commit comments

Comments
 (0)
Please sign in to comment.