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

Unified Diff: tools/dom/templates/html/dartium/html_dartium.darttemplate

Issue 1389683002: Fixed custom elements to work in Polymer (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge collision Created 5 years, 2 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/templates/html/dartium/html_dartium.darttemplate
diff --git a/tools/dom/templates/html/dartium/html_dartium.darttemplate b/tools/dom/templates/html/dartium/html_dartium.darttemplate
index e33b195264cdafaffb5da53c235395c0ec38ad21..3b70ccf173341d70f2c78d7bea59e26c7023eb76 100644
--- a/tools/dom/templates/html/dartium/html_dartium.darttemplate
+++ b/tools/dom/templates/html/dartium/html_dartium.darttemplate
@@ -370,19 +370,7 @@ bool __interop_checks = true;
/**
* Return the JsObject associated with a Dart class [dartClass_instance].
*/
-unwrap_jso(dartClass_instance) {
- try {
- if (dartClass_instance != null)
- return dartClass_instance is NativeFieldWrapperClass2 ?
- dartClass_instance.blink_jsObject : dartClass_instance;
- else
- return null;
- } catch(NoSuchMethodException) {
- // No blink_jsObject then return the dartClass_instance is probably an
- // array that was already converted to a Dart class e.g., Uint8ClampedList.
- return dartClass_instance;
- }
-}
+unwrap_jso(dartClass_instance) => js.unwrap_jso(dartClass_instance);
/**
* Create Dart class that maps to the JS Type, add the JsObject as an expando
@@ -571,6 +559,25 @@ class _DartHtmlWrappingList extends ListBase {
int set length(int newLength) => _basicList.length = newLength;
}
+/**
+ * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer.
+ */
+createCustomUpgrader(Type customElementClass, $this) {
+ var dartClass;
+ try {
+ dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this);
+ } catch (e) {
+ throw e;
+ } finally {
+ // Need to remember the Dart class that was created for this custom so
+ // return it and setup the blink_jsObject to the $this that we'll be working
+ // with as we talk to blink.
+ $this['dart_class'] = dartClass;
+ }
+
+ return dartClass;
+}
+
$else
class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {}
@@ -580,5 +587,6 @@ make_dart_rectangle(r) => r;
convertDartToNative_Dictionary(Map dict) => dict;
List convertDartToNative_StringArray(List<String> input) => input;
convertDartToNative_List(List input) => input;
+createCustomUpgrader(Type customElementClass, $this) => $this;
$endif
« no previous file with comments | « tools/dom/templates/html/dart2js/html_dart2js.darttemplate ('k') | tools/dom/templates/html/impl/impl_Document.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698