Adjust HTML message bubbles to utilize information from PathDiagnosticPiece::Kind.
llvm-svn: 65891
This commit is contained in:
parent
49d64927e1
commit
c62af6c4cf
|
@ -388,7 +388,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
|
||||||
|
|
||||||
// Next, determine the approximate size of the message bubble in em.
|
// Next, determine the approximate size of the message bubble in em.
|
||||||
unsigned em;
|
unsigned em;
|
||||||
const unsigned max_line = 120;
|
const unsigned max_line = 110;
|
||||||
|
|
||||||
if (max_token >= max_line)
|
if (max_token >= max_line)
|
||||||
em = max_token / 2;
|
em = max_token / 2;
|
||||||
|
@ -407,9 +407,16 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
|
||||||
em = characters / 2;
|
em = characters / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now generate the message bubble.
|
// Now generate the message bubble.
|
||||||
std::string s;
|
const char *Kind = 0;
|
||||||
llvm::raw_string_ostream os(s);
|
switch (P.getKind()) {
|
||||||
|
default: break;
|
||||||
|
case PathDiagnosticPiece::Event: Kind = "Event"; break;
|
||||||
|
case PathDiagnosticPiece::ControlFlow: Kind = "Control"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string sbuf;
|
||||||
|
llvm::raw_string_ostream os(sbuf);
|
||||||
|
|
||||||
os << "\n<tr><td class=\"num\"></td><td class=\"line\"><div id=\"";
|
os << "\n<tr><td class=\"num\"></td><td class=\"line\"><div id=\"";
|
||||||
|
|
||||||
|
@ -419,19 +426,26 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
|
||||||
os << "Path" << num;
|
os << "Path" << num;
|
||||||
|
|
||||||
os << "\" class=\"msg";
|
os << "\" class=\"msg";
|
||||||
switch (P.getKind()) {
|
if (Kind) os << " msg" << Kind;
|
||||||
default: break;
|
|
||||||
case PathDiagnosticPiece::Event: os << " msgEvent"; break;
|
|
||||||
case PathDiagnosticPiece::ControlFlow: os << " msgControl"; break;
|
|
||||||
}
|
|
||||||
os << "\" style=\"margin-left:" << PosNo << "ex";
|
os << "\" style=\"margin-left:" << PosNo << "ex";
|
||||||
if (em < max_line/2) os << "; max-width:" << em << "em";
|
if (em < max_line/2) os << "; max-width:" << em << "em";
|
||||||
os << "\">";
|
os << "\">";
|
||||||
|
|
||||||
if (max > 1)
|
if (max > 1) {
|
||||||
os << "<span class=\"PathIndex\">[" << num << "]</span> ";
|
os << "<table class=\"msgT\"><tr><td valign=\"top\">";
|
||||||
|
os << "<div class=\"PathIndex";
|
||||||
|
if (Kind) os << " PathIndex" << Kind;
|
||||||
|
os << "\">" << num << "</div>";
|
||||||
|
os << "</td><td>";
|
||||||
|
}
|
||||||
|
|
||||||
os << html::EscapeText(Msg) << "</div></td></tr>";
|
os << html::EscapeText(Msg);
|
||||||
|
|
||||||
|
if (max > 1) {
|
||||||
|
os << "</td></tr></table>";
|
||||||
|
}
|
||||||
|
|
||||||
|
os << "</div></td></tr>";
|
||||||
|
|
||||||
// Insert the new html.
|
// Insert the new html.
|
||||||
unsigned DisplayPos = LineEnd - FileStart;
|
unsigned DisplayPos = LineEnd - FileStart;
|
||||||
|
|
|
@ -314,12 +314,17 @@ void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
|
||||||
" .msg { padding:0.5em 1ex 0.5em 1ex }\n"
|
" .msg { padding:0.5em 1ex 0.5em 1ex }\n"
|
||||||
" .msg { margin-top:10px; margin-bottom:10px }\n"
|
" .msg { margin-top:10px; margin-bottom:10px }\n"
|
||||||
" .msg { font-weight:bold }\n"
|
" .msg { font-weight:bold }\n"
|
||||||
" .msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap;}\n"
|
" .msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap }\n"
|
||||||
|
" .msgT { padding:0x; spacing:0x }\n"
|
||||||
" .msgEvent { background-color:#fff8b4; color:#000000 }\n"
|
" .msgEvent { background-color:#fff8b4; color:#000000 }\n"
|
||||||
" .msgControl { background-color:#bbbbbb; color:#444444 }\n"
|
" .msgControl { background-color:#bbbbbb; color:#000000 }\n"
|
||||||
" .mrange { background-color:#dfddf3 }\n"
|
" .mrange { background-color:#dfddf3 }\n"
|
||||||
" .mrange { border-bottom:1px solid #6F9DBE }\n"
|
" .mrange { border-bottom:1px solid #6F9DBE }\n"
|
||||||
" .PathIndex { font-weight: bold }\n"
|
" .PathIndex { font-weight: bold; padding:5px;margin-right:5px;top:5px}\n"
|
||||||
|
" .PathIndex { -webkit-box-shadow:1px 1px 7px #000 }\n"
|
||||||
|
" .PathIndex { -webkit-border-radius:5px }\n"
|
||||||
|
" .PathIndexEvent { background-color:#fffbd9 }\n"
|
||||||
|
" .PathIndexControl { background-color:#dddddd }\n"
|
||||||
" .CodeInsertionHint { font-weight: bold; background-color: #10dd10 }\n"
|
" .CodeInsertionHint { font-weight: bold; background-color: #10dd10 }\n"
|
||||||
" .CodeRemovalHint { background-color:#de1010 }\n"
|
" .CodeRemovalHint { background-color:#de1010 }\n"
|
||||||
" .CodeRemovalHint { border-bottom:1px solid #6F9DBE }\n"
|
" .CodeRemovalHint { border-bottom:1px solid #6F9DBE }\n"
|
||||||
|
|
Loading…
Reference in New Issue