diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-02-05 05:05:05 -0800 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-02-08 03:09:10 -0800 |
| commit | dd5ff428edbc7cd4fa600b81f27bbec28589704f (patch) | |
| tree | 4338507acc1c942340cdc8dda26a240640d8db22 /src/test | |
| parent | 03b17b181af4945fa24e0df79676e89454546440 (diff) | |
| download | rust-dd5ff428edbc7cd4fa600b81f27bbec28589704f.tar.gz rust-dd5ff428edbc7cd4fa600b81f27bbec28589704f.zip | |
rustdoc: tweak line and ¶ spacing for a11y
The W3C Web Content Accessibility Guidelines specify a minimum line spacing of 1.5 and a minimum paragraph spacing of 1.5 times the line spacing. Our current line spacing (implemented by line-height) is 1.4, so it's a small bump to go up to 1.5. Similarly, we have a paragraph spacing of 0.6em. Bump that to 0.75em (which is 1.5 times the 0.5em distance between lines). Also, fix all the font sizes so instead of being round-ish numbers in rem (like 1.1rem, 1.2rem), they are round numbers in pixels. Ensure each font size is at least 2 pixels different than the nearest other font size, so distinctions can be clearly seen. Overall the font-sizes are mostly staying the same, being rounded up or down as appropriate. Remove a few unused styles. Simplify the display of the mobile-topbar location, by setting its margins to auto rather than trying to size it exactly to the topbar.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-gui/docblock-big-code-mobile.goml | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/headings.goml | 71 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/item-info-width.goml | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/mobile.goml | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/sidebar-source-code.goml | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/sidebar.goml | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/src-font-size.goml | 5 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/type-declation-overflow.goml | 4 |
8 files changed, 44 insertions, 46 deletions
diff --git a/src/test/rustdoc-gui/docblock-big-code-mobile.goml b/src/test/rustdoc-gui/docblock-big-code-mobile.goml index 12677a5648a..02f79f1fcd7 100644 --- a/src/test/rustdoc-gui/docblock-big-code-mobile.goml +++ b/src/test/rustdoc-gui/docblock-big-code-mobile.goml @@ -6,4 +6,4 @@ goto: file://|DOC_PATH|/test_docs/long_code_block/index.html show-text: true // We need to enable text draw to be able to have the "real" size // Little explanations for this test: if the text wasn't displayed on two lines, it would take // around 20px (which is the font size). -assert-property: (".docblock p > code", {"offsetHeight": "42"}) +assert-property: (".docblock p > code", {"offsetHeight": "44"}) diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml index 48e0156f1b8..8f126d98fe4 100644 --- a/src/test/rustdoc-gui/headings.goml +++ b/src/test/rustdoc-gui/headings.goml @@ -6,34 +6,33 @@ // Most of these sizes are set in CSS in `em` units, so here's a conversion chart based on our // default 16px font size: // 24px 1.5em -// 22.4px 1.4em -// 20.8px 1.3em -// 18.4px 1.15em -// 17.6px 1.1em -// 16px 1em -// 15.2px 0.95em +// 22px 1.375rem +// 20px 1.25rem +// 18px 1.125em +// 16px 1rem +// 14px 0.875rem goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html assert-css: ("h1.fqn", {"font-size": "24px"}) -assert-css: ("h2#top-doc-prose-title", {"font-size": "20.8px"}) +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) -assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "18.4px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) -assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "17.6px"}) +assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"}) assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"}) -assert-css: ("h2#fields", {"font-size": "22.4px"}) +assert-css: ("h2#fields", {"font-size": "22px"}) assert-css: ("h2#fields", {"border-bottom-width": "1px"}) -assert-css: ("h3#title-for-field", {"font-size": "20.8px"}) +assert-css: ("h3#title-for-field", {"font-size": "20px"}) assert-css: ("h3#title-for-field", {"border-bottom-width": "0px"}) assert-css: ("h4#sub-heading-for-field", {"font-size": "16px"}) assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"}) -assert-css: ("h2#implementations", {"font-size": "22.4px"}) +assert-css: ("h2#implementations", {"font-size": "22px"}) assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) -assert-css: ("#impl > h3.code-header", {"font-size": "17.6px"}) +assert-css: ("#impl > h3.code-header", {"font-size": "18px"}) assert-css: ("#impl > h3.code-header", {"border-bottom-width": "0px"}) assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"}) assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"}) @@ -42,27 +41,27 @@ assert-css: ("h4#title-for-struct-impl-doc", {"font-size": "16px"}) assert-css: ("h4#title-for-struct-impl-doc", {"border-bottom-width": "0px"}) assert-css: ("h5#sub-heading-for-struct-impl-doc", {"font-size": "16px"}) assert-css: ("h5#sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"font-size": "14px"}) assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"}) assert-css: ("h5#title-for-struct-impl-item-doc", {"font-size": "16px"}) assert-css: ("h5#title-for-struct-impl-item-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) goto: file://|DOC_PATH|/test_docs/enum.HeavilyDocumentedEnum.html assert-css: ("h1.fqn", {"font-size": "24px"}) -assert-css: ("h2#top-doc-prose-title", {"font-size": "20.8px"}) +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) -assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "18.4px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) -assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "17.6px"}) +assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"}) assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"}) -assert-css: ("h2#variants", {"font-size": "22.4px"}) +assert-css: ("h2#variants", {"font-size": "22px"}) assert-css: ("h2#variants", {"border-bottom-width": "1px"}) assert-css: ("h4#none-prose-title", {"font-size": "16px"}) @@ -77,18 +76,18 @@ assert-css: ("h5#wrapped-prose-sub-heading", {"border-bottom-width": "0px"}) assert-css: ("h5#wrapped0-prose-title", {"font-size": "16px"}) assert-css: ("h5#wrapped0-prose-title", {"border-bottom-width": "0px"}) -assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "15.2px"}) +assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "14px"}) assert-css: ("h6#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"}) assert-css: ("h5#structy-prose-title", {"font-size": "16px"}) assert-css: ("h5#structy-prose-title", {"border-bottom-width": "0px"}) -assert-css: ("h6#structy-prose-sub-heading", {"font-size": "15.2px"}) +assert-css: ("h6#structy-prose-sub-heading", {"font-size": "14px"}) assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"}) -assert-css: ("h2#implementations", {"font-size": "22.4px"}) +assert-css: ("h2#implementations", {"font-size": "22px"}) assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) -assert-css: ("#impl > h3.code-header", {"font-size": "17.6px"}) +assert-css: ("#impl > h3.code-header", {"font-size": "18px"}) assert-css: ("#impl > h3.code-header", {"border-bottom-width": "0px"}) assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"}) assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"}) @@ -97,14 +96,14 @@ assert-css: ("h4#title-for-enum-impl-doc", {"font-size": "16px"}) assert-css: ("h4#title-for-enum-impl-doc", {"border-bottom-width": "0px"}) assert-css: ("h5#sub-heading-for-enum-impl-doc", {"font-size": "16px"}) assert-css: ("h5#sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"font-size": "14px"}) assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"}) assert-css: ("h5#title-for-enum-impl-item-doc", {"font-size": "16px"}) assert-css: ("h5#title-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) assert-text: (".sidebar .others h3", "Modules") @@ -114,23 +113,23 @@ goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html assert-css: ("h1.fqn", {"font-size": "24px"}) -assert-css: ("h2#top-doc-prose-title", {"font-size": "20.8px"}) +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) -assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "18.4px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) -assert-css: ("h2#fields", {"font-size": "22.4px"}) +assert-css: ("h2#fields", {"font-size": "22px"}) assert-css: ("h2#fields", {"border-bottom-width": "1px"}) -assert-css: ("h3#title-for-union-variant", {"font-size": "20.8px"}) +assert-css: ("h3#title-for-union-variant", {"font-size": "20px"}) assert-css: ("h3#title-for-union-variant", {"border-bottom-width": "0px"}) assert-css: ("h4#sub-heading-for-union-variant", {"font-size": "16px"}) assert-css: ("h4#sub-heading-for-union-variant", {"border-bottom-width": "0px"}) -assert-css: ("h2#implementations", {"font-size": "22.4px"}) +assert-css: ("h2#implementations", {"font-size": "22px"}) assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) -assert-css: ("#impl > h3.code-header", {"font-size": "17.6px"}) +assert-css: ("#impl > h3.code-header", {"font-size": "18px"}) assert-css: ("#impl > h3.code-header", {"border-bottom-width": "0px"}) assert-css: ("h4#title-for-union-impl-doc", {"font-size": "16px"}) assert-css: ("h4#title-for-union-impl-doc", {"border-bottom-width": "0px"}) @@ -139,16 +138,16 @@ assert-css: ("h5#sub-heading-for-union-impl-doc", {"border-bottom-width": "0px"} assert-css: ("h5#title-for-union-impl-item-doc", {"font-size": "16px"}) assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"}) -assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "15.2px"}) +assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"}) goto: file://|DOC_PATH|/test_docs/macro.heavily_documented_macro.html assert-css: ("h1.fqn", {"font-size": "24px"}) -assert-css: ("h2#top-doc-prose-title", {"font-size": "20.8px"}) +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) -assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "18.4px"}) +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 diff --git a/src/test/rustdoc-gui/item-info-width.goml b/src/test/rustdoc-gui/item-info-width.goml index 1c4cf4ddf87..7a32d902910 100644 --- a/src/test/rustdoc-gui/item-info-width.goml +++ b/src/test/rustdoc-gui/item-info-width.goml @@ -4,5 +4,5 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html size: (1100, 800) // We check that ".item-info" is bigger than its content. assert-css: (".item-info", {"width": "790px"}) -assert-css: (".item-info .stab", {"width": "341px"}) +assert-css: (".item-info .stab", {"width": "340px"}) assert-position: (".item-info .stab", {"x": 295}) diff --git a/src/test/rustdoc-gui/mobile.goml b/src/test/rustdoc-gui/mobile.goml index 2e44dd32d45..e70abcb83cf 100644 --- a/src/test/rustdoc-gui/mobile.goml +++ b/src/test/rustdoc-gui/mobile.goml @@ -11,7 +11,7 @@ assert-css: (".main-heading", { "flex-direction": "column" }) -assert-property: (".mobile-topbar h2.location", {"offsetHeight": 48}) +assert-property: (".mobile-topbar h2.location", {"offsetHeight": 36}) // Note: We can't use assert-text here because the 'Since' is set by CSS and // is therefore not part of the DOM. diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml index 1c5eb9239ba..0cb8e776385 100644 --- a/src/test/rustdoc-gui/sidebar-source-code.goml +++ b/src/test/rustdoc-gui/sidebar-source-code.goml @@ -10,7 +10,7 @@ click: (10, 10) // We wait for the sidebar to be expanded (there is a 0.5s animation). wait-for: 600 assert-css: ("nav.sidebar.expanded", {"width": "300px"}) -assert-css: ("nav.sidebar.expanded a", {"font-size": "14.4px"}) +assert-css: ("nav.sidebar.expanded a", {"font-size": "14px"}) // We collapse the sidebar. click: (10, 10) // We wait for the sidebar to be collapsed (there is a 0.5s animation). diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index 877cc61b66f..9505e00512f 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -77,7 +77,7 @@ assert-text: ("#functions + .item-table .item-left > a", "foo") // Links to trait implementations in the sidebar should not wrap even if they are long. goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html -assert-property: (".sidebar-links a", {"offsetHeight": 30}) +assert-property: (".sidebar-links a", {"offsetHeight": 29}) // Test that clicking on of the "In <module>" headings in the sidebar links to the // appropriate anchor in index.html. diff --git a/src/test/rustdoc-gui/src-font-size.goml b/src/test/rustdoc-gui/src-font-size.goml index b0b2f122afd..0c01e254554 100644 --- a/src/test/rustdoc-gui/src-font-size.goml +++ b/src/test/rustdoc-gui/src-font-size.goml @@ -4,9 +4,8 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html show-text: true // Check the impl headers. -assert-css: (".impl.has-srclink .srclink", {"font-size": "17px"}, ALL) -// The ".6" part is because the font-size is actually "1.1em". -assert-css: (".impl.has-srclink .code-header.in-band", {"font-size": "17.6px"}, ALL) +assert-css: (".impl.has-srclink .srclink", {"font-size": "16px"}, ALL) +assert-css: (".impl.has-srclink .code-header.in-band", {"font-size": "18px"}, ALL) // Check the impl items. assert-css: (".impl-items .has-srclink .srclink", {"font-size": "16px"}, ALL) assert-css: (".impl-items .has-srclink .code-header", {"font-size": "16px"}, ALL) diff --git a/src/test/rustdoc-gui/type-declation-overflow.goml b/src/test/rustdoc-gui/type-declation-overflow.goml index d4142511e43..22212a31728 100644 --- a/src/test/rustdoc-gui/type-declation-overflow.goml +++ b/src/test/rustdoc-gui/type-declation-overflow.goml @@ -32,6 +32,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "950"}) size: (600, 600) goto: file://|DOC_PATH|/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html // It shouldn't have an overflow in the topbar either. -assert-property: (".mobile-topbar .location", {"scrollWidth": "493"}) -assert-property: (".mobile-topbar .location", {"clientWidth": "493"}) +assert-property: (".mobile-topbar .location", {"scrollWidth": "492"}) +assert-property: (".mobile-topbar .location", {"clientWidth": "492"}) assert-css: (".mobile-topbar .location", {"overflow-x": "hidden"}) |
