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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 24491003: Revert "Revert "Start of 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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index c58866226d01abbb229460a5511ab18ce38bf032..ff06e941dd8444eec14d1e7cd1e496710ea4a71d 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -7707,33 +7707,14 @@ class Document extends Node
@DocsEditable()
DocumentFragment createDocumentFragment() native "Document_createDocumentFragment_Callback";
- Element createElement(String localName_OR_tagName, [String typeExtension]) {
- if ((localName_OR_tagName is String || localName_OR_tagName == null) && typeExtension == null) {
- return _createElement_1(localName_OR_tagName);
- }
- if ((typeExtension is String || typeExtension == null) && (localName_OR_tagName is String || localName_OR_tagName == null)) {
- return _createElement_2(localName_OR_tagName, typeExtension);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Element _createElement_1(localName_OR_tagName) native "Document__createElement_1_Callback";
-
- Element _createElement_2(localName_OR_tagName, typeExtension) native "Document__createElement_2_Callback";
-
- Element createElementNS(String namespaceURI, String qualifiedName, [String typeExtension]) {
- if ((qualifiedName is String || qualifiedName == null) && (namespaceURI is String || namespaceURI == null) && typeExtension == null) {
- return _createElementNS_1(namespaceURI, qualifiedName);
- }
- if ((typeExtension is String || typeExtension == null) && (qualifiedName is String || qualifiedName == null) && (namespaceURI is String || namespaceURI == null)) {
- return _createElementNS_2(namespaceURI, qualifiedName, typeExtension);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Element _createElementNS_1(namespaceURI, qualifiedName) native "Document__createElementNS_1_Callback";
+ /// Deprecated: use new Element.tag(tagName) instead.
+ @DomName('Document.createElement')
+ @DocsEditable()
+ Element createElement(String localName_OR_tagName, [String typeExtension]) native "Document_createElement_Callback";
- Element _createElementNS_2(namespaceURI, qualifiedName, typeExtension) native "Document__createElementNS_2_Callback";
+ @DomName('Document.createElementNS')
+ @DocsEditable()
+ Element createElementNS(String namespaceURI, String qualifiedName, [String typeExtension]) native "Document_createElementNS_Callback";
@DomName('Document.createEvent')
@DocsEditable()
@@ -13366,8 +13347,8 @@ class HtmlDocument extends Document {
* * UListElement
* * VideoElement
*/
- void register(String tag, Type customElementClass, {String nativeTagName}) {
- _Utils.register(tag, customElementClass);
+ void register(String tag, Type customElementClass, {String extendsTag}) {
+ _Utils.register(this, tag, customElementClass, extendsTag);
}
// Note: used to polyfill <template>
@@ -26119,13 +26100,13 @@ class Url extends NativeFieldWrapperClass1 {
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
return _createObjectURL_1(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
return _createObjectURL_2(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) {
return _createObjectURL_3(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
return _createObjectURL_4(blob_OR_source_OR_stream);
}
throw new ArgumentError("Incorrect number or type of arguments");
@@ -34479,7 +34460,7 @@ class TestRunner {
class _ConsoleVariables {
Map<String, Object> _data = new Map<String, Object>();
-
+
/**
* Forward member accesses to the backing JavaScript object.
*/
@@ -34495,7 +34476,7 @@ class _ConsoleVariables {
return Function.apply(_data[member], invocation.positionalArguments, invocation.namedArguments);
}
}
-
+
void clear() => _data.clear();
/**
@@ -34566,6 +34547,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";
@@ -34634,13 +34626,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)];
}
@@ -34657,10 +34649,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) {
@@ -34744,38 +34736,18 @@ 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.
ClassMirror cls = reflectClass(type);
if (_isBuiltinType(cls)) {
throw new UnsupportedError("Invalid custom element from $libName.");
}
- ClassMirror superClass = cls.superclass;
-
- Symbol objectName = reflectClass(Object).qualifiedName;
- bool isRoot(ClassMirror cls) =>
- cls == null || cls.qualifiedName == objectName;
- // TODO(vsm): Support extending SvgElement as well.
- Symbol elementName = reflectClass(HtmlElement).qualifiedName;
- bool isElement(ClassMirror cls) =>
- cls != null && cls.qualifiedName == elementName;
-
- ClassMirror nativeClass = _isBuiltinType(superClass) ? superClass : null;
- while(!isRoot(superClass) && !isElement(superClass)) {
- superClass = superClass.superclass;
- if (nativeClass == null && _isBuiltinType(superClass)) {
- nativeClass = superClass;
- }
- }
-
- if (isRoot(superClass)) {
- throw new UnsupportedError("Invalid custom element doesn't inherit from HtmlElement.");
- }
- _register(document, tag, type, extendsTagName, nativeClass.reflectedType);
+ _register(document, tag, type, extendsTagName);
}
static void _register(Document document, String tag, Type customType,
- String extendsTagName, Type nativeType) native "Utils_register";
+ String extendsTagName) native "Utils_register";
}
class _NPObject extends NativeFieldWrapperClass1 {
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/custom/document_register_type_extensions_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698