From 85c917abe4294f97503d7629b3dd678bd0f1d409 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Fri, 12 Jul 2013 08:44:23 -0400 Subject: [PATCH] Bug 886496 - When doing lazy tab restoration, set the s in question to display:none until restored r=bnicholson --- .../android/chrome/content/MemoryObserver.js | 1 + mobile/android/components/SessionStore.js | 3 ++ mobile/android/themes/core/browser.css | 37 ++++--------------- mobile/android/themes/core/jar.mn | 2 +- 4 files changed, 13 insertions(+), 30 deletions(-) diff --git a/mobile/android/chrome/content/MemoryObserver.js b/mobile/android/chrome/content/MemoryObserver.js index 04c771cbef19..6315ee5901cb 100644 --- a/mobile/android/chrome/content/MemoryObserver.js +++ b/mobile/android/chrome/content/MemoryObserver.js @@ -50,6 +50,7 @@ var MemoryObserver = { browser.__SS_data = data; browser.__SS_extdata = extra; browser.__SS_restore = true; + browser.setAttribute("pending", "true"); }, gc: function() { diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js index 7aab0170e026..67cdaa0d9133 100644 --- a/mobile/android/components/SessionStore.js +++ b/mobile/android/components/SessionStore.js @@ -418,6 +418,7 @@ SessionStore.prototype = { this._restoreHistory(data, aBrowser.sessionHistory); delete aBrowser.__SS_restore; + aBrowser.removeAttribute("pending"); } this.saveStateDelayed(); @@ -861,10 +862,12 @@ SessionStore.prototype = { if (window.BrowserApp.selectedTab == tab) { this._restoreHistory(tabData, tab.browser.sessionHistory); delete tab.browser.__SS_restore; + tab.browser.removeAttribute("pending"); } else { // Make sure the browser has its session data for the delay reload tab.browser.__SS_data = tabData; tab.browser.__SS_restore = true; + tab.browser.setAttribute("pending", "true"); } tab.browser.__SS_extdata = tabData.extData; diff --git a/mobile/android/themes/core/browser.css b/mobile/android/themes/core/browser.css index 191cd60fdd67..34f147c620ce 100644 --- a/mobile/android/themes/core/browser.css +++ b/mobile/android/themes/core/browser.css @@ -2,33 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -%filter substitution -%include defines.inc - -/* content scrollbars */ -.scroller { - opacity: 0; - background-color: rgba(0, 0, 0, 0.4) !important; - -moz-border-top-colors: none !important; - -moz-border-bottom-colors: none !important; - -moz-border-right-colors: none !important; - -moz-border-left-colors: none !important; - border-radius: @border_radius_tiny@; - border: @border_width_tiny@ solid rgba(255, 255, 255, 0.4) !important; -} - -.scroller[panning="true"] { - opacity: 1; -} - -.scroller[orient="vertical"] { - min-width: @scroller_thickness@; - width: @scroller_thickness@; - min-height: @scroller_minimum@; -} - -.scroller[orient="horizontal"] { - min-height: @scroller_thickness@; - height: @scroller_thickness@; - min-width: @scroller_minimum@; +/** + * Optimization for tabs that are restored lazily. We can save a good amount of + * memory that to-be-restored tabs would otherwise consume simply by setting + * their browsers to 'display: none' as that will prevent them from having to + * create a presentation and the like. + */ +browser[pending] { + display: none; } diff --git a/mobile/android/themes/core/jar.mn b/mobile/android/themes/core/jar.mn index 215d5b9ed246..6f2044beb3e1 100644 --- a/mobile/android/themes/core/jar.mn +++ b/mobile/android/themes/core/jar.mn @@ -20,7 +20,7 @@ chrome.jar: * skin/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css) skin/aboutReader.css (aboutReader.css) skin/aboutSupport.css (aboutSupport.css) -* skin/browser.css (browser.css) + skin/browser.css (browser.css) * skin/content.css (content.css) skin/config.css (config.css) skin/touchcontrols.css (touchcontrols.css)