| Index: ui/events/event.cc
|
| diff --git a/ui/events/event.cc b/ui/events/event.cc
|
| index c26b9c97b7748719a0cff3dee816b32912524dff..dd65815f629ebd6b10b908649a61689f9b81956a 100644
|
| --- a/ui/events/event.cc
|
| +++ b/ui/events/event.cc
|
| @@ -680,7 +680,7 @@ KeyEvent::KeyEvent(EventType type,
|
| int flags)
|
| : Event(type, EventTimeForNow(), flags),
|
| key_code_(key_code),
|
| - code_(DomCode::NONE),
|
| + code_(KeyboardCodeToDomCode(key_code)),
|
| is_char_(false),
|
| platform_keycode_(0),
|
| key_(DomKey::NONE),
|
| @@ -769,33 +769,31 @@ void KeyEvent::ApplyLayout() const {
|
| key_ = DomKey::UNIDENTIFIED;
|
| return;
|
| }
|
| + KeyboardCode dummy_key_code;
|
| #if defined(OS_WIN)
|
| // Native Windows character events always have is_char_ == true,
|
| // so this is a synthetic or native keystroke event.
|
| // Therefore, perform only the fallback action.
|
| - GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_);
|
| + DomCodeToMeaning(code_, flags(), &key_, &character_, &dummy_key_code);
|
| #elif defined(USE_X11)
|
| // When a control key is held, prefer ASCII characters to non ASCII
|
| // characters in order to use it for shortcut keys. GetCharacterFromKeyCode
|
| // returns 'a' for VKEY_A even if the key is actually bound to 'à' in X11.
|
| // GetCharacterFromXEvent returns 'à' in that case.
|
| - character_ = (IsControlDown() || !native_event()) ?
|
| - GetCharacterFromKeyCode(key_code_, flags()) :
|
| - GetCharacterFromXEvent(native_event());
|
| - // TODO(kpschoedel): set key_ field for X11.
|
| + if (IsControlDown() || !native_event())
|
| + DomCodeToMeaning(code_, flags(), &key_, &character_, &dummy_key_code);
|
| + else
|
| + GetMeaningFromXEvent(native_event(), &key_, &character_);
|
| #elif defined(USE_OZONE)
|
| - KeyboardCode key_code;
|
| if (!KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()->Lookup(
|
| - code_, flags(), &key_, &character_, &key_code, &platform_keycode_)) {
|
| - GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_);
|
| - }
|
| + code_, flags(), &key_, &character_, &dummy_key_code, &platform_keycode_))
|
| + DomCodeToMeaning(code_, flags(), &key_, &character_, &dummy_key_code);
|
| #else
|
| if (native_event()) {
|
| DCHECK(EventTypeFromNative(native_event()) == ET_KEY_PRESSED ||
|
| EventTypeFromNative(native_event()) == ET_KEY_RELEASED);
|
| }
|
| - // TODO(kpschoedel): revise to use DOM code_ instead of Windows key_code_
|
| - GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_);
|
| + DomCodeToMeaning(code_, flags(), &key_, &character_, &dummy_key_code);
|
| #endif
|
| }
|
|
|
| @@ -815,9 +813,12 @@ base::char16 KeyEvent::GetCharacter() const {
|
|
|
| base::char16 KeyEvent::GetText() const {
|
| if ((flags() & EF_CONTROL_DOWN) != 0) {
|
| - // TODO(kpschoedel): revise to use DOM code_ instead of Windows key_code_
|
| - return GetControlCharacterForKeycode(key_code_,
|
| - (flags() & EF_SHIFT_DOWN) != 0);
|
| + base::char16 character;
|
| + ui::DomKey key;
|
| + ui::KeyboardCode dummy_key_code;
|
| + if (DomCodeToControlCharacter(
|
| + code_, flags(), &key, &character, &dummy_key_code))
|
| + return character;
|
| }
|
| return GetUnmodifiedText();
|
| }
|
|
|