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

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

Issue 1754523006: Beginning fix for KeyEvent,KeyboardEvent and UIEvent changes in roll 45 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged Created 4 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 unified diff | Download patch
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/src/dartium_KeyEvent.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15 matching lines...) Expand all
26 * possible. Bugs welcome! 26 * possible. Bugs welcome!
27 */ 27 */
28 @Experimental() 28 @Experimental()
29 class KeyEvent extends _WrappedEvent implements KeyboardEvent { 29 class KeyEvent extends _WrappedEvent implements KeyboardEvent {
30 /** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */ 30 /** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */
31 KeyboardEvent _parent; 31 KeyboardEvent _parent;
32 32
33 /** The "fixed" value of whether the alt key is being pressed. */ 33 /** The "fixed" value of whether the alt key is being pressed. */
34 bool _shadowAltKey; 34 bool _shadowAltKey;
35 35
36 /** Caculated value of what the estimated charCode is for this event. */ 36 /** Calculated value of what the estimated charCode is for this event. */
37 int _shadowCharCode; 37 int _shadowCharCode;
38 38
39 /** Caculated value of what the estimated keyCode is for this event. */ 39 /** Calculated value of what the estimated keyCode is for this event. */
40 int _shadowKeyCode; 40 int _shadowKeyCode;
41 41
42 /** Caculated value of what the estimated keyCode is for this event. */ 42 /** Calculated value of what the estimated keyCode is for this event. */
43 int get keyCode => _shadowKeyCode; 43 int get keyCode => _shadowKeyCode;
44 44
45 /** Caculated value of what the estimated charCode is for this event. */ 45 /** Calculated value of what the estimated charCode is for this event. */
46 int get charCode => this.type == 'keypress' ? _shadowCharCode : 0; 46 int get charCode => this.type == 'keypress' ? _shadowCharCode : 0;
47 47
48 /** Caculated value of whether the alt key is pressed is for this event. */ 48 /** Calculated value of whether the alt key is pressed is for this event. */
49 bool get altKey => _shadowAltKey; 49 bool get altKey => _shadowAltKey;
50 50
51 /** Caculated value of what the estimated keyCode is for this event. */ 51 /** Calculated value of what the estimated keyCode is for this event. */
52 int get which => keyCode; 52 int get which => keyCode;
53 53
54 /** Accessor to the underlying keyCode value is the parent event. */ 54 /** Accessor to the underlying keyCode value is the parent event. */
55 int get _realKeyCode => JS('int', '#.keyCode', _parent); 55 int get _realKeyCode => JS('int', '#.keyCode', _parent);
56 56
57 /** Accessor to the underlying charCode value is the parent event. */ 57 /** Accessor to the underlying charCode value is the parent event. */
58 int get _realCharCode => JS('int', '#.charCode', _parent); 58 int get _realCharCode => JS('int', '#.charCode', _parent);
59 59
60 /** Accessor to the underlying altKey value is the parent event. */ 60 /** Accessor to the underlying altKey value is the parent event. */
61 bool get _realAltKey => JS('bool', '#.altKey', _parent); 61 bool get _realAltKey => JS('bool', '#.altKey', _parent);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 new _KeyboardEventHandler('keydown'); 180 new _KeyboardEventHandler('keydown');
181 /** Accessor to provide a stream of KeyEvents on the desired target. */ 181 /** Accessor to provide a stream of KeyEvents on the desired target. */
182 static EventStreamProvider<KeyEvent> keyUpEvent = 182 static EventStreamProvider<KeyEvent> keyUpEvent =
183 new _KeyboardEventHandler('keyup'); 183 new _KeyboardEventHandler('keyup');
184 /** Accessor to provide a stream of KeyEvents on the desired target. */ 184 /** Accessor to provide a stream of KeyEvents on the desired target. */
185 static EventStreamProvider<KeyEvent> keyPressEvent = 185 static EventStreamProvider<KeyEvent> keyPressEvent =
186 new _KeyboardEventHandler('keypress'); 186 new _KeyboardEventHandler('keypress');
187 187
188 /** Accessor to the clipboardData available for this event. */ 188 /** Accessor to the clipboardData available for this event. */
189 DataTransfer get clipboardData => _parent.clipboardData; 189 DataTransfer get clipboardData => _parent.clipboardData;
190 String get code => parent.code;
190 /** True if the ctrl key is pressed during this event. */ 191 /** True if the ctrl key is pressed during this event. */
191 bool get ctrlKey => _parent.ctrlKey; 192 bool get ctrlKey => _parent.ctrlKey;
192 int get detail => _parent.detail; 193 int get detail => _parent.detail;
194 String get key => parent.key;
193 /** 195 /**
194 * Accessor to the part of the keyboard that the key was pressed from (one of 196 * Accessor to the part of the keyboard that the key was pressed from (one of
195 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT, 197 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT,
196 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK). 198 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK).
197 */ 199 */
198 int get keyLocation => _parent.keyLocation; 200 int get keyLocation => _parent.keyLocation;
199 Point get layer => _parent.layer; 201 Point get layer => _parent.layer;
200 /** True if the Meta (or Mac command) key is pressed during this event. */ 202 /** True if the Meta (or Mac command) key is pressed during this event. */
201 bool get metaKey => _parent.metaKey; 203 bool get metaKey => _parent.metaKey;
202 Point get page => _parent.page; 204 Point get page => _parent.page;
203 /** True if the shift key was pressed during this event. */ 205 /** True if the shift key was pressed during this event. */
204 bool get shiftKey => _parent.shiftKey; 206 bool get shiftKey => _parent.shiftKey;
207 InputDevice get sourceDevice => parent.sourceDevice;
205 Window get view => _parent.view; 208 Window get view => _parent.view;
206 void _initUIEvent(String type, bool canBubble, bool cancelable, 209 void _initUIEvent(String type, bool canBubble, bool cancelable,
207 Window view, int detail) { 210 Window view, int detail) {
208 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent."); 211 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent.");
209 } 212 }
210 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent); 213 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent);
211 214
212 int get _charCode => charCode; 215 int get _charCode => charCode;
213 int get _keyCode => keyCode; 216 int get _keyCode => keyCode;
217 int get _which => which;
218
214 String get _keyIdentifier { 219 String get _keyIdentifier {
215 throw new UnsupportedError("keyIdentifier is unsupported."); 220 throw new UnsupportedError("keyIdentifier is unsupported.");
216 } 221 }
217 void _initKeyboardEvent(String type, bool canBubble, bool cancelable, 222 void _initKeyboardEvent(String type, bool canBubble, bool cancelable,
218 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, 223 Window view, String keyIdentifier, int keyLocation, bool ctrlKey,
219 bool altKey, bool shiftKey, bool metaKey) { 224 bool altKey, bool shiftKey, bool metaKey) {
220 throw new UnsupportedError( 225 throw new UnsupportedError(
221 "Cannot initialize a KeyboardEvent from a KeyEvent."); 226 "Cannot initialize a KeyboardEvent from a KeyEvent.");
222 } 227 }
223 int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent');
224 int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent');
225 int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent');
226 int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent');
227 @Experimental() // untriaged 228 @Experimental() // untriaged
228 bool getModifierState(String keyArgument) => throw new UnimplementedError(); 229 bool getModifierState(String keyArgument) => throw new UnimplementedError();
229 @Experimental() // untriaged 230 @Experimental() // untriaged
230 int get location => throw new UnimplementedError(); 231 int get location => throw new UnimplementedError();
231 @Experimental() // untriaged 232 @Experimental() // untriaged
232 bool get repeat => throw new UnimplementedError(); 233 bool get repeat => throw new UnimplementedError();
233 dynamic get _get_view => throw new UnimplementedError(); 234 dynamic get _get_view => throw new UnimplementedError();
234 } 235 }
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/src/dartium_KeyEvent.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698