about summary refs log tree commit diff
path: root/src/librustdoc/html/static/css
diff options
context:
space:
mode:
authorWill Crichton <wcrichto@cs.stanford.edu>2022-12-07 10:24:16 -0800
committerWill Crichton <wcrichto@cs.stanford.edu>2022-12-07 10:42:09 -0800
commit9499d2cce3bebef96d8ae64442602f87726a875a (patch)
treeb4ffbfdb3873f76cb44e8dd69e06b3bc51919632 /src/librustdoc/html/static/css
parent8a459384ad02d120f1d1cc81166f95262c1d4fac (diff)
downloadrust-9499d2cce3bebef96d8ae64442602f87726a875a.tar.gz
rust-9499d2cce3bebef96d8ae64442602f87726a875a.zip
Improve calculation of scraped example minimized height
Diffstat (limited to 'src/librustdoc/html/static/css')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 6e5e293780d..afed3da9e91 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1931,18 +1931,24 @@ in storage.js
 }
 
 .scraped-example:not(.expanded) .code-wrapper {
-	max-height: 120px;
+	/* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
+	 * of lines shown in the un-expanded example code viewer. This pre needs to have
+	 * a max-height equal to line-height * N. The line-height is currently 1.5em,
+	 * and we include additional 10px for padding. */
+	 max-height: calc(1.5em * 5 + 10px);
 }
 
 .scraped-example:not(.expanded) .code-wrapper pre {
 	overflow-y: hidden;
-	max-height: 120px;
 	padding-bottom: 0;
+	/* See above comment, should be the same max-height. */
+	max-height: calc(1.5em * 5 + 10px);
 }
 
 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,
 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre {
-	max-height: 240px;
+	/* See above comment, except this height is based on HIDDEN_MAX_LINES. */
+	max-height: calc(1.5em * 10 + 10px);
 }
 
 .scraped-example .code-wrapper .next,