diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index cc69a2c4dada0..27496381b2ce0 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -2215,7 +2215,7 @@ details.toggle:not([open]) > summary .docblock { overflow-y: hidden; } details.toggle:not([open]) > summary .docblock > :first-child { - max-width: calc(100% - 1em); + max-width: 100%; overflow: hidden; width: fit-content; white-space: nowrap; @@ -2230,10 +2230,15 @@ details.toggle:not([open]) > summary .docblock > :first-child::after { bottom: 0; z-index: 1; background-color: var(--main-background-color); - /* In case this ends up in a heading or a `` item. */ - font-weight: normal; font: 1rem/1.5 "Source Serif 4", NanumBarunGothic, serif; + /* To make it look a bit better and not have it stuck to the preceding element. */ + padding-left: 0.2em; } +details.toggle:not([open]) > summary .docblock > div:first-child::after { + /* This is to make the "..." always appear at the bottom. */ + padding-top: calc(1.5em + 0.75em - 1.2rem); +} + details.toggle > summary .docblock { margin-top: 0.75em; } diff --git a/tests/rustdoc-gui/impl-block-doc.goml b/tests/rustdoc-gui/impl-block-doc.goml index 6c7d7f4cbc185..906ce1a37c6fe 100644 --- a/tests/rustdoc-gui/impl-block-doc.goml +++ b/tests/rustdoc-gui/impl-block-doc.goml @@ -31,3 +31,12 @@ assert: (|impl_y| + |impl_height|) <= (|doc_y| + |doc_height|) call-function: ("compare-size-and-pos", {"nth_impl": 2}) // The second impl block has a short line. assert: (|impl_y| + |impl_height|) >= (|doc_y| + |doc_height|) + +// FIXME: Needs `if` condition to make this test check that `padding-top` on the "..." element +// is as expected for tables. +call-function: ("compare-size-and-pos", {"nth_impl": 3}) +assert: (|impl_y| + |impl_height|) >= (|doc_y| + |doc_height|) +call-function: ("compare-size-and-pos", {"nth_impl": 4}) +assert: (|impl_y| + |impl_height|) >= (|doc_y| + |doc_height|) +call-function: ("compare-size-and-pos", {"nth_impl": 5}) +assert: (|impl_y| + |impl_height|) >= (|doc_y| + |doc_height|) diff --git a/tests/rustdoc-gui/source-code-page-code-scroll.goml b/tests/rustdoc-gui/source-code-page-code-scroll.goml index 31ab281d6ce09..60012db6c8c8b 100644 --- a/tests/rustdoc-gui/source-code-page-code-scroll.goml +++ b/tests/rustdoc-gui/source-code-page-code-scroll.goml @@ -2,7 +2,7 @@ go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" set-window-size: (800, 1000) // "scrollWidth" should be superior than "clientWidth". -assert-property: ("body", {"scrollWidth": 1114, "clientWidth": 800}) +assert-property: ("body", {"scrollWidth": 1776, "clientWidth": 800}) // Both properties should be equal (ie, no scroll on the code block). -assert-property: (".example-wrap .rust", {"scrollWidth": 1000, "clientWidth": 1000}) +assert-property: (".example-wrap .rust", {"scrollWidth": 1662, "clientWidth": 1662}) diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index bdb958bf0e1b4..91aa2c3fae54a 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -669,3 +669,25 @@ impl ImplDoc { impl ImplDoc { pub fn bar2() {} } + +// ignore-tidy-linelength +/// | this::is::a::kinda::very::long::header::number::one | this::is::a::kinda::very::long::header::number::two | this::is::a::kinda::very::long::header::number::three | +/// |-|-|-| +/// | bla | bli | blob | +impl ImplDoc { + pub fn bar3() {} +} + +/// # h1 +/// +/// bla +impl ImplDoc { + pub fn bar4() {} +} + +/// * list +/// * list +/// * list +impl ImplDoc { + pub fn bar5() {} +}