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

Side by Side Diff: tools/dom/src/dartium_CustomElementSupport.dart

Issue 1409743003: Hide internal methods like wrap_jso from the dart:html public interface (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review fixes 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 part of dart.dom.html; 5 part of dart.dom.html;
6 6
7 /// Dartium ElementUpgrader implementation. 7 /// Dartium ElementUpgrader implementation.
8 class _VMElementUpgrader implements ElementUpgrader { 8 class _VMElementUpgrader implements ElementUpgrader {
9 final Type _type; 9 final Type _type;
10 final Type _nativeType; 10 final Type _nativeType;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 jsObject = unwrap_jso(element); 46 jsObject = unwrap_jso(element);
47 } else if (element.runtimeType == js.JsObjectImpl) { 47 } else if (element.runtimeType == js.JsObjectImpl) {
48 // It's a Polymer core element (written in JS). 48 // It's a Polymer core element (written in JS).
49 jsObject = element; 49 jsObject = element;
50 } else if (isNativeElementExtension) { 50 } else if (isNativeElementExtension) {
51 // Extending a native element. 51 // Extending a native element.
52 jsObject = element.blink_jsObject; 52 jsObject = element.blink_jsObject;
53 53
54 // Element to extend is the real tag. 54 // Element to extend is the real tag.
55 tag = element.localName; 55 tag = element.localName;
56 } else if (tag != null && element.localName != tag) { 56 } else if (tag != null && element.localName != tag) {
57 throw new UnsupportedError('Element is incorrect type. Got ${element.runti meType}, expected native Html or Svg element to extend.'); 57 throw new UnsupportedError('Element is incorrect type. Got ${element.runti meType}, expected native Html or Svg element to extend.');
58 } else if (tag == null) { 58 } else if (tag == null) {
59 throw new UnsupportedError('Element is incorrect type. Got ${element.runti meType}, expected HtmlElement/JsObjectImpl.'); 59 throw new UnsupportedError('Element is incorrect type. Got ${element.runti meType}, expected HtmlElement/JsObjectImpl.');
60 } 60 }
61 61
62 // Remember Dart class to tagName for any upgrading done in wrap_jso. 62 // Remember Dart class to tagName for any upgrading done in wrap_jso.
63 _addCustomElementType(tag, _type, _extendsTag); 63 addCustomElementType(tag, _type, _extendsTag);
64 64
65 return createCustomUpgrader(_type, jsObject); 65 return _createCustomUpgrader(_type, jsObject);
66 } 66 }
67 } 67 }
68 68
69 /// Validates that the custom type is properly formed- 69 /// Validates that the custom type is properly formed-
70 /// 70 ///
71 /// * Is a user-defined class. 71 /// * Is a user-defined class.
72 /// * Has a created constructor with zero args. 72 /// * Has a created constructor with zero args.
73 /// * Derives from an Element subclass. 73 /// * Derives from an Element subclass.
74 /// 74 ///
75 /// Then returns the native base class. 75 /// Then returns the native base class.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return nativeClass; 116 return nativeClass;
117 } 117 }
118 118
119 119
120 bool _isBuiltinType(ClassMirror cls) { 120 bool _isBuiltinType(ClassMirror cls) {
121 // TODO(vsm): Find a less hackish way to do this. 121 // TODO(vsm): Find a less hackish way to do this.
122 LibraryMirror lib = cls.owner; 122 LibraryMirror lib = cls.owner;
123 String libName = lib.uri.toString(); 123 String libName = lib.uri.toString();
124 return libName.startsWith('dart:'); 124 return libName.startsWith('dart:');
125 } 125 }
OLDNEW
« no previous file with comments | « tests/html/wrapping_collections_test.dart ('k') | tools/dom/templates/html/dartium/html_dartium.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698