From 86afc44dd3d7cc990a4b9109ac36c2bc7ce2a20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 10 Jul 2009 11:13:10 +0200 Subject: [PATCH] Bug 485841 - Get rid of some timeouts and avoid boxObject where appropriate in tabbrowser, part 2. r=enn --- browser/base/content/tabbrowser.xml | 66 ++++++++++++----------------- 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index a2d7ad84f2a..395c4defe7a 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -1968,8 +1968,9 @@ var newIndex = this.getNewIndex(aEvent); var ib = this.mTabDropIndicatorBar; var ind = ib.firstChild; - var tabStripBoxObject = tabStrip.scrollBoxObject; - var minMargin = tabStripBoxObject.x - this.boxObject.x; + var scrollRect = tabStrip.scrollClientRect; + var rect = this.getBoundingClientRect(); + var minMargin = scrollRect.left - rect.left; // make sure we don't place the tab drop indicator past the // edge, or the containing box will flex and stretch // the tab drop indicator bar, which will flex the url bar. @@ -1977,13 +1978,13 @@ // just use first value if you can figure out how to get // the tab drop indicator to crop instead of flex and stretch // the tab drop indicator bar. - var maxMargin = Math.min(minMargin + tabStripBoxObject.width, - ib.boxObject.x + ib.boxObject.width - - ind.boxObject.width); + var maxMargin = Math.min(minMargin + scrollRect.width, + ib.getBoundingClientRect().right - + ind.clientWidth); if (!ltr) - [minMargin, maxMargin] = [this.boxObject.width - maxMargin, - this.boxObject.width - minMargin]; - var newMargin, tabBoxObject; + [minMargin, maxMargin] = [this.clientWidth - maxMargin, + this.clientWidth - minMargin]; + var newMargin; if (pixelsToScroll) { // if we are scrolling, put the drop indicator at the edge // so that it doesn't jump while scrolling @@ -1991,21 +1992,18 @@ } else { if (newIndex == this.mTabs.length) { - tabBoxObject = this.mTabs[newIndex-1].boxObject; + let tabRect = this.mTabs[newIndex-1].getBoundingClientRect(); if (ltr) - newMargin = tabBoxObject.screenX - this.boxObject.screenX - + tabBoxObject.width; + newMargin = tabRect.right - rect.left; else - newMargin = this.boxObject.screenX - tabBoxObject.screenX - + this.boxObject.width; + newMargin = rect.right - tabRect.left; } else { - tabBoxObject = this.mTabs[newIndex].boxObject; + let tabRect = this.mTabs[newIndex].getBoundingClientRect(); if (ltr) - newMargin = tabBoxObject.screenX - this.boxObject.screenX; + newMargin = tabRect.left - rect.left; else - newMargin = this.boxObject.screenX - tabBoxObject.screenX - + this.boxObject.width - tabBoxObject.width; + newMargin = rect.right - tabRect.right; } // ensure we never place the drop indicator beyond our limits if (newMargin < minMargin) @@ -2236,7 +2234,7 @@ this.mTabContainer.childNodes[i]._selected = false; } this.mCurrentTab._selected = true; - this.mTabContainer.mTabstrip.scrollBoxObject.ensureElementIsVisible(this.mCurrentTab); + this.mTabContainer.mTabstrip.ensureElementIsVisible(this.mCurrentTab, false); var evt = document.createEvent("UIEvents"); evt.initUIEvent("TabMove", true, false, window, oldPosition); @@ -2795,7 +2793,7 @@ this._scrollButtonDownBox.collapsed = false; this._scrollButtonDownBoxAnimate.collapsed = false; #endif - this.scrollBoxObject.ensureElementIsVisible(tabs.selectedItem); + this.ensureElementIsVisible(tabs.selectedItem, false); ]]> #ifdef XP_MACOSX @@ -3039,15 +3037,9 @@ // of the tabstrip, we need to ensure that we stay // completely scrolled to the right side var tabStrip = this.mTabstrip; - var scrollPos = {}; - tabStrip.scrollBoxObject.getPosition(scrollPos, {}); - var scrolledSize = {}; - tabStrip.scrollBoxObject.getScrolledSize(scrolledSize, {}); - - if (scrollPos.value + tabStrip.boxObject.width >= - scrolledSize.value) { + if (tabStrip.scrollPosition + tabStrip.scrollClientSize >= + tabStrip.scrollSize) tabStrip.scrollByPixels(-1); - } } catch (e) {} ]]> @@ -3111,30 +3103,26 @@