Index: content/browser/renderer_host/input/web_input_event_builders_mac.mm |
diff --git a/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/content/browser/renderer_host/input/web_input_event_builders_mac.mm |
index 2fdc15057c74366e2a1ced63ef9debdd47005e3f..4b11acbea4bfbedc6f4f84c6fcb0a529bf2105c0 100644 |
--- a/content/browser/renderer_host/input/web_input_event_builders_mac.mm |
+++ b/content/browser/renderer_host/input/web_input_event_builders_mac.mm |
@@ -150,338 +150,6 @@ inline NSString* UnmodifiedTextFromEvent(NSEvent* event) { |
return FilterSpecialCharacter([event charactersIgnoringModifiers]); |
} |
-NSString* KeyIdentifierForKeyEvent(NSEvent* event) { |
- if ([event type] == NSFlagsChanged) { |
- switch ([event keyCode]) { |
- case 54: // Right Command |
- case 55: // Left Command |
- return @"Meta"; |
- |
- case 57: // Capslock |
- return @"CapsLock"; |
- |
- case 56: // Left Shift |
- case 60: // Right Shift |
- return @"Shift"; |
- |
- case 58: // Left Alt |
- case 61: // Right Alt |
- return @"Alt"; |
- |
- case 59: // Left Ctrl |
- case 62: // Right Ctrl |
- return @"Control"; |
- |
- // Begin non-Apple addition/modification |
- // -------------------------------------- |
- case 63: // Function |
- return @"Function"; |
- |
- default: // Unknown, but this may be a strange/new keyboard. |
- return @"Unidentified"; |
- // End non-Apple addition/modification |
- // ---------------------------------------- |
- } |
- } |
- |
- NSString* s = [event charactersIgnoringModifiers]; |
- if ([s length] != 1) |
- return @"Unidentified"; |
- |
- unichar c = [s characterAtIndex:0]; |
- switch (c) { |
- // Each identifier listed in the DOM spec is listed here. |
- // Many are simply commented out since they do not appear on standard |
- // Macintosh keyboards |
- // or are on a key that doesn't have a corresponding character. |
- |
- // "Accept" |
- // "AllCandidates" |
- |
- // "Alt" |
- case NSMenuFunctionKey: |
- return @"Alt"; |
- |
- // "Apps" |
- // "BrowserBack" |
- // "BrowserForward" |
- // "BrowserHome" |
- // "BrowserRefresh" |
- // "BrowserSearch" |
- // "BrowserStop" |
- // "CapsLock" |
- |
- // "Clear" |
- case NSClearLineFunctionKey: |
- return @"Clear"; |
- |
- // "CodeInput" |
- // "Compose" |
- // "Control" |
- // "Crsel" |
- // "Convert" |
- // "Copy" |
- // "Cut" |
- |
- // "Down" |
- case NSDownArrowFunctionKey: |
- return @"Down"; |
- // "End" |
- case NSEndFunctionKey: |
- return @"End"; |
- // "Enter" |
- case 0x3: |
- case 0xA: |
- case 0xD: // Macintosh calls the one on the main keyboard Return, but |
- // Windows calls it Enter, so we'll do the same for the DOM |
- return @"Enter"; |
- |
- // "EraseEof" |
- |
- // "Execute" |
- case NSExecuteFunctionKey: |
- return @"Execute"; |
- |
- // "Exsel" |
- |
- // "F1" |
- case NSF1FunctionKey: |
- return @"F1"; |
- // "F2" |
- case NSF2FunctionKey: |
- return @"F2"; |
- // "F3" |
- case NSF3FunctionKey: |
- return @"F3"; |
- // "F4" |
- case NSF4FunctionKey: |
- return @"F4"; |
- // "F5" |
- case NSF5FunctionKey: |
- return @"F5"; |
- // "F6" |
- case NSF6FunctionKey: |
- return @"F6"; |
- // "F7" |
- case NSF7FunctionKey: |
- return @"F7"; |
- // "F8" |
- case NSF8FunctionKey: |
- return @"F8"; |
- // "F9" |
- case NSF9FunctionKey: |
- return @"F9"; |
- // "F10" |
- case NSF10FunctionKey: |
- return @"F10"; |
- // "F11" |
- case NSF11FunctionKey: |
- return @"F11"; |
- // "F12" |
- case NSF12FunctionKey: |
- return @"F12"; |
- // "F13" |
- case NSF13FunctionKey: |
- return @"F13"; |
- // "F14" |
- case NSF14FunctionKey: |
- return @"F14"; |
- // "F15" |
- case NSF15FunctionKey: |
- return @"F15"; |
- // "F16" |
- case NSF16FunctionKey: |
- return @"F16"; |
- // "F17" |
- case NSF17FunctionKey: |
- return @"F17"; |
- // "F18" |
- case NSF18FunctionKey: |
- return @"F18"; |
- // "F19" |
- case NSF19FunctionKey: |
- return @"F19"; |
- // "F20" |
- case NSF20FunctionKey: |
- return @"F20"; |
- // "F21" |
- case NSF21FunctionKey: |
- return @"F21"; |
- // "F22" |
- case NSF22FunctionKey: |
- return @"F22"; |
- // "F23" |
- case NSF23FunctionKey: |
- return @"F23"; |
- // "F24" |
- case NSF24FunctionKey: |
- return @"F24"; |
- |
- // "FinalMode" |
- |
- // "Find" |
- case NSFindFunctionKey: |
- return @"Find"; |
- |
- // "FullWidth" |
- // "HalfWidth" |
- // "HangulMode" |
- // "HanjaMode" |
- |
- // "Help" |
- case NSHelpFunctionKey: |
- return @"Help"; |
- |
- // "Hiragana" |
- |
- // "Home" |
- case NSHomeFunctionKey: |
- return @"Home"; |
- // "Insert" |
- case NSInsertFunctionKey: |
- return @"Insert"; |
- |
- // "JapaneseHiragana" |
- // "JapaneseKatakana" |
- // "JapaneseRomaji" |
- // "JunjaMode" |
- // "KanaMode" |
- // "KanjiMode" |
- // "Katakana" |
- // "LaunchApplication1" |
- // "LaunchApplication2" |
- // "LaunchMail" |
- |
- // "Left" |
- case NSLeftArrowFunctionKey: |
- return @"Left"; |
- |
- // "Meta" |
- // "MediaNextTrack" |
- // "MediaPlayPause" |
- // "MediaPreviousTrack" |
- // "MediaStop" |
- |
- // "ModeChange" |
- case NSModeSwitchFunctionKey: |
- return @"ModeChange"; |
- |
- // "Nonconvert" |
- // "NumLock" |
- |
- // "PageDown" |
- case NSPageDownFunctionKey: |
- return @"PageDown"; |
- // "PageUp" |
- case NSPageUpFunctionKey: |
- return @"PageUp"; |
- |
- // "Paste" |
- |
- // "Pause" |
- case NSPauseFunctionKey: |
- return @"Pause"; |
- |
- // "Play" |
- // "PreviousCandidate" |
- |
- // "PrintScreen" |
- case NSPrintScreenFunctionKey: |
- return @"PrintScreen"; |
- |
- // "Process" |
- // "Props" |
- |
- // "Right" |
- case NSRightArrowFunctionKey: |
- return @"Right"; |
- |
- // "RomanCharacters" |
- |
- // "Scroll" |
- case NSScrollLockFunctionKey: |
- return @"Scroll"; |
- // "Select" |
- case NSSelectFunctionKey: |
- return @"Select"; |
- |
- // "SelectMedia" |
- // "Shift" |
- |
- // "Stop" |
- case NSStopFunctionKey: |
- return @"Stop"; |
- // "Up" |
- case NSUpArrowFunctionKey: |
- return @"Up"; |
- // "Undo" |
- case NSUndoFunctionKey: |
- return @"Undo"; |
- |
- // "VolumeDown" |
- // "VolumeMute" |
- // "VolumeUp" |
- // "Win" |
- // "Zoom" |
- |
- // More function keys, not in the key identifier specification. |
- case NSF25FunctionKey: |
- return @"F25"; |
- case NSF26FunctionKey: |
- return @"F26"; |
- case NSF27FunctionKey: |
- return @"F27"; |
- case NSF28FunctionKey: |
- return @"F28"; |
- case NSF29FunctionKey: |
- return @"F29"; |
- case NSF30FunctionKey: |
- return @"F30"; |
- case NSF31FunctionKey: |
- return @"F31"; |
- case NSF32FunctionKey: |
- return @"F32"; |
- case NSF33FunctionKey: |
- return @"F33"; |
- case NSF34FunctionKey: |
- return @"F34"; |
- case NSF35FunctionKey: |
- return @"F35"; |
- |
- // Turn 0x7F into 0x08, because backspace needs to always be 0x08. |
- case 0x7F: |
- return @"U+0008"; |
- // Standard says that DEL becomes U+007F. |
- case NSDeleteFunctionKey: |
- return @"U+007F"; |
- |
- // Always use 0x09 for tab instead of AppKit's backtab character. |
- case NSBackTabCharacter: |
- return @"U+0009"; |
- |
- case NSBeginFunctionKey: |
- case NSBreakFunctionKey: |
- case NSClearDisplayFunctionKey: |
- case NSDeleteCharFunctionKey: |
- case NSDeleteLineFunctionKey: |
- case NSInsertCharFunctionKey: |
- case NSInsertLineFunctionKey: |
- case NSNextFunctionKey: |
- case NSPrevFunctionKey: |
- case NSPrintFunctionKey: |
- case NSRedoFunctionKey: |
- case NSResetFunctionKey: |
- case NSSysReqFunctionKey: |
- case NSSystemFunctionKey: |
- case NSUserFunctionKey: |
- // FIXME: We should use something other than the vendor-area Unicode values |
- // for the above keys. |
- // For now, just fall through to the default. |
- default: |
- return [NSString stringWithFormat:@"U+%04X", base::ToUpperASCII(c)]; |
- } |
-} |
- |
// End Apple code. |
// ---------------------------------------------------------------------------- |
@@ -624,7 +292,6 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event) { |
result.domKey = DomKeyFromEvent(event); |
NSString* text_str = TextFromEvent(event); |
NSString* unmodified_str = UnmodifiedTextFromEvent(event); |
- NSString* identifier_str = KeyIdentifierForKeyEvent(event); |
// Begin Apple code, copied from KeyEventMac.mm |
@@ -651,10 +318,6 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event) { |
} else |
NOTIMPLEMENTED(); |
- [identifier_str getCString:&result.keyIdentifier[0] |
- maxLength:sizeof(result.keyIdentifier) |
- encoding:NSASCIIStringEncoding]; |
- |
result.timeStampSeconds = [event timestamp]; |
result.isSystemKey = IsSystemKeyEvent(result); |