Commit 1cead06
authored
Rollup merge of rust-lang#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```File tree
5 files changed
+42
-26
lines changed- src
- librustdoc/html/static
- css
- js
- test/rustdoc-gui
5 files changed
+42
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
390 | 394 | | |
391 | 395 | | |
392 | 396 | | |
393 | 397 | | |
394 | 398 | | |
395 | | - | |
| 399 | + | |
396 | 400 | | |
397 | 401 | | |
398 | 402 | | |
399 | | - | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| |||
1682 | 1686 | | |
1683 | 1687 | | |
1684 | 1688 | | |
1685 | | - | |
| 1689 | + | |
1686 | 1690 | | |
1687 | 1691 | | |
1688 | 1692 | | |
1689 | | - | |
| 1693 | + | |
1690 | 1694 | | |
1691 | 1695 | | |
1692 | 1696 | | |
| |||
1766 | 1770 | | |
1767 | 1771 | | |
1768 | 1772 | | |
1769 | | - | |
| 1773 | + | |
1770 | 1774 | | |
1771 | 1775 | | |
1772 | 1776 | | |
| |||
1889 | 1893 | | |
1890 | 1894 | | |
1891 | 1895 | | |
1892 | | - | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
| 1896 | + | |
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| |||
1910 | 1910 | | |
1911 | 1911 | | |
1912 | 1912 | | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
1913 | 1921 | | |
1914 | 1922 | | |
1915 | 1923 | | |
| |||
1952 | 1960 | | |
1953 | 1961 | | |
1954 | 1962 | | |
1955 | | - | |
| 1963 | + | |
1956 | 1964 | | |
1957 | 1965 | | |
1958 | 1966 | | |
| |||
2010 | 2018 | | |
2011 | 2019 | | |
2012 | 2020 | | |
2013 | | - | |
| 2021 | + | |
2014 | 2022 | | |
2015 | 2023 | | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
2016 | 2027 | | |
2017 | 2028 | | |
2018 | 2029 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
| 68 | + | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | | - | |
| 72 | + | |
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
| |||
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 105 | | |
112 | 106 | | |
113 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
236 | 241 | | |
237 | 242 | | |
238 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
239 | 250 | | |
240 | 251 | | |
241 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
0 commit comments