diff options
author | Andy Huang <ath@google.com> | 2012-10-02 19:24:58 -0700 |
---|---|---|
committer | Andy Huang <ath@google.com> | 2012-10-02 19:59:47 -0700 |
commit | e964eeec3a088b3f4c29b68d41f99e43a321ac52 (patch) | |
tree | db0d032013c8f6cf8e2bdf8b5d85aa31caafadc3 /assets | |
parent | 0a648c9b8f9d02f89e8711e97215b0e30f2cf0b6 (diff) | |
download | android_packages_apps_UnifiedEmail-e964eeec3a088b3f4c29b68d41f99e43a321ac52.tar.gz android_packages_apps_UnifiedEmail-e964eeec3a088b3f4c29b68d41f99e43a321ac52.tar.bz2 android_packages_apps_UnifiedEmail-e964eeec3a088b3f4c29b68d41f99e43a321ac52.zip |
save/restore conversation view scroll position
Save scroll position as a fraction of total height to handle
scaled and width-change cases. Restore scroll position fraction
in JavaScript as soon as the document geometry is known.
(This was how it was done in Gmail1, and I can't find a better
non-JS way to detect this signal.)
Does not restore scale upon rotate/re-render.
Bug: 7246054
Bug: 7022509
Change-Id: Ibf811b31ba6d7d79d34c236f6ffe2229d626528f
Diffstat (limited to 'assets')
-rw-r--r-- | assets/script.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/assets/script.js b/assets/script.js index 0f250649b..39ee3c800 100644 --- a/assets/script.js +++ b/assets/script.js @@ -189,6 +189,13 @@ function setWideViewport() { metaViewport.setAttribute('content', 'width=' + WIDE_VIEWPORT_WIDTH); } +function restoreScrollPosition() { + var scrollYPercent = window.mail.getScrollYPercent(); + if (scrollYPercent && document.body.offsetHeight > window.innerHeight) { + document.body.scrollTop = Math.floor(scrollYPercent * document.body.offsetHeight); + } +} + // BEGIN Java->JavaScript handlers function measurePositions() { var overlayBottoms; @@ -328,5 +335,6 @@ collapseAllQuotedText(); hideUnsafeImages(); normalizeAllMessageWidths(); //setWideViewport(); +restoreScrollPosition(); measurePositions(); |