| Index: tools/dom/src/dartium_KeyEvent.dart
|
| diff --git a/tools/dom/src/dartium_KeyEvent.dart b/tools/dom/src/dartium_KeyEvent.dart
|
| index 6be8d67ffbd36850fdff0fca274c0d821f43d26d..1adf7d888599b4ba97d92a07a06d893edd3531bb 100644
|
| --- a/tools/dom/src/dartium_KeyEvent.dart
|
| +++ b/tools/dom/src/dartium_KeyEvent.dart
|
| @@ -12,6 +12,7 @@
|
| */
|
| part of html;
|
|
|
| +@Experimental()
|
| class KeyEvent extends _WrappedEvent implements KeyboardEvent {
|
| /** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */
|
| KeyboardEvent _parent;
|
| @@ -46,14 +47,35 @@ class KeyEvent extends _WrappedEvent implements KeyboardEvent {
|
| /** Accessor to the underlying altKey value is the parent event. */
|
| bool get _realAltKey => _parent.altKey;
|
|
|
| + /** Shadows on top of the parent's currentTarget. */
|
| + EventTarget _currentTarget;
|
| +
|
| /** Construct a KeyEvent with [parent] as the event we're emulating. */
|
| - KeyEvent(KeyboardEvent parent): super(parent) {
|
| + KeyEvent.wrap(KeyboardEvent parent): super(parent) {
|
| _parent = parent;
|
| _shadowAltKey = _realAltKey;
|
| _shadowCharCode = _realCharCode;
|
| _shadowKeyCode = _realKeyCode;
|
| + _currentTarget = _parent.currentTarget == null? window :
|
| + _parent.currentTarget;
|
| }
|
|
|
| + /** Programmatically create a new KeyEvent (and KeyboardEvent). */
|
| + KeyEvent(String type,
|
| + {Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0,
|
| + int charCode: 0, int keyLocation: 1, bool ctrlKey: false,
|
| + bool altKey: false, bool shiftKey: false, bool metaKey: false,
|
| + bool altGraphKey: false, EventTarget currentTarget}) {
|
| + _parent = new KeyboardEvent(type, view: view, canBubble: canBubble,
|
| + cancelable: cancelable, keyLocation: keyLocation, ctrlKey: ctrlKey,
|
| + altKey: altKey, shiftKey: shiftKey, metaKey: metaKey, altGraphKey:
|
| + altGraphKey);
|
| + _shadowAltKey = altKey;
|
| + _shadowCharCode = charCode;
|
| + _shadowKeyCode = keyCode;
|
| + _currentTarget = currentTarget == null ? window : currentTarget;
|
| + }
|
| +
|
| /** Accessor to provide a stream of KeyEvents on the desired target. */
|
| static EventStreamProvider<KeyEvent> keyDownEvent =
|
| new _KeyboardEventHandler('keydown');
|
| @@ -64,6 +86,9 @@ class KeyEvent extends _WrappedEvent implements KeyboardEvent {
|
| static EventStreamProvider<KeyEvent> keyPressEvent =
|
| new _KeyboardEventHandler('keypress');
|
|
|
| + /** The currently registered target for this event. */
|
| + EventTarget get currentTarget => _currentTarget;
|
| +
|
| /** True if the altGraphKey is pressed during this event. */
|
| bool get altGraphKey => _parent.altGraphKey;
|
| /** Accessor to the clipboardData available for this event. */
|
|
|