summaryrefslogtreecommitdiffstats
path: root/gerrit-prettify
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2013-02-04 16:04:50 -0800
committerShawn Pearce <sop@google.com>2013-02-04 16:04:50 -0800
commit7e0aa0b417b19c03bc2add438323d4e937de0fe1 (patch)
tree09dce1b0ecd3a9066b97e074fa044995a71b2cff /gerrit-prettify
parent7c98dd477537316e862e23ee6caf909f65cc8aa6 (diff)
Fix performance problem in side by side viewer
Inserting "<lf>\n" doesn't work. Prettify leaves the <lf> but often inserts a <span> tag between <lf> and \n leaving a very deep tag stack for the DOM to handle. This is really slow to render and can cause mis-rendering. Insert a space before LF. Most prettify styles will treat this as the same as the LF, allowing the trailing space to be removed before splitting by line. Change-Id: I85d12c590a8d1bda1b1b66874a0dddb4628a8655
Diffstat (limited to 'gerrit-prettify')
-rw-r--r--gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java
index 56bd723d93..511b056c86 100644
--- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java
+++ b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java
@@ -145,9 +145,9 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
// Drop any '\r' to avoid this problem.
html = html.replace("\r</span>\n", "</span>\n");
- html = html.replace("\n", "<lf>\n");
+ html = html.replace("\n", " \n");
html = prettify(html, getFileType());
- html = html.replace("<lf>\n", "\n");
+ html = html.replace(" \n", "\n");
} else {
html = expandTabs(html);
}