Skip to content

Commit f94b90c

Browse files
committed
Continued from previous commit
1 parent c390c4c commit f94b90c

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

gcovr-templates/html/gcovr.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,17 +1389,18 @@
13891389
var target = document.getElementById(this.getAttribute('href').substring(1));
13901390
if (target) {
13911391
e.preventDefault();
1392-
// Scroll so the target line sits just below the sticky header
1393-
var header = document.querySelector('.main-header');
1394-
var headerBottom = header ? header.getBoundingClientRect().bottom : 0;
1395-
var gap = 16; // breathing room below header
1396-
var targetTop = target.getBoundingClientRect().top + window.scrollY;
1397-
window.scrollTo({ top: targetTop - headerBottom - gap, behavior: 'smooth' });
1392+
// Scroll within the source-table-container
1393+
var scrollBox = document.querySelector('.source-table-container');
1394+
var row = target.closest('tr');
1395+
if (scrollBox && row) {
1396+
var thead = scrollBox.querySelector('thead');
1397+
var theadHeight = thead ? thead.offsetHeight : 0;
1398+
scrollBox.scrollTo({ top: row.offsetTop - theadHeight - 8, behavior: 'smooth' });
1399+
}
13981400
history.replaceState(null, '', this.getAttribute('href'));
13991401
// Highlight the target row (clear any previous highlight first)
14001402
var prev = document.querySelector('.highlight-target');
14011403
if (prev) prev.classList.remove('highlight-target');
1402-
var row = target.closest('tr');
14031404
if (row) row.classList.add('highlight-target');
14041405
}
14051406
});
@@ -1422,7 +1423,16 @@
14221423
var row = el.closest('tr');
14231424
if (row) {
14241425
row.classList.add('highlight-target');
1425-
if (scroll) row.scrollIntoView({ block: 'center' });
1426+
if (scroll) {
1427+
var scrollBox = document.querySelector('.source-table-container');
1428+
if (scrollBox) {
1429+
var thead = scrollBox.querySelector('thead');
1430+
var theadHeight = thead ? thead.offsetHeight : 0;
1431+
scrollBox.scrollTo({ top: row.offsetTop - theadHeight - 8, behavior: 'smooth' });
1432+
} else {
1433+
row.scrollIntoView({ block: 'center' });
1434+
}
1435+
}
14261436
}
14271437
}
14281438

gcovr-templates/html/style.css

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,7 @@ body.sidebar-resizing .main-content {
947947
min-height: 0;
948948
display: flex;
949949
flex-direction: column;
950-
padding: 24px;
951-
padding-right: 12px;
952-
padding-left: 0;
950+
padding: 12px 12px 4px 0;
953951
width: 100%;
954952
margin-left: 0;
955953
}
@@ -962,11 +960,10 @@ body.sidebar-resizing .main-content {
962960
}
963961

964962
.main-footer {
965-
padding: 1rem;
963+
padding: 4px 8px;
966964
text-align: center;
967965
color: var(--text-muted);
968966
font-size: var(--font-size-xs);
969-
border-top: 1px solid var(--border-color);
970967
}
971968

972969
.main-footer a {
@@ -978,7 +975,7 @@ body.sidebar-resizing .main-content {
978975
=========================================== */
979976

980977
.summary-section {
981-
margin-bottom: 24px;
978+
margin-bottom: 12px;
982979
}
983980

984981
.summary-cards {
@@ -1449,7 +1446,8 @@ body.sidebar-resizing .main-content {
14491446

14501447
.source-table {
14511448
min-width: 100%;
1452-
border-collapse: collapse;
1449+
border-collapse: separate;
1450+
border-spacing: 0;
14531451
font-family: var(--font-mono);
14541452
font-size: var(--font-size-code);
14551453
line-height: 1.2;
@@ -1468,6 +1466,7 @@ body.sidebar-resizing .main-content {
14681466
font-weight: 600;
14691467
text-align: left;
14701468
border-bottom: 1px solid var(--border-color);
1469+
border-bottom: 1px solid var(--border-color);
14711470
white-space: nowrap;
14721471
}
14731472

0 commit comments

Comments
 (0)