mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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
21 lines
865 B
Plaintext
21 lines
865 B
Plaintext
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
[
|
|
EventConstructor,
|
|
] interface KeyboardEvent : Event {
|
|
// For keydown and keyup events:
|
|
[InitializedByEventConstructor] readonly attribute long key;
|
|
[InitializedByEventConstructor] readonly attribute DOMString location;
|
|
|
|
// For keypress events:
|
|
[InitializedByEventConstructor] readonly attribute long charCode;
|
|
|
|
[InitializedByEventConstructor] readonly attribute boolean ctrlKey;
|
|
[InitializedByEventConstructor] readonly attribute boolean shiftKey;
|
|
[InitializedByEventConstructor] readonly attribute boolean altKey;
|
|
[InitializedByEventConstructor] readonly attribute boolean metaKey;
|
|
[InitializedByEventConstructor] readonly attribute boolean repeat;
|
|
};
|