ie6: Correct rendering of commit messages
IE6 won't honor an LF inside of a div formatted with "white-space: pre". Instead, create <br> and <p> tags ourselves to replace these LFs, such that the HTML renderer would lay out the lines according to the break tags. Unfortunately we have to use <p> rather than <br><br> to insert what should be a double LF, as IE6 collapses the double <br> tags into one, trying to outsmart the author of the page. Unfortunately the <p> margins collapse entirely under IE6, so we have to use padding on the <p> box to get them back the way we expected to see, but that messes with Firefox (which keeps the margins correctly) so we have to make the margin 0px to prevent getting double margins between paragraphs. Bug: GERRIT-85 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -455,6 +455,10 @@
|
||||
font-family: monospace;
|
||||
font-size: small;
|
||||
}
|
||||
.gerrit-ChangeScreen-Description p {
|
||||
margin-top: 0px;
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
|
||||
.gerrit-ChangeScreen .gerrit-ChangeMessages .header {
|
||||
width: 35em;
|
||||
|
||||
@@ -46,8 +46,13 @@ public class ChangeDescriptionBlock extends Composite {
|
||||
public void display(final Change chg, final PatchSetInfo info,
|
||||
final AccountInfoCache acc) {
|
||||
infoBlock.display(chg, acc);
|
||||
SafeHtml.set(description, new SafeHtmlBuilder().append(info.getMessage())
|
||||
.linkify());
|
||||
|
||||
SafeHtml msg = new SafeHtmlBuilder().append(info.getMessage());
|
||||
msg = msg.linkify();
|
||||
msg = msg.replaceAll("\n\n", "<p />");
|
||||
msg = msg.replaceAll("\n", "<br />");
|
||||
SafeHtml.set(description, msg);
|
||||
|
||||
descriptionPanel.setOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user