Fix the delay when arrow keying up and down in the themes/extensions listboxes (and other listboxes).

This commit is contained in:
blakeross%telocity.com 2002-11-11 02:25:46 +00:00
Родитель 9a8851a52a
Коммит 5f28b87f2d
4 изменённых файлов: 68 добавлений и 27 удалений

Просмотреть файл

@ -395,7 +395,7 @@ static PRBool
matchQueryCallback(nsIMdbRow *row, void *aClosure)
{
matchQuery_t *query = (matchQuery_t*)aClosure;
return query->history->RowMatches(row, query->query);
return query->history->RowMatches(row, query->query, PR_TRUE);
}
//----------------------------------------------------------------------
@ -1968,7 +1968,7 @@ nsGlobalHistory::HasAssertion(nsIRDFResource* aSource,
return NS_OK;
}
*aHasAssertion = RowMatches(row, &query);
*aHasAssertion = RowMatches(row, &query, PR_TRUE);
FreeSearchQuery(query);
return NS_OK;
}
@ -3695,7 +3695,7 @@ nsGlobalHistory::SearchEnumerator::IsResult(nsIMdbRow *aRow)
}
// now do the actual match
if (!mHistory->RowMatches(aRow, mQuery))
if (!mHistory->RowMatches(aRow, mQuery, PR_FALSE))
return PR_FALSE;
if (mQuery->groupBy != 0) {
@ -3718,7 +3718,8 @@ nsGlobalHistory::SearchEnumerator::IsResult(nsIMdbRow *aRow)
//
PRBool
nsGlobalHistory::RowMatches(nsIMdbRow *aRow,
searchQuery *aQuery)
searchQuery *aQuery,
PRBool caseSensitive)
{
PRUint32 length = aQuery->terms.Count();
PRUint32 i;
@ -3781,44 +3782,79 @@ nsGlobalHistory::RowMatches(nsIMdbRow *aRow,
rowVal.EndReading(end);
NS_ConvertUCS2toUTF8 utf8Value(term->text);
if (term->method.Equals("is")) {
if (caseSensitive) {
if (!utf8Value.Equals(rowVal, nsDefaultCStringComparator()))
return PR_FALSE;
}
else {
if (!utf8Value.Equals(rowVal, nsCaseInsensitiveCStringComparator()))
return PR_FALSE;
}
}
else if (term->method.Equals("isnot")) {
if (utf8Value == rowVal)
if (caseSensitive) {
if (utf8Value.Equals(rowVal, nsDefaultCStringComparator()))
return PR_FALSE;
}
else {
if (utf8Value.Equals(rowVal, nsCaseInsensitiveCStringComparator()))
return PR_FALSE;
}
}
else if (term->method.Equals("contains")) {
if (caseSensitive) {
if (!FindInReadable(utf8Value, start, end, nsDefaultCStringComparator()))
return PR_FALSE;
}
else {
if (!FindInReadable(utf8Value, start, end, nsCaseInsensitiveCStringComparator()))
return PR_FALSE;
}
}
else if (term->method.Equals("doesntcontain")) {
if (caseSensitive) {
if (FindInReadable(utf8Value, start, end, nsDefaultCStringComparator()))
return PR_FALSE;
}
else {
if (FindInReadable(utf8Value, start, end, nsCaseInsensitiveCStringComparator()))
return PR_FALSE;
}
}
else if (term->method.Equals("startswith")) {
// need to make sure that the found string is
// at the beginning of the string
nsACString::const_iterator real_start = start;
if (caseSensitive) {
if (!(FindInReadable(utf8Value, start, end, nsDefaultCStringComparator()) && real_start == start))
return PR_FALSE;
}
else {
if (!(FindInReadable(utf8Value, start, end, nsCaseInsensitiveCStringComparator()) &&
real_start == start))
return PR_FALSE;
}
}
else if (term->method.Equals("endswith")) {
// need to make sure that the found string ends
// at the end of the string
nsACString::const_iterator real_end = end;
if (caseSensitive) {
if (!(RFindInReadable(utf8Value, start, end, nsDefaultCStringComparator()) && real_end == end))
return PR_FALSE;
}
else {
if (!(RFindInReadable(utf8Value, start, end, nsCaseInsensitiveCStringComparator()) &&
real_end == end))
return PR_FALSE;
}
}
else {
NS_WARNING("Unrecognized search method in SearchEnumerator::RowMatches");

Просмотреть файл

@ -155,7 +155,7 @@ public:
// these must be public so that the callbacks can call them
PRBool MatchExpiration(nsIMdbRow *row, PRInt64* expirationDate);
PRBool MatchHost(nsIMdbRow *row, matchHost_t *hostInfo);
PRBool RowMatches(nsIMdbRow* aRow, searchQuery *aQuery);
PRBool RowMatches(nsIMdbRow* aRow, searchQuery *aQuery, PRBool caseSensitive);
protected:

Просмотреть файл

@ -68,6 +68,10 @@
onset="if (val) this.setAttribute('disableKeyNavigation', 'true');
else this.removeAttribute('disableKeyNavigation'); return val;"/>
<property name="_selectDelay"
onset="this.setAttribute('_selectDelay', val);"
onget="return this.getAttribute('_selectDelay') || 50;"/>
<method name="timedSelect">
<parameter name="item"/>
<parameter name="timeout"/>
@ -497,7 +501,7 @@
var n = this.getPreviousItem(this.selectedItems[this.selectedItems.length-1], 1);
if (n) {
this.ensureIndexIsVisible(this.getIndexOfItem(n));
this.timedSelect(n, 500);
this.timedSelect(n, this._selectDelay);
}
]]>
</handler>
@ -518,7 +522,7 @@
if (n) {
this.ensureIndexIsVisible(this.getIndexOfItem(n));
this.timedSelect(n, 500);
this.timedSelect(n, this._selectDelay);
}
]]>
</handler>
@ -584,7 +588,7 @@
}
this.scrollToIndex(newIndex);
}
this.timedSelect(n, 500);
this.timedSelect(n, this._selectDelay);
]]>
</handler>
<handler event="keypress" keycode="vk_page_down">
@ -609,7 +613,7 @@
}
this.scrollToIndex(newIndex);
}
this.timedSelect(n, 500);
this.timedSelect(n, this._selectDelay);
]]>
</handler>
<handler event="keypress" keycode="vk_home">
@ -678,7 +682,7 @@
this._isUpSelection=0;
this._isDownSelection=0;
this.ensureIndexIsVisible(k);
this.timedSelect(item, 500);
this.timedSelect(item, this._selectDelay);
break;
}
}

Просмотреть файл

@ -22,8 +22,9 @@
<implementation implements="nsIAccessibleProvider">
<constructor>
this.addEventListener("DOMMouseScroll", this._handleMouseScroll, true);
if (navigator.platform.indexOf("Mac") != -1)
#ifdef XP_MAC
this.pageUpOrDownMovesSelection = false;
#endif
</constructor>
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->