summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorAndy Huang <ath@google.com>2014-02-04 19:58:57 -0800
committerAndy Huang <ath@google.com>2014-02-07 12:09:56 -0800
commit4dc732387454eef3ee6d89f9fa393630eb6213f9 (patch)
treece9b69607740223c2f6247cffa008b5fa271679e /assets
parente7ac3c2aae204147a02e0e4217da3be15e8e7f54 (diff)
downloadandroid_packages_apps_UnifiedEmail-4dc732387454eef3ee6d89f9fa393630eb6213f9.tar.gz
android_packages_apps_UnifiedEmail-4dc732387454eef3ee6d89f9fa393630eb6213f9.tar.bz2
android_packages_apps_UnifiedEmail-4dc732387454eef3ee6d89f9fa393630eb6213f9.zip
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
Diffstat (limited to 'assets')
-rw-r--r--assets/script.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/assets/script.js b/assets/script.js
index 79987d353..b8bd62cfa 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -175,9 +175,14 @@ function normalizeElementWidths(elements) {
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 @@ function normalizeElementWidths(elements) {
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;
}
}