diff --git a/toolkit/content/widgets/listbox.xml b/toolkit/content/widgets/listbox.xml index 9538bb184dcd..bdc678135913 100644 --- a/toolkit/content/widgets/listbox.xml +++ b/toolkit/content/widgets/listbox.xml @@ -12,7 +12,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listbox-base"> @@ -27,7 +27,7 @@ - + 0 0 false @@ -492,9 +492,9 @@ - + - + - + - + - + - + - + - + - + - + 0 && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) { @@ -654,12 +651,21 @@ key = key.toLowerCase(); if (event.timeStamp - this._lastKeyTime > 1000) this._incrementalString = key; - else { - if (this._incrementalString.length != 1 || this._incrementalString.charAt(0) != key.charAt(0)) - this._incrementalString += key; - } + else + this._incrementalString += key; this._lastKeyTime = event.timeStamp; + var length = this._incrementalString.length; + var incrementalString = this._incrementalString; + var charIndex = 1; + while (charIndex < length && incrementalString[charIndex] == incrementalString[charIndex - 1]) + charIndex++; + // If all letters in incremental string are same, just try to match the first one + if (charIndex == length) { + length = 1; + incrementalString = incrementalString.substring(0, length); + } + var l = this.selectedItems.length; var c = -1; if (l > 0) @@ -667,7 +673,7 @@ var rowCount = this.getRowCount(); var start = 1; - if (this._incrementalString.length > 1) { + if (length > 1) { start = 0; if (c < 0) c = 0; @@ -677,8 +683,8 @@ var k = (i + start + c) % rowCount; var item = this.getItemAtIndex(k); //listitem var cellText = item.getAttribute("label"); - cellText = cellText.toLowerCase(); - if (cellText.search(this._incrementalString) == 0) { + cellText = cellText.substring(0, length).toLowerCase(); + if (cellText == incrementalString) { this._isUpSelection=0; this._isDownSelection=0; this.ensureIndexIsVisible(k); @@ -693,100 +699,25 @@ - - - this.addEventListener("DOMMouseScroll", this._handleMouseScroll, true); - - - - - - - + extends="chrome://global/content/widgets/listbox.xml#listbox-base"> - - + - + var listBox = this.parentNode.listBoxObject; + var rows = event.detail; + if (rows == NSUIEvent.SCROLL_PAGE_UP) + rows = -listBox.getNumberOfVisibleRows(); + else if (rows == NSUIEvent.SCROLL_PAGE_DOWN) + rows = listBox.getNumberOfVisibleRows(); - - - + extends="chrome://global/content/widgets/general.xml#basetext"> @@ -837,7 +768,7 @@ this.removeAttribute("selected"); var event = document.createEvent("Events"); - event.initEvent("ListitemStateChange", true, true); + event.initEvent("DOMMenuItemActive", true, true); this.dispatchEvent(event); return val; @@ -856,10 +787,66 @@ ]]> + + + + + + + + + + + + extends="chrome://global/content/widgets/listbox.xml#listitem"> @@ -868,7 +855,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listitem"> @@ -897,7 +884,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listitem-checkbox"> @@ -906,7 +893,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listbox-base"> @@ -915,7 +902,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listcell"> @@ -925,7 +912,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listcell"> @@ -935,7 +922,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listcell-checkbox"> @@ -946,7 +933,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listbox-base"> @@ -955,7 +942,7 @@ + extends="chrome://global/content/widgets/listbox.xml#listbox-base">