From 966b475029dc10fadc0231a44577ce72c4dadd48 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sun, 25 Jan 2015 22:46:50 -0800 Subject: [PATCH] Switch KeyboardEvents over to NewEventHandler This CL moves KeyboardEvents from the old event model to NewEventHandler. This CL keeps the basic structure of keydown, keypress, keyup events even though that's a bit wacky. As with pointer and gesture events, this CL removes PlatformKeyboardEvent in favor of just using WebKeyboardEvent. I've also made WebKeyboardEvent align more closely with Mojo's keyboard event. The CL does change one important aspect of key event handling: on the web the "keyCode" property of KeyboardEvent changes its meaning depending on whether the event is a keydown or a keypress event. For the former events, keyCode is the "virtual" (i.e., windows) key code where for the latter events, keyCode is the character code. To be more precise, I've renamed keyCode to virtualKeyCode and I've given it a zero (unknown key code) value during keypress events. R=ojan@chromium.org, eseidel@chromium.org Review URL: https://codereview.chromium.org/872233002 --- engine/src/flutter/tests/services/event-sender.sky | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/tests/services/event-sender.sky b/engine/src/flutter/tests/services/event-sender.sky index 99472060aa..27965c9814 100644 --- a/engine/src/flutter/tests/services/event-sender.sky +++ b/engine/src/flutter/tests/services/event-sender.sky @@ -10,10 +10,10 @@ describe('Sky event sender', function() { it('should be able to send events', function(done) { var sky = document.querySelector('sky') - sky.focus(); sky.addEventListener('keypress', function(event) { assert.equal(event.type, 'keypress'); - assert.equal(event.keyCode, 0x41); + assert.equal(event.key, 0); + assert.equal(event.charCode, 0x41); done(); }); @@ -22,7 +22,7 @@ describe('Sky event sender', function() { testHarness.dispatchInputEvent(new events.Event({ action: constants.EventType.KEY_PRESSED, key_data: new events.KeyData({ - native_key_code: 0x41, + windows_key_code: 0x41, text: 0x41, unmodified_text: 0x41, is_char: true,