hgweb: fix incorrect graph padding calculation (issue3626) stable
authorTim Delaney <timothy.c.delaney@gmail.com>
Mon, 17 Sep 2012 21:33:16 +0200
branchstable
changeset 17580 ffe3630cb243
parent 17544 26ebc7f72fe6
child 17581 54c832922e85
child 17582 495d3c671a8b
hgweb: fix incorrect graph padding calculation (issue3626) hgweb has an incorrect padding calculation, causing the text to move further away from the graph the more branches there are (issue3626). This patch fixes all existing templates (gitweb, monoblue, paper and spartan). Tests updated by Patrick Mezard <patrick@mezard.eu>
mercurial/templates/gitweb/graph.tmpl
mercurial/templates/monoblue/graph.tmpl
mercurial/templates/paper/graph.tmpl
mercurial/templates/spartan/graph.tmpl
tests/test-hgweb-commands.t
tests/test-hgweb-empty.t
--- a/mercurial/templates/gitweb/graph.tmpl	Tue Sep 11 10:59:21 2012 -0300
+++ b/mercurial/templates/gitweb/graph.tmpl	Mon Sep 17 21:33:16 2012 +0200
@@ -59,7 +59,7 @@
 	this.ctx.fill();
 	
 	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
+	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
 	var nstyle = 'padding-left: ' + left + 'px;';
 	
 	var tagspan = '';
--- a/mercurial/templates/monoblue/graph.tmpl	Tue Sep 11 10:59:21 2012 -0300
+++ b/mercurial/templates/monoblue/graph.tmpl	Mon Sep 17 21:33:16 2012 +0200
@@ -57,7 +57,7 @@
         this.ctx.fill();
 
         var bg = '<li class="bg parity' + parity + '"></li>';
-        var left = (this.columns + 1) * this.bg_height;
+        var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
         var nstyle = 'padding-left: ' + left + 'px;';
 
         var tagspan = '';
--- a/mercurial/templates/paper/graph.tmpl	Tue Sep 11 10:59:21 2012 -0300
+++ b/mercurial/templates/paper/graph.tmpl	Mon Sep 17 21:33:16 2012 +0200
@@ -70,7 +70,7 @@
 	this.ctx.fill();
 	
 	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
+	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
 	var nstyle = 'padding-left: ' + left + 'px;';
 
 	var tagspan = '';
--- a/mercurial/templates/spartan/graph.tmpl	Tue Sep 11 10:59:21 2012 -0300
+++ b/mercurial/templates/spartan/graph.tmpl	Mon Sep 17 21:33:16 2012 +0200
@@ -51,7 +51,7 @@
 	this.ctx.fill();
 	
 	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
+	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
 	var nstyle = 'padding-left: ' + left + 'px;';
 	var item = '<li style="' + nstyle + '"><span class="desc">';
 	item += '<a href="{url}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';
--- a/tests/test-hgweb-commands.t	Tue Sep 11 10:59:21 2012 -0300
+++ b/tests/test-hgweb-commands.t	Mon Sep 17 21:33:16 2012 +0200
@@ -988,7 +988,7 @@
   	this.ctx.fill();
   	
   	var bg = '<li class="bg parity' + parity + '"></li>';
-  	var left = (this.columns + 1) * this.bg_height;
+  	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
   	var nstyle = 'padding-left: ' + left + 'px;';
   	
   	var tagspan = '';
--- a/tests/test-hgweb-empty.t	Tue Sep 11 10:59:21 2012 -0300
+++ b/tests/test-hgweb-empty.t	Mon Sep 17 21:33:16 2012 +0200
@@ -258,7 +258,7 @@
   	this.ctx.fill();
   	
   	var bg = '<li class="bg parity' + parity + '"></li>';
-  	var left = (this.columns + 1) * this.bg_height;
+  	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
   	var nstyle = 'padding-left: ' + left + 'px;';
   
   	var tagspan = '';