about summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2021-05-25Move extra search result information for keywords and primitives from CSS to DOMGuillaume Gomez-16/+12
2021-05-24Rollup merge of #85621 - jsha:serif-in-table, r=GuillaumeGomezGuillaume Gomez-0/+1
Restore sans-serif font for module items. This was broke in #84462 by modifying a style that applied both to searches and to module items (and other tables). Fixes #85616. Fixes https://github.com/rust-lang/rust/issues/85545. r? `@camelid`
2021-05-24Rollup merge of #85551 - GuillaumeGomez:fix-search-result-overflow, r=jshaGuillaume Gomez-7/+34
Fix search results display Fixes https://github.com/rust-lang/rust/issues/85544. cc `@dns2utf8` r? `@jsha`
2021-05-23Restore sans-serif font for module items.Jacob Hoffman-Andrews-0/+1
This was broke in #84462 by modifying a style that applied both to searches and to module items (and other tables).
2021-05-23Rollup merge of #85575 - jsha:fix-toggle-settings, r=GuillaumeGomezDylan DPC-4/+21
Fix auto-hide for implementations and implementors. This sets their toggles to be closed in the HTML (matching the default setting), and opens them if the setting indicates to do so. This distinguishes between implementations and implementors based on being descendants of certain named elements. Demo https://hoffman-andrews.com/rust/fix-toggle-settings/std/io/trait.Read.html#implementors and https://hoffman-andrews.com/rust/fix-toggle-settings/std/string/struct.String.html#trait-implementations Fixes #85411 r? `@GuillaumeGomez`
2021-05-22Fix auto-hide for implementations and implementors.Jacob Hoffman-Andrews-4/+21
This sets their toggles to be closed in the HTML (matching the default setting), and opens them if the setting indicates to do so. This distinguishes between implementations and implementors based on being descendants of certain named elements.
2021-05-22Set desc class on the div instead of the span to simplify CSSGuillaume Gomez-6/+6
2021-05-22Mobile description width: 100%Stefan Schindler-1/+1
2021-05-22Add padding to mobile layout and fix width issue on bothStefan Schindler-0/+2
2021-05-22Prepar to remove deep nestingStefan Schindler-6/+5
2021-05-22Implement staggered mobile layoutStefan Schindler-4/+17
2021-05-22Auto merge of #85568 - GuillaumeGomez:search-result-extra-info, r=jshabors-2/+2
Search result extra info The CSS rule was not updated when we updated the search result, this fixes it: Before: ![Screenshot from 2021-05-21 22-56-17](https://user-images.githubusercontent.com/3050060/119197314-d31a4e80-ba87-11eb-863a-bc0b3de3bfb2.png) After: ![Screenshot from 2021-05-21 22-54-53](https://user-images.githubusercontent.com/3050060/119197227-b54ce980-ba87-11eb-9f43-c10803ca1b90.png) r? `@jsha`
2021-05-21Fix display for primitive and keyword extra infoGuillaume Gomez-2/+2
2021-05-21Rollup merge of #85548 - GuillaumeGomez:remove-dead-js, r=jshaGuillaume Gomez-158/+0
Remove dead toggle JS code Explanations on how I got there: I randomly saw `adjustToggle` while browsing through code, checked where it was called, put a `debugger;` instruction in it and checked on all pages while playing with settings and toggles. The breakpoint was never triggered. I then looked at `collapseNonInherent` (its grand-parent). In there, the breakpoint was triggered so I look at what was being done and in fact... nothing. So I simply removed it all, re-ran the tests and play with the UI. Everything is working as expected. Better double check in case I forgot to check a case though, but if nothing has been left out, then it's a great cleanup once again. :) r? ``@jsha``
2021-05-21Rollup merge of #85506 - GuillaumeGomez:reset-focusedByTab, r=jshaGuillaume Gomez-4/+5
Reset "focusedByTab" field when doing another search Fixes https://github.com/rust-lang/rust/issues/85467. The problem was simply that we forget to reset the `focusedByTab` field, which was still referring to removed DOM elements. r? ``@jsha``
2021-05-21Fix search results displayGuillaume Gomez-3/+16
2021-05-21Remove dead toggle JS codeGuillaume Gomez-158/+0
2021-05-20Rollup merge of #85509 - GuillaumeGomez:search-null-title, r=jshaGuillaume Gomez-1/+1
Prevent tab title to "null" if the URL is a search one When we arrive on page with a search parameter in the URL, until the results are displayed, the page title is "null". It's because of this code: ```js if (params.search !== undefined) { var search = searchState.outputElement(); search.innerHTML = "<h3 style=\"text-align: center;\">" + searchState.loadingText + "</h3>"; searchState.showResults(search); loadSearch(); } ``` In `searchState.showResults`, we have this: ```js document.title = searchState.title; ``` But since it's `null`, we set it as title. This PR fixes it. r? `@jsha`
2021-05-20Prevent tab title to "null" if the URL is a search oneGuillaume Gomez-1/+1
2021-05-20Reset "focusedByTab" field when doing another searchGuillaume Gomez-4/+5
2021-05-20Rollup merge of #85470 - GuillaumeGomez:fix-css-rules, r=jshaRalf Jung-9/+6
Fix invalid CSS rules for a:hover When hovering some links: ![Screenshot from 2021-05-19 15-00-31](https://user-images.githubusercontent.com/3050060/118823585-5f2a4b80-b8b9-11eb-8043-bb7759a178c7.png) ![Screenshot from 2021-05-19 15-00-29](https://user-images.githubusercontent.com/3050060/118823566-5b96c480-b8b9-11eb-8c4e-08e490752fbf.png) It is a side-effect from #84462. r? ```@jsha```
2021-05-20Rollup merge of #85169 - jsha:hoist-classes, r=GuillaumeGomezRalf Jung-12/+4
Add method-toggle to <details> for methods The makes the code for handling "auto-hide" settings more consistent. Demo at https://hoffman-andrews.com/rust/hoist-classes/std/string/struct.String.html Fixes #84829
2021-05-19Fix invalid CSS rules for a:hoverGuillaume Gomez-9/+6
2021-05-18Rollup merge of #85438 - GuillaumeGomez:fix-escape-handling, r=jshaJack Huey-2/+2
Fix escape handling Currently, when we press Escape while on the search results, nothing is happening, this PR fixes it. More information: it's because in case the element doesn't exist, `hasClass` will return `null`, which coerces into `false` with the `!` comparison operator. But even if it returned `false`, it would still be an issue because if the element doesn't exist, it means it's hidden so in this case it's just as good, hence the additional check I added. r? ``@jsha``
2021-05-18Rollup merge of #85396 - jsha:top-doc-font-sizes, r=GuillaumeGomezJack Huey-3/+7
rustdoc: restore header sizes The `<details>` toggle work changed the relationship from #main to the top-doc docblock so it was no longer a parent relationship but a great-grandparent relationship. This updates the CSS rules that set the heading sizes so they still apply. Fixes #85389 r? ``@camelid``
2021-05-18Add method-toggle to <details> for methods.Jacob Hoffman-Andrews-12/+4
The makes the code for handling "auto-hide" settings more consistent.
2021-05-18Rollup merge of #85407 - GuillaumeGomez:copy-path-display-improvement, r=jshaRalf Jung-13/+39
Improve display for "copy-path" button, making it more discreet As suggested by `@Nemo157` [here](https://github.com/rust-lang/rust/pull/85118#issuecomment-838887670): ![Screenshot from 2021-05-18 11-18-49](https://user-images.githubusercontent.com/3050060/118626882-899ddb00-b7cb-11eb-84c5-ef68dee5e351.png) ![Screenshot from 2021-05-18 11-15-06](https://user-images.githubusercontent.com/3050060/118626880-899ddb00-b7cb-11eb-95c1-2f3bacd22374.png) ![Screenshot from 2021-05-18 11-18-54](https://user-images.githubusercontent.com/3050060/118626885-8a367180-b7cb-11eb-870c-7acdf4259bef.png) ![Screenshot from 2021-05-18 11-15-00](https://user-images.githubusercontent.com/3050060/118626877-89054480-b7cb-11eb-9efc-9a0f153964ce.png) ![Screenshot from 2021-05-18 11-18-58](https://user-images.githubusercontent.com/3050060/118626888-8a367180-b7cb-11eb-91bb-47867cd0f2cc.png) ![Screenshot from 2021-05-18 11-19-00](https://user-images.githubusercontent.com/3050060/118626891-8acf0800-b7cb-11eb-9e3d-d2937b361524.png) r? `@jsha`
2021-05-18Rollup merge of #84462 - jsha:focus-search-results2, r=GuillaumeGomezRalf Jung-195/+178
rustdoc: use focus for search navigation Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class. This required wrapping each row of results in one big `<a>` tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float. This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements. This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focus. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus. Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't. Demo at https://hoffman-andrews.com/rust/focus-search-results2/std/?search=fn Fixes #84384 Fixes #79962 Fixes #79872
2021-05-18Fix escape handling on search resultsGuillaume Gomez-2/+2
2021-05-18Improve display for "copy-path" button, making it more discreteGuillaume Gomez-13/+39
2021-05-16rustdoc: restore header sizesJacob Hoffman-Andrews-3/+7
2021-05-16Fix invalid input:disabled CSS selectorGuillaume Gomez-4/+4
2021-05-16Auto merge of #85304 - Stupremee:crates-in-sidebar-in-root, r=Nemo157bors-0/+1
rustdoc: Call `initSidebarItems` in root module of crate r? `@jsha` Resolves #85301
2021-05-15Call `initSidebarItems` in root module of crateJustus K-0/+1
2021-05-15Rollup merge of #85323 - GuillaumeGomez:fix-eslint-errors, r=jshaGuillaume Gomez-34/+32
Fix eslint errors I cherry-picked the two non-CI commits from #85285. r? ```@jsha```
2021-05-15Rollup merge of #85289 - GuillaumeGomez:fix-toggle-position-mobile, r=jshaGuillaume Gomez-192/+198
Fix toggle position on mobile Before: ![Screenshot from 2021-05-14 14-21-27](https://user-images.githubusercontent.com/3050060/118276475-fe210300-b4c7-11eb-94f8-4e2a4e10d91e.png) ![Screenshot from 2021-05-14 14-21-30](https://user-images.githubusercontent.com/3050060/118276479-feb99980-b4c7-11eb-85db-40e9df6e9abd.png) After: ![Screenshot from 2021-05-14 15-16-54](https://user-images.githubusercontent.com/3050060/118276494-0416e400-b4c8-11eb-9479-d447928cfa62.png) ![Screenshot from 2021-05-14 15-16-59](https://user-images.githubusercontent.com/3050060/118276498-0416e400-b4c8-11eb-99f6-894276c62dfc.png) r? ```@jsha```
2021-05-15Rollup merge of #85256 - GuillaumeGomez:fix-implementors-display, r=notriddleGuillaume Gomez-1/+1
Fix display for "implementors" section Just saw this problem when going through docs: ![Screenshot from 2021-05-13 15-20-52](https://user-images.githubusercontent.com/3050060/118131978-766fc180-b3ff-11eb-86a8-7f6d22afa675.png) This fix puts it back to normal: ![Screenshot from 2021-05-13 15-23-29](https://user-images.githubusercontent.com/3050060/118132006-7e2f6600-b3ff-11eb-9985-025a7b7c5216.png) You can see it on the `TryFrom` page for example. r? ```@Nemo157```
2021-05-15Fix eslint errorsGuillaume Gomez-34/+32
2021-05-15chore: update comment in rustdoc.cssShinwoo Park-1/+1
2021-05-15rustdoc: add the license of Noto Sans KRShinwoo Park-0/+93
2021-05-15rustdoc: avoid legacy Korean fonts in WindowsShinwoo Park-1/+9
2021-05-14Unify toggle rules on smaller resolutionsGuillaume Gomez-6/+3
2021-05-14Move @media rules at the end so they override the other rulesGuillaume Gomez-193/+195
2021-05-14Fix toggle position on mobileGuillaume Gomez-1/+8
2021-05-13rustdoc: use focus for search navigationJacob Hoffman-Andrews-195/+178
Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class. This required wrapping each row of results in one big <a> tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float. This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements. This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focused element. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus. Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't.
2021-05-13Rollup merge of #85175 - GuillaumeGomez:rustdoc-cleanup, r=jshaGuillaume Gomez-259/+142
Rustdoc cleanup Part of https://github.com/rust-lang/rust/issues/83332. The goal of this PR is to remove a few unused things: * The "loading content" things are now unneeded. * Some toggle CSS rules were still there. * Some parts of the JS had a different indent, fixed it. r? `@jsha`
2021-05-13Fix display for "implementors" sectionGuillaume Gomez-1/+1
2021-05-12Rollup merge of #85174 - GuillaumeGomez:doc-code-block-border-radius, r=jshaGuillaume Gomez-2/+2
Fix border radius for doc code blocks in rustdoc In #85148, I made an invalid change on the border radius of the doc code blocks (look in the top left and bottom left corners of the code blocks). Before this fix: ![Screenshot from 2021-05-11 11-14-59](https://user-images.githubusercontent.com/3050060/117791459-a4f86b80-b24a-11eb-8ac3-facc719c799a.png) After this fix: ![Screenshot from 2021-05-11 11-05-29](https://user-images.githubusercontent.com/3050060/117791482-a9bd1f80-b24a-11eb-8c38-a01989595f5c.png) r? `@jsha`
2021-05-12Rollup merge of #85117 - jsha:bubble-bubble-toil-and-trouble, r=GuillaumeGomezGuillaume Gomez-127/+136
Move global click handlers to per-element ones. In rustdoc's main.js, we had an onclick handler for the whole document that would dispatch to handlers for various elements. This change attaches the handlers to the elements that trigger them, instead. This simplifies the code and avoids reimplementing the browser's bubbling functionality. As part of this change, change from a class to an id for help button. Move the handlers and associated code for highlighting source lines into source-script.js (and factor out a shared regex). Demo at https://hoffman-andrews.com/rust/bubble-bubble-toil-and-trouble/std/string/struct.String.html Note: this conflicts with / depends on #85074. Once that's merged I'll rebase this and resolve conflicts. Part of #83332. Thanks to `@Manishearth` for the [suggestion to not reimplement bubbling](https://github.com/rust-lang/rust/issues/83332#issuecomment-803497509). r? `@GuillaumeGomez`
2021-05-12Fix indent in JS filesGuillaume Gomez-138/+140