hgweb: make followlines button absolutely positioned
authorAnton Shestakov <av6@dwimlabs.net>
Sun, 08 Apr 2018 20:53:07 +0800
changeset 37492 8d05938dd063
parent 37491 685ad41feba0
child 37493 f1413e4a54a6
hgweb: make followlines button absolutely positioned It used to have position: absolute only on annotate page, but it makes sense to have it everywhere, because the button shouldn't affect other elements at all. Especially since the button has a set height, which meant that for certain smaller fonts source lines were changing their height on hover. Note that the button doesn't set any of the usual properties that accompany absolute position (top, right, bottom or left). These properties would position the button without any account for source line padding. Instead, margins are used (the button already has all margins defined, they do the job).
mercurial/templates/static/style-gitweb.css
mercurial/templates/static/style-paper.css
tests/test-hgweb.t
--- a/mercurial/templates/static/style-gitweb.css	Mon Apr 09 22:00:11 2018 +0800
+++ b/mercurial/templates/static/style-gitweb.css	Sun Apr 08 20:53:07 2018 +0800
@@ -232,6 +232,7 @@
 }
 
 .btn-followlines {
+  position: absolute;
   display: none;
   cursor: pointer;
   box-sizing: content-box;
@@ -249,14 +250,6 @@
   line-height: 5px;
 }
 
-tr .btn-followlines {
-  position: absolute;
-}
-
-span .btn-followlines {
-  float: left;
-}
-
 span.followlines-select .btn-followlines {
   margin-left: -1.6em;
 }
--- a/mercurial/templates/static/style-paper.css	Mon Apr 09 22:00:11 2018 +0800
+++ b/mercurial/templates/static/style-paper.css	Sun Apr 08 20:53:07 2018 +0800
@@ -350,6 +350,7 @@
 }
 
 .btn-followlines {
+  position: absolute;
   display: none;
   cursor: pointer;
   box-sizing: content-box;
@@ -367,14 +368,6 @@
   line-height: 5px;
 }
 
-tr .btn-followlines {
-  position: absolute;
-}
-
-span .btn-followlines {
-  float: left;
-}
-
 span.followlines-select .btn-followlines {
   margin-left: -1.5em;
 }
--- a/tests/test-hgweb.t	Mon Apr 09 22:00:11 2018 +0800
+++ b/tests/test-hgweb.t	Sun Apr 08 20:53:07 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: 9126
+  content-length: 9059
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@@ -577,6 +577,7 @@
   }
   
   .btn-followlines {
+    position: absolute;
     display: none;
     cursor: pointer;
     box-sizing: content-box;
@@ -594,14 +595,6 @@
     line-height: 5px;
   }
   
-  tr .btn-followlines {
-    position: absolute;
-  }
-  
-  span .btn-followlines {
-    float: left;
-  }
-  
   span.followlines-select .btn-followlines {
     margin-left: -1.6em;
   }