From 7157f98cb481766873306238185fb5d4522a903a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 3 Sep 2024 22:17:04 +0200 Subject: [PATCH] Fix square corners on line numbers when code is collapsed --- src/librustdoc/html/static/css/rustdoc.css | 6 ++++-- .../rustdoc-gui/docblock-code-block-line-number.goml | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b69689cfb68..c2b3d65b2f9 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -746,7 +746,8 @@ ul.block, .block li { } .rustdoc .example-wrap > pre, -.rustdoc .scraped-example .src-line-numbers { +.rustdoc .scraped-example .src-line-numbers, +.rustdoc .scraped-example .src-line-numbers > pre { border-radius: 6px; } @@ -755,7 +756,8 @@ If the code example line numbers are displayed, there will be a weird radius in both the code example and the line numbers, so we need to remove the radius in this case. */ .rustdoc .example-wrap > .example-line-numbers, -.rustdoc .scraped-example .src-line-numbers { +.rustdoc .scraped-example .src-line-numbers, +.rustdoc .scraped-example .src-line-numbers > pre { border-top-right-radius: 0; border-bottom-right-radius: 0; } diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index 71ef041c684..03f8f80b10d 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -108,6 +108,17 @@ assert-local-storage: {"rustdoc-line-numbers": "true" } // Same check with scraped examples line numbers. go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +assert-css: ( + ".scraped-example .src-line-numbers > pre", + { + // There should not be a radius on the right of the line numbers. + "border-top-left-radius": "6px", + "border-bottom-left-radius": "6px", + "border-top-right-radius": "0px", + "border-bottom-right-radius": "0px", + }, + ALL, +) assert-css: ( ".scraped-example .src-line-numbers", {