From e17863c216c4f411fcb5b2203e827c9a986edd0a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 20 Jan 2020 16:25:12 +0200 Subject: [PATCH] Fix #9574 htmlreport: fix sticky sidebar (#2495) * rename JS functions * Use the native font stack * Update cppcheck-htmlreport * Use a class for hiding content and toggle that instead. This should improve performance with huge reports. * reorder selectors * use classes for header and footer * remove unneeded clear property (we don't have floats anymore) * fix wrong `font-size` and `margin` properties * remove `dir=rtl` Related ticket: https://trac.cppcheck.net/ticket/9574 --- htmlreport/cppcheck-htmlreport | 220 ++++++++++++++++----------------- 1 file changed, 106 insertions(+), 114 deletions(-) diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 3c86d2b40..6cf400af6 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -24,7 +24,9 @@ with syntax highlighted source code. STYLE_FILE = """ body { - font: 13px Arial, Verdana, Sans-Serif; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; margin: 0; width: auto; } @@ -33,10 +35,72 @@ h1 { margin: 10px; } -#footer > p { +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { margin: 4px; } +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + .error { background-color: #ffb7b7; } @@ -58,13 +122,13 @@ h1 { margin-left: 4px; } -div.verbose { +.verbose { display: inline-block; vertical-align: top; cursor: help; } -div.verbose div.content { +.verbose .content { display: none; position: absolute; padding: 10px; @@ -80,77 +144,11 @@ div.verbose div.content { padding: 1px; } -#header { - border-bottom: thin solid #aaa; -} - -#menu { - float: left; - margin-top: 5px; - text-align: left; - width: 150px; - /*height: 75%;*/ - position: fixed; - overflow: auto; - z-index: 1; -} - -#menu_index { - float: left; - margin-top: 5px; - padding-left: 5px; - text-align: left; - width: 300px; - /*height: 75%;*/ - position: fixed; - overflow: auto; - z-index: 1; -} - -#menu > a { - display: block; - margin-left: 10px; - font: 12px; - z-index: 1; -} - -#filename { - margin-left: 10px; - font: 12px; - z-index: 1; -} - .highlighttable { background-color: #fff; z-index: 10; position: relative; - margin: -10 px; -} - -#content { - background-color: #fff; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - float: left; - margin: 5px; - margin-left: 10px; - padding: 0 10px 10px 10px; - width: 80%; - padding-left: 150px; -} - -#content_index { - background-color: #fff; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - float: left; - margin: 5px; - margin-left: 10px; - padding: 0 10px 10px 10px; - width: 80%; - padding-left: 300px; + margin: -10px; } .linenos { @@ -159,16 +157,8 @@ div.verbose div.content { padding-right: 6px; } -#footer { - border-top: thin solid #aaa; - clear: both; - font-size: 90%; - margin-top: 5px; -} - -#footer ul { - list-style-type: none; - padding-left: 0; +.d-none { + display: none; } """ @@ -185,10 +175,13 @@ HTML_HEAD = """ -