Bug 161449 Non-ASCII shortcuts for select elements in html forms

r=aaronl, sr=alecf
fix nsCRT::ToLower/ToUpper bugs and use |ToLowerCase()| instead of |nsCRT::ToLower()| in nsListControlFrame
This commit is contained in:
kyle.yuan%sun.com 2002-09-29 01:42:07 +00:00
Родитель f31c2de835
Коммит cf801d0295
3 изменённых файлов: 10 добавлений и 8 удалений

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

@ -3448,7 +3448,6 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
PRUint32 charCode, keyCode;
keyEvent->GetCharCode(&charCode);
keyEvent->GetKeyCode(&keyCode);
charCode = (PRUint32)nsCRT::ToLower((char)charCode);
if (charCode == 0) {
// Backspace key will delete the last char in the string
@ -3458,6 +3457,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
PRUnichar uniChar = ToLowerCase(NS_STATIC_CAST(PRUnichar, charCode));
DOMTimeStamp keyTime;
aKeyEvent->GetTimeStamp(&keyTime);
@ -3474,8 +3475,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
// Exception: If the user types the same key repeatedly, we'll cycle through all
// options beginning with that char, rather than appending it.
if (!(GetIncrementalString().Length() == 1 &&
GetIncrementalString().First() == NS_STATIC_CAST(PRUnichar, charCode))) {
GetIncrementalString().Append(NS_STATIC_CAST(PRUnichar, charCode));
GetIncrementalString().First() == uniChar)) {
GetIncrementalString().Append(uniChar);
}
// Determine where we're going to start reading the string

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

@ -3448,7 +3448,6 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
PRUint32 charCode, keyCode;
keyEvent->GetCharCode(&charCode);
keyEvent->GetKeyCode(&keyCode);
charCode = (PRUint32)nsCRT::ToLower((char)charCode);
if (charCode == 0) {
// Backspace key will delete the last char in the string
@ -3458,6 +3457,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
PRUnichar uniChar = ToLowerCase(NS_STATIC_CAST(PRUnichar, charCode));
DOMTimeStamp keyTime;
aKeyEvent->GetTimeStamp(&keyTime);
@ -3474,8 +3475,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
// Exception: If the user types the same key repeatedly, we'll cycle through all
// options beginning with that char, rather than appending it.
if (!(GetIncrementalString().Length() == 1 &&
GetIncrementalString().First() == NS_STATIC_CAST(PRUnichar, charCode))) {
GetIncrementalString().Append(NS_STATIC_CAST(PRUnichar, charCode));
GetIncrementalString().First() == uniChar)) {
GetIncrementalString().Append(uniChar);
}
// Determine where we're going to start reading the string

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

@ -110,12 +110,12 @@ static const unsigned char kLower2Upper[256] = {
char nsCRT::ToUpper(char aChar)
{
return (char)kLower2Upper[aChar];
return (char)kLower2Upper[(unsigned char)aChar];
}
char nsCRT::ToLower(char aChar)
{
return (char)kUpper2Lower[aChar];
return (char)kUpper2Lower[(unsigned char)aChar];
}
PRBool nsCRT::IsUpper(char aChar)