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

Side by Side Diff: tools/dom/templates/html/dartium/html_dartium.darttemplate

Issue 1383903002: wrap_jso should wrap JsArray as well, not always call wrap on its contents (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // DO NOT EDIT 5 // DO NOT EDIT
6 // Auto-generated dart:html library. 6 // Auto-generated dart:html library.
7 7
8 /** 8 /**
9 * HTML elements and other resources for web-based applications that need to 9 * HTML elements and other resources for web-based applications that need to
10 * interact with the browser and the DOM (Document Object Model). 10 * interact with the browser and the DOM (Document Object Model).
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 // TODO(alanknight): With upgraded custom elements this causes a failure bec ause 399 // TODO(alanknight): With upgraded custom elements this causes a failure bec ause
400 // we need a new wrapper after the type changes. We could possibly invalidat e this 400 // we need a new wrapper after the type changes. We could possibly invalidat e this
401 // if the constructor name didn't match? 401 // if the constructor name didn't match?
402 var wrapper = js.getDartHtmlWrapperFor(jsObject); 402 var wrapper = js.getDartHtmlWrapperFor(jsObject);
403 if (wrapper != null) { 403 if (wrapper != null) {
404 return wrapper; 404 return wrapper;
405 } 405 }
406 406
407 if (jsObject is js.JsArray) {
408 var wrappingList = new _DartHtmlWrappingList(jsObject);
409 js.setDartHtmlWrapperFor(jsObject, wrappingList);
410 return wrappingList;
411 }
412
407 // Try the most general type conversions on it. 413 // Try the most general type conversions on it.
408 // TODO(alanknight): We may be able to do better. This maintains identity, 414 // TODO(alanknight): We may be able to do better. This maintains identity,
409 // which is useful, but expensive. And if we nest something that only 415 // which is useful, but expensive. And if we nest something that only
410 // this conversion handles, how does that work? e.g. a list of maps of eleme nts. 416 // this conversion handles, how does that work? e.g. a list of maps of eleme nts.
411 var converted = convertNativeToDart_SerializedScriptValue(jsObject); 417 var converted = convertNativeToDart_SerializedScriptValue(jsObject);
412 if (!identical(converted, jsObject)) { 418 if (!identical(converted, jsObject)) {
413 return converted; 419 return converted;
414 } 420 }
415 var constructor = jsObject['constructor']; 421 var constructor = jsObject['constructor'];
416 if (__interop_checks) { 422 if (__interop_checks) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 }); 548 });
543 return jsObject; 549 return jsObject;
544 } 550 }
545 551
546 // Converts a Dart list into a JsArray. For the Dartium version only. 552 // Converts a Dart list into a JsArray. For the Dartium version only.
547 convertDartToNative_List(List input) => new js.JsArray()..addAll(input); 553 convertDartToNative_List(List input) => new js.JsArray()..addAll(input);
548 554
549 // Conversion function place holder (currently not used in dart2js or dartium). 555 // Conversion function place holder (currently not used in dart2js or dartium).
550 List convertDartToNative_StringArray(List<String> input) => input; 556 List convertDartToNative_StringArray(List<String> input) => input;
551 557
558 /**
559 * Wraps a JsArray and will call wrap_jso on its entries.
560 */
561 class _DartHtmlWrappingList extends ListBase {
562 _DartHtmlWrappingList(this._basicList);
563
564 final js.JsArray _basicList;
565
566 operator [](int index) => wrap_jso(_basicList[index]);
567
568 operator []=(int index, value) => _basicList[index] = unwrap_jso(value);
569
570 int get length => _basicList.length;
571 int set length(int newLength) => _basicList.length = newLength;
572 }
573
552 $else 574 $else
553 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} 575 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {}
554 576
555 unwrap_jso(dartClass_instance) => dartClass_instance; 577 unwrap_jso(dartClass_instance) => dartClass_instance;
556 wrap_jso(jsObject) => jsObject; 578 wrap_jso(jsObject) => jsObject;
557 make_dart_rectangle(r) => r; 579 make_dart_rectangle(r) => r;
558 convertDartToNative_Dictionary(Map dict) => dict; 580 convertDartToNative_Dictionary(Map dict) => dict;
559 List convertDartToNative_StringArray(List<String> input) => input; 581 List convertDartToNative_StringArray(List<String> input) => input;
560 convertDartToNative_List(List input) => input; 582 convertDartToNative_List(List input) => input;
561 583
562 $endif 584 $endif
OLDNEW
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/templates/html/impl/impl_MutationObserver.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698