| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 class _Utils { | 7 class _Utils { |
| 8 static double dateTimeToDouble(DateTime dateTime) => | 8 static double dateTimeToDouble(DateTime dateTime) => |
| 9 dateTime.millisecondsSinceEpoch.toDouble(); | 9 dateTime.millisecondsSinceEpoch.toDouble(); |
| 10 static DateTime doubleToDateTime(double dateTime) { | 10 static DateTime doubleToDateTime(double dateTime) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 LibraryMirror lib = cls.owner; | 204 LibraryMirror lib = cls.owner; |
| 205 String libName = lib.uri.toString(); | 205 String libName = lib.uri.toString(); |
| 206 if (libName.startsWith('dart:')) { | 206 if (libName.startsWith('dart:')) { |
| 207 throw new UnsupportedError("Invalid custom element from $libName."); | 207 throw new UnsupportedError("Invalid custom element from $libName."); |
| 208 } | 208 } |
| 209 ClassMirror superClass = cls.superclass; | 209 ClassMirror superClass = cls.superclass; |
| 210 | 210 |
| 211 Symbol objectName = reflectClass(Object).qualifiedName; | 211 Symbol objectName = reflectClass(Object).qualifiedName; |
| 212 bool isRoot(ClassMirror cls) => | 212 bool isRoot(ClassMirror cls) => |
| 213 cls == null || cls.qualifiedName == objectName; | 213 cls == null || cls.qualifiedName == objectName; |
| 214 Symbol elementName = reflectClass(Element).qualifiedName; | 214 // TODO(vsm): Support extending SvgElement as well. |
| 215 Symbol elementName = reflectClass(HtmlElement).qualifiedName; |
| 215 bool isElement(ClassMirror cls) => | 216 bool isElement(ClassMirror cls) => |
| 216 cls != null && cls.qualifiedName == elementName; | 217 cls != null && cls.qualifiedName == elementName; |
| 217 | 218 |
| 218 while(!isRoot(superClass) && !isElement(superClass)) { | 219 while(!isRoot(superClass) && !isElement(superClass)) { |
| 219 superClass = superClass.superclass; | 220 superClass = superClass.superclass; |
| 220 } | 221 } |
| 221 | 222 |
| 222 if (isRoot(superClass)) { | 223 if (isRoot(superClass)) { |
| 223 throw new UnsupportedError("Invalid custom element doesn't inherit from El
ement."); | 224 throw new UnsupportedError("Invalid custom element doesn't inherit from Ht
mlElement."); |
| 224 } | 225 } |
| 225 _register(tag, type); | 226 _register(tag, type); |
| 226 } | 227 } |
| 227 | 228 |
| 228 static void _register(String tag, Type type) native "Utils_register"; | 229 static void _register(String tag, Type type) native "Utils_register"; |
| 229 } | 230 } |
| 230 | 231 |
| 231 class _NPObject extends NativeFieldWrapperClass1 { | 232 class _NPObject extends NativeFieldWrapperClass1 { |
| 232 _NPObject.internal(); | 233 _NPObject.internal(); |
| 233 static _NPObject retrieve(String key) native "NPObject_retrieve"; | 234 static _NPObject retrieve(String key) native "NPObject_retrieve"; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 _send(msg) { | 421 _send(msg) { |
| 421 _sendToHelperIsolate(msg, _sendPort); | 422 _sendToHelperIsolate(msg, _sendPort); |
| 422 } | 423 } |
| 423 | 424 |
| 424 bool get isActive => _isActive; | 425 bool get isActive => _isActive; |
| 425 } | 426 } |
| 426 | 427 |
| 427 get _pureIsolateTimerFactoryClosure => | 428 get _pureIsolateTimerFactoryClosure => |
| 428 ((int milliSeconds, void callback(Timer time), bool repeating) => | 429 ((int milliSeconds, void callback(Timer time), bool repeating) => |
| 429 new _PureIsolateTimer(milliSeconds, callback, repeating)); | 430 new _PureIsolateTimer(milliSeconds, callback, repeating)); |
| OLD | NEW |