Chromium Code Reviews| Index: tools/dom/scripts/systemhtml.py |
| diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py |
| index 90d2610856e7cd158934610b771c677fd00cee79..f4ca952604084d69420660c013ef40216685c938 100644 |
| --- a/tools/dom/scripts/systemhtml.py |
| +++ b/tools/dom/scripts/systemhtml.py |
| @@ -325,6 +325,43 @@ def ElementConstructorInfos(typename, element_constructors, |
| return infos |
| # ------------------------------------------------------------------------------ |
| + |
| +_html_element_tags = [ |
| + # TODO(amouravski): add a custom factory constructor for h1..h6. |
| + # TODO(amouravski): add a custom factory constructor for input |
| + 'a', |
| + 'article', |
| + 'aside', |
| + 'audio', |
| + 'br', |
| + 'canvas', |
| + 'div', |
| + 'footer', |
| + 'header', |
| + 'hr', |
| + 'iframe', |
| + 'img', |
| + 'li', |
| + 'nav', |
| + 'ol', |
| + 'option', |
| + 'p', |
| + 'pre', |
| + 'section', |
| + 'select', |
| + 'span', |
| + 'svg', |
| + 'table', |
| + 'td', |
| + 'textarea', |
| + 'th', |
| + 'tr', |
| + 'ul', |
| + 'video', |
| +] |
| + |
| + |
| +# ------------------------------------------------------------------------------ |
| def SvgSupportStr(tagName): |
| return 'Svg%s' % ElemSupportStr(tagName) |
| @@ -543,6 +580,22 @@ class HtmlDartInterfaceGenerator(object): |
| if self._renamer.ShouldSuppressInterface(self._interface): |
| class_modifiers = 'abstract ' |
| +# additional_methods = 'asdasdas' |
|
blois
2013/06/28 00:28:11
delete.
Andrei Mouravski
2013/06/28 19:19:21
Done.
|
| +# if self._interface.id == 'HTMLElement': |
| +# additional_methods = ''.join(_ElementTagConstructors()) |
| + |
| + additional_methods = [] |
| + if self._interface.id in 'HTMLElement': |
| + for tag in _html_element_tags: |
| + method = ( |
| + "\n" |
| + " /// Creates a new `<{0}>` element.\n" |
|
blois
2013/06/28 00:28:11
Just put this into the template file.
Andrei Mouravski
2013/06/28 19:19:21
I don't understand. Do you mean inline all of the
|
| + " ///\n" |
| + " /// This is identical to calling `new Element.tag({0})`.\n" |
| + " factory Element.{0}() => new Element.tag({0});\n").format(tag) |
| + additional_methods.append(method) |
| + additional_str = ''.join(additional_methods) |
| + |
| self._implementation_members_emitter = implementation_emitter.Emit( |
| self._backend.ImplementationTemplate(), |
| LIBRARYNAME='dart.dom.%s' % self._library_name, |
| @@ -553,7 +606,8 @@ class HtmlDartInterfaceGenerator(object): |
| IMPLEMENTS=implements_str, |
| MIXINS=mixins_str, |
| DOMNAME=self._interface.doc_js_name, |
| - NATIVESPEC=self._backend.NativeSpec()) |
| + NATIVESPEC=self._backend.NativeSpec(), |
| + ADDITIONAL_METHODS=additional_str) |
| self._backend.StartInterface(self._implementation_members_emitter) |
| self._backend.EmitHelpers(base_class) |