Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import sys | 6 import sys |
| 7 from collections import defaultdict | 7 from collections import defaultdict |
| 8 | 8 |
| 9 import hasher | 9 import hasher |
| 10 import in_generator | 10 import in_generator |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 'noConstructor': None, | 26 'noConstructor': None, |
| 27 'noTypeHelpers': None, | 27 'noTypeHelpers': None, |
| 28 'ImplementedAs': None, | 28 'ImplementedAs': None, |
| 29 'JSInterfaceName': None, | 29 'JSInterfaceName': None, |
| 30 'constructorNeedsCreatedByParser': None, | 30 'constructorNeedsCreatedByParser': None, |
| 31 'constructorNeedsFormElement': None, | 31 'constructorNeedsFormElement': None, |
| 32 'contextConditional': None, | 32 'contextConditional': None, |
| 33 'interfaceName': None, | 33 'interfaceName': None, |
| 34 'noConstructor': None, | 34 'noConstructor': None, |
| 35 'runtimeEnabled': None, | 35 'runtimeEnabled': None, |
| 36 'Conditional': None, | |
|
Nils Barth (inactive)
2014/06/16 06:27:52
alpha
(could you alphabetize the earlier interface
| |
| 36 } | 37 } |
| 37 default_parameters = { | 38 default_parameters = { |
| 38 'attrsNullNamespace': None, | 39 'attrsNullNamespace': None, |
| 39 'namespace': '', | 40 'namespace': '', |
| 40 'namespacePrefix': '', | 41 'namespacePrefix': '', |
| 41 'namespaceURI': '', | 42 'namespaceURI': '', |
| 42 'fallbackInterfaceName': '', | 43 'fallbackInterfaceName': '', |
| 43 'fallbackJSInterfaceName': '', | 44 'fallbackJSInterfaceName': '', |
| 44 } | 45 } |
| 45 filters = { | 46 filters = { |
| 46 'hash': hasher.hash, | 47 'hash': hasher.hash, |
| 47 'symbol': _symbol, | 48 'symbol': _symbol, |
| 49 'enable_conditional': name_utilities.enable_conditional_if_endif, | |
|
Nils Barth (inactive)
2014/06/16 06:27:52
alpha
| |
| 48 } | 50 } |
| 49 | 51 |
| 50 def __init__(self, in_file_path): | 52 def __init__(self, in_file_path): |
| 51 super(MakeElementTypeHelpersWriter, self).__init__(in_file_path) | 53 super(MakeElementTypeHelpersWriter, self).__init__(in_file_path) |
| 52 | 54 |
| 53 self.namespace = self.in_file.parameters['namespace'].strip('"') | 55 self.namespace = self.in_file.parameters['namespace'].strip('"') |
| 54 self.fallbackInterface = self.in_file.parameters['fallbackInterfaceName' ].strip('"') | 56 self.fallbackInterface = self.in_file.parameters['fallbackInterfaceName' ].strip('"') |
| 55 | 57 |
| 56 assert self.namespace, 'A namespace is required.' | 58 assert self.namespace, 'A namespace is required.' |
| 57 | 59 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 85 if name == 'HTML': | 87 if name == 'HTML': |
| 86 name = 'Html' | 88 name = 'Html' |
| 87 dash = name.find('-') | 89 dash = name.find('-') |
| 88 while dash != -1: | 90 while dash != -1: |
| 89 name = name[:dash] + name[dash + 1].upper() + name[dash + 2:] | 91 name = name[:dash] + name[dash + 1].upper() + name[dash + 2:] |
| 90 dash = name.find('-') | 92 dash = name.find('-') |
| 91 return '%s%sElement' % (self.namespace, name) | 93 return '%s%sElement' % (self.namespace, name) |
| 92 | 94 |
| 93 if __name__ == "__main__": | 95 if __name__ == "__main__": |
| 94 in_generator.Maker(MakeElementTypeHelpersWriter).main(sys.argv) | 96 in_generator.Maker(MakeElementTypeHelpersWriter).main(sys.argv) |
| OLD | NEW |