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

Unified Diff: sdk/lib/js/dartium/js_dartium.dart

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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/dartium_CustomElementSupport.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/js/dartium/js_dartium.dart
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart
index f0e653b123a3555d515adc0cb992963722f077a1..186bde7d613cac0f9b3f7b2d60e5ace528533329 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -496,6 +496,25 @@ void setDartHtmlWrapperFor(JsObject object, wrapper) {
}
/**
+ * Used by callMethod to get the JS object for each argument passed if the
+ * argument is a Dart class instance that delegates to a DOM object. See
+ * wrap_jso defined in dart:html.
+ */
+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;
+ }
+}
+
+/**
* Proxies a JavaScript object to Dart.
*
* The properties of the JavaScript object are accessible via the `[]` and
@@ -666,6 +685,10 @@ class JsObject extends NativeFieldWrapperClass2 {
*/
callMethod(String method, [List args]) {
try {
+ if (args != null) {
+ for (var i = 0; i < args.length; i++)
+ args[i] = unwrap_jso(args[i]);
+ }
return _callMethod(method, args);
} catch (e) {
if (hasProperty(method)) {
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/dartium_CustomElementSupport.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698