summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-03-30 13:33:01 -0700
committerShawn O. Pearce <sop@google.com>2009-03-30 13:45:04 -0700
commit4380fcd2ededbe849f4665a89670517454bab54a (patch)
treeccbfc2b800c9ffc9d4438d14899546cf31f471a2
parent7a1ee1dc817a714a0dedf20b606e6b77ce503ed3 (diff)
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>
-rw-r--r--src/main/java/com/google/gerrit/client/GerritCss.css4
-rw-r--r--src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/google/gerrit/client/GerritCss.css b/src/main/java/com/google/gerrit/client/GerritCss.css
index ddf2c9b727..1dc526dcf6 100644
--- a/src/main/java/com/google/gerrit/client/GerritCss.css
+++ b/src/main/java/com/google/gerrit/client/GerritCss.css
@@ -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;
diff --git a/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java b/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java
index 17dc4db0ad..da6f4305db 100644
--- a/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java
+++ b/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java
@@ -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);
}
}