From 147812ff1cd08b7da787f44ece313ca340dfc1b9 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Wed, 24 Aug 2011 14:27:19 +0900 Subject: [PATCH] split methods --- modules/browser.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/modules/browser.js b/modules/browser.js index 78403a08..c1b44135 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -2453,6 +2453,26 @@ TreeStyleTabBrowser.prototype = { lastScrollX : -1, lastScrollY : -1, + restoreLastScrollPosition : function TSTBrowser_restoreLastScrollPosition() + { + if (this.lastScrollX < 0 || this.lastScrollY < 0) return; + var lastX = this.lastScrollX; + var lastY = this.lastScrollY; + this.clearLastScrollPosition(); + if (!this.smoothScrollTask && + !this.scrollBox._smoothScrollTimer) { // don't restore scroll position if another scroll is already running. + let x = {}, y = {}; + let scrollBoxObject = this.scrollBoxObject; + scrollBoxObject.getPosition(x, y); + if (x.value != lastX || y.value != lastY) + scrollBoxObject.scrollTo(lastX, lastY); + } + }, + clearLastScrollPosition : function TSTBrowser_clearLastScrollPosition() + { + this.lastScrollX = -1; + this.lastScrollY = -1; + }, updateLastScrollPosition : function TSTBrowser_updateLastScrollPosition() { if (!this.isVertical) return; @@ -3769,22 +3789,6 @@ TreeStyleTabBrowser.prototype = { // restore scroll position when a tab is closed. this.restoreLastScrollPosition(); }, - restoreLastScrollPosition : function TSTBrowser_restoreLastScrollPosition() - { - if (this.lastScrollX < 0 || this.lastScrollY < 0) return; - var lastX = this.lastScrollX; - var lastY = this.lastScrollY; - this.lastScrollX = -1; - this.lastScrollY = -1; - if (!this.smoothScrollTask && - !this.scrollBox._smoothScrollTimer) { // don't restore scroll position if another scroll is already running. - let x = {}, y = {}; - let scrollBoxObject = this.scrollBoxObject; - scrollBoxObject.getPosition(x, y); - if (x.value != lastX || y.value != lastY) - scrollBoxObject.scrollTo(lastX, lastY); - } - }, onTabbarOverflow : function TSTBrowser_onTabbarOverflow(aEvent) {