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
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java
index 135b5e9..803935e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java
@@ -271,10 +271,7 @@
     }
   }
 
-  private void appendImageDifferences(final PatchScript script,
-      final SafeHtmlBuilder nc) {
-    final String rawBase = GWT.getHostPageBaseURL() + "cat/";
-
+  private void appendImageLine(final SafeHtmlBuilder nc, final String url) {
     nc.openTr();
     nc.setAttribute("valign", "center");
     nc.setAttribute("align", "center");
@@ -288,22 +285,32 @@
 
     nc.openTd();
     nc.setStyleName(Gerrit.RESOURCES.css().fileLine());
-    if (script.getDisplayMethodA() == DisplayMethod.IMG) {
-      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");
-    }
+    appendImgTag(nc, url);
     nc.closeTd();
 
     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,
       final SafeHtmlBuilder nc, final ArrayList<PatchLine> lines) {
     final SparseHtmlFile a = getSparseHtmlFileA(script);