[opt-viewer] Truncate long remark text in source view

The table is changed to fixed layout[1] and the lines use ellipses if they
would overflow their cell.

[1] https://css-tricks.com/fixing-tables-long-strings/

llvm-svn: 318136
This commit is contained in:
Adam Nemet 2017-11-14 04:48:18 +00:00
parent edfc869151
commit 5bc61c0028
2 changed files with 21 additions and 7 deletions

View File

@ -119,17 +119,21 @@ class SourceFileRenderer:
</head>
<body>
<div class="centered">
<table>
<table class="source">
<thead>
<tr>
<td>Line</td>
<td>Hotness</td>
<td>Optimization</td>
<td>Source</td>
<td>Inline Context</td>
</tr>''', file=self.stream)
<th style="width: 2%">Line</td>
<th style="width: 3%">Hotness</td>
<th style="width: 10%">Optimization</td>
<th style="width: 70%">Source</td>
<th style="width: 15%">Inline Context</td>
</tr>
</thead>
<tbody>''', file=self.stream)
self.render_source_lines(self.source_stream, line_remarks)
print('''
</tbody>
</table>
</body>
</html>''', file=self.stream)

View File

@ -1,3 +1,13 @@
.source {
table-layout: fixed;
width: 100%;
white-space: nowrap;
}
.source td {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.red {
background-color: #ffd0d0;
}