document.getAnonymousElementByAttribute(this, "anonid", "main-box"); this._scrollbox.boxObject; -1) this._currentIndex = this.currentIndex + 1; var event = document.createEvent("Events"); event.initEvent("select", true, true); this.dispatchEvent(event); // always call this (allows a commandupdater without controller) document.commandDispatcher.updateCommands("richlistbox-select"); ]]> return this.insertItemAt(-1, aLabel, aValue); const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var item = this.ownerDocument.createElementNS(XULNS, "richlistitem"); item.setAttribute("value", aValue); var label = this.ownerDocument.createElementNS(XULNS, "label"); label.setAttribute("value", aLabel); label.setAttribute("flex", "1"); label.setAttribute("crop", "end"); item.appendChild(label); var before = this.getItemAtIndex(aIndex); if (!before) this.appendChild(item); else this.insertBefore(item, before); return item; return this.children[aIndex] || null; = 0) { // scrollRect.bottom wouldn't take a horizontal scroll bar into account let scrollRectBottom = scrollRect.top + this._scrollbox.clientHeight; offset = targetRect.bottom - scrollRectBottom; if (offset <= 0) return; } this._scrollbox.scrollTop += offset; ]]> height) break; // we've reached the desired distance index = ix; } return index != this.currentIndex ? index - this.currentIndex : aDirection; ]]> = 0; i--) { let selectedItem = this.selectedItems[i]; itemIds.push(selectedItem.id); this.selectedItems.remove(selectedItem); } for (i = 0; i < itemIds.length; i++) { let selectedItem = document.getElementById(itemIds[i]); if (selectedItem) { this.selectedItems.append(selectedItem); } } } if (this.currentItem && this.currentItem.id) this.currentItem = document.getElementById(this.currentItem.id); else this.currentItem = null; // if we have no previously current item or if the above check fails to // find the previous nodes (which causes it to clear selection) if (!this.currentItem && this.selectedCount == 0) { this.currentIndex = this._currentIndex ? this._currentIndex - 1 : 0; // cf. listbox constructor: // select items according to their attributes var children = this.children; for (var i = 0; i < children.length; ++i) { if (children[i].getAttribute("selected") == "true") this.selectedItems.append(children[i]); } } if (this.selType != "multiple" && this.selectedCount == 0) this.selectedItem = this.currentItem; ]]> y) && (aItem.boxObject.y < y + this.scrollBoxObject.height); ]]> null label.value) .join(" "); ]]>