Manish Goregaokar
556cae4454
Rollup merge of #110371 - notriddle:notriddle/search-corrections, r=GuillaumeGomez
...
rustdoc: restructure type search engine to pick-and-use IDs
Fixes #110029
Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.
This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
2023-05-03 16:42:49 -07:00
Michael Howell
9e27179a4d
rustdoc: remove unneeded handleKey from settings.js
...
This code was added in 8ff62b097e
and 2f822fa851 because the browser-
native checkbox was `display: none`, breaking native keyboard
accessibility.
The native checkbox is now merely `appearance: none`, which does
not turn off [behavior semantics], so JavaScript to
reimplement it isn't needed any more.
[behavior semantics]: https://w3c.github.io/csswg-drafts/css-ui/#appearance-semantics
2023-04-21 16:42:23 -07:00
Michael Howell
0dc5cebf34
rustdoc-search: use more descriptive "x not found; y instead" message
2023-04-20 14:32:02 -07:00
Michael Howell
6ad391d8f7
rustdoc-search: give longer notification for type corrections
2023-04-19 12:56:52 -07:00
Michael Howell
3b505c1292
rustdoc: restructure type search engine to pick-and-use IDs
...
This change makes it so, instead of mixing string distance with
type unification, function signature search works by
mapping names to IDs at the start, reporting to the user any
cases where it had to make corrections, and then matches with
IDs when going through the items.
This only changes function searches. Name searches are left alone,
and corrections are only done when there's a single item in the
search query.
2023-04-17 12:16:54 -07:00
bors
309584a835
Auto merge of #110252 - matthiaskrgr:rollup-ovaixra, r=matthiaskrgr
...
Rollup of 8 pull requests
Successful merges:
- #109810 (Replace rustdoc-ui/{c,z}-help tests with a stable run-make test )
- #110035 (fix: ensure bad `#[test]` invocs retain correct AST)
- #110089 (sync::mpsc: synchronize receiver disconnect with initialization)
- #110103 (Report overflows gracefully with new solver)
- #110122 (Fix x check --stage 1 when download-ci-llvm=false)
- #110133 (Do not use ImplDerivedObligationCause for inherent impl method error reporting)
- #110135 (Revert "Don't recover lifetimes/labels containing emojis as character literals")
- #110235 (Fix `--extend-css` option)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-12 22:19:29 +00:00
Matthias Krüger
1043bedb19
Rollup merge of #110205 - notriddle:notriddle/pixelated-border, r=GuillaumeGomez
...
rustdoc: make settings radio and checks thicker, less contrast
This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly.
This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility.
## Preview
https://notriddle.com/rustdoc-demo-html-3/pixelated-border/settings.html
## Before

## After

<details><summary>Original "after" image with 2px border around checked box</summary>

</details>
2023-04-12 20:56:23 +02:00
Guillaume Gomez
6f78520e9a
Add/update tests for --extend-css option
2023-04-12 20:07:10 +02:00
Michael Howell
ab705049b0
rustdoc: use CSS overscroll-behavior instead of JavaScript
...
Fixes the desktop scrolling weirdness mentioned in
https://github.com/rust-lang/rust/pull/98775#issuecomment-1182575603
As described in the MDN page for this property:
* The current Firefox ESR is 102, and the first Firefox version
to support this feature is 59.
* The current Chrome version 112, and the first version to support
this is 63.
* Edge is described as having a minor bug in `none` mode, but we
use `contain` mode anyway, so it doesn't matter.
* Safari 16, released September 2022, is the last browser to
add this feature, and is also the oldest version we officially
support.
2023-04-12 10:31:06 -07:00
Michael Howell
35b5462a3b
rustdoc: make settings radio and checks thicker, less contrast
...
This is very dependent on subjectivity and what screen you use,
but this change makes the radio buttons' outer circle less ugly.
This is because I could see the pixels very clearly, thanks to the
very thin line and high contrast. This change makes both less
severe, giving your browser's antialiasing algorithm more to
work with. Since it's thicker, lowering the contrast shouldn't
impact visibility.
2023-04-12 08:39:43 -07:00
Guillaume Gomez
7b8677c7bc
Update rustdoc GUI tests to new browser-ui-test version
2023-04-11 19:14:35 +02:00
Nilstrieb
ee88d9507e
Rollup merge of #110037 - notriddle:notriddle/theme-default, r=GuillaumeGomez
...
rustdoc: add test and bug fix for theme defaults
Part of https://github.com/rust-lang/rust/issues/66181
2023-04-08 10:26:14 +02:00
Michael Howell
9c9d8c686c
rustdoc: add test and bug fix for theme defaults
2023-04-06 20:25:07 -07:00
Guillaume Gomez
2c6b8aa489
Run collapsed GUI test in mobile mode as well
2023-04-06 20:26:27 +02:00
Guillaume Gomez
c58efce66b
Update GUI tests for logo display on very small screens
2023-04-05 21:38:52 +02:00
Guillaume Gomez
04762ee488
Add GUI test for scrollbar position on source code page
2023-04-04 16:35:53 +02:00
Guillaume Gomez
7067d43950
Add tests to check that collapsed content is expanded when jumping to it
2023-03-31 16:51:50 +02:00
Matthias Krüger
16a94d7553
Rollup merge of #109633 - GuillaumeGomez:fix-go-to-only-setting, r=notriddle
...
Fix "Directly go to item in search if there is only one result" setting
Part of #66181 .
The setting was actually broken, so I fixed it when I added the GUI test.
r? `@notriddle`
2023-03-27 08:46:53 +02:00
Guillaume Gomez
a9f6536be6
Add GUI test for "Directly go to item in search if there is only one result" setting
2023-03-26 17:50:09 +02:00
Matthias Krüger
f06b32b5ba
Rollup merge of #109595 - GuillaumeGomez:improve-gui-test-auto-hide-trait, r=notriddle
...
Improve "Auto-hide trait implementation documentation" GUI test
Part of #66181 .
I'll start working on the `include` command for `browser-ui-test` so we can greatly reduce the duplicated code between setting tests.
r? ``@notriddle``
2023-03-26 08:39:27 +02:00
Guillaume Gomez
7cd6b571a0
Improve "Auto-hide trait implementation documentation" GUI test
2023-03-25 15:28:18 +01:00
Guillaume Gomez
2935d5ca07
Add GUI test for "Auto-hide item methods' documentation" setting
2023-03-24 16:57:55 +01:00
Guillaume Gomez
42486e9f9e
Add GUI test for "Auto-hide item contents for large items" setting
2023-03-20 20:25:35 +01:00
Matthias Krüger
04d74822b6
Rollup merge of #106915 - notriddle:notriddle/load-only-one-theme, r=GuillaumeGomez,jsha
...
Only load one CSS theme by default
This is a tweaked version of #103971 that uses `document.write` to create the stylesheet link at startup, avoiding a FOUC during page navigation. It also rebases the PR, making it work with the new hashed filenames.
Fixes #82614
Preview: http://notriddle.com/notriddle-rustdoc-demos/load-only-one-theme-v2/std/index.html
2023-03-09 12:11:52 +01:00
Matthias Krüger
ca6f6fedfd
Rollup merge of #108686 - notriddle:notriddle/jank-all, r=jsha
...
rustdoc: include link on all.html location header
This avoids a subtle layout shift when switching from the crate page to all items.
## Before
| index.html | all.html |
|------------|----------|
|  |  |
## After
| index.html | all.html |
|------------|----------|
|  |  |
2023-03-08 21:24:50 +01:00
Michael Howell
8b02dadaaf
Update browser-ui-test version
...
Use NEAR check to allow one pixel difference between scroll positions.
2023-03-08 12:49:35 -07:00
Michael Howell
7d941a1612
rustdoc: include link on all.html location header
...
This avoids a subtle layout shift when switching from the crate page
to all items.
2023-03-04 11:54:28 -07:00
Guillaume Gomez
b2c19aa224
Add GUI test for rustdoc search errors background
2023-03-02 12:59:04 +01:00
Guillaume Gomez
fd5ab8a13d
No need for the wait-for anymore to go around browser navigation bug
2023-02-23 22:04:38 +01:00
Dylan DPC
3ef89cbd95
Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomez
...
rustdoc: simplify DOM for `.item-table`
This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-19 13:03:41 +05:30
Matthias Krüger
4cb6a00294
Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, r=GuillaumeGomez
...
rustdoc: merge doctest tooltip with notable traits tooltip
Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000
<details><summary>a user report where the tooltip arrow overlaps the text</summary>

</details>
Fixes #91100
Preview: <https://notriddle.com/notriddle-rustdoc-demos/simplify-doctest-tooltip/std/vec/struct.Vec.html#indexing >
Screenshot:

2023-02-13 11:34:56 +01:00
Michael Howell
ee033e3ad8
rustdoc: use tighter line height in h1 and h2
2023-02-12 12:30:57 -07:00
Michael Howell
04d69e4063
rustdoc: simplify DOM for .item-table
...
This switches from using `<div>` to the more semantic `<ul>`, and
using class names that rhyme with the classes the search results
table uses.
2023-02-07 19:00:42 -07:00
bors
4db32c15d4
Auto merge of #107141 - notriddle:notriddle/max-lev-distance-2023, r=GuillaumeGomez
...
rustdoc: compute maximum Levenshtein distance based on the query
Preview: https://notriddle.com/notriddle-rustdoc-demos/search-lev-distance-2023/std/index.html?search=regex
The heuristic is pretty close to the name resolver, maxLevDistance = `Math.floor(queryLen / 3)`.
Fixes #103357
Fixes #82131
Similar to https://github.com/rust-lang/rust/pull/103710 , but following the suggestion in https://github.com/rust-lang/rust/pull/103710#issuecomment-1296360267 to use `floor` instead of `ceil`, and unblocked now that https://github.com/rust-lang/rust/pull/105796 made it so that setting the max lev distance to `0` doesn't cause substring matches to be removed.
2023-02-06 02:09:00 +00:00
Michael Howell
55f2de151b
rustdoc: remove unnecessary wrapper div.item-decl from HTML
2023-01-30 11:06:18 -07:00
Michael Howell
8b7fabc089
rustdoc: remove unused class has-srclink
...
Stopped being used in CSS with
ae464bc8dc
2023-01-28 17:18:56 -07:00
Michael Howell
495b8d05e3
rustdoc: merge doctest tooltip with notable traits tooltip
...
Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000
Fixes #91100
2023-01-27 09:04:39 -07:00
Yuki Okushi
99fdd7822c
Rollup merge of #107336 - notriddle:notriddle/import-item-module-item, r=GuillaumeGomez
...
rustdoc: remove mostly-unused CSS classes `import-item` and `module-item`
2023-01-27 12:57:57 +09:00
Yuki Okushi
6c6c9a7a91
Rollup merge of #107242 - notriddle:notriddle/title-ordering, r=GuillaumeGomez
...
rustdoc: make item links consistently use `title="{shortty} {path}"`
The ordering in item tables was flipped in 0b6d7bee27 , making it inconsistent with the ordering in method signatures.
Compare these (before this PR is merged):
https://github.com/rust-lang/rust/blob/21e82d6606fa6cdde188aec5dc1bd6705fa1bef0/src/librustdoc/html/render/print_item.rs#L455-L459
https://github.com/rust-lang/rust/blob/21e82d6606fa6cdde188aec5dc1bd6705fa1bef0/src/librustdoc/html/format.rs#L903-L908
2023-01-27 12:57:55 +09:00
Michael Howell
7d46048b4f
rustdoc: remove mostly-unused CSS classes import/module-item
2023-01-26 12:55:19 -07:00
Michael Howell
d1f2082fac
rustdoc: simplify settings popover DOM
...
* Changes the class names so that they all start with `setting-`.
That should make it harder to accidentally use a setting class outside
the settings popover, where loading the CSS might accidentally change
the styles of something unrelated.
* Get rid of an unnecessary wrapper DIV around the radio button line.
* Simplify CSS selectors by making the DOM easier and more intuitive
to target.
2023-01-23 15:08:33 -07:00
Michael Howell
5e5f33d85c
rustdoc: make item links consistently use title="{shortty} {path}"
...
The ordering in item tables was flipped in 0b6d7bee27 , making it
inconsistent with the ordering in method signatures.
Compare these:
https://github.com/rust-lang/rust/blob/21e82d6606fa6cdde188aec5dc1bd6705fa1bef0/src/librustdoc/html/render/print_item.rs#L455-L459
https://github.com/rust-lang/rust/blob/21e82d6606fa6cdde188aec5dc1bd6705fa1bef0/src/librustdoc/html/format.rs#L903-L908
2023-01-23 14:31:35 -07:00
Guillaume Gomez
02a75d68f4
Extend rustdoc GUI test for scraped examples top and bottom "borders"
2023-01-21 12:16:02 +01:00
Michael Howell
dc94b29b23
rustdoc: update test case to deal with "coo" only accepting dist=1
2023-01-21 00:11:39 -07:00
Michael Goulet
dc9888a6c0
Rollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, r=GuillaumeGomez
...
rustdoc: remove redundant CSS rule `#settings .setting-line`
Since the current version of settings.js always nests things below a div with ID `settings`, this rule always overrode the one above.
2023-01-18 18:00:31 -05:00
Michael Howell
7db2122b62
rustdoc: add test case for setting-line margin on settings.html
2023-01-18 12:48:24 -07:00
Michael Howell
e10673bb88
rustdoc: fix "?" keyboard command when radio button is focused
...
This extends the special case with checkbox settings to also cover radios.
2023-01-18 12:14:00 -07:00
Michael Howell
137b5d37ad
rustdoc: put focus on the help link when opening it from keyboard
...
This prevents some strange blur-event-related bugs with the "?" command
by ensuring that the focus remains in the same spot when the settings
area closes.
2023-01-18 12:14:00 -07:00
Michael Howell
95bb6a9488
rustdoc: add test cases for settings radio button layout
2023-01-17 12:09:53 -07:00
Matthias Krüger
573f0191ef
Rollup merge of #106869 - notriddle:notriddle/item-decl-pre-rust, r=GuillaumeGomez
...
rustdoc: remove redundant item kind class from `.item-decl > pre`
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/6ebf4c340e30786bb225442bfd3c6440dc83e0a6/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 PR 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-17 05:25:22 +01:00