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

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

Issue 1401063003: Extension support (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged 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 | « tests/html/html.status ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9bd24f0b78f54de6e6ea1ec344a701fb2b2698b2..2d157eab2139761fc4c650918f88da1636251fd0 100644
--- a/tools/dom/templates/html/dartium/html_dartium.darttemplate
+++ b/tools/dom/templates/html/dartium/html_dartium.darttemplate
@@ -353,13 +353,30 @@ Function _getSvgFunction(String key) {
******************************************************************************/
// List of known tagName to DartClass for custom elements, used for upgrade.
-var _knownCustomElements = new Map<String, Type>();
+var _knownCustomElements = new Map<String, Map<Type, String>>();
-void _addCustomElementType(String tagName, Type dartClass) {
- _knownCustomElements[tagName] = dartClass;
+void _addCustomElementType(String tagName, Type dartClass, [String extendTag]) {
+ _knownCustomElements[tagName] =
+ {'type': dartClass, 'extends': extendTag != null ? extendTag : "" };
}
-Type _getCustomElementType(object) => _knownCustomElements[_getCustomElementName(object)];
+Type _getCustomElementType(object) {
+ var entry = _knownCustomElements[_getCustomElementName(object)];
+ if (entry != null) {
+ return entry['type'];
+ }
+ return null;
+}
+
+String _getCustomElementExtends(object) {
+ var entry = _knownCustomElements[_getCustomElementName(object)];
+ if (entry != null) {
+ return entry['extends'];
+ }
+ return null;
+}
+
+_getCustomElement(object) => _knownCustomElements[_getCustomElementName(object)];
// Return the tag name or is attribute of the custom element or data binding.
String _getCustomElementName(element) {
@@ -488,9 +505,15 @@ wrap_jso(jsObject) {
// make sure it's upgraded.
dartClass_instance = _upgradeHtmlElement(jsObject['dart_class']);
} else {
- var customElementClass = _getCustomElementType(jsObject);
+ var customElementClass = null;
+ var extendsTag = "";
+ var custom = _getCustomElement(jsObject);
+ if (custom != null) {
+ customElementClass = custom['type'];
+ extendsTag = custom['extends'];
+ }
// Custom Element to upgrade.
- if (jsTypeName == 'HTMLElement' && customElementClass != null) {
+ if (jsTypeName == 'HTMLElement' && customElementClass != null && extendsTag == "") {
try {
dartClass_instance = _blink.Blink_Utils.constructElement(customElementClass, jsObject);
} finally {
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698