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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11416249: Make KeyboardEvent cross-browser consistent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: doc comment fix Created 8 years 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 library html; 1 library html;
2 2
3 import 'dart:isolate'; 3 import 'dart:isolate';
4 import 'dart:json'; 4 import 'dart:json';
5 import 'dart:svg' as svg; 5 import 'dart:svg' as svg;
6 import 'dart:web_audio' as web_audio; 6 import 'dart:web_audio' as web_audio;
7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
8 // for details. All rights reserved. Use of this source code is governed by a 8 // for details. All rights reserved. Use of this source code is governed by a
9 // BSD-style license that can be found in the LICENSE file. 9 // BSD-style license that can be found in the LICENSE file.
10 10
(...skipping 5963 matching lines...) Expand 10 before | Expand all | Expand 10 after
5974 5974
5975 /// @domName DirectoryReaderSync.readEntries; @docsEditable true 5975 /// @domName DirectoryReaderSync.readEntries; @docsEditable true
5976 @Returns('_EntryArraySync') @Creates('_EntryArraySync') 5976 @Returns('_EntryArraySync') @Creates('_EntryArraySync')
5977 List<EntrySync> readEntries() native; 5977 List<EntrySync> readEntries() native;
5978 } 5978 }
5979 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 5979 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
5980 // for details. All rights reserved. Use of this source code is governed by a 5980 // for details. All rights reserved. Use of this source code is governed by a
5981 // BSD-style license that can be found in the LICENSE file. 5981 // BSD-style license that can be found in the LICENSE file.
5982 5982
5983 5983
5984 /**
5985 * Represents an HTML <div> element.
5986 *
5987 * The [DivElement] is a generic container for content and does not have any
5988 * special significance. It is functionally similar to [SpanElement].
5989 *
5990 * The [DivElement] is a block-level element, as opposed to [SpanElement],
5991 * which is an inline-level element.
5992 *
5993 * Example usage:
5994 *
5995 * DivElement div = new DivElement();
5996 * div.text = 'Here's my new DivElem
5997 * document.body.elements.add(elem);
5998 *
5999 * See also:
6000 *
6001 * * [HTML <div> element](http://www.w3.org/TR/html-markup/div.html) from W3C.
6002 * * [Block-level element](http://www.w3.org/TR/CSS2/visuren.html#block-boxes) f rom W3C.
6003 * * [Inline-level element](http://www.w3.org/TR/CSS2/visuren.html#inline-boxes) from W3C.
6004 */
6005 /// @domName HTMLDivElement; @docsEditable true 5984 /// @domName HTMLDivElement; @docsEditable true
6006 class DivElement extends Element implements Element native "*HTMLDivElement" { 5985 class DivElement extends Element implements Element native "*HTMLDivElement" {
6007 5986
6008 factory DivElement() => document.$dom_createElement("div"); 5987 factory DivElement() => document.$dom_createElement("div");
6009 } 5988 }
6010 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 5989 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
6011 // for details. All rights reserved. Use of this source code is governed by a 5990 // for details. All rights reserved. Use of this source code is governed by a
6012 // BSD-style license that can be found in the LICENSE file. 5991 // BSD-style license that can be found in the LICENSE file.
6013 5992
6014 5993
(...skipping 4874 matching lines...) Expand 10 before | Expand all | Expand 10 after
10889 int scopeType(int scopeIndex) native; 10868 int scopeType(int scopeIndex) native;
10890 } 10869 }
10891 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10870 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
10892 // for details. All rights reserved. Use of this source code is governed by a 10871 // for details. All rights reserved. Use of this source code is governed by a
10893 // BSD-style license that can be found in the LICENSE file. 10872 // BSD-style license that can be found in the LICENSE file.
10894 10873
10895 10874
10896 /// @domName KeyboardEvent; @docsEditable true 10875 /// @domName KeyboardEvent; @docsEditable true
10897 class KeyboardEvent extends UIEvent native "*KeyboardEvent" { 10876 class KeyboardEvent extends UIEvent native "*KeyboardEvent" {
10898 10877
10878 factory KeyboardEvent(String type, Window view,
10879 [bool canBubble = true, bool cancelable = true,
10880 String keyIdentifier = null, int keyLocation = 1, bool ctrlKey = false,
10881 bool altKey = false, bool shiftKey = false, bool metaKey = false,
10882 bool altGraphKey = false]) {
10883 final e = document.$dom_createEvent("KeyboardEvent");
10884 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier,
10885 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
10886 return e;
10887 }
10888
10889 /** @domName KeyboardEvent.initKeyboardEvent */
10890 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable,
10891 LocalWindow view, String keyIdentifier, int keyLocation, bool ctrlKey,
10892 bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) {
10893 // initKeyEvent is the call in Firefox, initKeyboardEvent for all other
10894 // browsers.
10895 var function = JS('dynamic', '#.initKeyboardEvent || #.initKeyEvent', this,
10896 this);
10897 JS('void', '#(#, #, #, #, #, #, #, #, #, #, #)', function, type,
10898 canBubble, cancelable, view, keyIdentifier, keyLocation, ctrlKey,
10899 altKey, shiftKey, metaKey, altGraphKey);
10900 }
10901
10902 /** @domName KeyboardEvent.keyCode */
10903 int get keyCode => $dom_keyCode;
10904
10905 /** @domName KeyboardEvent.charCode */
10906 int get charCode => $dom_charCode;
10907
10899 /// @domName KeyboardEvent.altGraphKey; @docsEditable true 10908 /// @domName KeyboardEvent.altGraphKey; @docsEditable true
10900 final bool altGraphKey; 10909 final bool altGraphKey;
10901 10910
10902 /// @domName KeyboardEvent.altKey; @docsEditable true 10911 /// @domName KeyboardEvent.altKey; @docsEditable true
10903 final bool altKey; 10912 final bool altKey;
10904 10913
10905 /// @domName KeyboardEvent.ctrlKey; @docsEditable true 10914 /// @domName KeyboardEvent.ctrlKey; @docsEditable true
10906 final bool ctrlKey; 10915 final bool ctrlKey;
10907 10916
10908 /// @domName KeyboardEvent.keyIdentifier; @docsEditable true 10917 /// @domName KeyboardEvent.keyIdentifier; @docsEditable true
10909 final String keyIdentifier; 10918 String get $dom_keyIdentifier => JS("String", "#.keyIdentifier", this);
10910 10919
10911 /// @domName KeyboardEvent.keyLocation; @docsEditable true 10920 /// @domName KeyboardEvent.keyLocation; @docsEditable true
10912 final int keyLocation; 10921 final int keyLocation;
10913 10922
10914 /// @domName KeyboardEvent.metaKey; @docsEditable true 10923 /// @domName KeyboardEvent.metaKey; @docsEditable true
10915 final bool metaKey; 10924 final bool metaKey;
10916 10925
10917 /// @domName KeyboardEvent.shiftKey; @docsEditable true 10926 /// @domName KeyboardEvent.shiftKey; @docsEditable true
10918 final bool shiftKey; 10927 final bool shiftKey;
10919 10928
10920 /// @domName KeyboardEvent.initKeyboardEvent; @docsEditable true
10921 void initKeyboardEvent(String type, bool canBubble, bool cancelable, LocalWind ow view, String keyIdentifier, int keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) native;
10922 } 10929 }
10923 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10930 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
10924 // for details. All rights reserved. Use of this source code is governed by a 10931 // for details. All rights reserved. Use of this source code is governed by a
10925 // BSD-style license that can be found in the LICENSE file. 10932 // BSD-style license that can be found in the LICENSE file.
10926 10933
10927 10934
10928 /// @domName HTMLKeygenElement; @docsEditable true 10935 /// @domName HTMLKeygenElement; @docsEditable true
10929 class KeygenElement extends Element implements Element native "*HTMLKeygenElemen t" { 10936 class KeygenElement extends Element implements Element native "*HTMLKeygenElemen t" {
10930 10937
10931 factory KeygenElement() => document.$dom_createElement("keygen"); 10938 factory KeygenElement() => document.$dom_createElement("keygen");
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
11365 /// @domName Window.opener; @docsEditable true 11372 /// @domName Window.opener; @docsEditable true
11366 Window get opener => _convertNativeToDart_Window(this._opener); 11373 Window get opener => _convertNativeToDart_Window(this._opener);
11367 dynamic get _opener => JS("dynamic", "#.opener", this); 11374 dynamic get _opener => JS("dynamic", "#.opener", this);
11368 11375
11369 /// @domName Window.outerHeight; @docsEditable true 11376 /// @domName Window.outerHeight; @docsEditable true
11370 final int outerHeight; 11377 final int outerHeight;
11371 11378
11372 /// @domName Window.outerWidth; @docsEditable true 11379 /// @domName Window.outerWidth; @docsEditable true
11373 final int outerWidth; 11380 final int outerWidth;
11374 11381
11375 /// @domName DOMWindow.pagePopupController; @docsEditable true 11382 /// @domName Window.pagePopupController; @docsEditable true
11376 final PagePopupController pagePopupController; 11383 final PagePopupController pagePopupController;
11377 11384
11378 /// @domName Window.pageXOffset; @docsEditable true 11385 /// @domName Window.pageXOffset; @docsEditable true
11379 final int pageXOffset; 11386 final int pageXOffset;
11380 11387
11381 /// @domName Window.pageYOffset; @docsEditable true 11388 /// @domName Window.pageYOffset; @docsEditable true
11382 final int pageYOffset; 11389 final int pageYOffset;
11383 11390
11384 /// @domName Window.parent; @docsEditable true 11391 /// @domName Window.parent; @docsEditable true
11385 Window get parent => _convertNativeToDart_Window(this._parent); 11392 Window get parent => _convertNativeToDart_Window(this._parent);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
11431 /// @domName Window.styleMedia; @docsEditable true 11438 /// @domName Window.styleMedia; @docsEditable true
11432 final StyleMedia styleMedia; 11439 final StyleMedia styleMedia;
11433 11440
11434 /// @domName Window.toolbar; @docsEditable true 11441 /// @domName Window.toolbar; @docsEditable true
11435 final BarInfo toolbar; 11442 final BarInfo toolbar;
11436 11443
11437 /// @domName Window.top; @docsEditable true 11444 /// @domName Window.top; @docsEditable true
11438 Window get top => _convertNativeToDart_Window(this._top); 11445 Window get top => _convertNativeToDart_Window(this._top);
11439 dynamic get _top => JS("dynamic", "#.top", this); 11446 dynamic get _top => JS("dynamic", "#.top", this);
11440 11447
11441 /// @domName DOMWindow.webkitIndexedDB; @docsEditable true 11448 /// @domName Window.webkitIndexedDB; @docsEditable true
11442 final IDBFactory webkitIndexedDB; 11449 final IDBFactory webkitIndexedDB;
11443 11450
11444 /// @domName DOMWindow.webkitNotifications; @docsEditable true 11451 /// @domName Window.webkitNotifications; @docsEditable true
11445 final NotificationCenter webkitNotifications; 11452 final NotificationCenter webkitNotifications;
11446 11453
11447 /// @domName DOMWindow.webkitStorageInfo; @docsEditable true 11454 /// @domName Window.webkitStorageInfo; @docsEditable true
11448 final StorageInfo webkitStorageInfo; 11455 final StorageInfo webkitStorageInfo;
11449 11456
11450 /// @domName Window.window; @docsEditable true 11457 /// @domName Window.window; @docsEditable true
11451 Window get window => _convertNativeToDart_Window(this._window); 11458 Window get window => _convertNativeToDart_Window(this._window);
11452 dynamic get _window => JS("dynamic", "#.window", this); 11459 dynamic get _window => JS("dynamic", "#.window", this);
11453 11460
11454 /// @domName Window.addEventListener; @docsEditable true 11461 /// @domName Window.addEventListener; @docsEditable true
11455 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native "addEventListener"; 11462 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native "addEventListener";
11456 11463
11457 /// @domName Window.alert; @docsEditable true 11464 /// @domName Window.alert; @docsEditable true
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
11496 11503
11497 /// @domName Window.matchMedia; @docsEditable true 11504 /// @domName Window.matchMedia; @docsEditable true
11498 MediaQueryList matchMedia(String query) native; 11505 MediaQueryList matchMedia(String query) native;
11499 11506
11500 /// @domName Window.moveBy; @docsEditable true 11507 /// @domName Window.moveBy; @docsEditable true
11501 void moveBy(num x, num y) native; 11508 void moveBy(num x, num y) native;
11502 11509
11503 /// @domName Window.moveTo; @docsEditable true 11510 /// @domName Window.moveTo; @docsEditable true
11504 void moveTo(num x, num y) native; 11511 void moveTo(num x, num y) native;
11505 11512
11506 /// @domName DOMWindow.openDatabase; @docsEditable true 11513 /// @domName Window.openDatabase; @docsEditable true
11507 @Creates('Database') @Creates('DatabaseSync') 11514 @Creates('Database') @Creates('DatabaseSync')
11508 Database openDatabase(String name, String version, String displayName, int est imatedSize, [DatabaseCallback creationCallback]) native; 11515 Database openDatabase(String name, String version, String displayName, int est imatedSize, [DatabaseCallback creationCallback]) native;
11509 11516
11510 /// @domName Window.postMessage; @docsEditable true 11517 /// @domName Window.postMessage; @docsEditable true
11511 void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts]) { 11518 void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts]) {
11512 if (?message && 11519 if (?message &&
11513 !?messagePorts) { 11520 !?messagePorts) {
11514 var message_1 = _convertDartToNative_SerializedScriptValue(message); 11521 var message_1 = _convertDartToNative_SerializedScriptValue(message);
11515 _postMessage_1(message_1, targetOrigin); 11522 _postMessage_1(message_1, targetOrigin);
11516 return; 11523 return;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
11560 11567
11561 /// @domName Window.stop; @docsEditable true 11568 /// @domName Window.stop; @docsEditable true
11562 void stop() native; 11569 void stop() native;
11563 11570
11564 /// @domName Window.webkitConvertPointFromNodeToPage; @docsEditable true 11571 /// @domName Window.webkitConvertPointFromNodeToPage; @docsEditable true
11565 Point webkitConvertPointFromNodeToPage(Node node, Point p) native; 11572 Point webkitConvertPointFromNodeToPage(Node node, Point p) native;
11566 11573
11567 /// @domName Window.webkitConvertPointFromPageToNode; @docsEditable true 11574 /// @domName Window.webkitConvertPointFromPageToNode; @docsEditable true
11568 Point webkitConvertPointFromPageToNode(Node node, Point p) native; 11575 Point webkitConvertPointFromPageToNode(Node node, Point p) native;
11569 11576
11570 /// @domName DOMWindow.webkitRequestFileSystem; @docsEditable true 11577 /// @domName Window.webkitRequestFileSystem; @docsEditable true
11571 void webkitRequestFileSystem(int type, int size, FileSystemCallback successCal lback, [ErrorCallback errorCallback]) native; 11578 void webkitRequestFileSystem(int type, int size, FileSystemCallback successCal lback, [ErrorCallback errorCallback]) native;
11572 11579
11573 /// @domName DOMWindow.webkitResolveLocalFileSystemURL; @docsEditable true 11580 /// @domName Window.webkitResolveLocalFileSystemURL; @docsEditable true
11574 void webkitResolveLocalFileSystemUrl(String url, EntryCallback successCallback , [ErrorCallback errorCallback]) native "webkitResolveLocalFileSystemURL"; 11581 void webkitResolveLocalFileSystemUrl(String url, EntryCallback successCallback , [ErrorCallback errorCallback]) native "webkitResolveLocalFileSystemURL";
11575 11582
11576 } 11583 }
11577 11584
11578 class LocalWindowEvents extends Events { 11585 class LocalWindowEvents extends Events {
11579 LocalWindowEvents(EventTarget _ptr) : super(_ptr); 11586 LocalWindowEvents(EventTarget _ptr) : super(_ptr);
11580 11587
11581 EventListenerList get abort => this['abort']; 11588 EventListenerList get abort => this['abort'];
11582 11589
11583 EventListenerList get beforeUnload => this['beforeunload']; 11590 EventListenerList get beforeUnload => this['beforeunload'];
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
12385 final int totalJSHeapSize; 12392 final int totalJSHeapSize;
12386 12393
12387 /// @domName MemoryInfo.usedJSHeapSize; @docsEditable true 12394 /// @domName MemoryInfo.usedJSHeapSize; @docsEditable true
12388 final int usedJSHeapSize; 12395 final int usedJSHeapSize;
12389 } 12396 }
12390 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 12397 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
12391 // for details. All rights reserved. Use of this source code is governed by a 12398 // for details. All rights reserved. Use of this source code is governed by a
12392 // BSD-style license that can be found in the LICENSE file. 12399 // BSD-style license that can be found in the LICENSE file.
12393 12400
12394 12401
12395 /**
12396 * An HTML <menu> element.
12397 *
12398 * A <menu> element represents an unordered list of menu commands.
12399 *
12400 * See also:
12401 *
12402 * * [Menu Element](https://developer.mozilla.org/en-US/docs/HTML/Element/menu) from MDN.
12403 * * [Menu Element](http://www.w3.org/TR/html5/the-menu-element.html#the-menu-e lement) from the W3C.
12404 */
12405 /// @domName HTMLMenuElement; @docsEditable true 12402 /// @domName HTMLMenuElement; @docsEditable true
12406 class MenuElement extends Element implements Element native "*HTMLMenuElement" { 12403 class MenuElement extends Element implements Element native "*HTMLMenuElement" {
12407 12404
12408 factory MenuElement() => document.$dom_createElement("menu"); 12405 factory MenuElement() => document.$dom_createElement("menu");
12409 } 12406 }
12410 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 12407 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
12411 // for details. All rights reserved. Use of this source code is governed by a 12408 // for details. All rights reserved. Use of this source code is governed by a
12412 // BSD-style license that can be found in the LICENSE file. 12409 // BSD-style license that can be found in the LICENSE file.
12413 12410
12414 12411
(...skipping 4686 matching lines...) Expand 10 before | Expand all | Expand 10 after
17101 /// @domName TreeWalker.previousNode; @docsEditable true 17098 /// @domName TreeWalker.previousNode; @docsEditable true
17102 Node previousNode() native; 17099 Node previousNode() native;
17103 17100
17104 /// @domName TreeWalker.previousSibling; @docsEditable true 17101 /// @domName TreeWalker.previousSibling; @docsEditable true
17105 Node previousSibling() native; 17102 Node previousSibling() native;
17106 } 17103 }
17107 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 17104 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
17108 // for details. All rights reserved. Use of this source code is governed by a 17105 // for details. All rights reserved. Use of this source code is governed by a
17109 // BSD-style license that can be found in the LICENSE file. 17106 // BSD-style license that can be found in the LICENSE file.
17110 17107
17108 // WARNING: Do not edit - generated code.
17109
17111 17110
17112 /// @domName UIEvent; @docsEditable true 17111 /// @domName UIEvent; @docsEditable true
17113 class UIEvent extends Event native "*UIEvent" { 17112 class UIEvent extends Event native "*UIEvent" {
17113 // In JS, canBubble and cancelable are technically required parameters to
17114 // init*Event. In practice, though, if they aren't provided they simply
17115 // default to false (since that's Boolean(undefined)).
17116 //
17117 // Contrary to JS, we default canBubble and cancelable to true, since that's
17118 // what people want most of the time anyway.
17119 factory UIEvent(String type, Window view, int detail,
17120 [bool canBubble = true, bool cancelable = true]) {
17121 final e = document.$dom_createEvent("UIEvent");
17122 e.$dom_initUIEvent(type, canBubble, cancelable, view, detail);
17123 return e;
17124 }
17114 17125
17115 /// @domName UIEvent.charCode; @docsEditable true 17126 /// @domName UIEvent.charCode; @docsEditable true
17116 final int charCode; 17127 int get $dom_charCode => JS("int", "#.charCode", this);
17117 17128
17118 /// @domName UIEvent.detail; @docsEditable true 17129 /// @domName UIEvent.detail; @docsEditable true
17119 final int detail; 17130 final int detail;
17120 17131
17121 /// @domName UIEvent.keyCode; @docsEditable true 17132 /// @domName UIEvent.keyCode; @docsEditable true
17122 final int keyCode; 17133 int get $dom_keyCode => JS("int", "#.keyCode", this);
17123 17134
17124 /// @domName UIEvent.layerX; @docsEditable true 17135 /// @domName UIEvent.layerX; @docsEditable true
17125 final int layerX; 17136 final int layerX;
17126 17137
17127 /// @domName UIEvent.layerY; @docsEditable true 17138 /// @domName UIEvent.layerY; @docsEditable true
17128 final int layerY; 17139 final int layerY;
17129 17140
17130 /// @domName UIEvent.pageX; @docsEditable true 17141 /// @domName UIEvent.pageX; @docsEditable true
17131 final int pageX; 17142 final int pageX;
17132 17143
17133 /// @domName UIEvent.pageY; @docsEditable true 17144 /// @domName UIEvent.pageY; @docsEditable true
17134 final int pageY; 17145 final int pageY;
17135 17146
17136 /// @domName UIEvent.view; @docsEditable true 17147 /// @domName UIEvent.view; @docsEditable true
17137 Window get view => _convertNativeToDart_Window(this._view); 17148 Window get view => _convertNativeToDart_Window(this._view);
17138 dynamic get _view => JS("dynamic", "#.view", this); 17149 dynamic get _view => JS("dynamic", "#.view", this);
17139 17150
17140 /// @domName UIEvent.which; @docsEditable true 17151 /// @domName UIEvent.which; @docsEditable true
17141 final int which; 17152 final int which;
17142 17153
17143 /// @domName UIEvent.initUIEvent; @docsEditable true 17154 /// @domName UIEvent.initUIEvent; @docsEditable true
17144 void initUIEvent(String type, bool canBubble, bool cancelable, LocalWindow vie w, int detail) native; 17155 void $dom_initUIEvent(String type, bool canBubble, bool cancelable, LocalWindo w view, int detail) native "initUIEvent";
17156
17145 } 17157 }
17146 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 17158 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
17147 // for details. All rights reserved. Use of this source code is governed by a 17159 // for details. All rights reserved. Use of this source code is governed by a
17148 // BSD-style license that can be found in the LICENSE file. 17160 // BSD-style license that can be found in the LICENSE file.
17149 17161
17150 17162
17151 /// @domName HTMLUListElement; @docsEditable true 17163 /// @domName HTMLUListElement; @docsEditable true
17152 class UListElement extends Element implements Element native "*HTMLUListElement" { 17164 class UListElement extends Element implements Element native "*HTMLUListElement" {
17153 17165
17154 factory UListElement() => document.$dom_createElement("ul"); 17166 factory UListElement() => document.$dom_createElement("ul");
(...skipping 4746 matching lines...) Expand 10 before | Expand all | Expand 10 after
21901 Element get first => _filtered.first; 21913 Element get first => _filtered.first;
21902 21914
21903 Element get last => _filtered.last; 21915 Element get last => _filtered.last;
21904 } 21916 }
21905 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 21917 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
21906 // for details. All rights reserved. Use of this source code is governed by a 21918 // for details. All rights reserved. Use of this source code is governed by a
21907 // BSD-style license that can be found in the LICENSE file. 21919 // BSD-style license that can be found in the LICENSE file.
21908 21920
21909 21921
21910 /** 21922 /**
21923 * Works with KeyboardEvent and KeyEvent to determine how to expose information
21924 * about Key(board)Events. This class functions like an EventListenerList, and
21925 * provides a consistent interface for the Dart
21926 * user, despite the fact that a multitude of browsers that have varying
21927 * keyboard default behavior.
21928 *
21929 * This class is very much a work in progress, and we'd love to get information
21930 * on how we can make this class work with as many international keyboards as
21931 * possible. Bugs welcome!
21932 */
21933 class KeyboardEventController {
21934 // This code inspired by Closure's KeyHandling library.
21935 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keyhandl er.js.source.html
21936
21937 /**
21938 * The set of keys that have been pressed down without seeing their
21939 * corresponding keyup event.
21940 */
21941 List<KeyboardEvent> keyDownList;
21942
21943 /** The set of functions that wish to be notified when a KeyEvent happens. */
21944 List<Function> _callbacks;
21945
21946 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */
21947 String _type;
21948
21949 /** The element we are watching for events to happen on. */
21950 EventTarget _target;
21951
21952 // The distance to shift from upper case alphabet Roman letters to lower case.
21953 const int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0];
21954
21955 // Instance members referring to the internal event handlers because closures
21956 // are not hashable.
21957 var _keyUp, _keyDown, _keyPress;
21958
21959 /**
21960 * An enumeration of key identifiers currently part of the W3C draft for DOM3
21961 * and their mappings to keyCodes.
21962 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set
21963 */
21964 static Map<String, int> _keyIdentifier = {
21965 'Up': KeyCode.UP,
21966 'Down': KeyCode.DOWN,
21967 'Left': KeyCode.LEFT,
21968 'Right': KeyCode.RIGHT,
21969 'Enter': KeyCode.ENTER,
21970 'F1': KeyCode.F1,
21971 'F2': KeyCode.F2,
21972 'F3': KeyCode.F3,
21973 'F4': KeyCode.F4,
21974 'F5': KeyCode.F5,
21975 'F6': KeyCode.F6,
21976 'F7': KeyCode.F7,
21977 'F8': KeyCode.F8,
21978 'F9': KeyCode.F9,
21979 'F10': KeyCode.F10,
21980 'F11': KeyCode.F11,
21981 'F12': KeyCode.F12,
21982 'U+007F': KeyCode.DELETE,
21983 'Home': KeyCode.HOME,
21984 'End': KeyCode.END,
21985 'PageUp': KeyCode.PAGE_UP,
21986 'PageDown': KeyCode.PAGE_DOWN,
21987 'Insert': KeyCode.INSERT
21988 };
21989
21990 /** Named constructor to add an onKeyPress event listener to our handler. */
21991 KeyboardEventController.keypress(EventTarget target) {
21992 _KeyboardEventController(target, 'keypress');
21993 }
21994
21995 /** Named constructor to add an onKeyUp event listener to our handler. */
21996 KeyboardEventController.keyup(EventTarget target) {
21997 _KeyboardEventController(target, 'keyup');
21998 }
21999
22000 /** Named constructor to add an onKeyDown event listener to our handler. */
22001 KeyboardEventController.keydown(EventTarget target) {
22002 _KeyboardEventController(target, 'keydown');
22003 }
22004
22005 /**
22006 * General constructor, performs basic initialization for our improved
22007 * KeyboardEvent controller.
22008 */
22009 _KeyboardEventController(EventTarget target, String type) {
22010 _callbacks = [];
22011 _type = type;
22012 _target = target;
22013 _initializeAllEventListeners();
22014 }
22015
22016 /**
22017 * Hook up all event listeners under the covers so we can estimate keycodes
22018 * and charcodes when they are not provided.
22019 */
22020 void _initializeAllEventListeners() {
22021 keyDownList = [];
22022 _keyDown = processKeyDown;
22023 _keyUp = processKeyUp;
22024 _keyPress = processKeyPress;
22025 _target.on.keyDown.add(_keyDown, true);
22026 _target.on.keyPress.add(_keyPress, true);
22027 _target.on.keyUp.add(_keyUp, true);
22028 }
22029
22030 /** Add a callback that wishes to be notified when a KeyEvent occurs. */
22031 void add(void callback(KeyEvent)) {
22032 if (_callbacks.length == 0) {
22033 _initializeAllEventListeners();
22034 }
22035 _callbacks.add(callback);
22036 }
22037
22038 /**
22039 * Notify all callback listeners that a KeyEvent of the relevant type has
22040 * occurred.
22041 */
22042 bool _dispatch(KeyEvent event) {
22043 if (event.type == _type) {
22044 // Make a copy of the listeners in case a callback gets removed while
22045 // dispatching from the list.
22046 List callbacksCopy = new List.from(_callbacks);
22047 for(var callback in callbacksCopy) {
22048 callback(event);
22049 }
22050 }
22051 }
22052
22053 /** Remove the given callback from the listeners list. */
22054 void remove(void callback(KeyEvent)) {
22055 var index = _callbacks.indexOf(callback);
22056 if (index != -1) {
22057 _callbacks.removeAt(index);
22058 }
22059 if (_callbacks.length == 0) {
22060 // If we have no listeners, don't bother keeping track of keypresses.
22061 _target.on.keyDown.remove(_keyDown);
22062 _target.on.keyPress.remove(_keyPress);
22063 _target.on.keyUp.remove(_keyUp);
22064 }
22065 }
22066
22067 /** Determine if caps lock is one of the currently depressed keys. */
22068 bool get _capsLockOn() =>
22069 keyDownList.some((var element) => element.keyCode == KeyCode.CAPS_LOCK);
22070
22071 /**
22072 * Given the previously recorded keydown key codes, see if we can determine
22073 * the keycode of this keypress [event]. (Generally browsers only provide
22074 * charCode information for keypress events, but with a little
22075 * reverse-engineering, we can also determine the keyCode.) Returns
22076 * KeyCode.UNKNOWN if the keycode could not be determined.
22077 */
22078 int _determineKeyCodeForKeypress(KeyboardEvent event) {
22079 // Note: This function is a work in progress. We'll expand this function
22080 // once we get more information about other keyboards.
22081 for (var prevEvent in keyDownList) {
22082 if (prevEvent._shadowCharCode == event.charCode) {
22083 return prevEvent.keyCode;
22084 }
22085 if ((event.shiftKey || _capsLockOn) && event.charCode >= "A".charCodes[0]
22086 && event.charCode <= "Z".charCodes[0] && event.charCode +
22087 _ROMAN_ALPHABET_OFFSET == prevEvent._shadowCharCode) {
22088 return prevEvent.keyCode;
22089 }
22090 }
22091 return KeyCode.UNKNOWN;
22092 }
22093
22094 /**
22095 * Given the charater code returned from a keyDown [event], try to ascertain
22096 * and return the corresponding charCode for the character that was pressed.
22097 * This information is not shown to the user, but used to help polyfill
22098 * keypress events.
22099 */
22100 int _findCharCodeKeyDown(KeyboardEvent event) {
22101 if (event.keyLocation == 3) { // Numpad keys.
22102 switch (event.keyCode) {
22103 case KeyCode.NUM_ZERO:
22104 // Even though this function returns _charCodes_, for some cases the
22105 // KeyCode == the charCode we want, in which case we use the keycode
22106 // constant for readability.
22107 return KeyCode.ZERO;
22108 case KeyCode.NUM_ONE:
22109 return KeyCode.ONE;
22110 case KeyCode.NUM_TWO:
22111 return KeyCode.TWO;
22112 case KeyCode.NUM_THREE:
22113 return KeyCode.THREE;
22114 case KeyCode.NUM_FOUR:
22115 return KeyCode.FOUR;
22116 case KeyCode.NUM_FIVE:
22117 return KeyCode.FIVE;
22118 case KeyCode.NUM_SIX:
22119 return KeyCode.SIX;
22120 case KeyCode.NUM_SEVEN:
22121 return KeyCode.SEVEN;
22122 case KeyCode.NUM_EIGHT:
22123 return KeyCode.EIGHT;
22124 case KeyCode.NUM_NINE:
22125 return KeyCode.NINE;
22126 case KeyCode.NUM_MULTIPLY:
22127 return 42; // Char code for *
22128 case KeyCode.NUM_PLUS:
22129 return 43; // +
22130 case KeyCode.NUM_MINUS:
22131 return 45; // -
22132 case KeyCode.NUM_PERIOD:
22133 return 46; // .
22134 case KeyCode.NUM_DIVISION:
22135 return 47; // /
22136 }
22137 } else if (event.keyCode >= 65 && event.keyCode <= 90) {
22138 // Set the "char code" for key down as the lower case letter. Again, this
22139 // will not show up for the user, but will be helpful in estimating
22140 // keyCode locations and other information during the keyPress event.
22141 return event.keyCode + _ROMAN_ALPHABET_OFFSET;
22142 }
22143 switch(event.keyCode) {
22144 case KeyCode.SEMICOLON:
22145 return KeyCode.FF_SEMICOLON;
22146 case KeyCode.EQUALS:
22147 return KeyCode.FF_EQUALS;
22148 case KeyCode.COMMA:
22149 return 44; // Ascii value for ,
22150 case KeyCode.DASH:
22151 return 45; // -
22152 case KeyCode.PERIOD:
22153 return 46; // .
22154 case KeyCode.SLASH:
22155 return 47; // /
22156 case KeyCode.APOSTROPHE:
22157 return 96; // `
22158 case KeyCode.OPEN_SQUARE_BRACKET:
22159 return 91; // [
22160 case KeyCode.BACKSLASH:
22161 return 92; // \
22162 case KeyCode.CLOSE_SQUARE_BRACKET:
22163 return 93; // ]
22164 case KeyCode.SINGLE_QUOTE:
22165 return 39; // '
22166 }
22167 return event.keyCode;
22168 }
22169
22170 /**
22171 * Returns true if the key fires a keypress event in the current browser.
22172 */
22173 bool _firesKeyPressEvent(KeyEvent event) {
22174 if (!_Device.isIE && !_Device.isWebKit) {
22175 return true;
22176 }
22177
22178 if (_Device.userAgent.contains('Mac') && event.altKey) {
22179 return KeyCode.isCharacterKey(event.keyCode);
22180 }
22181
22182 // Alt but not AltGr which is represented as Alt+Ctrl.
22183 if (event.altKey && !event.ctrlKey) {
22184 return false;
22185 }
22186
22187 // Saves Ctrl or Alt + key for IE and WebKit, which won't fire keypress.
22188 if (!event.shiftKey &&
22189 (keyDownList.last.keyCode == KeyCode.CTRL ||
22190 keyDownList.last.keyCode == KeyCode.ALT ||
22191 _Device.userAgent.contains('Mac') &&
22192 keyDownList.last.keyCode == KeyCode.META)) {
22193 return false;
22194 }
22195
22196 // Some keys with Ctrl/Shift do not issue keypress in WebKit.
22197 if (_Device.isWebKit && event.ctrlKey && event.shiftKey && (
22198 event.keycode == KeyCode.BACKSLASH ||
22199 event.keycode == KeyCode.OPEN_SQUARE_BRACKET ||
22200 event.keycode == KeyCode.CLOSE_SQUARE_BRACKET ||
22201 event.keycode == KeyCode.TILDE ||
22202 event.keycode == KeyCode.SEMICOLON || event.keycode == KeyCode.DASH ||
22203 event.keycode == KeyCode.EQUALS || event.keycode == KeyCode.COMMA ||
22204 event.keycode == KeyCode.PERIOD || event.keycode == KeyCode.SLASH ||
22205 event.keycode == KeyCode.APOSTROPHE ||
22206 event.keycode == KeyCode.SINGLE_QUOTE)) {
22207 return false;
22208 }
22209
22210 switch (event.keyCode) {
22211 case KeyCode.ENTER:
22212 // IE9 does not fire keypress on ENTER.
22213 return !_Device.isIE;
22214 case KeyCode.ESC:
22215 return !_Device.isWebKit;
22216 }
22217
22218 return KeyCode.isCharacterKey(event.keyCode);
22219 }
22220
22221 /**
22222 * Normalize the keycodes to the IE KeyCodes (this is what Chrome, IE, and
22223 * Opera all use).
22224 */
22225 int _normalizeKeyCodes(KeyboardEvent event) {
22226 // Note: This may change once we get input about non-US keyboards.
22227 if (_Device.isFirefox) {
22228 switch(event.keyCode) {
22229 case KeyCode.FF_EQUALS:
22230 return KeyCode.EQUALS;
22231 case KeyCode.FF_SEMICOLON:
22232 return KeyCode.SEMICOLON;
22233 case KeyCode.MAC_FF_META:
22234 return KeyCode.META;
22235 case KeyCode.WIN_KEY_FF_LINUX:
22236 return KeyCode.WIN_KEY;
22237 }
22238 }
22239 return event.keyCode;
22240 }
22241
22242 /** Handle keydown events. */
22243 void processKeyDown(KeyboardEvent e) {
22244 // Ctrl-Tab and Alt-Tab can cause the focus to be moved to another window
22245 // before we've caught a key-up event. If the last-key was one of these
22246 // we reset the state.
22247 if (keyDownList.length > 0 &&
22248 (keyDownList.last.keyCode == KeyCode.CTRL && !e.ctrlKey ||
22249 keyDownList.last.keyCode == KeyCode.ALT && !e.altKey ||
22250 _Device.userAgent.contains('Mac') &&
22251 keyDownList.last.keyCode == KeyCode.META && !e.metaKey)) {
22252 keyDownList = [];
22253 }
22254
22255 var event = new KeyEvent(e);
22256 event._shadowKeyCode = _normalizeKeyCodes(event);
22257 // Technically a "keydown" event doesn't have a charCode. This is
22258 // calculated nonetheless to provide us with more information in giving
22259 // as much information as possible on keypress about keycode and also
22260 // charCode.
22261 event._shadowCharCode = _findCharCodeKeyDown(event);
22262 if (keyDownList.length > 0 && event.keyCode != keyDownList.last.keyCode &&
22263 !_firesKeyPressEvent(event)) {
22264 // Some browsers have quirks not firing keypress events where all other
22265 // browsers do. This makes them more consistent.
22266 processKeyPress(event);
22267 }
22268 keyDownList.add(event);
22269 _dispatch(event);
22270 }
22271
22272 /** Handle keypress events. */
22273 void processKeyPress(KeyboardEvent event) {
22274 var e = new KeyEvent(event);
22275 // IE reports the character code in the keyCode field for keypress events.
22276 // There are two exceptions however, Enter and Escape.
22277 if (_Device.isIE) {
22278 if (e.keyCode == KeyCode.ENTER || e.keyCode == KeyCode.ESC) {
22279 e._shadowCharCode = 0;
22280 } else {
22281 e._shadowCharCode = e.keyCode;
22282 }
22283 } else if (_Device.isOpera) {
22284 // Opera reports the character code in the keyCode field.
22285 e._shadowCharCode = KeyCode.isCharacterKey(keyCode) ? e.keyCode : 0;
22286 }
22287 // Now we guestimate about what the keycode is that was actually
22288 // pressed, given previous keydown information.
22289 e._shadowKeyCode = _determineKeyCodeForKeypress(e);
22290
22291 // Correct the key value for certain browser-specific quirks.
22292 if (e._shadowKeyIdentifier &&
22293 _keyIdentifier.contains(e._shadowKeyIdentifier)) {
22294 // This is needed for Safari Windows because it currently doesn't give a
22295 // keyCode/which for non printable keys.
22296 e._shadowKeyCode = _keyIdentifier[keyIdentifier];
22297 }
22298 e._shadowAltKey = keyDownList.some((var element) => element.altKey);
22299 _dispatch(e);
22300 }
22301
22302 /** Handle keyup events. */
22303 void processKeyUp(KeyboardEvent event) {
22304 var e = new KeyEvent(event);
22305 KeyboardEvent toRemove = null;
22306 for (var key in keyDownList) {
22307 if (key.keyCode == e.keyCode) {
22308 toRemove = key;
22309 }
22310 }
22311 if (toRemove != null) {
22312 keyDownList = keyDownList.filter((element) => element != toRemove);
22313 } else if (keyDownList.length > 0) {
22314 // This happens when we've reached some international keyboard case we
22315 // haven't accounted for or we haven't correctly eliminated all browser
22316 // inconsistencies. Filing bugs on when this is reached is welcome!
22317 keyDownList.removeLast();
22318 }
22319 _dispatch(e);
22320 }
22321 }
22322 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
22323 // for details. All rights reserved. Use of this source code is governed by a
22324 // BSD-style license that can be found in the LICENSE file.
22325
22326
22327 /**
21911 * Defines the keycode values for keys that are returned by 22328 * Defines the keycode values for keys that are returned by
21912 * KeyboardEvent.keyCode. 22329 * KeyboardEvent.keyCode.
21913 * 22330 *
21914 * Important note: There is substantial divergence in how different browsers 22331 * Important note: There is substantial divergence in how different browsers
21915 * handle keycodes and their variants in different locales/keyboard layouts. We 22332 * handle keycodes and their variants in different locales/keyboard layouts. We
21916 * provide these constants to help make code processing keys more readable. 22333 * provide these constants to help make code processing keys more readable.
21917 */ 22334 */
21918 abstract class KeyCode { 22335 abstract class KeyCode {
21919 // These constant names were borrowed from Closure's Keycode enumeration 22336 // These constant names were borrowed from Closure's Keycode enumeration
21920 // class. 22337 // class.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
22091 */ 22508 */
22092 static const int BACKSLASH = 220; 22509 static const int BACKSLASH = 220;
22093 /** 22510 /**
22094 * CAUTION: This constant requires localization for other locales and keyboard 22511 * CAUTION: This constant requires localization for other locales and keyboard
22095 * layouts. 22512 * layouts.
22096 */ 22513 */
22097 static const int CLOSE_SQUARE_BRACKET = 221; 22514 static const int CLOSE_SQUARE_BRACKET = 221;
22098 static const int WIN_KEY = 224; 22515 static const int WIN_KEY = 224;
22099 static const int MAC_FF_META = 224; 22516 static const int MAC_FF_META = 224;
22100 static const int WIN_IME = 229; 22517 static const int WIN_IME = 229;
22518
22519 /** A sentinel value if the keycode could not be determined. */
22520 static const int UNKNOWN = -1;
22521
22522 /**
22523 * Returns true if the keyCode produces a (US keyboard) character.
22524 * Note: This does not (yet) cover characters on non-US keyboards (Russian,
22525 * Hebrew, etc.).
22526 */
22527 static bool isCharacterKey(int keyCode) {
22528 if ((keyCode >= ZERO && keyCode <= NINE) ||
22529 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) ||
22530 (keyCode >= A && keyCode <= Z)) {
22531 return true;
22532 }
22533
22534 // Safari sends zero key code for non-latin characters.
22535 if (_Device.isWebKit && keyCode == 0) {
22536 return true;
22537 }
22538
22539 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS
22540 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD ||
22541 keyCode == NUM_DIVISION || keyCode == SEMICOLON ||
22542 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS ||
22543 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD ||
22544 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE ||
22545 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH ||
22546 keyCode == CLOSE_SQUARE_BRACKET);
22547 }
22101 } 22548 }
22102 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 22549 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
22103 // for details. All rights reserved. Use of this source code is governed by a 22550 // for details. All rights reserved. Use of this source code is governed by a
22104 // BSD-style license that can be found in the LICENSE file. 22551 // BSD-style license that can be found in the LICENSE file.
22105 22552
22106 22553
22107 /** 22554 /**
22108 * Defines the standard key locations returned by 22555 * Defines the standard key locations returned by
22109 * KeyboardEvent.getKeyLocation. 22556 * KeyboardEvent.getKeyLocation.
22110 */ 22557 */
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
24024 24471
24025 static History _createSafe(h) { 24472 static History _createSafe(h) {
24026 if (identical(h, window.history)) { 24473 if (identical(h, window.history)) {
24027 return h; 24474 return h;
24028 } else { 24475 } else {
24029 // TODO(vsm): Cache or implement equality. 24476 // TODO(vsm): Cache or implement equality.
24030 return new _HistoryCrossFrame(h); 24477 return new _HistoryCrossFrame(h);
24031 } 24478 }
24032 } 24479 }
24033 } 24480 }
24481 /**
24482 * A custom KeyboardEvent that attempts to eliminate cross-browser
24483 * inconsistencies, and also provide both keyCode and charCode information
24484 * for all key events (when such information can be determined).
24485 *
24486 * This class is very much a work in progress, and we'd love to get information
24487 * on how we can make this class work with as many international keyboards as
24488 * possible. Bugs welcome!
24489 */
24490 class KeyEvent implements KeyboardEvent {
24491 /** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */
24492 KeyboardEvent _parent;
24493
24494 /** The "fixed" value of whether the alt key is being pressed. */
24495 bool _shadowAltKey;
24496
24497 /** Caculated value of what the estimated charCode is for this event. */
24498 int _shadowCharCode;
24499
24500 /** Caculated value of what the estimated keyCode is for this event. */
24501 int _shadowKeyCode;
24502
24503 /** Caculated value of what the estimated keyCode is for this event. */
24504 int get keyCode => _shadowKeyCode;
24505
24506 /** Caculated value of what the estimated charCode is for this event. */
24507 int get charCode => this.type == 'keypress' ? _shadowCharCode : 0;
24508
24509 /** Caculated value of whether the alt key is pressed is for this event. */
24510 bool get altKey => _shadowAltKey;
24511
24512 /** Caculated value of what the estimated keyCode is for this event. */
24513 int get which => keyCode;
24514
24515 /** Accessor to the underlying keyCode value is the parent event. */
24516 int get _realKeyCode => JS('int', '#.keyCode', _parent);
24517
24518 /** Accessor to the underlying charCode value is the parent event. */
24519 int get _realCharCode => JS('int', '#.charCode', _parent);
24520
24521 /** Accessor to the underlying altKey value is the parent event. */
24522 bool get _realAltKey => JS('int', '#.altKey', _parent);
24523
24524 /** Construct a KeyEvent with [parent] as event we're emulating. */
24525 KeyEvent(KeyboardEvent parent) {
24526 _parent = parent;
24527 _shadowAltKey = _realAltKey;
24528 _shadowCharCode = _realCharCode;
24529 _shadowKeyCode = _realKeyCode;
24530 }
24531
24532 /** True if the altGraphKey is pressed during this event. */
24533 bool get altGraphKey => _parent.altGraphKey;
24534 bool get bubbles => _parent.bubbles;
24535 /** True if this event can be cancelled. */
24536 bool get cancelable => _parent.cancelable;
24537 bool get cancelBubble => _parent.cancelBubble;
24538 set cancelBubble(bool cancel) => _parent = cancel;
24539 /** Accessor to the clipboardData available for this event. */
24540 Clipboard get clipboardData => _parent.clipboardData;
24541 /** True if the ctrl key is pressed during this event. */
24542 bool get ctrlKey => _parent.ctrlKey;
24543 /** Accessor to the target this event is listening to for changes. */
24544 EventTarget get currentTarget => _parent.currentTarget;
24545 bool get defaultPrevented => _parent.defaultPrevented;
24546 int get detail => _parent.detail;
24547 int get eventPhase => _parent.eventPhase;
24548 /**
24549 * Accessor to the part of the keyboard that the key was pressed from (one of
24550 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT,
24551 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK).
24552 */
24553 int get keyLocation => _parent.keyLocation;
24554 int get layerX => _parent.layerX;
24555 int get layerY => _parent.layerY;
24556 /** True if the Meta (or Mac command) key is pressed during this event. */
24557 bool get metaKey => _parent.metaKey;
24558 int get pageX => _parent.pageX;
24559 int get pageY => _parent.pageY;
24560 bool get returnValue => _parent.returnValue;
24561 set returnValue(bool value) => _parent = value;
24562 /** True if the shift key was pressed during this event. */
24563 bool get shiftKey => _parent.shiftKey;
24564 int get timeStamp => _parent.timeStamp;
24565 /**
24566 * The type of key event that occurred. One of "keydown", "keyup", or
24567 * "keypress".
24568 */
24569 String get type => _parent.type;
24570 Window get view => _parent.view;
24571 void preventDefault() => _parent.preventDefault();
24572 void stopImmediatePropagation() => _parent.stopImmediatePropagation();
24573 void stopPropagation() => _parent.stopPropagation();
24574 void $dom_initUIEvent(String type, bool canBubble, bool cancelable,
24575 LocalWindow view, int detail) {
24576 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent.");
24577 }
24578 void $dom_initEvent(String eventTypeArg, bool canBubbleArg,
24579 bool cancelableArg) {
24580 throw new UnsupportedError("Cannot initialize an Event from a KeyEvent.");
24581 }
24582 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent);
24583 }
24034 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 24584 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
24035 // for details. All rights reserved. Use of this source code is governed by a 24585 // for details. All rights reserved. Use of this source code is governed by a
24036 // BSD-style license that can be found in the LICENSE file. 24586 // BSD-style license that can be found in the LICENSE file.
24037 24587
24038 24588
24039 class _PointFactoryProvider { 24589 class _PointFactoryProvider {
24040 static Point createPoint(num x, num y) => 24590 static Point createPoint(num x, num y) =>
24041 JS('Point', 'new WebKitPoint(#, #)', x, y); 24591 JS('Point', 'new WebKitPoint(#, #)', x, y);
24042 } 24592 }
24043 24593
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
24459 if (length < 0) throw new ArgumentError('length'); 25009 if (length < 0) throw new ArgumentError('length');
24460 if (start < 0) throw new RangeError.value(start); 25010 if (start < 0) throw new RangeError.value(start);
24461 int end = start + length; 25011 int end = start + length;
24462 if (end > a.length) throw new RangeError.value(end); 25012 if (end > a.length) throw new RangeError.value(end);
24463 for (int i = start; i < end; i++) { 25013 for (int i = start; i < end; i++) {
24464 accumulator.add(a[i]); 25014 accumulator.add(a[i]);
24465 } 25015 }
24466 return accumulator; 25016 return accumulator;
24467 } 25017 }
24468 } 25018 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | sdk/lib/html/src/KeyboardEventController.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698