List for cgit developers and users
 help / color / mirror / Atom feed
From: andy at warmcat.com (Andy Green)
Subject: [PATCH v2] blame: css: make blame highlight div absolute and top left
Date: Mon, 18 Jun 2018 14:02:54 +0800	[thread overview]
Message-ID: <152930177469.14523.10990799053551185333.stgit@mail.warmcat.com> (raw)
In-Reply-To: <152929959685.28149.11453139176219636772.stgit@mail.warmcat.com>

Normal operation of blame view requires div.highlight to
have absolute position and set to its parent's top left
for me.

Otherwise the grey background boxes indicating the extent of
the patch in the lines td displace the highlit sources, they
start at the bottom of the td.

This patch makes the blame highlight div start back up the top of
its parent area and render on top of the grey boxes.

Checked on Linux Firefox 60 and Linux Chrome 69.

"highlight" div class name is also used in md2html rendering
output.  So this patch solves it by introducing a wrapper
div and new "blame_highlight" css class.

Signed-off-by: Andy Green <andy at warmcat.com>
---
 cgit.css   |    2 ++
 ui-blame.c |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cgit.css b/cgit.css
index da8d9b0..5a85ceb 100644
--- a/cgit.css
+++ b/cgit.css
@@ -162,6 +162,8 @@ div#cgit table.list tr.nohover-highlight:hover:nth-child(odd) {
 	background: white;
 }
 
+div#cgit div.blame_highlight { position: absolute; top: 0; left: 0; }
+
 div#cgit table.list th {
 	font-weight: bold;
 	/* color: #888;
diff --git a/ui-blame.c b/ui-blame.c
index 6e23f0b..ab44e3f 100644
--- a/ui-blame.c
+++ b/ui-blame.c
@@ -196,7 +196,7 @@ static void print_object(const struct object_id *oid, const char *path,
 	free((void *)sb.final_buf);
 
 	/* Lines */
-	html("<pre><code>");
+	html("<div class=\"blame_highlight\"> <pre><code>");
 	if (ctx.repo->source_filter) {
 		char *filter_arg = xstrdup(basename);
 		cgit_open_filter(ctx.repo->source_filter, filter_arg);
@@ -207,7 +207,7 @@ static void print_object(const struct object_id *oid, const char *path,
 		html_txt(buf);
 	}
 
-	html("</code></pre>");
+	html("</code></pre></div>");
 
 	html("</div></td>\n");
 



  reply	other threads:[~2018-06-18  6:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  5:26 [PATCH] css: make " andy
2018-06-18  6:02 ` andy [this message]
2018-06-18 18:57   ` [PATCH v2] blame: css: make blame " john
2018-06-18 19:11     ` andy
2018-06-19 19:59       ` john
2018-06-20  0:50         ` andy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152930177469.14523.10990799053551185333.stgit@mail.warmcat.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).