Improve positioning of "..." in collapsed impl block

This commit is contained in:
Guillaume Gomez 2024-11-19 22:11:28 +01:00
parent 448d9adc38
commit 90feb9a645
4 changed files with 41 additions and 5 deletions

View file

@ -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 `<code>` 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;
}

View file

@ -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|)

View file

@ -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})

View file

@ -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() {}
}