| Index: Source/build/scripts/make_element_factory.py
|
| diff --git a/Source/build/scripts/make_element_factory.py b/Source/build/scripts/make_element_factory.py
|
| index b9600cbf7177340a64a77c999c72294b098718c5..6bf636219e760f143482c28f352a4aa7364e29a3 100755
|
| --- a/Source/build/scripts/make_element_factory.py
|
| +++ b/Source/build/scripts/make_element_factory.py
|
| @@ -35,7 +35,6 @@ import name_utilities
|
|
|
| from make_qualified_names import MakeQualifiedNamesWriter
|
|
|
| -
|
| def _interface(tag):
|
| if tag['interfaceName']:
|
| return tag['interfaceName']
|
| @@ -43,22 +42,26 @@ def _interface(tag):
|
| # FIXME: We shouldn't hard-code HTML here.
|
| if name == 'HTML':
|
| name = 'Html'
|
| - return 'HTML%sElement' % name
|
| + dash = name.find('-')
|
| + while dash != -1:
|
| + name = name[:dash] + name[dash + 1].upper() + name[dash + 2:]
|
| + dash = name.find('-')
|
| + return '%sElement' % name
|
|
|
|
|
| def _js_interface(tag):
|
| - if tag['JSInterfaceName']:
|
| - return tag['JSInterfaceName']
|
| + if tag['useDefaultJSInterface']:
|
| + return 'Element'
|
| return _interface(tag)
|
|
|
|
|
| def _has_js_interface(tag):
|
| - return not tag['mapToTagName'] and not tag['noConstructor'] and _js_interface(tag) != 'HTMLElement'
|
| + return not tag['mapToTagName'] and not tag['noConstructor'] and _js_interface(tag) != 'Element'
|
|
|
|
|
| class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
|
| defaults = dict(MakeQualifiedNamesWriter.default_parameters, **{
|
| - 'JSInterfaceName': None,
|
| + 'useDefaultJSInterface': None,
|
| 'constructorNeedsCreatedByParser': None,
|
| 'constructorNeedsFormElement': None,
|
| 'contextConditional': None,
|
| @@ -68,7 +71,8 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
|
| 'wrapperOnlyIfMediaIsAvailable': None,
|
| })
|
| default_parameters = dict(MakeQualifiedNamesWriter.default_parameters, **{
|
| - 'fallbackInterfaceName': None,
|
| + 'fallbackInterfaceName': '',
|
| + 'fallbackJSInterfaceName': '',
|
| })
|
| filters = dict(MakeQualifiedNamesWriter.filters, **{
|
| 'interface': _interface,
|
| @@ -89,11 +93,15 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
|
| ('V8' + self.namespace + 'ElementWrapperFactory.cpp'): self.generate_wrapper_factory_implementation,
|
| })
|
|
|
| + fallback_interface = self.tags_in_file.parameters['fallbackInterfaceName'].strip('"')
|
| + fallback_js_interface = self.tags_in_file.parameters['fallbackJSInterfaceName'].strip('"') or fallback_interface
|
| +
|
| for tag in self._template_context['tags']:
|
| tag['js_interface'] = _js_interface(tag) if _has_js_interface(tag) else None
|
|
|
| self._template_context.update({
|
| - 'fallback_interface': self.tags_in_file.parameters['fallbackInterfaceName'].strip('"'),
|
| + 'fallback_interface': fallback_interface,
|
| + 'fallback_js_interface': fallback_js_interface,
|
| })
|
|
|
| @template_expander.use_jinja('ElementFactory.h.tmpl', filters=filters)
|
|
|