From 4df8e78a59bba8811d7614f170fd032c9f20281a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Jul 2022 15:00:43 +0200 Subject: [PATCH 1/3] Fix invalid css property value --- src/librustdoc/html/static/css/rustdoc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 70b7a47bcd58b..68f8de15ba287 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -652,7 +652,7 @@ h2.location a { } .top-doc .docblock h2 { font-size: 1.375rem; } -.top-doc .docblock h3 { font-size: 1.25; } +.top-doc .docblock h3 { font-size: 1.25rem; } .top-doc .docblock h4, .top-doc .docblock h5 { font-size: 1.125rem; From 88b137d5fe0cbe28dab4f9af61045c726f831872 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Jul 2022 15:36:27 +0200 Subject: [PATCH 2/3] Fix headings border --- src/librustdoc/html/static/css/rustdoc.css | 2 +- src/librustdoc/html/static/css/themes/dark.css | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 68f8de15ba287..0b9a16c57347b 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -167,7 +167,7 @@ h2, h3, h4 { h2, .top-doc .docblock > h3, .top-doc .docblock > h4 { - border-bottom: 1px solid; + border-bottom: 1px solid var(--headings-border-bottom-color); } h3.code-header { font-size: 1.125rem; /* 18px */ diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 8e753f5768206..1ded3730e848d 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -42,10 +42,6 @@ input:focus + .slider { background-color: #0a042f !important; } -.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5, .docblock h6 { - border-bottom-color: #DDD; -} - .docblock table td, .docblock table th { border-color: #ddd; } From bff43d0e37c5299152c61d6ad959860dcd1ec15d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 27 Jul 2022 15:36:43 +0200 Subject: [PATCH 3/3] Add GUI tests for headings border and text color --- src/test/rustdoc-gui/docblock-details.goml | 4 +- src/test/rustdoc-gui/headings.goml | 100 ++++++++++++++++++++- src/test/rustdoc-gui/src/test_docs/lib.rs | 4 + 3 files changed, 103 insertions(+), 5 deletions(-) diff --git a/src/test/rustdoc-gui/docblock-details.goml b/src/test/rustdoc-gui/docblock-details.goml index 2edbf1e4e2d8c..f6287ade2f295 100644 --- a/src/test/rustdoc-gui/docblock-details.goml +++ b/src/test/rustdoc-gui/docblock-details.goml @@ -9,12 +9,12 @@ reload: assert-text: (".top-doc .docblock > h3", "Hello") assert-css: ( ".top-doc .docblock > h3", - {"border-bottom": "1px solid rgb(221, 221, 221)"}, + {"border-bottom": "1px solid rgb(210, 210, 210)"}, ) // We now check that the `` doesn't have a bottom border and has the correct display. assert-css: ( ".top-doc .docblock summary h4", - {"border-bottom": "0px none rgb(221, 221, 221)"}, + {"border-bottom": "0px none rgb(210, 210, 210)"}, ) // This allows to ensure that summary is on one line only! assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"}) diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml index cc3dd61e99a7a..8c2c3df1588f5 100644 --- a/src/test/rustdoc-gui/headings.goml +++ b/src/test/rustdoc-gui/headings.goml @@ -150,15 +150,109 @@ assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) -goto: file://|DOC_PATH|/staged_api/struct.Foo.html +// Checking colors now. show-text: true local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"}, +) +assert-css: ( + ".top-doc .docblock h3", + {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"}, +) +assert-css: ( + ".top-doc .docblock h4", + {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"}, +) +assert-css: ( + ".top-doc .docblock h5", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) +assert-css: ( + "#implementations-list .docblock h4", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) +assert-css: ( + "#implementations-list .docblock h5", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) +assert-css: ( + "#implementations-list .docblock h6", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) + +local-storage: {"rustdoc-theme": "dark"} +reload: +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"}, +) +assert-css: ( + ".top-doc .docblock h3", + {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"}, +) +assert-css: ( + ".top-doc .docblock h4", + {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"}, +) +assert-css: ( + ".top-doc .docblock h5", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) +assert-css: ( + "#implementations-list .docblock h4", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) +assert-css: ( + "#implementations-list .docblock h5", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) +assert-css: ( + "#implementations-list .docblock h6", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) + +local-storage: {"rustdoc-theme": "ayu"} +reload: +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"}, +) +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"}, +) +assert-css: ( + ".top-doc .docblock h4", + {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"}, +) +assert-css: ( + ".top-doc .docblock h5", + {"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) +assert-css: ( + "#implementations-list .docblock h4", + {"color": "rgb(255, 255, 255)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) +assert-css: ( + "#implementations-list .docblock h5", + {"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) +assert-css: ( + "#implementations-list .docblock h6", + {"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) + +local-storage: {"rustdoc-theme": "light"} +goto: file://|DOC_PATH|/staged_api/struct.Foo.html assert-css: (".since", {"color": "rgb(128, 128, 128)"}) -local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +local-storage: {"rustdoc-theme": "dark"} reload: assert-css: (".since", {"color": "rgb(128, 128, 128)"}) -local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"} +local-storage: {"rustdoc-theme": "ayu"} reload: assert-css: (".since", {"color": "rgb(128, 128, 128)"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index aa2f78289bea2..1b26aaecb5ef3 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -146,6 +146,10 @@ pub use crate::repro as repro2; /// ### Top-doc Prose sub-sub-heading /// /// Text below sub-sub-heading +/// +/// #### You know the drill. +/// +/// More text. pub struct HeavilyDocumentedStruct { /// # Title for field /// ## Sub-heading for field