about summary refs log tree commit diff
path: root/src/librustdoc/html/static
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-03-20 19:02:25 -0700
committerManish Goregaokar <manishsmail@gmail.com>2021-04-12 08:45:45 -0700
commit71c52acf32efb48975edb86a1cef1df810f60c45 (patch)
tree543f4b7e4050a60f67576fec2ee636f6139a83e9 /src/librustdoc/html/static
parentc96f86de3026f864e78397aff9097e885f2f8fdf (diff)
downloadrust-71c52acf32efb48975edb86a1cef1df810f60c45.tar.gz
rust-71c52acf32efb48975edb86a1cef1df810f60c45.zip
rustdoc: hide variants of enums > 5
Diffstat (limited to 'src/librustdoc/html/static')
-rw-r--r--src/librustdoc/html/static/main.js4
-rw-r--r--src/librustdoc/html/static/rustdoc.css13
2 files changed, 10 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 0abfe18a19f..f112a113adc 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2703,6 +2703,10 @@ function hideThemeButtonState() {
                         }
                     });
                 }
+            } else if (hasClass(e, "type-contents-toggle")) {
+                let text = e.getAttribute("data-toggle-text");
+                let tog = createToggle(toggle, `Show ${text}`, null, "", true);
+                e.parentNode.insertBefore(tog,  e);
             }
             if (e.parentNode.id === "main") {
                 var otherMessage = "";
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 585b7459bd7..3a171a1d652 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -970,6 +970,10 @@ a.test-arrow:hover{
 	position: absolute;
 	left: -23px;
 	top: 0;
+
+	/* The click event for this is defined on the document,
+	   so bubbling does not work. See https://github.com/rust-lang/rust/issues/83332 */
+	z-index: 10;
 }
 
 h3 > .collapse-toggle, h4 > .collapse-toggle {
@@ -1054,10 +1058,9 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
 	margin-top: 3px;
 }
 
+/* for enum and struct fields */
 .enum > .toggle-wrapper + .docblock, .struct > .toggle-wrapper + .docblock {
-	margin-left: 30px;
-	margin-bottom: 20px;
-	margin-top: 5px;
+	margin-left: 0px;
 }
 
 .docblock > .section-header:first-child {
@@ -1069,10 +1072,6 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
 	left: -10px;
 }
 
-.enum > .collapsed, .struct > .collapsed {
-	margin-bottom: 25px;
-}
-
 #main > .variant, #main > .structfield {
 	display: block;
 }