From 7cfbe23bc8d4534e31731724075e8c46d8dcee5d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 28 Oct 2024 11:06:45 +0100 Subject: [PATCH 1/2] Unify variant struct fields margins with struct fields --- 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 97e8b8f5b5f4a..1042d254749e3 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -230,7 +230,7 @@ h4.code-header { padding: 0; white-space: pre-wrap; } -.structfield { +.structfield, .sub-variant-field { margin: 0.6em 0; } From 26b6ccdbd775cc9b81af5aeacdd95073febf5cbe Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 28 Oct 2024 11:16:38 +0100 Subject: [PATCH 2/2] Add GUI regression test for variant structfields margins --- tests/rustdoc-gui/fields.goml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/rustdoc-gui/fields.goml b/tests/rustdoc-gui/fields.goml index 5d13d7be2f972..dce9918c33242 100644 --- a/tests/rustdoc-gui/fields.goml +++ b/tests/rustdoc-gui/fields.goml @@ -1,6 +1,7 @@ // This test checks that fields are displayed as expected (one by line) and they are surrounded // by margins. +store-value: (margin, "9.6px") define-function: ( "check-fields", [path, selector_1, selector_2], @@ -12,8 +13,8 @@ define-function: ( // Check the margins. assert-css: (".structfield.section-header", { - "margin-top": "9.6px", - "margin-bottom": "9.6px", + "margin-top": |margin|, + "margin-bottom": |margin|, "margin-left": "0px", "margin-right": "0px", }, ALL) @@ -41,9 +42,9 @@ store-position: ("#variant\.B\.field\.b", {"y": b_y}) assert: |a_y| < |b_y| // Check the margins. -assert-css: (".sub-variant-field .section-header", { - "margin-top": "0px", - "margin-bottom": "0px", - "margin-left": "0px", +assert-css: (".sub-variant-field", { + "margin-top": |margin|, + "margin-bottom": |margin|, + "margin-left": "24px", "margin-right": "0px", }, ALL)