[rustdoc] If line number setting is disabled, do not make line numbers take space#150396
Conversation
|
Some changes occurred in HTML/CSS/JS. |
|
The actual CSS looks fine, I'm not familiar with the GUI tests though so maybe someone else should take a look at that? |
|
Maybe @lolbinarycat knows enough about them? |
This comment has been minimized.
This comment has been minimized.
9ff3086 to
99836fc
Compare
|
I know a bit about the gui test system yeah, I'll do my best to take a look at this tomorrow. |
| assert-local-storage: {"rustdoc-line-numbers": "true" } | ||
|
|
||
| // The line numbers are being displayed, their "space" should be back. | ||
| assert-position-false: (".example-wrap code .macro", {"x": |span_x_pos|}) | ||
|
|
||
| // Same check with scraped examples line numbers. |
There was a problem hiding this comment.
this comment seems somewhat nonsensical now.
There was a problem hiding this comment.
How so? From there we check that the line numbers are as expected for scraped code examples. How would you write it?
There was a problem hiding this comment.
it seems like a similar check, but not exactly the same, in particular the padding checks aren't done for the first case.
There was a problem hiding this comment.
They're checked in the check-colors function (which is badly named ^^').
| set-local-storage: {"rustdoc-line-numbers": "true"} | ||
| reload: | ||
| // We wait for the line numbers to be added into the DOM by the JS... | ||
| wait-for: ".digits-1 pre" |
There was a problem hiding this comment.
why is this being removed? does store-position implicitly wait for the element to exist? if so, that should probably be documented. there's already enough sneaky race conditions in our gui tests.
There was a problem hiding this comment.
Because we don't need to wait for JS to generate line numbers anymore since we removed the reload:.
|
Alright, gui tests, looks fine to me, thanks for clearing things up. |
|
@bors r=lolbinarycat rollup |
Rollup merge of #150396 - GuillaumeGomez:fix-line-numbers-hidden, r=lolbinarycat [rustdoc] If line number setting is disabled, do not make line numbers take space While working on #150395, I realized that when enabled then disabled the "show line numbers" setting, instead of looking like initially: <img width="904" height="148" alt="Screenshot From 2025-12-26 16-51-44" src="https://github.com/user-attachments/assets/a24df2f2-61be-4db5-b60f-519b35425fd2" /> The "space" taken by line numbers was still there: <img width="904" height="148" alt="Screenshot From 2025-12-26 16-51-41" src="https://github.com/user-attachments/assets/b44af75d-52a4-4401-98e4-602b16bf6b9b" /> This PR fixes it. First commit cleans up the `utils.goml` file a bit, I think I'll do more cleanup because switching the settings without reloading the page should make GUI tests a bit faster. r? `@yotamofek`
While working on #150395, I realized that when enabled then disabled the "show line numbers" setting, instead of looking like initially:
The "space" taken by line numbers was still there:
This PR fixes it.
First commit cleans up the
utils.gomlfile a bit, I think I'll do more cleanup because switching the settings without reloading the page should make GUI tests a bit faster.r? @yotamofek