From dde361128157a0845fb51d11dcd121c3491dd4a7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 27 Jan 2018 18:58:59 +0100 Subject: [PATCH 1/3] Fix rendering issues on mobile --- src/librustdoc/html/static/main.js | 26 ++++++++++++++++++++++ src/librustdoc/html/static/rustdoc.css | 8 ++++--- src/librustdoc/html/static/themes/dark.css | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 0f9e7001c159b..ba9bcb7af7ae0 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -47,6 +47,8 @@ // 2 for "In Return Types" var currentTab = 0; + var themesWidth = null; + function hasClass(elem, className) { if (elem && className && elem.className) { var elemClass = elem.className; @@ -121,10 +123,25 @@ sidebar.appendChild(div); } } + var themeChoices = document.getElementById("theme-choices"); + if (themeChoices) { + if (!themesWidth) { + var savedState = themeChoices.style.display; + themeChoices.style.display = 'block'; + themesWidth = themeChoices.offsetWidth + 'px'; + themeChoices.style.display = savedState; + } + themeChoices.style.position = "fixed"; + themeChoices.style.width = themesWidth; + themeChoices.style.top = '78px'; + themeChoices.style.left = '250px'; + } document.getElementsByTagName("body")[0].style.marginTop = '45px'; var themePicker = document.getElementById("theme-picker"); if (themePicker) { themePicker.style.position = "fixed"; + themePicker.style.top = "50px"; + themePicker.style.left = "250px"; } } @@ -143,6 +160,15 @@ var themePicker = document.getElementById("theme-picker"); if (themePicker) { themePicker.style.position = "absolute"; + themePicker.style.top = null; + themePicker.style.left = null; + } + var themeChoices = document.getElementById("theme-choices"); + if (themeChoices) { + themeChoices.style.position = 'absolute'; + themeChoices.style.width = null; + themeChoices.style.top = null; + themeChoices.style.left = null; } } diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index d2eeb2e15b3dd..cb6f5d836b8a7 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -856,6 +856,7 @@ span.since { display: block; border-bottom: 1px solid; border-right: 1px solid; + height: 45px; } .sidebar-elems { @@ -875,7 +876,8 @@ span.since { } nav.sub { - margin: 0 auto; + width: calc(100% - 32px); + float: right; } .content { @@ -1184,8 +1186,8 @@ kbd { @media (max-width: 700px) { .theme-picker { - left: 109px; - top: 7px; + left: 10px; + top: 54px; z-index: 1; } } diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index 4c6bcab72b7c9..907a6e4fcb4a0 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -383,6 +383,6 @@ kbd { @media (max-width: 700px) { #theme-picker { - background: #353535; + background: #f0f0f0; } } From c26abe75bcc4201c8f94d278f9da8645c4a8f718 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 4 Feb 2018 13:38:39 +0100 Subject: [PATCH 2/3] Fix not selectable search input --- src/librustdoc/html/static/rustdoc.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index cb6f5d836b8a7..fc5444b6b788d 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -884,6 +884,11 @@ span.since { margin-left: 0px; } + #main { + margin-top: 50px; + padding: 0; + } + .content .in-band { width: 100%; } From 8a587e67afcd99e800eb0783a090f8b163cdfb10 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 4 Feb 2018 13:47:35 +0100 Subject: [PATCH 3/3] Improve big sidebar elements display --- src/librustdoc/html/static/rustdoc.css | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index fc5444b6b788d..6d95123e63c65 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1035,6 +1035,24 @@ h4 > .important-traits { .show-it { display: block; + width: 246px; + } + + .show-it > .block.items { + margin: 8px 0; + } + + .show-it > .block.items > ul { + margin: 0; + } + + .show-it > .block.items > ul > li { + text-align: center; + margin: 2px 0; + } + + .show-it > .block.items > ul > li > a { + font-size: 21px; } /* Because of ios, we need to actually have a full height sidebar title so the