зеркало из https://github.com/mozilla/gecko-dev.git
Make sure kepress handlers are not affected by Caps Lock state. Bug 295228,
patch by Dainis Jonitis <Dainis_Jonitis@swh-t.lv>, r=neil, sr=bzbarsky
This commit is contained in:
Родитель
f1c932f964
Коммит
0f56e73dd0
|
@ -105,9 +105,7 @@ nsDOMKeyboardEvent::GetCharCode(PRUint32* aCharCode)
|
|||
switch (mEvent->message) {
|
||||
case NS_KEY_UP:
|
||||
case NS_KEY_DOWN:
|
||||
#if defined(NS_DEBUG) && defined(DEBUG_brade)
|
||||
printf("GetCharCode used for wrong key event; should use onkeypress.\n");
|
||||
#endif
|
||||
NS_WARNING("GetCharCode used for wrong key event; should use onkeypress.");
|
||||
*aCharCode = 0;
|
||||
break;
|
||||
case NS_KEY_PRESS:
|
||||
|
|
|
@ -559,8 +559,11 @@ nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
|
||||
// Get the keycode or charcode of the key event.
|
||||
PRUint32 code;
|
||||
if (mMisc)
|
||||
|
||||
if (mMisc) {
|
||||
aKeyEvent->GetCharCode(&code);
|
||||
code = ToLowerCase(PRUnichar(code));
|
||||
}
|
||||
else
|
||||
aKeyEvent->GetKeyCode(&code);
|
||||
|
||||
|
@ -576,7 +579,7 @@ nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
|||
if (mDetail == -1 && mMisc == 0 && (mKeyMask & cAllModifiers) == 0)
|
||||
return PR_TRUE; // No filters set up. It's generic.
|
||||
|
||||
unsigned short button;
|
||||
PRUint16 button;
|
||||
aMouseEvent->GetButton(&button);
|
||||
if (mDetail != -1 && (button != mDetail))
|
||||
return PR_FALSE;
|
||||
|
@ -843,7 +846,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
|||
mKeyMask = cAllModifiers;
|
||||
char* str = ToNewCString(modifiers);
|
||||
char* newStr;
|
||||
char* token = nsCRT::strtok( str, ", ", &newStr );
|
||||
char* token = nsCRT::strtok( str, ", \t", &newStr );
|
||||
while( token != NULL ) {
|
||||
if (PL_strcmp(token, "shift") == 0)
|
||||
mKeyMask |= cShift | cShiftMask;
|
||||
|
@ -860,7 +863,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
|||
else if (PL_strcmp(token, "any") == 0)
|
||||
mKeyMask &= ~(mKeyMask << 4);
|
||||
|
||||
token = nsCRT::strtok( newStr, ", ", &newStr );
|
||||
token = nsCRT::strtok( newStr, ", \t", &newStr );
|
||||
}
|
||||
|
||||
nsMemory::Free(str);
|
||||
|
@ -878,11 +881,6 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
|||
if (!key.IsEmpty()) {
|
||||
if (mKeyMask == 0)
|
||||
mKeyMask = cAllModifiers;
|
||||
if (!(mKeyMask & cShift))
|
||||
mKeyMask &= ~cShiftMask;
|
||||
if ((mKeyMask & cShift) != 0)
|
||||
ToUpperCase(key);
|
||||
else
|
||||
ToLowerCase(key);
|
||||
|
||||
// We have a charcode.
|
||||
|
|
|
@ -876,7 +876,7 @@ nsTypeAheadFind::HandleChar(PRUnichar aChar)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aChar = ToLowerCase(NS_STATIC_CAST(PRUnichar, aChar));
|
||||
aChar = ToLowerCase(aChar);
|
||||
PRInt32 bufferLength = mTypeAheadBuffer.Length();
|
||||
|
||||
mIsFirstVisiblePreferred = PR_FALSE;
|
||||
|
|
|
@ -96,10 +96,7 @@
|
|||
|
||||
// Constants
|
||||
const nscoord kMaxDropDownRows = 20; // This matches the setting for 4.x browsers
|
||||
const PRInt32 kDefaultMultiselectHeight = 4; // This is compatible with 4.x browsers
|
||||
const PRInt32 kNothingSelected = -1;
|
||||
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
|
||||
const PRInt32 kNoSizeSpecified = -1;
|
||||
|
||||
|
||||
nsListControlFrame * nsListControlFrame::mFocused = nsnull;
|
||||
|
@ -3101,8 +3098,8 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
keyEvent->GetKeyCode(&keycode);
|
||||
keyEvent->GetCharCode(&charcode);
|
||||
#ifdef DO_REFLOW_DEBUG
|
||||
if (code >= 32) {
|
||||
REFLOW_DEBUG_MSG3("KeyCode: %c %d\n", code, code);
|
||||
if (charcode >= 32) {
|
||||
REFLOW_DEBUG_MSG3("KeyCode: %c %d\n", charcode, charcode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -214,7 +214,6 @@ nsMenuListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
// Do shortcut navigation.
|
||||
// A letter was pressed. We want to see if a shortcut gets matched. If
|
||||
// so, we'll know the menu got activated.
|
||||
keyEvent->GetCharCode(&theChar);
|
||||
mMenuParent->ShortcutNavigation(keyEvent, handled);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче