michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: null michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0) { michael@0: if (this.overflowable && this.overflowable.initialized) { michael@0: this.overflowable.onOverflow(aEvent); michael@0: } else { michael@0: this.overflowedDuringConstruction = aEvent; michael@0: } michael@0: } else if (aEvent.type == "underflow" && aEvent.detail > 0) { michael@0: this.overflowedDuringConstruction = null; michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: currentWidgets.has(x)).join(','); michael@0: ]]> michael@0: x); michael@0: let oldIds = CustomizableUI.getWidgetIdsInArea(this.id); michael@0: michael@0: // Get a list of items only in the new list michael@0: let newIds = [id for (id of newVal) if (oldIds.indexOf(id) == -1)]; michael@0: CustomizableUI.beginBatchUpdate(); michael@0: try { michael@0: for (let newId of newIds) { michael@0: oldIds = CustomizableUI.getWidgetIdsInArea(this.id); michael@0: let nextId = newId; michael@0: let pos; michael@0: do { michael@0: // Get the next item michael@0: nextId = newVal[newVal.indexOf(nextId) + 1]; michael@0: // Figure out where it is in the old list michael@0: pos = oldIds.indexOf(nextId); michael@0: // If it's not in the old list, repeat: michael@0: } while (pos == -1 && nextId); michael@0: if (pos == -1) { michael@0: pos = null; // We didn't find anything, insert at the end michael@0: } michael@0: CustomizableUI.addWidgetToArea(newId, this.id, pos); michael@0: } michael@0: michael@0: let currentIds = this.currentSet.split(','); michael@0: let removedIds = [id for (id of currentIds) if (newIds.indexOf(id) == -1 && newVal.indexOf(id) == -1)]; michael@0: for (let removedId of removedIds) { michael@0: CustomizableUI.removeWidgetFromArea(removedId); michael@0: } michael@0: } finally { michael@0: CustomizableUI.endBatchUpdate(); michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: this._setInactive(); michael@0: michael@0: michael@0: this._setActive(); michael@0: michael@0: michael@0: null michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: true michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: !!x)) { michael@0: this._currentSetMigrated.add(migratedItem); michael@0: } michael@0: this.evictNodes(); michael@0: // We can't easily use |this| or strong bindings for the observer fn here michael@0: // because that creates leaky circular references when the node goes away, michael@0: // and XBL destructors are unreliable. michael@0: let mutationObserver = new MutationObserver(function(mutations) { michael@0: if (!mutations.length) { michael@0: return; michael@0: } michael@0: let toolbar = mutations[0].target; michael@0: // Can't use our own attribute because we might not have one if we're set to michael@0: // collapsed michael@0: let areCustomizing = toolbar.ownerDocument.documentElement.getAttribute("customizing"); michael@0: if (!toolbar._isModifying && !areCustomizing) { michael@0: toolbar.evictNodes(); michael@0: } michael@0: }); michael@0: mutationObserver.observe(this, {childList: true}); michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: kItemMaxWidth) { michael@0: throw new Error(aNode.id + " is too big (" + nodeWidth + michael@0: "px wide), moving to the palette"); michael@0: } michael@0: CustomizableUI.addWidgetToArea(aNode.id, this._delegatingToolbar); michael@0: movedOut = true; michael@0: } catch (ex) { michael@0: // This will throw if the node is too big, or can't be moved there for michael@0: // some reason. Report this: michael@0: Cu.reportError(ex); michael@0: } michael@0: } michael@0: michael@0: /* We won't have moved the widget if either the add-on bar was collapsed, michael@0: * or if it was too wide to be inserted into the navbar. */ michael@0: if (!movedOut) { michael@0: try { michael@0: CustomizableUI.removeWidgetFromArea(aNode.id); michael@0: } catch (ex) { michael@0: Cu.reportError(ex); michael@0: aNode.remove(); michael@0: } michael@0: } michael@0: michael@0: // Surprise: addWidgetToArea(palette) will get you nothing if the palette michael@0: // is not constructed yet. Fix: michael@0: if (aNode.parentNode == oldParent) { michael@0: let palette = this.toolbox.palette; michael@0: if (palette && oldParent != palette) { michael@0: palette.appendChild(aNode); michael@0: } michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: x && (!this._whiteListed.has(x) && michael@0: !CustomizableUI.isSpecialWidget(x) && michael@0: !this._currentSetMigrated.has(x))); michael@0: for (let newButton of newButtons) { michael@0: this._currentSetMigrated.add(newButton); michael@0: this.insertItem(newButton); michael@0: } michael@0: this._updateMigratedSet(); michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: new Set(["addonbar-closebutton", "status-bar"]) michael@0: false michael@0: new Set() michael@0: michael@0: michael@0: