Index: webkit/api/src/mac/WebInputEventFactory.mm |
=================================================================== |
--- webkit/api/src/mac/WebInputEventFactory.mm (revision 22136) |
+++ webkit/api/src/mac/WebInputEventFactory.mm (working copy) |
@@ -846,7 +846,7 @@ |
WebKeyboardEvent result; |
result.type = |
- isKeyUpEvent(event) ? WebInputEvent::KeyUp : WebInputEvent::KeyDown; |
+ isKeyUpEvent(event) ? WebInputEvent::KeyUp : WebInputEvent::RawKeyDown; |
result.modifiers = modifiersFromEvent(event); |
@@ -905,6 +905,25 @@ |
return result; |
} |
+WebKeyboardEvent WebInputEventFactory::keyboardEvent(wchar_t character, |
+ int modifiers, |
+ double timeStampSeconds) |
+{ |
+ // keyboardEvent(NSEvent*) depends on the NSEvent object and |
+ // it is hard to use it from methods of the NSTextInput protocol. For |
+ // such methods, this function creates a WebInputEvent::Char event without |
+ // using a NSEvent object. |
+ WebKeyboardEvent result; |
+ result.type = WebKit::WebInputEvent::Char; |
+ result.timeStampSeconds = timeStampSeconds; |
+ result.modifiers = modifiers; |
+ result.windowsKeyCode = character; |
+ result.nativeKeyCode = character; |
+ result.text[0] = character; |
+ result.unmodifiedText[0] = character; |
+ return result; |
+} |
+ |
// WebMouseEvent -------------------------------------------------------------- |
WebMouseEvent WebInputEventFactory::mouseEvent(NSEvent* event, NSView* view) |