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

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

Issue 1397793002: Hide the accessors for bad custom element upgrade (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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 568
569 // Problem? 569 // Problem?
570 return null; 570 return null;
571 } 571 }
572 } 572 }
573 573
574 // Upgrade a Dart HtmlElement to the user's Dart custom element class. 574 // Upgrade a Dart HtmlElement to the user's Dart custom element class.
575 _upgradeHtmlElement(dartInstance) { 575 _upgradeHtmlElement(dartInstance) {
576 // Only try upgrading HtmlElement (Dart class) if there is a failure then 576 // Only try upgrading HtmlElement (Dart class) if there is a failure then
577 // don't try it again - one failure is enough. 577 // don't try it again - one failure is enough.
578 if (dartInstance.runtimeType == HtmlElement && !dartInstance.isBadUpgrade) { 578 if (dartInstance.runtimeType == HtmlElement && !dartInstance._isBadUpgrade) {
579 // Must be exactly HtmlElement not something derived from it. 579 // Must be exactly HtmlElement not something derived from it.
580 var jsObject = dartInstance.blink_jsObject; 580 var jsObject = dartInstance.blink_jsObject;
581 var localName = dartInstance.localName; 581 var localName = dartInstance.localName;
582 var customElementClass = _knownCustomeElements[localName]; 582 var customElementClass = _knownCustomeElements[localName];
583 // Custom Element to upgrade. 583 // Custom Element to upgrade.
584 if (customElementClass != null) { 584 if (customElementClass != null) {
585 try { 585 try {
586 dartInstance = _blink.Blink_Utils.constructElement(customElementClass, j sObject); 586 dartInstance = _blink.Blink_Utils.constructElement(customElementClass, j sObject);
587 } catch (e) { 587 } catch (e) {
588 dartInstance.badUpgrade(); 588 dartInstance._badUpgrade();
589 } finally { 589 } finally {
590 dartInstance.blink_jsObject = jsObject; 590 dartInstance.blink_jsObject = jsObject;
591 jsObject['dart_class'] = dartInstance; 591 jsObject['dart_class'] = dartInstance;
592 js.setDartHtmlWrapperFor(jsObject, dartInstance); 592 js.setDartHtmlWrapperFor(jsObject, dartInstance);
593 } 593 }
594 } 594 }
595 } 595 }
596 596
597 return dartInstance; 597 return dartInstance;
598 } 598 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 678 }
679 679
680 /** 680 /**
681 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. 681 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer.
682 */ 682 */
683 createCustomUpgrader(Type customElementClass, $this) { 683 createCustomUpgrader(Type customElementClass, $this) {
684 var dartClass; 684 var dartClass;
685 try { 685 try {
686 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); 686 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this);
687 } catch (e) { 687 } catch (e) {
688 dartClass.badUpgrade(); 688 dartClass._badUpgrade();
689 throw e; 689 throw e;
690 } finally { 690 } finally {
691 // Need to remember the Dart class that was created for this custom so 691 // Need to remember the Dart class that was created for this custom so
692 // return it and setup the blink_jsObject to the $this that we'll be working 692 // return it and setup the blink_jsObject to the $this that we'll be working
693 // with as we talk to blink. 693 // with as we talk to blink.
694 js.setDartHtmlWrapperFor($this, dartClass); 694 js.setDartHtmlWrapperFor($this, dartClass);
695 } 695 }
696 696
697 return dartClass; 697 return dartClass;
698 } 698 }
699 699
700 $else 700 $else
701 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} 701 class DartHtmlDomObject extends NativeFieldWrapperClass2 {}
702 702
703 unwrap_jso(dartClass_instance) => dartClass_instance; 703 unwrap_jso(dartClass_instance) => dartClass_instance;
704 wrap_jso(jsObject) => jsObject; 704 wrap_jso(jsObject) => jsObject;
705 make_dart_rectangle(r) => r; 705 make_dart_rectangle(r) => r;
706 convertDartToNative_Dictionary(Map dict) => dict; 706 convertDartToNative_Dictionary(Map dict) => dict;
707 List convertDartToNative_StringArray(List<String> input) => input; 707 List convertDartToNative_StringArray(List<String> input) => input;
708 convertDartToNative_List(List input) => input; 708 convertDartToNative_List(List input) => input;
709 createCustomUpgrader(Type customElementClass, $this) => $this; 709 createCustomUpgrader(Type customElementClass, $this) => $this;
710 710
711 $endif 711 $endif
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698