@@ -171,10 +171,19 @@ where
171
171
// | | (on successful return) | +_4 |
172
172
// +-+----------------------------------+------------+
173
173
174
- write ! (
175
- w,
176
- r#"<table border="1" cellborder="1" cellspacing="0" cellpadding="3" sides="rb">"# ,
177
- ) ?;
174
+ // N.B., Some attributes (`align`, `balign`) are repeated on parent elements and their
175
+ // children. This is because `xdot` seemed to have a hard time correctly propagating
176
+ // attributes. Make sure to test the output before trying to remove the redundancy.
177
+ // Notably, `align` was found to have no effect when applied only to <table>.
178
+
179
+ let table_fmt = concat ! (
180
+ " border=\" 1\" " ,
181
+ " cellborder=\" 1\" " ,
182
+ " cellspacing=\" 0\" " ,
183
+ " cellpadding=\" 3\" " ,
184
+ " sides=\" rb\" " ,
185
+ ) ;
186
+ write ! ( w, r#"<table{fmt}>"# , fmt = table_fmt) ?;
178
187
179
188
// A + B: Block header
180
189
if self . state_formatter . column_names ( ) . is_empty ( ) {
@@ -186,7 +195,7 @@ where
186
195
// C: Entry state
187
196
self . bg = Background :: Light ;
188
197
self . results . seek_to_block_start ( block) ;
189
- self . write_row_with_full_state ( w, "" , "(on_entry )" ) ?;
198
+ self . write_row_with_full_state ( w, "" , "(on entry )" ) ?;
190
199
191
200
// D: Statement transfer functions
192
201
for ( i, statement) in body[ block] . statements . iter ( ) . enumerate ( ) {
@@ -212,7 +221,7 @@ where
212
221
self . write_row ( w, "" , "(on successful return)" , |this, w, fmt| {
213
222
write ! (
214
223
w,
215
- r#"<td colspan="{colspan}" {fmt} align="left">"# ,
224
+ r#"<td balign="left" colspan="{colspan}" {fmt} align="left">"# ,
216
225
colspan = num_state_columns,
217
226
fmt = fmt,
218
227
) ?;
@@ -311,7 +320,9 @@ where
311
320
f : impl FnOnce ( & mut Self , & mut W , & str ) -> io:: Result < ( ) > ,
312
321
) -> io:: Result < ( ) > {
313
322
let bg = self . toggle_background ( ) ;
314
- let fmt = format ! ( "sides=\" tl\" {}" , bg. attr( ) ) ;
323
+ let valign = if mir. starts_with ( "(on " ) && mir != "(on entry)" { "bottom" } else { "top" } ;
324
+
325
+ let fmt = format ! ( "valign=\" {}\" sides=\" tl\" {}" , valign, bg. attr( ) ) ;
315
326
316
327
write ! (
317
328
w,
@@ -345,7 +356,7 @@ where
345
356
colspan = this. num_state_columns( ) ,
346
357
fmt = fmt,
347
358
) ?;
348
- pretty_print_state_elems ( w, analysis, state. iter ( ) , "," , LIMIT_40_ALIGN_1 ) ?;
359
+ pretty_print_state_elems ( w, analysis, state. iter ( ) , ", " , LIMIT_30_ALIGN_1 ) ?;
349
360
write ! ( w, "}}</td>" )
350
361
} )
351
362
}
@@ -416,7 +427,7 @@ where
416
427
}
417
428
418
429
self . prev_loc = location;
419
- write ! ( w, r#"<td {fmt} align="left">"# , fmt = fmt) ?;
430
+ write ! ( w, r#"<td {fmt} balign="left" align="left">"# , fmt = fmt) ?;
420
431
results. seek_after ( location) ;
421
432
let curr_state = results. get ( ) ;
422
433
write_diff ( & mut w, results. analysis ( ) , & self . prev_state , curr_state) ?;
@@ -524,12 +535,12 @@ where
524
535
for set in & [ & block_trans. gen , & block_trans. kill ] {
525
536
write ! (
526
537
w,
527
- r#"<td {fmt} rowspan="{rowspan}" align="center ">"# ,
538
+ r#"<td {fmt} rowspan="{rowspan}" balign="left" align="left ">"# ,
528
539
fmt = fmt,
529
540
rowspan = rowspan
530
541
) ?;
531
542
532
- pretty_print_state_elems ( & mut w, results. analysis ( ) , set. iter ( ) , " \n " , None ) ?;
543
+ pretty_print_state_elems ( & mut w, results. analysis ( ) , set. iter ( ) , BR_LEFT , None ) ?;
533
544
write ! ( w, "</td>" ) ?;
534
545
}
535
546
@@ -561,25 +572,28 @@ fn write_diff<A: Analysis<'tcx>>(
561
572
562
573
if !set. is_empty ( ) {
563
574
write ! ( w, r#"<font color="darkgreen">+"# ) ?;
564
- pretty_print_state_elems ( w, analysis, set. iter ( ) , "," , LIMIT_40_ALIGN_1 ) ?;
575
+ pretty_print_state_elems ( w, analysis, set. iter ( ) , ", " , LIMIT_30_ALIGN_1 ) ?;
565
576
write ! ( w, r#"</font>"# ) ?;
566
577
}
567
578
568
579
if !set. is_empty ( ) && !clear. is_empty ( ) {
569
- write ! ( w, "<br/>" ) ?;
580
+ write ! ( w, "{}" , BR_LEFT ) ?;
570
581
}
571
582
572
583
if !clear. is_empty ( ) {
573
584
write ! ( w, r#"<font color="red">-"# ) ?;
574
- pretty_print_state_elems ( w, analysis, clear. iter ( ) , "," , LIMIT_40_ALIGN_1 ) ?;
585
+ pretty_print_state_elems ( w, analysis, clear. iter ( ) , ", " , LIMIT_30_ALIGN_1 ) ?;
575
586
write ! ( w, r#"</font>"# ) ?;
576
587
}
577
588
578
589
Ok ( ( ) )
579
590
}
580
591
592
+ const BR_LEFT : & ' static str = r#"<br align="left"/>"# ;
593
+ const BR_LEFT_SPACE : & ' static str = r#"<br align="left"/> "# ;
594
+
581
595
/// Line break policy that breaks at 40 characters and starts the next line with a single space.
582
- const LIMIT_40_ALIGN_1 : Option < LineBreak > = Some ( LineBreak { sequence : "<br/> " , limit : 40 } ) ;
596
+ const LIMIT_30_ALIGN_1 : Option < LineBreak > = Some ( LineBreak { sequence : BR_LEFT_SPACE , limit : 30 } ) ;
583
597
584
598
struct LineBreak {
585
599
sequence : & ' static str ,
0 commit comments