OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 // send ASCII characters when pressing a control key on Windows, | 260 // send ASCII characters when pressing a control key on Windows, |
261 // which may be configured to do it so by user. | 261 // which may be configured to do it so by user. |
262 // See also http://en.wikipedia.org/wiki/Keyboard_Layout | 262 // See also http://en.wikipedia.org/wiki/Keyboard_Layout |
263 // FIXME(ukai): investigate more detail for various keyboard layout. | 263 // FIXME(ukai): investigate more detail for various keyboard layout. |
264 UChar ch = event.keyEvent()->text[0U]; | 264 UChar ch = event.keyEvent()->text[0U]; |
265 | 265 |
266 // Don't insert null or control characters as they can result in | 266 // Don't insert null or control characters as they can result in |
267 // unexpected behaviour | 267 // unexpected behaviour |
268 if (ch < ' ') | 268 if (ch < ' ') |
269 return false; | 269 return false; |
270 #if !OS(WIN) | 270 #if OS(LINUX) |
271 // According to XKB map no keyboard combinations with ctrl key are mapped to | |
272 // printable characters, however we need the filter as the DomKey/text could | |
273 // contain printable characters. | |
274 if (event.ctrlKey()) | |
yosin_UTC9
2016/11/11 01:49:26
Q: How about other modifier keys, Alt, Meta, Hyper
chongz
2016/11/11 20:12:28
Good question!
1. Alt: We set |webkit_event.isSy
| |
275 return false; | |
276 #elif !OS(WIN) | |
271 // Don't insert ASCII character if ctrl w/o alt or meta is on. | 277 // Don't insert ASCII character if ctrl w/o alt or meta is on. |
272 // On Mac, we should ignore events when meta is on (Command-<x>). | 278 // On Mac, we should ignore events when meta is on (Command-<x>). |
273 if (ch < 0x80) { | 279 if (ch < 0x80) { |
274 if (event.ctrlKey() && !event.altKey()) | 280 if (event.ctrlKey() && !event.altKey()) |
275 return false; | 281 return false; |
276 #if OS(MACOSX) | 282 #if OS(MACOSX) |
277 if (event.metaKey()) | 283 if (event.metaKey()) |
278 return false; | 284 return false; |
279 #endif | 285 #endif |
280 } | 286 } |
281 #endif | 287 #endif |
282 | 288 |
283 return true; | 289 return true; |
284 } | 290 } |
285 } // namespace blink | 291 } // namespace blink |
OLD | NEW |