OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
7 * Copyright (C) 2006-2009 Google Inc. | 7 * Copyright (C) 2006-2009 Google Inc. |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 unmodified_str = @"\x8"; | 624 unmodified_str = @"\x8"; |
625 // Always use 9 for tab -- we don't want to use AppKit's different character | 625 // Always use 9 for tab -- we don't want to use AppKit's different character |
626 // for shift-tab. | 626 // for shift-tab. |
627 if (result.windowsKeyCode == 9) { | 627 if (result.windowsKeyCode == 9) { |
628 text_str = @"\x9"; | 628 text_str = @"\x9"; |
629 unmodified_str = @"\x9"; | 629 unmodified_str = @"\x9"; |
630 } | 630 } |
631 | 631 |
632 // End Apple code. | 632 // End Apple code. |
633 | 633 |
634 // Handle Apple's private use character | |
635 if ([text_str length] == 1) { | |
dtapuska
2015/12/10 20:50:12
Can we do this in TextFromEvent and UnmodifiedText
chongz
2015/12/11 06:38:46
Moved text_str filter into a single function, but
| |
636 unichar c = [text_str characterAtIndex:0]; | |
637 if (c == NSDeleteFunctionKey) { | |
638 // Delete should be 0x7F | |
639 text_str = @"\x7F"; | |
640 } else if (c >= 0xF700 && c <= 0xF747) { | |
erikchen
2015/12/10 21:48:09
Where are you getting 0xF747 from?
https://code
dtapuska
2015/12/10 21:53:01
F7FF I'd prefer; would match this:
http://www.ope
chongz
2015/12/11 06:38:46
Done.
| |
641 // Other Apple private use characters should be "\0" | |
642 text_str = @"\0"; | |
643 } | |
644 } | |
645 if ([unmodified_str length] == 1) { | |
646 unichar c = [unmodified_str characterAtIndex:0]; | |
647 if (c == NSDeleteFunctionKey) { | |
648 // Delete should be 0x7F | |
649 unmodified_str = @"\x7F"; | |
650 } else if (c >= 0xF700 && c <= 0xF747) { | |
651 // Other Apple private use characters should be "\0" | |
652 unmodified_str = @"\0"; | |
653 } | |
654 } | |
655 | |
634 if ([text_str length] < blink::WebKeyboardEvent::textLengthCap && | 656 if ([text_str length] < blink::WebKeyboardEvent::textLengthCap && |
635 [unmodified_str length] < blink::WebKeyboardEvent::textLengthCap) { | 657 [unmodified_str length] < blink::WebKeyboardEvent::textLengthCap) { |
636 [text_str getCharacters:&result.text[0]]; | 658 [text_str getCharacters:&result.text[0]]; |
637 [unmodified_str getCharacters:&result.unmodifiedText[0]]; | 659 [unmodified_str getCharacters:&result.unmodifiedText[0]]; |
638 } else | 660 } else |
639 NOTIMPLEMENTED(); | 661 NOTIMPLEMENTED(); |
640 | 662 |
641 [identifier_str getCString:&result.keyIdentifier[0] | 663 [identifier_str getCString:&result.keyIdentifier[0] |
642 maxLength:sizeof(result.keyIdentifier) | 664 maxLength:sizeof(result.keyIdentifier) |
643 encoding:NSASCIIStringEncoding]; | 665 encoding:NSASCIIStringEncoding]; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 break; | 940 break; |
919 default: | 941 default: |
920 NOTIMPLEMENTED(); | 942 NOTIMPLEMENTED(); |
921 result.type = blink::WebInputEvent::Undefined; | 943 result.type = blink::WebInputEvent::Undefined; |
922 } | 944 } |
923 | 945 |
924 return result; | 946 return result; |
925 } | 947 } |
926 | 948 |
927 } // namespace content | 949 } // namespace content |
OLD | NEW |