]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: put in rule to get alignment in desktop and mobile layouts
authorMichael Howell <michael@notriddle.com>
Fri, 2 Sep 2022 19:15:06 +0000 (12:15 -0700)
committerMichael Howell <michael@notriddle.com>
Fri, 2 Sep 2022 20:13:22 +0000 (13:13 -0700)
src/librustdoc/html/static/css/rustdoc.css
src/test/rustdoc-gui/item-info-alignment.goml [new file with mode: 0644]
src/test/rustdoc-gui/src/lib2/lib.rs

index 90c86750425f6e6dc0fb669d5281a7549b1e711e..147d2260964f2dd987841ce6667dbdd0ee9c39e4 100644 (file)
@@ -2007,6 +2007,11 @@ in storage.js plus the media query with (min-width: 701px)
        #main-content > div > details.rustdoc-toggle > summary::before {
                left: -11px;
        }
+
+       /* Align summary-nested and unnested item-info gizmos. */
+       .content .impl-items > .item-info {
+               margin-left: 34px;
+       }
 }
 
 @media print {
diff --git a/src/test/rustdoc-gui/item-info-alignment.goml b/src/test/rustdoc-gui/item-info-alignment.goml
new file mode 100644 (file)
index 0000000..4d7b504
--- /dev/null
@@ -0,0 +1,10 @@
+// This test ensures that the "item-info" looks about the same
+// whether or not it's inside a toggle.
+goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html
+
+// First, we try it in "desktop" mode.
+size: (1200, 870)
+compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
+// Next, we try it in "mobile" mode (max-width: 700px).
+size: (650, 650)
+compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
index 7f3172878bfb5f74325ee5b1a0f75db7143c30d1..5a151ed7b687a2ba8042dd1b9ffaa07617f6d8df 100644 (file)
@@ -170,3 +170,13 @@ pub trait Whitespace<Idx>
     type Output;
     fn index(&self, index: Idx) -> &Self::Output;
 }
+
+pub struct ItemInfoAlignmentTest;
+
+impl ItemInfoAlignmentTest {
+    /// This method has docs
+    #[deprecated]
+    pub fn foo() {}
+    #[deprecated]
+    pub fn bar() {}
+}