338 Commits

Author SHA1 Message Date
Guillaume Gomez
7c3bddaa74 Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
binarycat
00c104225f rustdoc: make srcIndex no longer a global variable
this is one-time initialization data, it can just
be a function parameter.

we also move the json parsing into createSrcSidebar
to save a few bytes.
2025-06-16 20:22:24 -05:00
Jacob Pratt
045ac21c6f
Rollup merge of #139831 - lolbinarycat:rustdoc-mobile-sidebar, r=GuillaumeGomez
rustdoc: on mobile, make the sidebar full width and linewrap

this is because the mobile sidebar cannot be resized, unlike on desktop.
2025-05-25 04:00:55 +02:00
binarycat
bcca611b35 rustdoc-gui test: apply suggestions from code review 2025-05-23 17:43:19 -05:00
binarycat
1eba1b56e3 rustdoc: rip out all the gui tests for <100% width mobile sidebar
stuff like "clicking the settings menu closes the mobile sidebar"
is now impossible for users to observe, since the mobile sidebar
will always cover the settings menu due to being full-width,
which is good because that behavior is also now impossible for
our testing framework to observe.
2025-05-22 16:44:29 -05:00
Matthias Krüger
981bbf4197
Rollup merge of #140868 - SpecificProtagonist:rustdoc-trait-impl-code-link, r=notriddle
rustdoc: Fix links with inline code in trait impl docs

Fixes #140857
2025-05-22 07:19:01 +02:00
SpecificProtagonist
4516a5b96b
better checks 2025-05-11 08:02:19 +02:00
SpecificProtagonist
b8d55544c5
remove superfluous import 2025-05-11 07:58:18 +02:00
SpecificProtagonist
bd23ee2382
gui test different link 2025-05-10 19:48:13 +02:00
SpecificProtagonist
31ae60d30d
gui test 2025-05-10 19:36:28 +02:00
Michael Howell
3fa98a1507 rustdoc: add a handle that makes sidebar resizing more obvious
This change is based on some discussion on [lolbinarycat's idea],
but with a more "traditional" design. Specifically, this is the
closest thing I could find to a consensus across many systems I
looked at for inspiration:

- In Jira, resizable sidebars have a stack of four dots.
- In The GIMP, resizable sidebars have a stack of three dots.
- In [old Windows], "panes" are defined to have the same border
  style as a window, which has a raised appearance.
- In [NeXT], a drag point usually had an innie, whether the line in a
  slider or the circle in a scroller; I can also hide and show the
  favorites bar in Workspace by dragging on a circular "grip spot"
- In [old Mac], drag handles for things usually had a "grip track"
  of parallel lines.
- [OSX] kept that, but the "Source List" part of the Finder still had
  the circle grip for a time the same way Workspace did

[lolbinarycat's idea]: https://github.com/rust-lang/rust/pull/139420
[old Windows]: https://archive.org/details/windowsinterface00micr/page/n9/mode/2up
[old Mac]: https://archive.org/details/apple-hig/1996_Human_Interface_Guidelines_for_Mac_OS_8_%28WWDC_Release%29/page/16/mode/2up
[NeXT]: https://archive.org/details/apple-hig/1993%20NeXTSTEP%20User%20Interface%20Guidelines%20-%20Release%203/page/145/mode/2up
[OSX]: https://dn721903.ca.archive.org/0/items/apple-hig/MacOSX_HIG_2005_09_08.pdf#page=267
2025-05-09 12:38:00 -07:00
Guillaume Gomez
a92ba60d0f
Rollup merge of #140135 - GuillaumeGomez:sidebars-image, r=rustdoc
Unify sidebar buttons to use the same image

Part of https://github.com/rust-lang/rust/issues/139832.

The source sidebar looks like this with the new image:

![image](https://github.com/user-attachments/assets/df4fee52-fb71-4794-91b7-3afc6d2aab70)

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-images/src/foo/foo.rs.html).

r? `@notriddle`
2025-05-06 14:50:45 +02:00
Guillaume Gomez
a29072a67a Add/update GUI test for impl indent fix 2025-04-24 12:33:29 +02:00
Guillaume Gomez
f7d8558003 Add rustdoc-gui test to ensure sidebars share the same image 2025-04-23 21:34:50 +02:00
Guillaume Gomez
30f56df6f9 Add regression test for #139282 2025-04-07 17:28:46 +02:00
León Orell Valerian Liehr
8462d56fc1
Rollup merge of #137539 - GuillaumeGomez:copy-content-tests, r=notriddle
Add rustdoc-gui regression test for #137082

Fixes https://github.com/rust-lang/rust/issues/137082.

Added new commands in `browser-ui-test` allowing us to add a regression test for #137082 and also another to copy code examples content.

r? `@notriddle`
2025-02-25 13:07:34 +01:00
Guillaume Gomez
592028a2fc Add rustdoc-gui regression test for #137082 2025-02-24 14:27:33 +01:00
Jacob Pratt
8133652562
Rollup merge of #136991 - GuillaumeGomez:code-wrapping, r=notriddle
[rustdoc] Add new setting to wrap source code lines when too long

Fixes https://github.com/rust-lang/rust/issues/127334.

Wrapped lines look like this:

![image](https://github.com/user-attachments/assets/92006a27-ed1e-4beb-91f2-f453b72c5e1a)

It works in both source code pages and doc pages.

You can test it [here](https://rustdoc.crud.net/imperio/code-wrapping/bar/index.html).

r? ``@notriddle``
2025-02-24 02:11:32 -05:00
Guillaume Gomez
a1471f3aa6 Rename feature into Word wrap source code 2025-02-22 15:44:14 +01:00
yukang
a467ecacd4 Add custom sort for link in rustdoc 2025-02-19 08:35:51 +08:00
Guillaume Gomez
38b5bfce24 Add GUI test for code wrapping 2025-02-14 11:41:28 +01:00
Guillaume Gomez
10d666f3d6 Update rustdoc-gui test 2025-02-14 11:41:28 +01:00
Michael Howell
2c4922cf29 rustdoc: use better, consistent SVG icons for scraped examples
This continues two ongoing projects:

- Replacing ascii art with real icons that don't look like
  syntax, are understandable to people who're familiar with
  desktop computers and smart devices, and aren't ugly.
- Using labels and tooltips to clarify these icons, when the
  limits of popular iconography hit us. In this case, I've added
  tooltips, because, unfortunately, there's not room for
  always-visible labels.
2025-02-12 16:07:11 -07:00
Guillaume Gomez
673fd23dff Update rustdoc tests 2025-02-11 14:29:58 +01:00
Guillaume Gomez
65fedebfc4 Add GUI test for new "sans serif fonts" setting 2025-01-29 11:01:14 +01:00
Guillaume Gomez
caacb04830 Add GUI regression test for indent of trait items on mobile 2025-01-24 15:36:52 +01:00
Guillaume Gomez
b3865d1832 Remove more CSS classes 2025-01-18 20:29:55 +01:00
Guillaume Gomez
3c62ccdff5 Update rustdoc tests 2025-01-17 22:36:49 +01:00
binarycat
9397d133f6 Treat other items as functions for the purpose of type-based search
constants and statics are nullary functions, and struct fields are unary functions.

functions (along with methods and trait methods) are prioritized over other
items, like fields and constants.
2025-01-16 11:52:00 -06:00
Guillaume Gomez
0128c910f4 Add GUI test for #135499 2025-01-15 16:31:20 +01:00
Guillaume Gomez
00bf8717e3 Add GUI test for item info elements color 2024-12-28 20:54:00 +01:00
Nicholas Nethercote
121e87bf14 Remove rustc::existing_doc_keyword lint.
`CheckAttrVisitor::check_doc_keyword` checks `#[doc(keyword = "..")]`
attributes to ensure they are on an empty module, and that the value is
a non-empty identifier.

The `rustc::existing_doc_keyword` lint checks these attributes to ensure
that the value is the name of a keyword.

It's silly to have two different checking mechanisms for these
attributes. This commit does the following.
- Changes `check_doc_keyword` to check that the value is the name of a
  keyword (avoiding the need for the identifier check, which removes a
  dependency on `rustc_lexer`).
- Removes the lint.
- Updates tests accordingly.

There is one hack: the `SelfTy` FIXME case used to used to be handled by
disabling the lint, but now is handled with a special case in
`is_doc_keyword`. That hack will go away if/when the FIXME is fixed.

Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-12-17 13:56:10 +11:00
Guillaume Gomez
854ebe7522 Update GUI test after rebase 2024-12-05 22:50:21 +01:00
Guillaume Gomez
90feb9a645 Improve positioning of "..." in collapsed impl block 2024-12-05 22:50:21 +01:00
Guillaume Gomez
abcd094c51 Update GUI tests 2024-12-05 22:50:21 +01:00
Guillaume Gomez
5d26accecd Add GUI test for impl block doc display 2024-12-05 22:50:21 +01:00
Guillaume Gomez
bf6fcc9db8 Align impl doc block with impl keyword 2024-11-13 15:13:31 +01:00
Guillaume Gomez
4f20626cef Update GUI tests for documentation indent changes 2024-11-12 17:58:10 +01:00
Michael Howell
12dc24f460 rustdoc-search: simplify rules for generics and type params
This commit is a response to feedback on the displayed type
signatures results, by making generics act stricter.

Generics are tightened by making order significant. This means
`Vec<Allocator>` now matches only with a true vector of allocators,
instead of matching the second type param. It also makes unboxing
within generics stricter, so `Result<A, B>` only matches if `B`
is in the error type and `A` is in the success type. The top level
of the function search is unaffected.

Find the discussion on:

* <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149>
* <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265>
* <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
2024-10-30 12:27:48 -07:00
Michael Howell
20a4b4fea1 rustdoc-search: show types signatures in results 2024-10-30 10:35:39 -07:00
Michael Howell
5c7e7dfe10 rustdoc-search: pass original names through AST 2024-10-30 10:35:38 -07:00
Guillaume Gomez
26b6ccdbd7 Add GUI regression test for variant structfields margins 2024-10-28 11:16:38 +01:00
Guillaume Gomez
c50bfda34f Add GUI regression test for doc struct fields margins 2024-10-27 11:26:45 +01:00
Jubilee
b80593995d
Rollup merge of #132183 - GuillaumeGomez:code-in-docblock, r=notriddle
Fix code HTML items making big blocks if too long

Encountered this bug randomly where `code` item in docblocks would look like this:

![Screenshot from 2024-10-26 15-44-46](https://github.com/user-attachments/assets/a9c1df9d-5007-49eb-a7dd-a2c381b2511e)

With this fix it looks like this:

![image](https://github.com/user-attachments/assets/ea918595-5434-4781-b68c-6abd38689365)

r? ``@notriddle``
2024-10-26 21:58:39 -07:00
Guillaume Gomez
88f4425dd2 Update GUI test 2024-10-26 20:40:59 +02:00
Guillaume Gomez
ae66380da0 Add GUI regression test for code in doc blocks 2024-10-26 15:45:17 +02:00
Michael Howell
a53655a023 rustdoc: adjust spacing and typography in header 2024-10-23 19:15:23 -04:00
Guillaume Gomez
5e6033ea8b Strengthen some GUI tests 2024-10-09 21:23:20 +02:00
Guillaume Gomez
12d5f0aa2c Add GUI regression test for methods left margin on mobile 2024-10-09 21:01:08 +02:00
Guillaume Gomez
16844e2485 Fix methods alignment on mobile 2024-10-09 21:01:08 +02:00