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

Unified Diff: tools/dom/src/native_DOMImplementation.dart

Issue 23817006: Dartium custom element lifecycle event support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/dom/src/native_DOMImplementation.dart
diff --git a/tools/dom/src/native_DOMImplementation.dart b/tools/dom/src/native_DOMImplementation.dart
index 333d747169094cd902e7e68bf34ccc424bfdf0a9..2484c9b78e9372d3351c65b00e65d7909b403a5a 100644
--- a/tools/dom/src/native_DOMImplementation.dart
+++ b/tools/dom/src/native_DOMImplementation.dart
@@ -6,7 +6,7 @@ part of html;
class _ConsoleVariables {
Map<String, Object> _data = new Map<String, Object>();
-
+
/**
* Forward member accesses to the backing JavaScript object.
*/
@@ -22,7 +22,7 @@ class _ConsoleVariables {
return Function.apply(_data[member], invocation.positionalArguments, invocation.namedArguments);
}
}
-
+
void clear() => _data.clear();
/**
@@ -93,6 +93,17 @@ class _Utils {
return new UnsupportedError('[info: $fileName:$lineNo]');
}
+ static bool isTypeSubclassOf(Type type, Type other) {
+ if (type == other) {
+ return true;
+ }
+ var superclass = reflectClass(type).superclass;
+ if (superclass != null) {
+ return isTypeSubclassOf(superclass.reflectedType, other);
+ }
+ return false;
+ }
+
static window() native "Utils_window";
static forwardingPrint(String message) native "Utils_forwardingPrint";
static void spawnDomFunction(Function f, int replyTo) native "Utils_spawnDomFunction";
@@ -161,13 +172,13 @@ class _Utils {
sb.write("final $arg");
args[arg] = value;
}
-
+
addArg("\$var", _consoleTempVariables);
-
+
for (int i = 0; i < locals.length; i+= 2) {
addArg(locals[i], locals[i+1]);
}
- sb..write(')=>\n$expression');
+ sb..write(')=>\n$expression');
return [sb.toString(), args.values.toList(growable: false)];
}
@@ -184,10 +195,10 @@ class _Utils {
* prepended to disambuguate. This scheme is simplistic but easy to encode and
* decode. The use case for this method is displaying all map keys in a human
* readable way in debugging tools.
- */
+ */
static List<String> getEncodedMapKeyList(dynamic obj) {
if (obj is! Map) return null;
-
+
var ret = new List<String>();
int i = 0;
return obj.keys.map((key) {
@@ -271,7 +282,8 @@ class _Utils {
return libName.startsWith('dart:');
}
- static void register(String tag, Type type) {
+ static void register(Document document, String tag, Type type,
+ String extendsTagName) {
// TODO(vsm): Move these checks into native code.
vsm 2013/09/19 23:16:32 Should we keep this validation in Dart? Seems lik
blois 2013/09/20 00:05:05 Removed most, opened bug for remaining one (need t
if (type == null) {
throw new UnsupportedError("Invalid null type.");
@@ -301,10 +313,11 @@ class _Utils {
if (isRoot(superClass)) {
throw new UnsupportedError("Invalid custom element doesn't inherit from HtmlElement.");
}
- _register(tag, type, nativeClass.reflectedType);
+ _register(document, tag, type, extendsTagName, nativeClass.reflectedType);
}
- static void _register(String tag, Type customType, Type nativeType) native "Utils_register";
+ static void _register(Document document, String tag, Type customType,
+ String extendsTagName, Type nativeType) native "Utils_register";
}
class _NPObject extends NativeFieldWrapperClass1 {

Powered by Google App Engine
This is Rietveld 408576698