| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 windowY = p.y(); | 230 windowY = p.y(); |
| 231 x = event.offsetX(); | 231 x = event.offsetX(); |
| 232 y = event.offsetY(); | 232 y = event.offsetY(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { | 235 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { |
| 236 if (event.type() == eventNames().keydownEvent) | 236 if (event.type() == eventNames().keydownEvent) |
| 237 type = KeyDown; | 237 type = KeyDown; |
| 238 else if (event.type() == eventNames().keyupEvent) | 238 else if (event.type() == eventNames().keyupEvent) |
| 239 type = WebInputEvent::KeyUp; | 239 type = WebInputEvent::KeyUp; |
| 240 else if (event.type() == eventNames().keypressEvent) |
| 241 type = WebInputEvent::Char; |
| 240 else | 242 else |
| 241 return; // Skip all other keyboard events. | 243 return; // Skip all other keyboard events. |
| 242 modifiers = getWebInputModifiers(event); | 244 modifiers = getWebInputModifiers(event); |
| 243 timeStampSeconds = event.timeStamp() * 1.0e-3; | 245 timeStampSeconds = event.timeStamp() * 1.0e-3; |
| 244 windowsKeyCode = event.keyCode(); | 246 windowsKeyCode = event.keyCode(); |
| 245 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); | 247 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); |
| 248 unsigned int numChars = std::min(event.keyEvent()->text().length(), |
| 249 static_cast<unsigned int>(WebKeyboardEvent::textLengthCap)); |
| 250 for (unsigned int i = 0; i < numChars; i++) { |
| 251 text[i] = event.keyEvent()->text()[i]; |
| 252 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; |
| 253 } |
| 246 } | 254 } |
| 247 | 255 |
| 248 } // namespace WebKit | 256 } // namespace WebKit |
| OLD | NEW |