Render conversations to 980px viewport

Expand all conversations to 980px width to allow double-tap to continue
to work on newer Chromium builds. See
https://codereview.chromium.org/18850005.

cool side effects
* much more usable double-tap zoom factor on KK+ (now "it just works")
* better text rendering fidelity in complex layouts (text no longer
  escapes bounds as it tended to do before)
* fixes text sizing edge cases where text was unexpectedly large and/or
  line heights messed with text rendering

Initially enable these changes on both JB- and KK+ WebViews. Disable
NARROW_COLUMNS layout on JB- to prevent very short columns.
pros on JB-: better rendering fidelity like on KK+, consistency with KK+
cons on JB-: some power users will miss pinch-then-double-tap-to-reflow
functionality

Possible future improvement: use device-width viewport when full convo
fits to inherit Chromium's new fast-click-handling behavior.

Bug: 12579959
Bug: 10695551
Change-Id: I13f85a6df909a966fcd0862e5bd292ec6ae77212
diff --git a/assets/script.js b/assets/script.js
index 79987d3..b8bd62c 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -175,9 +175,14 @@
     var i;
     var el;
     var documentWidth;
+    var goalWidth;
+    var origWidth;
     var newZoom, oldZoom;
+    var outerZoom;
+    var outerDiv;
 
     documentWidth = document.body.offsetWidth;
+    goalWidth = WEBVIEW_WIDTH - DOC_SIDE_MARGIN * 2;
 
     for (i = 0; i < elements.length; i++) {
         el = elements[i];
@@ -186,12 +191,21 @@
         if (oldZoom) {
             el.style.zoom = 1;
         }
+        origWidth = el.style.width;
+        el.style.width = goalWidth + "px";
         newZoom = documentWidth / el.scrollWidth;
-        transformContent(el, documentWidth, el.scrollWidth);
+        transformContent(el, goalWidth, el.scrollWidth);
         newZoom = documentWidth / el.scrollWidth;
         if (NORMALIZE_MESSAGE_WIDTHS) {
-            el.style.zoom = newZoom;
+            if (el.classList.contains("mail-message-content")) {
+                outerZoom = 1;
+            } else {
+                outerDiv = up(el, "mail-message-content");
+                outerZoom = outerDiv ? outerDiv.style.zoom : 1;
+            }
+            el.style.zoom = newZoom / outerZoom;
         }
+        el.style.width = origWidth;
     }
 }