Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: tools/dom/src/dartium_KeyEvent.dart

Issue 12419011: Modern-ify KeyEvent handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: \ Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/dom/src/dartium_KeyEvent.dart
diff --git a/tools/dom/src/dartium_KeyEvent.dart b/tools/dom/src/dartium_KeyEvent.dart
index 5be90c96958ee6149666f283ad5097408c63eed8..e6a246ea09dcc1694839bdf36e0bd2c5a0283da6 100644
--- a/tools/dom/src/dartium_KeyEvent.dart
+++ b/tools/dom/src/dartium_KeyEvent.dart
@@ -3,6 +3,9 @@
* inconsistencies, and also provide both keyCode and charCode information
* for all key events (when such information can be determined).
*
+ * KeyEvent tries to provide a higher level, more polished keyboard event
+ * information on top of the "raw" [KeyboardEvent].
+ *
* This class is very much a work in progress, and we'd love to get information
* on how we can make this class work with as many international keyboards as
* possible. Bugs welcome!
@@ -41,7 +44,7 @@ class KeyEvent implements KeyboardEvent {
/** Accessor to the underlying altKey value is the parent event. */
bool get _realAltKey => _parent.altKey;
- /** Construct a KeyEvent with [parent] as event we're emulating. */
+ /** Construct a KeyEvent with [parent] as the event we're emulating. */
KeyEvent(KeyboardEvent parent) {
_parent = parent;
_shadowAltKey = _realAltKey;
@@ -49,6 +52,16 @@ class KeyEvent implements KeyboardEvent {
_shadowKeyCode = _realKeyCode;
}
+ /** Accessor to provide a stream of KeyEvents on the desired target. */
+ static EventStreamProvider<KeyEvent> keyDownEvent =
+ _KeyboardEventHandler('keydown');
+ /** Accessor to provide a stream of KeyEvents on the desired target. */
+ static EventStreamProvider<KeyEvent> keyUpEvent =
+ _KeyboardEventHandler('keyup');
+ /** Accessor to provide a stream of KeyEvents on the desired target. */
+ static EventStreamProvider<KeyEvent> keyPressEvent =
+ _KeyboardEventHandler('keypress');
+
/** True if the altGraphKey is pressed during this event. */
bool get altGraphKey => _parent.altGraphKey;
bool get bubbles => _parent.bubbles;

Powered by Google App Engine
This is Rietveld 408576698