From 542ab2daa6eb4b05a01403114783aa323315b416 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Thu, 21 Oct 2021 18:46:47 -0700 Subject: [PATCH] Outdent method headings so they stand out The makes the heading / documentation distinction clearer. --- src/librustdoc/html/static/css/rustdoc.css | 28 ++++++++-------------- src/test/rustdoc-gui/anchor-navigable.goml | 11 +++++++++ 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 src/test/rustdoc-gui/anchor-navigable.goml diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index e41c993a5285d..8336f4c1859dc 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -152,10 +152,15 @@ h1.fqn > .in-band > a:hover { h2, h3, h4 { border-bottom: 1px solid; } -h3.code-header, h4.code-header { +h3.code-header { + font-size: 1.1em; +} +h4.code-header { font-size: 1em; +} +h3.code-header, h4.code-header { font-weight: 600; - border: none; + border-bottom-style: none; padding: 0; margin: 0; } @@ -174,12 +179,6 @@ h3.code-header, h4.code-header { margin-bottom: 10px; position: relative; } -.impl, .method.trait-impl, -.type.trait-impl, -.associatedconstant.trait-impl, -.associatedtype.trait-impl { - padding-left: 15px; -} div.impl-items > div { padding-left: 0; @@ -669,13 +668,6 @@ nav.sub { left: -19px; } -.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant, -.impl-items > .associatedtype, .content .impl-items details > summary > .type, -.impl-items details > summary > .associatedconstant, -.impl-items details > summary > .associatedtype { - margin-left: 20px; -} - .content .impl-items .docblock, .content .impl-items .item-info { margin-bottom: .6em; } @@ -746,7 +738,7 @@ a { .anchor { display: none; position: absolute; - left: 0; + left: -0.5em; background: none !important; } .anchor.field { @@ -1579,14 +1571,14 @@ details.rustdoc-toggle > summary.hideme::before { details.rustdoc-toggle > summary:not(.hideme)::before { position: absolute; - left: -23px; + left: -24px; top: 3px; } .impl-items > details.rustdoc-toggle > summary:not(.hideme)::before, .undocumented > details.rustdoc-toggle > summary:not(.hideme)::before { position: absolute; - left: -2px; + left: -24px; } /* When a "hideme" summary is open and the "Expand description" or "Show diff --git a/src/test/rustdoc-gui/anchor-navigable.goml b/src/test/rustdoc-gui/anchor-navigable.goml new file mode 100644 index 0000000000000..424c312233b5d --- /dev/null +++ b/src/test/rustdoc-gui/anchor-navigable.goml @@ -0,0 +1,11 @@ +// The `impl Foo` heading underneath `Implementations` has a ยง +// anchor to its left (used for linking to that heading). The anchor only shows +// up when hovering the `impl Foo`. This test ensures there's no gap between the +// anchor and the `impl Foo`. If there were a gap, this would cause an annoying +// problem: you hover `impl Foo` to see the anchor, then when you move your +// mouse to the left, the anchor disappears before you reach it. +goto: file://|DOC_PATH|/test_docs/struct.Foo.html +// We check that ".item-info" is bigger than its content. +move-cursor-to: ".impl" +assert-property: (".impl > a.anchor", {"offsetWidth": "9"}) +assert-css: (".impl > a.anchor", {"left": "-8px"})