Show diffed images above/below each other in unified diffs

Although unified diff shows text lines one above/below the other, we
showed images side-by-side. We now also show images one above/below
the other.

Change-Id: Ifbe16e241a4555570dc0ba11c62c1887a4d8fcca
This commit is contained in:
Christian Aistleitner
2013-04-24 17:24:26 +02:00
committed by Gerrit Code Review
parent 684fa1bdd9
commit f1542110b3

View File

@@ -271,10 +271,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
} }
} }
private void appendImageDifferences(final PatchScript script, private void appendImageLine(final SafeHtmlBuilder nc, final String url) {
final SafeHtmlBuilder nc) {
final String rawBase = GWT.getHostPageBaseURL() + "cat/";
nc.openTr(); nc.openTr();
nc.setAttribute("valign", "center"); nc.setAttribute("valign", "center");
nc.setAttribute("align", "center"); nc.setAttribute("align", "center");
@@ -288,22 +285,32 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
nc.openTd(); nc.openTd();
nc.setStyleName(Gerrit.RESOURCES.css().fileLine()); nc.setStyleName(Gerrit.RESOURCES.css().fileLine());
if (script.getDisplayMethodA() == DisplayMethod.IMG) { appendImgTag(nc, url);
if (idSideA == null) {
appendImgTag(nc, rawBase + KeyUtil.encode(patchKey.toString()) + "^1");
} else {
Patch.Key k = new Patch.Key(idSideA, patchKey.get());
appendImgTag(nc, rawBase + KeyUtil.encode(k.toString()) + "^0");
}
}
if (script.getDisplayMethodB() == DisplayMethod.IMG) {
appendImgTag(nc, rawBase + KeyUtil.encode(patchKey.toString()) + "^0");
}
nc.closeTd(); nc.closeTd();
nc.closeTr(); nc.closeTr();
} }
private void appendImageDifferences(final PatchScript script,
final SafeHtmlBuilder nc) {
final String rawBase = GWT.getHostPageBaseURL() + "cat/";
if (script.getDisplayMethodA() == DisplayMethod.IMG) {
final String url;
if (idSideA == null) {
url = rawBase + KeyUtil.encode(patchKey.toString()) + "^1";
} else {
Patch.Key k = new Patch.Key(idSideA, patchKey.get());
url = rawBase + KeyUtil.encode(k.toString()) + "^0";
}
appendImageLine(nc, url);
}
if (script.getDisplayMethodB() == DisplayMethod.IMG) {
final String url = rawBase + KeyUtil.encode(patchKey.toString()) + "^0";
appendImageLine(nc, url);
}
}
private void appendTextDifferences(final PatchScript script, private void appendTextDifferences(final PatchScript script,
final SafeHtmlBuilder nc, final ArrayList<PatchLine> lines) { final SafeHtmlBuilder nc, final ArrayList<PatchLine> lines) {
final SparseHtmlFile a = getSparseHtmlFileA(script); final SparseHtmlFile a = getSparseHtmlFileA(script);