Indefero

Indefero Commit Details


Date:2011-10-08 17:13:34 (13 years 2 months ago)
Author:Thomas Keller
Branch:develop, feature.diff-whitespace, feature.wiki-default-page, release-1.2, release-1.3
Commit:2e0995abac2175f1f77de7f47930d8996236d7d6
Parents: c84afd0f783537a5255ed2637568f242e0356640
Message:Fixed rendering in Firefox which did, unlike Chrome, not expand the last row's height to fit the up-popping horizontal scrollbar, but all rows just a little, so the heights did not match. I've reworked this to not used the ill-advised rowspan any longer, but two separate tables whose heights match each other now in both browsers.

Also I fixed a bug in the whitespace detection code - utf8 characters
where broken into single bytes, so apparently the [:print:] character
class does not accout for them, even in //u mode, so we're selecting
the characters that we want to make visible on our own (basically
control characters lower than space, I might add more).
Changes:

File differences

src/IDF/Diff.php
183183
184184
185185
186
186
187187
188
188
189189
190
190
191191
192192
193
193
194194
195195
196196
197197
198198
199199
200
200
201201
202202
203203
204204
205
206
207
208
209
210
211
212
213205
214206
215207
216208
217209
218
210
219211
220212
221213
222214
223
215
216
217
218
219
220
221
222
223
224224
225
226225
227
228
226
227
228
229
230
231
232
233
234
229235
230
231
232
233
236
234237
235
236
238
239
240
237241
238242
239243
......
243247
244248
245249
246
250
247251
248252
249253
foreach ($chunk as $line) {
list($left, $right, $content) = $line;
if ($left and $right) {
$class = 'diff diff-c';
$class = 'context';
} elseif ($left) {
$class = 'diff diff-r';
$class = 'removed';
} else {
$class = 'diff diff-a';
$class = 'added';
}
$offsets[] = sprintf('<td class="diff-lc">%s</td><td class="diff-lc">%s</td>', $left, $right);
$offsets[] = sprintf('<td>%s</td><td>%s</td>', $left, $right);
$content = Pluf_esc($content);
$content = self::makeNonPrintableCharsVisible($content);
$contents[] = sprintf('<td class="%s%s mono">%s</td>', $class, $pretty, $content);
}
if (count($file['chunks']) > $cc) {
$offsets[] = '<td class="next">...</td><td class="next">...</td>';
$contents[] = '<td class="next">&nbsp;</td>';
$contents[] = '<td class="next"></td>';
}
$cc++;
}
$inner = '<table class="diff-content">' ."\n".
'<tr class="diff-line">' .
implode('</tr>'."\n".'<tr class="diff-line">', $contents) .
'</tr>' ."\n".
'</table>' ."\n";
$rows = count($offsets);
list($added, $removed) = end($file['chunks_def']);
$added = $added[0] + $added[1];
$leftwidth = 1;
if ($added > 0)
$leftwidth = (ceil(log10($added)) + 1) * 10;
$leftwidth = ((ceil(log10($added)) + 1) * 8) + 12;
$removed = $removed[0] + $removed[1];
$rightwidth = 1;
if ($removed > 0)
$rightwidth = (ceil(log10($removed)) + 1) * 10;
$rightwidth = ((ceil(log10($removed)) + 1) * 8) + 12;
$inner_linecounts =
'<table class="diff-linecounts">' ."\n".
'<colgroup><col width="'.$leftwidth.'" /><col width="'. $rightwidth.'" /></colgroup>' ."\n".
'<tr class="line">' .
implode('</tr>'."\n".'<tr class="line">', $offsets).
'</tr>' ."\n".
'</table>' ."\n";
$first = array_shift($offsets);
$out .= '<table class="diff" summary="">' ."\n".
'<colgroup><col width="'.$leftwidth.'" /><col width="'.$rightwidth.'" /><col width="*" /></colgroup>' ."\n".
$inner_contents =
'<table class="diff-contents">' ."\n".
'<tr class="line">' .
implode('</tr>'."\n".'<tr class="line">', $contents) .
'</tr>' ."\n".
'</table>' ."\n";
$out .= '<table class="diff">' ."\n".
'<colgroup><col width="'.($leftwidth + $rightwidth + 1).'" /><col width="*" /></colgroup>' ."\n".
'<tr id="diff-'.md5($filename).'">'.
'<th colspan="3">'.Pluf_esc($filename).'</th>'.
'</tr>' ."\n".
'<tr class="line">' .
$first . sprintf('<td rowspan="%d"><div class="diff-content">%s</div></td>', $rows, $inner) .
'<th colspan="2">'.Pluf_esc($filename).'</th>'.
'</tr>' ."\n".
'<tr class="line">' .
implode('</tr>'."\n".'<tr class="line">', $offsets) .
'<tr>' .
'<td>'. $inner_linecounts .'</td>'. "\n".
'<td><div class="scroll">'. $inner_contents .'</div></td>'.
'</tr>' ."\n".
'</table>' ."\n";
}
private static function makeNonPrintableCharsVisible($line)
{
return preg_replace('/([^[:print:]\t])/e',
return preg_replace('/([\x00-\x1F])/ue',
'"<span class=\"non-printable\" title=\"0x".strtoupper(bin2hex("\\1"))."\">".bin2hex("\\1")."</span>"',
$line);
}
www/media/idf/css/style.css
212212
213213
214214
215
215
216216
217217
218218
219
220
219
220
221221
222222
223223
224
225
224
225
226226
227227
228228
......
506506
507507
508508
509
510
511
509
510
511
512512
513513
514514
515515
516
517
518
516
517
518
519519
520520
521521
......
572572
573573
574574
575
576575
577576
578577
579578
580
581
579
580
582581
583
582
584583
585584
586
587
588
585
586
589587
590588
591
592
593
594
595
589
590
591
592
596593
597594
598
595
599596
600
601597
602598
603
599
600
604601
605602
606603
607604
608605
609
606
607
610608
611609
612610
......
614612
615613
616614
617
618
619
620
621
622
623
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
624636
625637
626
627
628
629
630
631
638
639
640
641
642
643
644
645
646
647
648
649
650
632651
633652
634
653
635654
636655
637656
638
657
639658
640659
641660
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
658677
659678
660
661
679
680
662681
663682
664
665
683
684
666685
667686
668
669
687
688
670689
671690
672
673
691
692
674693
675694
676695
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
696698
697699
698700
......
858860
859861
860862
861
862
863
864
863
864
865
866
865867
866868
867869
868
869
870
871
872
873
870
871
872
873
874
875
874876
875877
876878
877
878
879
879
880
881
880882
881883
882884
883
885
884886
885887
886888
887
889
888890
889891
890892
891
893
892894
893895
894896
......
11271129
11281130
11291131
1130
1132
11311133
11321134
11331135
1134
1136
11351137
11361138
11371139
1138
1140
11391141
11401142
11411143
11421144
11431145
11441146
1145
1146
1147
1147
1148
1149
11481150
11491151
11501152
1151
1152
1153
1154
11531155
11541156
11551157
1156
1158
11571159
11581160
11591161
1160
1161
1162
1162
1163
1164
11631165
11641166
11651167
11661168
11671169
11681170
1169
1170
1171
1172
11711173
11721174
11731175
1174
1175
1176
1177
11761178
11771179
11781180
1179
1181
11801182
11811183
11821184
1183
1185
11841186
11851187
11861188
1187
1188
1189
1190
11891191
11901192
11911193
1192
1194
11931195
11941196
11951197
1196
1197
1198
1199
11981200
11991201
12001202
1201
1202
1203
1203
1204
1205
12041206
12051207
12061208
1207
1209
12081210
12091211
12101212
1211
1213
12121214
1213
* Issue
*/
#tagscloud dl {
margin: 0;
margin: 0;
}
#tagscloud dt {
margin-top: .5em;
font-weight: bold;
margin-top: .5em;
font-weight: bold;
}
#tagscloud dd {
margin: 0;
display: inline;
margin: 0;
display: inline;
}
a.issue-c {
cursor: default;
display: block;
/*
if width will be 100% horizontal scrollbar will apear
when scroll mode will be used
*/
if width will be 100% horizontal scrollbar will apear
when scroll mode will be used
*/
/*width: 100%;*/
font: menu;
font-size: 12px;
/*
it is very important, if line-height not setted or setted
in relative units scroll will be broken in firefox
*/
it is very important, if line-height not setted or setted
in relative units scroll will be broken in firefox
*/
line-height: 16px;
overflow: hidden;
}
* syntax highlighting of diffs
*/
table.diff {
border-bottom: 1px solid #d3d7cf;
width: 100%;
table-layout: fixed;
}
table.diff th {
background-color: #e4e8E0;
table.diff td {
border: none;
vertical-align: top;
border-color: #d3d7cf;
padding: 0;
}
table.diff tr.line {
border: 1px solid #d3d7cf;
table.diff > tbody > tr > td + td {
border-right: 1px solid #d3d7cf;
}
table.diff tr.line td.diff-lc {
font-size: 90%;
padding: 1px 10px;
text-align: right;
width: 20px;
table.diff th {
background-color: #e4e8E0;
vertical-align: top;
border-color: #d3d7cf;
}
table.diff tr.line div.diff-content {
table.diff div.scroll {
overflow: auto;
display: block;
}
table.diff td {
table.diff-contents td,
table.diff-linecounts td {
vertical-align: top;
border-color: inherit;
padding: 0;
}
table.diff td.next {
table.diff-contents td.next,
table.diff-linecounts td.next {
background-color: #e4e8E0;
vertical-align: top;
text-align: right;
padding: 1px 10px;
}
table.diff-content {
border: 0;
/* setting this to 100% sometimes triggers the overflow of the parent container,
when it is not actually needed. we try to prevent that by taking not the
complete available space... */
width: 99.99%;
margin: 0;
table.diff-linecounts {
margin: 0;
}
table.diff-contents {
border-bottom: 1px solid #d3d7cf;
width: 100%;
margin: 0;
}
table.diff-linecounts tr,
table.diff-contents tr {
height: 18px;
}
table.diff-linecounts tr {
border: 1px solid #d3d7cf;
}
table.diff-linecounts tr:first-child {
border-top: 0px;
}
table.diff-content td.diff {
line-height: 12px;
padding: 2px;
font-size: 90%;
border: none;
white-space: pre;
table.diff-linecounts td {
font-size: 90%;
padding: 1px 10px;
text-align: right;
border-left: 1px solid #d3d7cf;
}
table.diff-contents td {
line-height: 12px;
padding: 2px;
font-size: 90%;
border: none;
white-space: pre;
}
table.diff-content td.diff-a {
table.diff-contents td.added {
background-color: #dfd;
}
table.diff-content td.diff-r {
table.diff-contents td.removed {
background-color: #fdd;
}
table.diff-content td.diff > span.non-printable {
visibility: hidden;
color: white;
text-transform: uppercase;
float: none;
font-size: 5.5pt;
font-family: Calibri, Helvetica, Arial, sans-serif;
text-align: center;
display: inline-block;
padding: 1px 1px 0px 1px;
margin-left: 1px;
margin-right: 1px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
cursor: default;
vertical-align: 10%;
table.diff-contents td > span.non-printable {
visibility: hidden;
color: white;
text-transform: uppercase;
float: none;
font-size: 5.5pt;
font-family: Calibri, Helvetica, Arial, sans-serif;
text-align: center;
display: inline-block;
padding: 1px 1px 0px 1px;
margin-left: 1px;
margin-right: 1px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
cursor: default;
vertical-align: 10%;
}
table.diff-content td.diff:hover > span.non-printable {
visibility: visible;
table.diff-contents td:hover > span.non-printable {
visibility: visible;
}
table.diff-content td.diff-a > span.non-printable {
background: #0A0;
table.diff-contents td.added > span.non-printable {
background: #0A0;
}
table.diff-content td.diff-r > span.non-printable {
background: #A00;
table.diff-contents td.removed > span.non-printable {
background: #A00;
}
table.diff-content td.diff-c > span.non-printable {
background: black;
table.diff-contents td.context > span.non-printable {
background: black;
}
/* override prettify css rule */
table.diff-content td.diff > span.non-printable > * {
color: white;
}
/*
This is a special hack: the outer td.next has
top/bottom border and padding and comes to a total
height of 20px - BUT it shares the upper border
with the previous row, so the height is actually
only 19px. The inner table has no lines between rows,
so the upper border is counted and we have 20px
in the interior, which is one pixel too much for
every occurrence.
What we now do is to remove the 1px top padding and
therefor lower the total height of the inner one
again by one to match the outer.
*/
table.diff-content td.next {
padding-top: 0;
table.diff-contents td > span.non-printable > * {
color: white;
}
/**
}
#wiki-toc {
float: right;
margin-left: 10px;
margin-bottom: 10px;
max-width: 33%;
float: right;
margin-left: 10px;
margin-bottom: 10px;
max-width: 33%;
}
#wiki-toc-content {
border: 1px solid #999999;
border-width: 1px 0;
padding: 10px 0;
padding-bottom: 15px;
background-color: #ffffff;
display: block;
border: 1px solid #999999;
border-width: 1px 0;
padding: 10px 0;
padding-bottom: 15px;
background-color: #ffffff;
display: block;
}
#wiki-toc-content a {
display: block;
margin-top: 0.5em;
font-size: 90%;
display: block;
margin-top: 0.5em;
font-size: 90%;
}
#wiki-toc-content a:first-child {
margin-top: 0;
margin-top: 0;
}
#wiki-toc-content a.wiki-h2 {
margin-left: 1em;
margin-left: 1em;
}
#wiki-toc-content a.wiki-h3 {
margin-left: 2em;
margin-left: 2em;
}
/**
* Stats on index
*/
#stats > h3 {
text-decoration : underline;
text-decoration : underline;
}
#stats table tr td {
border-style: none;
border-style: none;
}
#stats td {
padding: .2em;
padding: .2em;
}
/*
* Project list on index
*/
div.p-list-img {
float: left;
height: 32px;
margin-top: .5em;
float: left;
height: 32px;
margin-top: .5em;
}
div.p-list-prj {
float: left;
margin: .5em 0 .5em .8em;
float: left;
margin: .5em 0 .5em .8em;
}
div.p-list-prj p {
margin: 0px;
margin: 0px;
}
div.p-list-private {
bottom: 16px;
right: -3px;
position: relative;
bottom: 16px;
right: -3px;
position: relative;
}
/*
* Issue summary
*/
div.issue-summary {
float: left;
width: 50%;
float: left;
width: 50%;
}
div.issue-summary > div {
margin-right: 3em;
padding-top: 1em;
margin-right: 3em;
padding-top: 1em;
}
div.issue-summary h2 {
border-bottom: 1px solid #A5E26A;
border-bottom: 1px solid #A5E26A;
}
table.issue-summary {
width: 100%;
width: 100%;
}
table.issue-summary tr td {
border: 0;
padding: .1em .005em;
border: 0;
padding: .1em .005em;
}
table.issue-summary td.graph {
width: 60%;
width: 60%;
}
table.issue-summary td.count {
text-align: right;
padding-right: .5em;
text-align: right;
padding-right: .5em;
}
table.graph {
width: 100%;
margin: 0;
padding: 0;
width: 100%;
margin: 0;
padding: 0;
}
table.issue-summary td.graph-color {
background: #3C78B5;
background: #3C78B5;
}
table.issue-summary td.graph-percent {
padding-left: 1em;
padding-left: 1em;
}

Archive Download the corresponding diff file

Page rendered in 0.09985s using 13 queries.