about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2023-01-14rustdoc: simplify JS search routine by not messing with lev distanceMichael Howell-50/+64
Since the sorting function accounts for an `index` field, there's not much reason to also be applying changes to the levenshtein distance. Instead, we can just not treat `lev` as a filter if there's already a non-sentinel value for `index`. This change gives slightly more weight to the index and path part, as search criteria, than it used to. This changes some of the test cases, but not in any obviously-"worse" way, and, in particular, substring matches are a bigger deal than levenshtein distances (we're assuming that a typo is less likely than someone just not typing the entire name). Based on https://github.com/rust-lang/rust/pull/103710#issuecomment-1296894296
2023-01-14rustdoc: remove redundant item kind class from `.item-decl > pre`Michael Howell-16/+16
This class originated in the very first commit of `rustdoc_ng`, and was used to add a color border around the item decl based on its kind. https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L102-L106 The item decl no longer has a border, and there aren't any kind-specific styles in modern rustdoc's rendering of this UI item. Most of this commit is updating test cases so that they use `item-decl` to find the `<pre>` tag instead of relying on the fact that the class name had `rust {kind}` in it while other `<pre>` tags only had class `rust`.
2023-01-14Rollup merge of #106855 - klensy:rd-s, r=notriddleMatthias Krüger-24/+28
rustdoc: few small cleanups
2023-01-14Rollup merge of #106828 - notriddle:notriddle/notable-trait-docblock, ↵Matthias Krüger-4/+8
r=GuillaumeGomez rustdoc: remove `docblock` class from notable trait popover This commit builds on b72de9be74dd5ac1d8b23d5ece03a7690274a14c, which removes the `docblock` class from the All Items page, and 9457380ac902db3febf92077c5b645db55998ad4, which removes the `docblock` class from the item decl. Fixes #92974
2023-01-14Rollup merge of #106819 - notriddle:notriddle/rm-h1-fqn, r=GuillaumeGomezYuki Okushi-8/+8
rustdoc: remove unnecessary DOM class `h1.fqn` It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-13rustdoc: remove `docblock` class from notable trait popoverMichael Howell-4/+8
This commit builds on b72de9be74dd5ac1d8b23d5ece03a7690274a14c, which removes the `docblock` class from the All Items page, and 9457380ac902db3febf92077c5b645db55998ad4, which removes the `docblock` class from the item decl. Fixes #92974
2023-01-13rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggleMichael Howell-56/+56
This swaps things around so that the class that gets used more often has the shorter name.
2023-01-13rustdoc: remove unnecessary DOM class `h1.fqn`Michael Howell-8/+8
It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-13CrateData: don't allocate String when Serialize, &str is enoughklensy-1/+1
2023-01-13Playground.crate_name String -> Symbolklensy-6/+5
2023-01-13fmt_type: don't alloc const String, use &str insteadklensy-1/+1
2023-01-13generate_macro_def_id_path: don't eagerly stringify Symbolsklensy-7/+12
2023-01-13IndexItem.name String -> Symbolklensy-5/+5
2023-01-13evade clonesklensy-4/+4
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-1/+1
2023-01-11Rollup merge of #106690 - GuillaumeGomez:item-declaration-scrolling, r=notriddleYuki Okushi-0/+4
Fix scrolling for item declaration block Fixes https://github.com/rust-lang/rust/issues/105580. The `contain: layout` was the issue here and the bug was actually on both mobile and desktop. r? `@notriddle`
2023-01-11Rollup merge of #106628 - GuillaumeGomez:rm-itemid-primitive, r=notriddleYuki Okushi-20/+55
Remove unneeded ItemId::Primitive variant As I mentioned [here](https://github.com/rust-lang/rust/pull/106412#issuecomment-1371405115), I wondered if `ItemId::Primitive` was actually used for anything. Apparently, it seems so because removing it led to no changes as far as I and tests could see. r? `@notriddle`
2023-01-10Remove unneeded ItemId::Primitive variantGuillaume Gomez-20/+55
2023-01-10Fix scrolling for item declaration blockGuillaume Gomez-0/+4
2023-01-09rustdoc: merge common CSS for `a`Michael Howell-4/+1
2023-01-07Rollup merge of #106556 - notriddle:notriddle/margin-left-content-mobile, ↵Matthias Krüger-4/+0
r=GuillaumeGomez rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }` This rule was added to override non-zero left margin on `.content`, which was removed in 135281ed1525db15edd8ebd092aa10aa40df2386 and the margin-left was put on the docblock.
2023-01-06Rollup merge of #106543 - notriddle:notriddle/source-sidebar-width-zero, ↵Michael Goulet-5/+1
r=GuillaumeGomez rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }` This CSS was added in dc2c9723343c985740be09919236a6e96c4e4433, before 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c when the sidebars were merged. Now that they are merged, the source sidebar is being pushed off-screen anyway, so giving it zero width doesn't do much.
2023-01-06rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`Michael Howell-4/+0
This rule was added to override non-zero left margin on `.content`, which was removed in 135281ed1525db15edd8ebd092aa10aa40df2386 and the margin-left was put on the docblock.
2023-01-06Rollup merge of #106466 - clubby789:relative-module-fix, r=notriddleMatthias Krüger-41/+103
Fix rustdoc source code rendering for `#[path = "../path/to/mod.rs"]` links Fixes #103517 While generating the location for modules source HTML to be saved at, a `..` path component appeared to be translated to `/up/`. Additionally, while generating the navigation sidebar, `..` path components were ignored. This means that (as in the issue above), a *real* directory structure of: ``` sys/ unix/ mod.rs <-- contains #![path = "../unix/mod.rs] cmath.rs ``` was rendered as: ``` sys/ unix/ mod.rs unix/ cmath.rs <-- links to sys/unix/unix/cmath.rs.html, 404 ``` While the *files* were stored as ``` sys/ unix/ mod.rs.html up/ unix/ cmath.rs.html ```
2023-01-06rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }`Michael Howell-5/+1
This CSS was added in dc2c9723343c985740be09919236a6e96c4e4433, before 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c when the sidebars were merged. Now that they are merged, the source sidebar is being pushed off-screen anyway, so giving it zero width doesn't do much.
2023-01-06Correctly render sidebar for relative module pathsclubby789-41/+103
2023-01-06Rollup merge of #106502 - notriddle:notriddle/user-select, r=GuillaumeGomezDylan DPC-2/+0
rustdoc: remove legacy user-select CSS According to [caniuse], the only supported browser that requires the vendor prefix, as defined in [RFC 1985], is Safari. * The last version of Chrome that required a vendor prefix was version 53. The current version is 108. * Firefox 68 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102. * The current version of Safari for Mac and iOS still requires a prefix. * The last version of Edge that required a vendor frefix was 18. The current version of Edge is 108. * UCAndroid support is unknown, but if it still requires a vendor prefix, it's more likely to be `-webkit-` than `-moz-` or `-ms-`, since they would want to emulate iOS for compatibility. [caniuse]: https://caniuse.com/?search=user-select [RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html [current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-05rustdoc: remove legacy user-select CSSMichael Howell-2/+0
According to [caniuse], the only supported browser that requires the vendor prefix, as defined in [RFC 1985], is Safari. * The last version of Chrome that required a vendor prefix was version 53. The current version is 108. * Firefox 68 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102. * The current version of Safari for Mac and iOS still requires a prefix. * The last version of Edge that required a vendor frefix was 18. The current version of Edge is 108. * UCAndroid support is unknown, but if it still requires a vendor prefix, it's more likely to be `-webkit-` than `-moz-` or `-ms-`, since they would want to emulate iOS for compatibility. [caniuse]: https://caniuse.com/?search=user-select [RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html [current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-05Auto merge of #106487 - GuillaumeGomez:fix-kbd-var, r=notriddlebors-1/+1
Fix --kbd-color variable name in rustdoc.css Interestingly enough, it only impacted the dark theme. Before: ![Screenshot from 2023-01-05 11-03-17](https://user-images.githubusercontent.com/3050060/210754145-c3bb0f50-d35f-4543-bf73-010a4524a803.png) After: ![Screenshot from 2023-01-05 11-03-05](https://user-images.githubusercontent.com/3050060/210754190-85c2f146-a774-4463-9cd3-9495b7c91bd7.png) r? `@notriddle`
2023-01-05Fix --kbd-color variable name in rustdoc.cssGuillaume Gomez-1/+1
2023-01-04Rollup merge of #106462 - notriddle:notriddle/logo-container-sidebar, ↵Michael Goulet-18/+15
r=GuillaumeGomez rustdoc: remove unnecessary wrapper around sidebar and mobile logos This commit changes `.sidebar a:hover:not(.logo-container)` to add the `:not()` pseudo-class, retaining the old appearance of the logo when mousing over it. This didn't used to be necessary because the `a.sidebar-logo` was `display:inline`, and was what got the `background` changed on hover, while the `div.logo-container` inside it was `display:block`. This resulted in the hover rule not having any effect, because the logo-container box was not actually nested inside the sidebar-logo box: https://www.w3.org/TR/CSS2/visuren.html#anonymous-block-level > When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes (even if either side is empty), one on each side of the block-level box(es). The line boxes before the break and after the break are enclosed in anonymous block boxes, and the block-level box becomes a sibling of those anonymous boxes. When such an inline box is affected by relative positioning, any resulting translation also affects the block-level box contained in the inline box.
2023-01-04Rollup merge of #106437 - notriddle:notriddle/http-url, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: fix buggy JS check for absolute URL The old code did the wrong thing when faced with a crate named "http".
2023-01-04Rollup merge of #106391 - ardislu:fix-popover-child-link, r=GuillaumeGomezMatthias Krüger-3/+0
rustdoc: allow popover child links to work No need to prevent default click behavior on a `<div>`, it will also disable all child click behavior. Closes #106390
2023-01-04rustdoc: remove unnecessary wrapper around sidebar and mobile logosMichael Howell-18/+15
This commit changes `.sidebar a:hover:not(.logo-container)` to add the `:not()` pseudo-class, retaining the old appearance of the logo when mousing over it. This didn't used to be necessary because the `a.sidebar-logo` was `display:inline`, and was what got the `background` changed on hover, while the `div.logo-container` inside it was `display:block`. This resulted in the hover rule not having any effect, because the logo-container box was not actually nested inside the sidebar-logo box: https://www.w3.org/TR/CSS2/visuren.html#anonymous-block-level > When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes (even if either side is empty), one on each side of the block-level box(es). The line boxes before the break and after the break are enclosed in anonymous block boxes, and the block-level box becomes a sibling of those anonymous boxes. When such an inline box is affected by relative positioning, any resulting translation also affects the block-level box contained in the inline box.
2023-01-03rustdoc: fix buggy JS check for absolute URLMichael Howell-1/+1
The old code did the wrong thing when faced with a crate named "http".
2023-01-03Rollup merge of #106411 - notriddle:notriddle/font-feature-settings, ↵Michael Goulet-4/+0
r=GuillaumeGomez rustdoc: remove legacy font-feature-settings CSS According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985]. * The last version of Chrome that required a vendor prefix was version 47. The current version is 108. * Firefox 33 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102. * The last version of Safari that required a vendor prefix was version 9.1. The current version is 16. * The last version of Safari/iOS that required a vendor prefix was version 9.3. The current version is 16. * Edge never required vendor prefixes. * UCAndroid never required vendor prefixes. [caniuse]: https://caniuse.com/?search=font-feature-settings [RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html [current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-03rustdoc: remove legacy font-feature-settings CSSMichael Howell-4/+0
According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985]. * The last version of Chrome that required a vendor prefix was version 47. The current version is 108. * Firefox 33 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102. * The last version of Safari that required a vendor prefix was version 9.1. The current version is 16. * The last version of Safari/iOS that required a vendor prefix was version 9.3. The current version is 16. * Edge never required vendor prefixes. * UCAndroid never required vendor prefixes. [caniuse]: https://caniuse.com/?search=font-feature-settings [RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html [current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-03Rollup merge of #106388 - notriddle:notriddle/box-sizing, r=camelidMatthias Krüger-2/+0
rustdoc: remove legacy box-sizing CSS According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985] * The last version of Chrome that required a vendor prefix was version 9. The current version is 108. * Firefox 28 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102. * The last version of Safari that required a vendor prefix was version 5. The current version is 16. * The last version of Safari/iOS that required a vendor prefix was version 4. The current version is 16. * Edge never required vendor prefixes. * UCAndroid never required vendor prefixes. [caniuse]: https://caniuse.com/?search=box-sizing [RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html [current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-03clean: Remove `ctor_kind` from `VariantStruct`.Nixon Enraght-Moony-10/+1
It's always `None`.
2023-01-02rustdoc: allow popover child links to workArdis Lu-3/+0
No need to prevent default click behavior on a <div>, it will also disable all child click behavior.
2023-01-02Rollup merge of #106354 - aDotInTheVoid:rdj-always-discr, r=GuillaumeGomezMichael Goulet-17/+20
Rustdoc-Json: Report discriminant on all kinds of enum variant. Closes https://github.com/rust-lang/rust/issues/106299 Probably easier to review one commit at a time. r? `@GuillaumeGomez`
2023-01-02rustdoc: remove legacy box-sizing CSSMichael Howell-2/+0
According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985] * The last version of Chrome that required a vendor prefix was version 9. The current version is 108. * Firefox 28 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102. * The last version of Safari that required a vendor prefix was version 5. The current version is 16. * The last version of Safari/iOS that required a vendor prefix was version 4. The current version is 16. * Edge never required vendor prefixes. * UCAndroid never required vendor prefixes. [caniuse]: https://caniuse.com/?search=box-sizing [RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html [current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-02Auto merge of #106301 - notriddle:notriddle/dir-entry, r=GuillaumeGomezbors-23/+2
rustdoc: use the regular arrow indicator for dir-entry CSS This mostly reverts 468acca108e65101b802821bded17149dc1d86c9, while still fixing the problem it fixed by using an internal list-style-position. It results in a slight change in the hover indicator, but nothing misleading. Preview: http://notriddle.com/notriddle-rustdoc-demos/dir-entry/src/std/lib.rs.html ## Before ![image](https://user-images.githubusercontent.com/1593513/210104247-642e6df0-07d3-452a-a2ab-4c700bc22e0e.png) ## After ![image](https://user-images.githubusercontent.com/1593513/210104271-a3832784-1e4d-4516-983e-6ecb9051857b.png)
2023-01-01clean: Always store enum disriminant.Nixon Enraght-Moony-17/+20
2022-12-31Rollup merge of #106297 - notriddle:notriddle/scrape-help, r=GuillaumeGomezMatthias Krüger-10/+6
rustdoc: merge scrape-help CSS
2022-12-30rustdoc: use the regular arrow indicator for dir-entry CSSMichael Howell-23/+2
This mostly reverts 468acca108e65101b802821bded17149dc1d86c9, while still fixing the problem it fixed by using an internal list-style-position. It results in a slight change in the hover indicator, but nothing misleading.
2022-12-30rustdoc: merge scrape-help CSSMichael Howell-10/+6
2022-12-30Rollup merge of #106273 - notriddle:notriddle/source-content-overflow, ↵Matthias Krüger-4/+0
r=GuillaumeGomez rustdoc: remove redundant CSS `.source .content { overflow: visible }` When added in 7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99 / #16066, the page itself was set to scroll. Now it's set so that the `example-wrap` is scrolling inside the page, so the overflow setting for the content is irrelevant.
2022-12-30Auto merge of #106262 - GuillaumeGomez:migrate-more-scraped-examples-css, ↵bors-24/+20
r=notriddle Migrate more scraped examples CSS rules to CSS variables It's based on https://github.com/rust-lang/rust/pull/106218 so it will need to wait for it to be merged first. r? `@notriddle`
2022-12-29rustdoc: remove redundant CSS `.source .content { overflow: visible }`Michael Howell-4/+0
When added in 7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99 / #16066, the page itself was set to scroll. Now it's set so that the `example-wrap` is scrolling inside the page, so the overflow setting for the content is irrelevant.