| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 | 54 |
| 55 def capitalize(name): | 55 def capitalize(name): |
| 56 """Capitalize first letter or initial acronym (used in setter names).""" | 56 """Capitalize first letter or initial acronym (used in setter names).""" |
| 57 for acronym in ACRONYMS: | 57 for acronym in ACRONYMS: |
| 58 if name.startswith(acronym.lower()): | 58 if name.startswith(acronym.lower()): |
| 59 return name.replace(acronym.lower(), acronym) | 59 return name.replace(acronym.lower(), acronym) |
| 60 return name[0].upper() + name[1:] | 60 return name[0].upper() + name[1:] |
| 61 | 61 |
| 62 | 62 |
| 63 def strip_suffix(string, suffix): |
| 64 if not suffix or not string.endswith(suffix): |
| 65 return string |
| 66 return string[:-len(suffix)] |
| 67 |
| 68 |
| 63 def uncapitalize(name): | 69 def uncapitalize(name): |
| 64 """Uncapitalizes first letter or initial acronym (* with some exceptions). | 70 """Uncapitalizes first letter or initial acronym (* with some exceptions). |
| 65 | 71 |
| 66 E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'. | 72 E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'. |
| 67 Used in method names; exceptions differ from capitalize(). | 73 Used in method names; exceptions differ from capitalize(). |
| 68 """ | 74 """ |
| 69 for acronym in ACRONYMS: | 75 for acronym in ACRONYMS: |
| 70 if name.startswith(acronym): | 76 if name.startswith(acronym): |
| 71 name.replace(acronym, acronym.lower()) | 77 name.replace(acronym, acronym.lower()) |
| 72 return name | 78 return name |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 def cpp_name(definition_or_member): | 186 def cpp_name(definition_or_member): |
| 181 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) | 187 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) |
| 182 | 188 |
| 183 | 189 |
| 184 # [MeasureAs] | 190 # [MeasureAs] |
| 185 def generate_measure_as(definition_or_member, contents, includes): | 191 def generate_measure_as(definition_or_member, contents, includes): |
| 186 if 'MeasureAs' not in definition_or_member.extended_attributes: | 192 if 'MeasureAs' not in definition_or_member.extended_attributes: |
| 187 return | 193 return |
| 188 contents['measure_as'] = definition_or_member.extended_attributes['MeasureAs
'] | 194 contents['measure_as'] = definition_or_member.extended_attributes['MeasureAs
'] |
| 189 includes.add('core/page/UseCounter.h') | 195 includes.add('core/page/UseCounter.h') |
| OLD | NEW |