# HG changeset patch # User Anton Shestakov # Date 1515150968 -28800 # Node ID 6c2264732dc5ab3fdb3340090a46edf4b801875c # Parent acd8a2454b479fa52a846d57924de02dfda33e2d gitweb: make actual changeset entries have backgrounds on /graph This patch removes a separate container for backgrounds only and puts backgrounds on changeset elements themselves. This makes it so that JS code doesn't need to create background elements separately anymore. There's a bit of manipulating positions of elements: every changeset entry has a "fg" element that gets a higher z-index than element. This prioritizes text information, so that even if it somehow gets close to the graph drawn on (which has z-index of 5), it'll still be on top of it. This can happen if commit message has a long first line and browser window is narrow, for example. diff -r acd8a2454b47 -r 6c2264732dc5 mercurial/templates/gitweb/graph.tmpl --- a/mercurial/templates/gitweb/graph.tmpl Fri Jan 05 19:08:00 2018 +0800 +++ b/mercurial/templates/gitweb/graph.tmpl Fri Jan 05 19:16:08 2018 +0800 @@ -37,7 +37,6 @@
-
      {nodes%graphentry}
    @@ -46,12 +45,6 @@ var data = {jsdata|json}; var graph = new Graph(); graph.scale({bg_height}); - -graph.vertex = function(x, y, radius, color, parity, cur) \{ - Graph.prototype.vertex.apply(this, arguments); - return ['
  • ', '']; -} - graph.render(data); diff -r acd8a2454b47 -r 6c2264732dc5 mercurial/templates/gitweb/graphentry.tmpl --- a/mercurial/templates/gitweb/graphentry.tmpl Fri Jan 05 19:08:00 2018 +0800 +++ b/mercurial/templates/gitweb/graphentry.tmpl Fri Jan 05 19:16:08 2018 +0800 @@ -1,7 +1,9 @@ -
  • - - {desc|strip|firstline|escape|nonempty} - - {alltags} -
    {date|age}, by {author|person}
    +
  • +
    + + {desc|strip|firstline|escape|nonempty} + + {alltags} +
    {date|age}, by {author|person}
    +
  • diff -r acd8a2454b47 -r 6c2264732dc5 mercurial/templates/static/style-gitweb.css --- a/mercurial/templates/static/style-gitweb.css Fri Jan 05 19:08:00 2018 +0800 +++ b/mercurial/templates/static/style-gitweb.css Fri Jan 05 19:16:08 2018 +0800 @@ -302,23 +302,22 @@ margin: 0; } -ul#nodebgs { +ul#graphnodes { list-style: none inside none; padding: 0; margin: 0; - top: -0.7em; -} - -ul#graphnodes li, ul#nodebgs li { - height: 39px; } -ul#graphnodes { +ul#graphnodes li { + position: relative; + height: 37px; + overflow: visible; + padding-top: 2px; +} + +ul#graphnodes li .fg { position: absolute; z-index: 10; - top: -0.8em; - list-style: none inside none; - padding: 0; } ul#graphnodes li .info { diff -r acd8a2454b47 -r 6c2264732dc5 tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t Fri Jan 05 19:08:00 2018 +0800 +++ b/tests/test-hgweb-commands.t Fri Jan 05 19:16:08 2018 +0800 @@ -1781,35 +1781,42 @@
    -
      -
      @@ -1818,12 +1825,6 @@ var data = [{"edges": [[0, 0, 1, 3, "FF0000"]], "node": "cad8025a2e87", "vertex": [0, 1]}, {"edges": [[0, 0, 1, 3, ""]], "node": "1d22e65f027e", "vertex": [0, 1]}, {"edges": [[0, 0, 1, 3, ""]], "node": "a4f92ed23982", "vertex": [0, 1]}, {"edges": [], "node": "2ef0ac749a14", "vertex": [0, 1]}]; var graph = new Graph(); graph.scale(39); - - graph.vertex = function(x, y, radius, color, parity, cur) { - Graph.prototype.vertex.apply(this, arguments); - return ['
    • ', '']; - } - graph.render(data); diff -r acd8a2454b47 -r 6c2264732dc5 tests/test-hgweb-symrev.t --- a/tests/test-hgweb-symrev.t Fri Jan 05 19:08:00 2018 +0800 +++ b/tests/test-hgweb-symrev.t Fri Jan 05 19:16:08 2018 +0800 @@ -493,9 +493,9 @@ less more | (0) tip - third - second - first + third + second + first less more | (0) tip @@ -586,8 +586,8 @@ less more | (0) tip - second - first + second + first less more | (0) tip diff -r acd8a2454b47 -r 6c2264732dc5 tests/test-hgweb.t --- a/tests/test-hgweb.t Fri Jan 05 19:08:00 2018 +0800 +++ b/tests/test-hgweb.t Fri Jan 05 19:16:08 2018 +0800 @@ -340,7 +340,7 @@ $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server 200 Script output follows - content-length: 9135 + content-length: 9118 content-type: text/css body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; } @@ -647,23 +647,22 @@ margin: 0; } - ul#nodebgs { + ul#graphnodes { list-style: none inside none; padding: 0; margin: 0; - top: -0.7em; - } - - ul#graphnodes li, ul#nodebgs li { - height: 39px; } - ul#graphnodes { + ul#graphnodes li { + position: relative; + height: 37px; + overflow: visible; + padding-top: 2px; + } + + ul#graphnodes li .fg { position: absolute; z-index: 10; - top: -0.8em; - list-style: none inside none; - padding: 0; } ul#graphnodes li .info {