From 16a3c8032e634d3da53f8d4c0a875f369a9d4394 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 6 Jan 2023 12:20:03 -0700 Subject: [PATCH] rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }` This CSS was added in dc2c9723343c985740be09919236a6e96c4e4433, before 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c when the sidebars were merged. Now that they are merged, the source sidebar is being pushed off-screen anyway, so giving it zero width doesn't do much. --- src/librustdoc/html/static/css/rustdoc.css | 6 +----- src/test/rustdoc-gui/sidebar-source-code-display.goml | 6 +++--- src/test/rustdoc-gui/sidebar-source-code.goml | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 05a12d3d4d4..d77b65ac603 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1598,14 +1598,10 @@ in storage.js .sidebar.shown, .source-sidebar-expanded .source .sidebar, - .sidebar:focus-within { + .rustdoc:not(.source) .sidebar:focus-within { left: 0; } - .rustdoc.source > .sidebar { - width: 0; - } - .mobile-topbar h2 { padding-bottom: 0; margin: auto 0.5em auto auto; diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index df4506e1119..d0e2c8a6adc 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -171,15 +171,15 @@ assert-css: ( // We now check that the scroll position is kept when opening the sidebar. click: "#src-sidebar-toggle" -wait-for-css: (".sidebar", {"width": "0px"}) +wait-for-css: (".sidebar", {"left": "-1000px"}) // We scroll to line 117 to change the scroll position. scroll-to: '//*[@id="117"]' assert-window-property: {"pageYOffset": "2542"} // Expanding the sidebar... click: "#src-sidebar-toggle" -wait-for-css: (".sidebar", {"width": "500px"}) +wait-for-css: (".sidebar", {"left": "0px"}) click: "#src-sidebar-toggle" -wait-for-css: (".sidebar", {"width": "0px"}) +wait-for-css: (".sidebar", {"left": "-1000px"}) // The "scrollTop" property should be the same. assert-window-property: {"pageYOffset": "2542"} diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml index 6bc07fbae04..08a237e49da 100644 --- a/src/test/rustdoc-gui/sidebar-source-code.goml +++ b/src/test/rustdoc-gui/sidebar-source-code.goml @@ -77,11 +77,11 @@ assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@op // We now switch to mobile mode. size: (600, 600) -wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"}) +wait-for-css: (".source-sidebar-expanded nav.sidebar", {"left": "0px"}) // We collapse the sidebar. click: (10, 10) -// We check that the sidebar has the expected width (0). -assert-css: ("nav.sidebar", {"width": "0px"}) +// We check that the sidebar has been moved off-screen. +assert-css: ("nav.sidebar", {"left": "-1000px"}) // We ensure that the class has been removed. assert-false: ".source-sidebar-expanded" assert: "nav.sidebar"