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

Side by Side Diff: tools/dom/src/dartium_KeyEvent.dart

Issue 589253002: Revert "Chrome 38 script changes from integration branch" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * A custom KeyboardEvent that attempts to eliminate cross-browser 2 * A custom KeyboardEvent that attempts to eliminate cross-browser
3 * inconsistencies, and also provide both keyCode and charCode information 3 * inconsistencies, and also provide both keyCode and charCode information
4 * for all key events (when such information can be determined). 4 * for all key events (when such information can be determined).
5 * 5 *
6 * KeyEvent tries to provide a higher level, more polished keyboard event 6 * KeyEvent tries to provide a higher level, more polished keyboard event
7 * information on top of the "raw" [KeyboardEvent]. 7 * information on top of the "raw" [KeyboardEvent].
8 * 8 *
9 * The mechanics of using KeyEvents is a little different from the underlying 9 * The mechanics of using KeyEvents is a little different from the underlying
10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add 10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 _shadowKeyCode = _realKeyCode; 73 _shadowKeyCode = _realKeyCode;
74 _currentTarget = _parent.currentTarget == null? window : 74 _currentTarget = _parent.currentTarget == null? window :
75 _parent.currentTarget; 75 _parent.currentTarget;
76 } 76 }
77 77
78 /** Programmatically create a new KeyEvent (and KeyboardEvent). */ 78 /** Programmatically create a new KeyEvent (and KeyboardEvent). */
79 factory KeyEvent(String type, 79 factory KeyEvent(String type,
80 {Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0, 80 {Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0,
81 int charCode: 0, int keyLocation: 1, bool ctrlKey: false, 81 int charCode: 0, int keyLocation: 1, bool ctrlKey: false,
82 bool altKey: false, bool shiftKey: false, bool metaKey: false, 82 bool altKey: false, bool shiftKey: false, bool metaKey: false,
83 EventTarget currentTarget}) { 83 bool altGraphKey: false, EventTarget currentTarget}) {
84 var parent = new KeyboardEvent(type, view: view, canBubble: canBubble, 84 var parent = new KeyboardEvent(type, view: view, canBubble: canBubble,
85 cancelable: cancelable, keyLocation: keyLocation, ctrlKey: ctrlKey, 85 cancelable: cancelable, keyLocation: keyLocation, ctrlKey: ctrlKey,
86 altKey: altKey, shiftKey: shiftKey, metaKey: metaKey); 86 altKey: altKey, shiftKey: shiftKey, metaKey: metaKey, altGraphKey:
87 altGraphKey);
87 var keyEvent = new KeyEvent.wrap(parent); 88 var keyEvent = new KeyEvent.wrap(parent);
88 keyEvent._shadowAltKey = altKey; 89 keyEvent._shadowAltKey = altKey;
89 keyEvent._shadowCharCode = charCode; 90 keyEvent._shadowCharCode = charCode;
90 keyEvent._shadowKeyCode = keyCode; 91 keyEvent._shadowKeyCode = keyCode;
91 keyEvent._currentTarget = currentTarget == null ? window : currentTarget; 92 keyEvent._currentTarget = currentTarget == null ? window : currentTarget;
92 return keyEvent; 93 return keyEvent;
93 } 94 }
94 95
95 /** Accessor to provide a stream of KeyEvents on the desired target. */ 96 /** Accessor to provide a stream of KeyEvents on the desired target. */
96 static EventStreamProvider<KeyEvent> keyDownEvent = 97 static EventStreamProvider<KeyEvent> keyDownEvent =
97 new _KeyboardEventHandler('keydown'); 98 new _KeyboardEventHandler('keydown');
98 /** Accessor to provide a stream of KeyEvents on the desired target. */ 99 /** Accessor to provide a stream of KeyEvents on the desired target. */
99 static EventStreamProvider<KeyEvent> keyUpEvent = 100 static EventStreamProvider<KeyEvent> keyUpEvent =
100 new _KeyboardEventHandler('keyup'); 101 new _KeyboardEventHandler('keyup');
101 /** Accessor to provide a stream of KeyEvents on the desired target. */ 102 /** Accessor to provide a stream of KeyEvents on the desired target. */
102 static EventStreamProvider<KeyEvent> keyPressEvent = 103 static EventStreamProvider<KeyEvent> keyPressEvent =
103 new _KeyboardEventHandler('keypress'); 104 new _KeyboardEventHandler('keypress');
104 105
105 /** The currently registered target for this event. */ 106 /** The currently registered target for this event. */
106 EventTarget get currentTarget => _currentTarget; 107 EventTarget get currentTarget => _currentTarget;
107 108
109 /** True if the altGraphKey is pressed during this event. */
110 bool get altGraphKey => _parent.altGraphKey;
108 /** Accessor to the clipboardData available for this event. */ 111 /** Accessor to the clipboardData available for this event. */
109 DataTransfer get clipboardData => _parent.clipboardData; 112 DataTransfer get clipboardData => _parent.clipboardData;
110 /** True if the ctrl key is pressed during this event. */ 113 /** True if the ctrl key is pressed during this event. */
111 bool get ctrlKey => _parent.ctrlKey; 114 bool get ctrlKey => _parent.ctrlKey;
112 int get detail => _parent.detail; 115 int get detail => _parent.detail;
113 /** 116 /**
114 * Accessor to the part of the keyboard that the key was pressed from (one of 117 * Accessor to the part of the keyboard that the key was pressed from (one of
115 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT, 118 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT,
116 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK). 119 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK).
117 */ 120 */
(...skipping 11 matching lines...) Expand all
129 } 132 }
130 String get _shadowKeyIdentifier => _parent._keyIdentifier; 133 String get _shadowKeyIdentifier => _parent._keyIdentifier;
131 134
132 int get _charCode => charCode; 135 int get _charCode => charCode;
133 int get _keyCode => keyCode; 136 int get _keyCode => keyCode;
134 String get _keyIdentifier { 137 String get _keyIdentifier {
135 throw new UnsupportedError("keyIdentifier is unsupported."); 138 throw new UnsupportedError("keyIdentifier is unsupported.");
136 } 139 }
137 void _initKeyboardEvent(String type, bool canBubble, bool cancelable, 140 void _initKeyboardEvent(String type, bool canBubble, bool cancelable,
138 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, 141 Window view, String keyIdentifier, int keyLocation, bool ctrlKey,
139 bool altKey, bool shiftKey, bool metaKey) { 142 bool altKey, bool shiftKey, bool metaKey,
143 bool altGraphKey) {
140 throw new UnsupportedError( 144 throw new UnsupportedError(
141 "Cannot initialize a KeyboardEvent from a KeyEvent."); 145 "Cannot initialize a KeyboardEvent from a KeyEvent.");
142 } 146 }
143 int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent'); 147 int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent');
144 int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent'); 148 int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent');
145 int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent'); 149 int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent');
146 int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent'); 150 int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent');
147 @Experimental() // untriaged 151 @Experimental() // untriaged
148 bool getModifierState(String keyArgument) => throw new UnimplementedError(); 152 bool getModifierState(String keyArgument) => throw new UnimplementedError();
149 @Experimental() // untriaged 153 @Experimental() // untriaged
150 int get location => throw new UnimplementedError(); 154 int get location => throw new UnimplementedError();
151 @Experimental() // untriaged 155 @Experimental() // untriaged
152 bool get repeat => throw new UnimplementedError(); 156 bool get repeat => throw new UnimplementedError();
153 dynamic get _get_view => throw new UnimplementedError(); 157 dynamic get _get_view => throw new UnimplementedError();
154 } 158 }
OLDNEW
« no previous file with comments | « tools/dom/src/dart2js_KeyEvent.dart ('k') | tools/dom/templates/html/dart2js/impl_KeyboardEvent.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698