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 3cc7cd5c47e8b433f1f15063696c152a3b32233e..010b36274a201cc9069ccbd4c31d4272dbb78b48 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -12688,18 +12688,18 @@ class ElementEvents extends Events { |
/* Raw event target. */ |
final Element _ptr; |
static final webkitEvents = { |
- 'animationend' : 'webkitAnimationEnd', |
- 'animationiteration' : 'webkitAnimationIteration', |
- 'animationstart' : 'webkitAnimationStart', |
- 'fullscreenchange' : 'webkitfullscreenchange', |
+ 'animationend' : 'webkitAnimationEnd', |
+ 'animationiteration' : 'webkitAnimationIteration', |
+ 'animationstart' : 'webkitAnimationStart', |
+ 'fullscreenchange' : 'webkitfullscreenchange', |
'fullscreenerror' : 'webkitfullscreenerror', |
- 'keyadded' : 'webkitkeyadded', |
- 'keyerror' : 'webkitkeyerror', |
- 'keymessage' : 'webkitkeymessage', |
- 'needkey' : 'webkitneedkey', |
- 'pointerlockchange' : 'webkitpointerlockchange', |
- 'pointerlockerror' : 'webkitpointerlockerror', |
- 'resourcetimingbufferfull' : 'webkitresourcetimingbufferfull', |
+ 'keyadded' : 'webkitkeyadded', |
+ 'keyerror' : 'webkitkeyerror', |
+ 'keymessage' : 'webkitkeymessage', |
+ 'needkey' : 'webkitneedkey', |
+ 'pointerlockchange' : 'webkitpointerlockchange', |
+ 'pointerlockerror' : 'webkitpointerlockerror', |
+ 'resourcetimingbufferfull' : 'webkitresourcetimingbufferfull', |
'transitionend': 'webkitTransitionEnd', |
'speechchange' : 'webkitSpeechChange' |
}; |
@@ -14872,32 +14872,6 @@ class HtmlDocument extends Document { |
* This custom element can also be instantiated via HTML using the syntax |
* `<input is="x-bar"></input>` |
* |
- * The [nativeTagName] parameter is needed by platforms without native support |
- * when subclassing a native type other than: |
- * |
- * * HtmlElement |
- * * SvgElement |
- * * AnchorElement |
- * * AudioElement |
- * * ButtonElement |
- * * CanvasElement |
- * * DivElement |
- * * ImageElement |
- * * InputElement |
- * * LIElement |
- * * LabelElement |
- * * MenuElement |
- * * MeterElement |
- * * OListElement |
- * * OptionElement |
- * * OutputElement |
- * * ParagraphElement |
- * * PreElement |
- * * ProgressElement |
- * * SelectElement |
- * * SpanElement |
- * * UListElement |
- * * VideoElement |
*/ |
void register(String tag, Type customElementClass, {String extendsTag}) { |
_Utils.register(this, tag, customElementClass, extendsTag); |
@@ -14928,6 +14902,33 @@ class HtmlDocument extends Document { |
@Experimental() |
Stream<Event> get onVisibilityChange => |
visibilityChangeEvent.forTarget(this); |
+ |
+ ElementUpgrader createElementUpgrader(Type type, [String tagName]) { |
+ } |
+ |
+} |
+ |
+ |
+ |
+abstract class ElementUpgrader { |
+ // Validate that e is subclass of type's native type |
+ // validate that e has not been upgraded as any type |
+ Element upgrade(Element element); |
+} |
+ |
+class _VMElementUpgrader implements ElementUpgrader { |
+ final Type _type; |
+ Type _nativeType; |
+ _VMElementUpgrader(Type type) : |
+ _type = type, |
+ _nativeType = _Utils.validateCustomType(type).reflectedType; |
+ |
+ Element upgrade(Element element) { |
+ if (element.runtimeType != _nativeType) { |
+ throw new UnsupportedError('Element is incorrect type'); |
+ } |
+ return null; |
+ } |
} |
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
@@ -28955,13 +28956,13 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils { |
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 MediaSource || blob_OR_source_OR_stream == null)) { |
+ if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) { |
return _createObjectURL_2(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 MediaSource || blob_OR_source_OR_stream == null)) { |
return _createObjectURL_3(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 _WebKitMediaSource || blob_OR_source_OR_stream == null)) { |
return _createObjectURL_4(blob_OR_source_OR_stream); |
} |
throw new ArgumentError("Incorrect number or type of arguments"); |
@@ -38698,8 +38699,14 @@ class _Utils { |
return libName.startsWith('dart:'); |
} |
- static void register(Document document, String tag, Type type, |
- String extendsTagName) { |
+ /// Validates that the custom type is properly formed- |
+ /// |
+ /// * Is a user-defined class. |
+ /// * Has a created constructor with zero args. |
+ /// * Derives from an Element subclass. |
+ /// |
+ /// Then returns the native base class. |
+ static ClassMirror validateCustomType(Type type) { |
// TODO(vsm): Move these checks into native code. |
ClassMirror cls = reflectClass(type); |
if (_isBuiltinType(cls)) { |
@@ -38733,6 +38740,13 @@ class _Utils { |
nativeClass = superClass; |
} |
} |
+ return nativeClass; |
+ } |
+ |
+ static void register(Document document, String tag, Type type, |
+ String extendsTagName) { |
+ var nativeClass = validateCustomType(type); |
+ |
if (extendsTagName == null) { |
if (nativeClass.reflectedType != HtmlElement) { |
throw new UnsupportedError('Class must provide extendsTag if base ' |