Commit Graph

350 Commits

Author SHA1 Message Date
Michael Howell
cb8a7388fa rustdoc: fix keyboard shortcuts bug in settings menu
This commit fixes the keyboard shorts code to call localStorage every time a
key is pressed. This matters because you're supposed to be able to change a
setting and have it immediately take effect.
2022-06-28 17:29:37 -07:00
Michael Howell
cec6988a07 rustdoc: fix help menu popover toggling 2022-06-28 16:02:44 -07:00
Matthias Krüger
df26fdf3e1 Rollup merge of #98297 - GuillaumeGomez:help-pocket-menu, r=notriddle
Transform help popup into a pocket menu

Just like we moved the settings menu into a "pocket menu", it's doing the same to the help popup.

You can test it [here](https://rustdoc.crud.net/imperio/help-pocket-menu/doc/foo/index.html) and here is a screenshot:

![Screenshot from 2022-06-20 20-58-29](https://user-images.githubusercontent.com/3050060/174663718-538e9d11-3bf9-48b2-8909-f9bfe75af135.png)

r? ``````````@jsha``````````
2022-06-26 19:47:03 +02:00
Guillaume Gomez
2bb46bedfc Add test for source sidebar elements colors 2022-06-25 22:22:35 +02:00
Michael Goulet
cc95225fee Rollup merge of #98310 - jsha:defer-source-sidebar, r=GuillaumeGomez
rustdoc: optimize loading of source sidebar

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? ````@GuillaumeGomez````
2022-06-23 14:39:10 -07:00
Guillaume Gomez
3eb9e1a7ae Add/update GUI tests for help pocket menu 2022-06-23 00:22:25 +02:00
Jacob Hoffman-Andrews
b37a05bd01 rustdoc: optimize loading of source sidebar
The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.
2022-06-20 15:08:02 -07:00
Jacob Hoffman-Andrews
27dcebeb3e Improve loading of crates.js and sidebar-items.js
Now that the "All Crates" dropdown is only rendered on the search results page,
there is no need to load crates.js on most pages. Load it only on crate pages.
Also, add the `defer` attribute so it does not block page rendering.

For sidebar-items.js, move the script tag to `<head>`. Since it already has the
defer attribute it won't block loading. The defer attribute does preserve
ordering between scripts, so instead of the callback on load, it can set a
global variable on load, which is slightly simpler. Also, since it is required
to finish rendering the page, beginning its load earlier is better.

Remove generation and handling of sidebar-vars. Everything there can be computed
with information available in JS via other means.

Remove the "other" wrapper in the sidebar. It was unnecessary.

Remove excess script fields
2022-06-20 11:12:55 -07:00
Guillaume Gomez
a70c14aecc Add GUI test for sidebar items expand/collapse 2022-06-14 20:09:09 +02:00
Guillaume Gomez
5799e7de16 Update rustdoc-gui README 2022-06-07 11:49:35 +02:00
Dylan DPC
94b8036147 Rollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jsha
Improve settings theme display

This is a follow-up of #96958. In this PR, I changed how the theme radio buttons are displayed and improved their look as well.

It now looks like this:

![Screenshot from 2022-05-17 20-46-20](https://user-images.githubusercontent.com/3050060/168887703-a01e3bd5-9644-4012-ac11-2ae7bacd6be6.png)
![Screenshot from 2022-05-17 20-46-12](https://user-images.githubusercontent.com/3050060/168887707-132f8b2d-1163-462f-b7dd-f861121bdee7.png)

You can test it [here](https://rustdoc.crud.net/imperio/improve-settings-theme-display/doc/foo/index.html).

r? `@jsha`
2022-05-31 07:57:32 +02:00
Guillaume Gomez
d286df1402 Add line number click GUI test 2022-05-30 17:15:41 +02:00
Guillaume Gomez
16d5cdc570 Improve source-code-page.goml GUI test code 2022-05-30 17:07:21 +02:00
Guillaume Gomez
b8db8cc10f Add GUI test for <details>/<summary> display 2022-05-30 16:38:53 +02:00
Guillaume Gomez
70db59ca35 Add GUI test for settings display 2022-05-30 12:12:43 +02:00
Guillaume Gomez
bfb16b9dd7 Add GUI test for javascript disabled display of settings page 2022-05-28 18:55:30 +02:00
Guillaume Gomez
fca1007ed3 Add GUI test for click on setting text 2022-05-24 15:40:50 +02:00
Guillaume Gomez
440bbce36d Add GUI test for search crate filter select CSS properties 2022-05-17 14:45:23 +02:00
Guillaume Gomez
5601044903 Add GUI test for search result "title" 2022-05-17 13:28:22 +02:00
Guillaume Gomez
44e5b3bf3e Update GUI tests 2022-05-14 17:21:52 +02:00
Matthias Krüger
231cd0fd7d Rollup merge of #96939 - GuillaumeGomez:settings-css, r=notriddle
Fix settings page CSS

In https://github.com/rust-lang/rust/pull/96741, I moved the CSS loading outside of `settings.js`. The result was that on the settings page, there isn't the settings CSS anymore:

![Screenshot from 2022-05-11 11-09-24](https://user-images.githubusercontent.com/3050060/167817969-6750931b-3e6e-4178-b5a9-ee3851e983be.png)

I also used this opportunity to remove unused CSS rules (we don't have `<select>` elements anymore in the settings).

cc `@jsha`
r? `@notriddle`
2022-05-12 16:41:04 +02:00
Guillaume Gomez
dd6bb09133 Ensure that the settings CSS is loaded on the settings page 2022-05-11 11:29:21 +02:00
Guillaume Gomez
fe4fa53fa8 Clean up rustdoc GUI test 2022-05-10 16:42:34 +02:00
Guillaume Gomez
bcfb95afd3 Rollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomez
rustdoc: ensure HTML/JS side implementors don't have dups

Fixes #94641

Rendered:

- https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html
2022-05-06 20:05:43 +02:00
Guillaume Gomez
93b86d69b6 Rollup merge of #96748 - GuillaumeGomez:reexports-in-search, r=notriddle
Fixes reexports in search

Fixes #96681.

At some point we stopped reexporting items in search so this PR fixes it.

It also adds a regression test.

r? ```@notriddle```
2022-05-06 20:05:41 +02:00
Michael Howell
bd11e22203 Add missing newline 2022-05-06 05:18:32 -07:00
Guillaume Gomez
fb2f97a37e Add GUI test for search reexports 2022-05-06 13:52:21 +02:00
Michael Howell
20010d7597 rustdoc: ensure HTML/JS side implementors don't have dups 2022-05-05 17:45:33 -07:00
Michael Howell
75790fabed rustdoc: add test case assertions for ArrowDown highlight first result 2022-05-05 09:39:47 -07:00
Michael Howell
8b2147b497 rustdoc: fix keyboard shortcuts and console log on search page 2022-05-05 09:39:45 -07:00
Michael Howell
21a121332b rustdoc: change the "In Function Signatures" to context-sensitive
* If it's just `-> a`, use "In Function Return Types"
* If it's just `a b`, use "In Function Parameters"
* Otherwise, still use "In Function Signatures"
2022-05-05 09:37:29 -07:00
Michael Howell
345a580e8d Use STARTS_WITH, since it's more specific
Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-05-05 09:37:29 -07:00
Michael Howell
6c8a2d4715 rustdoc: when running a function-signature search, tweak the tab bar 2022-05-05 09:37:29 -07:00
Guillaume Gomez
2f074dee42 Extend settings test to ensure settings text is as expected 2022-04-30 13:12:42 +02:00
Guillaume Gomez
e7d7d75c81 Add GUI test for settings menu 2022-04-30 13:12:42 +02:00
Andy Russell
753d567989 clarify doc(cfg) wording
The current "This is supported" wording implies that it's possible to
still use the item on other configurations, but in an unsupported way.
Changing this to "Available" removes this ambiguity.
2022-04-14 21:12:13 -04:00
Guillaume Gomez
3baac2af05 Add GUI test to ensure that the width of the item-info does not overflow its parent 2022-04-05 18:11:27 +02:00
Dylan DPC
c6764c982d Rollup merge of #95470 - GuillaumeGomez:fix-gui-spurious-test, r=notriddle
Fix last rustdoc-gui spurious test

This should the last spurious failing GUI test from https://github.com/rust-lang/rust/issues/93784.

r? ``@notriddle``
2022-03-31 13:09:52 +02:00
Guillaume Gomez
a4a9fff594 Fix last rustdoc-gui spurious test 2022-03-30 14:30:46 +02:00
Guillaume Gomez
e0a697aad4 Replace wait-for instructions for rustdoc GUI tests with wait-for-css 2022-03-25 21:32:16 +01:00
Guillaume Gomez
237d62588d Remove animation on source sidebar 2022-03-19 16:59:56 +01:00
Guillaume Gomez
372271e3dd Add URL GUI tests 2022-03-15 20:56:14 +01:00
Guillaume Gomez
8a7b83a24a Merge both "search-result-color" GUI tests 2022-03-15 20:41:24 +01:00
bors
7eac19c30c Auto merge of #94320 - GuillaumeGomez:sidebar-display, r=jsha
Fix sidebar elements display

The bug can be seen more easily when the javascript is disabled:

![Screenshot from 2022-02-24 12-18-28](https://user-images.githubusercontent.com/3050060/155514578-cbefd3dd-f006-47e9-bc76-7c26d7e823e8.png)

r? `@jsha`
2022-03-13 07:56:08 +00:00
Guillaume Gomez
aad4227607 Update GUI test 2022-03-11 14:48:53 +01:00
Matthias Krüger
82215ce646 Rollup merge of #94740 - GuillaumeGomez:unify-impl-blocks, r=notriddle
Unify impl blocks by wrapping them into a div

The blanket and "auto traits" sections are wrapped into a `div` with an ID. This PR fixes this incoherence by wrapping each impl section (the "deref impl" and the "inherent impl" sections were missing it). It'll also make some tests simpler to write.

r? `````@notriddle`````
2022-03-10 19:00:08 +01:00
Guillaume Gomez
18006a60d0 Fix spurious CI failures 2022-03-09 21:28:23 +01:00
Guillaume Gomez
fbd9c284d7 Update GUI tests for impl blocks path changes 2022-03-08 23:12:11 +01:00
Guillaume Gomez
f23d6d3a47 Add GUI test to ensure that line numbers text is aligned to the right 2022-03-07 12:08:14 +01:00
Guillaume Gomez
40e3b6ef42 Add GUI test for source code viewer scroll handling 2022-03-05 16:02:28 +01:00