diff --git a/browser/base/content/tabview/groupitems.js b/browser/base/content/tabview/groupitems.js index 2db949a4c8c..5fa4466bd95 100644 --- a/browser/base/content/tabview/groupitems.js +++ b/browser/base/content/tabview/groupitems.js @@ -1052,10 +1052,10 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), { return: 'widthAndColumns', count: count || this._children.length }; - let {childWidth, columns} = Items.arrange(null, bb, options); - - let shouldStack = childWidth < TabItems.minTabWidth * 1.35; - this._columns = shouldStack ? null : columns; + let arrObj = Items.arrange(null, bb, options); + + let shouldStack = arrObj.childWidth < TabItems.minTabWidth * 1.35; + this._columns = shouldStack ? null : arrObj.columns; return shouldStack; }, @@ -1646,6 +1646,7 @@ let GroupItems = { _arrangePaused: false, _arrangesPending: [], _removingHiddenGroups: false, + _delayedModUpdates: [], minGroupHeight: 110, minGroupWidth: 125, @@ -1659,9 +1660,18 @@ let GroupItems = { self._handleAttrModified(xulTab); } + // make sure any closed tabs are removed from the delay update list + function handleClose(xulTab) { + let idx = self._delayedModUpdates.indexOf(xulTab); + if (idx != -1) + self._delayedModUpdates.splice(idx, 1); + } + AllTabs.register("attrModified", handleAttrModified); + AllTabs.register("close", handleClose); this._cleanupFunctions.push(function() { AllTabs.unregister("attrModified", handleAttrModified); + AllTabs.unregister("close", handleClose); }); }, @@ -1728,6 +1738,30 @@ let GroupItems = { // Function: _handleAttrModified // watch for icon changes on app tabs _handleAttrModified: function GroupItems__handleAttrModified(xulTab) { + if (!UI.isTabViewVisible()) { + if (this._delayedModUpdates.indexOf(xulTab) == -1) { + this._delayedModUpdates.push(xulTab); + } + } else + this._updateAppTabIcons(xulTab); + }, + + // ---------- + // Function: flushTabUpdates + // Update apptab icons based on xulTabs which have been updated + // while the TabView hasn't been visible + flushAppTabUpdates: function GroupItems_flushAppTabUpdates() { + let self = this; + this._delayedModUpdates.forEach(function(xulTab) { + self._updateAppTabIcons(xulTab); + }); + this._delayedModUpdates = []; + }, + + // ---------- + // Function: _updateAppTabIcons + // Update images of any apptab icons that point to passed in xultab + _updateAppTabIcons: function GroupItems__updateAppTabIcons(xulTab) { if (xulTab.ownerDocument.defaultView != gWindow || !xulTab.pinned) return; @@ -1742,7 +1776,7 @@ let GroupItems = { $icon.attr("src", iconUrl); }); }); - }, + }, // ---------- // Function: addAppTab diff --git a/browser/base/content/tabview/tabitems.js b/browser/base/content/tabview/tabitems.js index bc2581f0ccc..14453687787 100644 --- a/browser/base/content/tabview/tabitems.js +++ b/browser/base/content/tabview/tabitems.js @@ -900,12 +900,9 @@ let TabItems = { Date.now() - this._lastUpdateTime < this._heartbeatTiming ); - let isCurrentTab = ( - !UI.isTabViewVisible() && - tab == gBrowser.selectedTab - ); - - if (shouldDefer && !isCurrentTab) { + if (shouldDefer) { + if (!this.reconnectingPaused() && !tab._tabViewTabItem._reconnected) + this._reconnect(tab._tabViewTabItem); if (this._tabsWaitingForUpdate.indexOf(tab) == -1) this._tabsWaitingForUpdate.push(tab); this.startHeartbeat(); @@ -1297,7 +1294,9 @@ TabCanvas.prototype = { ctx.save(); ctx.scale(scaler, scaler); try{ - ctx.drawWindow(fromWin, fromWin.scrollX, fromWin.scrollY, w/scaler, h/scaler, "#fff"); + ctx.drawWindow(fromWin, fromWin.scrollX, fromWin.scrollY, + w/scaler, h/scaler, "#fff", + Ci.nsIDOMCanvasRenderingContext2D.DRAWWINDOW_DO_NOT_FLUSH); } catch(e) { Utils.error('paint', e); } diff --git a/browser/base/content/tabview/ui.js b/browser/base/content/tabview/ui.js index cdfe3deaf2f..d1c86823381 100644 --- a/browser/base/content/tabview/ui.js +++ b/browser/base/content/tabview/ui.js @@ -500,6 +500,9 @@ let UI = { self._resize(true); dispatchEvent(event); + // Flush pending updates + GroupItems.flushAppTabUpdates(); + TabItems.resumePainting(); }); } else { @@ -509,6 +512,9 @@ let UI = { self.setActiveTab(null); dispatchEvent(event); + // Flush pending updates + GroupItems.flushAppTabUpdates(); + TabItems.resumePainting(); } },