| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // DO NOT EDIT | 5 // DO NOT EDIT |
| 6 // Auto-generated dart:html library. | 6 // Auto-generated dart:html library. |
| 7 | 7 |
| 8 #library("html"); | 8 #library("html"); |
| 9 | 9 |
| 10 #import("dart:isolate"); | 10 #import("dart:isolate"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #source('$AUXILIARY_DIR/../../html/src/Device.dart'); | 24 #source('$AUXILIARY_DIR/../../html/src/Device.dart'); |
| 25 #source('$AUXILIARY_DIR/../../html/src/_Testing.dart'); | 25 #source('$AUXILIARY_DIR/../../html/src/_Testing.dart'); |
| 26 #source('$AUXILIARY_DIR/../../html/src/_DOMTypeBase.dart'); | 26 #source('$AUXILIARY_DIR/../../html/src/_DOMTypeBase.dart'); |
| 27 #source('$AUXILIARY_DIR/_ListIterators.dart'); | 27 #source('$AUXILIARY_DIR/_ListIterators.dart'); |
| 28 #source('$AUXILIARY_DIR/_Lists.dart'); | 28 #source('$AUXILIARY_DIR/_Lists.dart'); |
| 29 | 29 |
| 30 #source('$AUXILIARY_DIR/native_DOMWrapperBase.dart'); | 30 #source('$AUXILIARY_DIR/native_DOMWrapperBase.dart'); |
| 31 #source('$AUXILIARY_DIR/native_DOMPublic.dart'); | 31 #source('$AUXILIARY_DIR/native_DOMPublic.dart'); |
| 32 #source('$AUXILIARY_DIR/native_DOMImplementation.dart'); | 32 #source('$AUXILIARY_DIR/native_DOMImplementation.dart'); |
| 33 | 33 |
| 34 _WindowImpl __window; | 34 Window get window() => _Utils.window(); |
| 35 _DocumentImpl __document; | 35 Window get _window() => _Utils.window(); |
| 36 | 36 |
| 37 void _initialize() { | 37 Document get document() => window.document; |
| 38 __window = _wrap(_Utils.window()); | 38 Document get _document() => window.document; |
| 39 __document = _wrap(_Utils.window().document); | |
| 40 } | |
| 41 | 39 |
| 42 Window get window() { | 40 // FIXME: get rid of _uwrap and _wrap. |
| 43 if (__window == null) { | 41 _unwrap(raw) => raw; |
| 44 _initialize(); | |
| 45 } | |
| 46 return __window; | |
| 47 } | |
| 48 | 42 |
| 49 Document get document() { | 43 _wrap(raw) => raw; |
| 50 if (__document == null) { | |
| 51 _initialize(); | |
| 52 } | |
| 53 return __document; | |
| 54 } | |
| 55 | |
| 56 _WindowImpl get _window() { | |
| 57 if (__window == null) { | |
| 58 _initialize(); | |
| 59 } | |
| 60 return __window; | |
| 61 } | |
| 62 | |
| 63 _DocumentImpl get _document() { | |
| 64 if (__document == null) { | |
| 65 _initialize(); | |
| 66 } | |
| 67 return __document; | |
| 68 } | |
| 69 | |
| 70 _unwrap(raw) { | |
| 71 return raw is _DOMTypeBase ? raw._ptr : raw; | |
| 72 } | |
| 73 | |
| 74 // Warning: does not attempt wrap event listeners. | |
| 75 _wrap(raw) { | |
| 76 if (raw is! _DOMWrapperBase) return raw; | |
| 77 _DOMWrapperBase domObject = raw; | |
| 78 if (domObject.dartObjectLocalStorage != null) | |
| 79 return domObject.dartObjectLocalStorage; | |
| 80 switch(domObject.typeName) { | |
| 81 case 'HTMLElement': | |
| 82 return new _UnknownElementImpl._wrap(domObject); | |
| 83 $WRAPCASES | |
| 84 case 'HTMLDocument': | |
| 85 return new _DocumentImpl._wrap(domObject); | |
| 86 default: | |
| 87 throw 'Unrecognized object $domObject. Name=${domObject.typeName}'; | |
| 88 } | |
| 89 } | |
| OLD | NEW |