Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 import os.path | 3 import os.path |
| 4 import re | 4 import re |
| 5 import subprocess | 5 import subprocess |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 from name_utilities import enum_for_css_keyword | 8 from name_utilities import enum_for_css_keyword |
| 9 from name_utilities import upper_first_letter | 9 from name_utilities import upper_first_letter |
| 10 import json5_generator | 10 import json5_generator |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 | 87 |
| 88 #if defined(__clang__) | 88 #if defined(__clang__) |
| 89 #pragma clang diagnostic pop | 89 #pragma clang diagnostic pop |
| 90 #endif | 90 #endif |
| 91 | 91 |
| 92 const Value* FindValue(const char* str, unsigned int len) { | 92 const Value* FindValue(const char* str, unsigned int len) { |
| 93 return CSSValueKeywordsHash::findValueImpl(str, len); | 93 return CSSValueKeywordsHash::findValueImpl(str, len); |
| 94 } | 94 } |
| 95 | 95 |
| 96 const char* getValueName(CSSValueID id) { | 96 const char* getValueName(CSSValueID id) { |
| 97 ASSERT(id > 0 && id < numCSSValueKeywords); | 97 DCHECK(id > 0 && id < numCSSValueKeywords); |
|
haraken
2017/05/19 17:52:03
Split the dcheck into two dchecks. The same commen
| |
| 98 return valueListStringPool + valueListStringOffsets[id - 1]; | 98 return valueListStringPool + valueListStringOffsets[id - 1]; |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { | 101 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { |
| 102 switch (id) { | 102 switch (id) { |
| 103 %(ua_sheet_mode_values_keywords)s | 103 %(ua_sheet_mode_values_keywords)s |
| 104 return IsUASheetBehavior(mode); | 104 return IsUASheetBehavior(mode); |
| 105 %(quirks_mode_or_ua_sheet_mode_values_keywords)s | 105 %(quirks_mode_or_ua_sheet_mode_values_keywords)s |
| 106 return IsUASheetBehavior(mode) || IsQuirksModeBehavior(mode); | 106 return IsUASheetBehavior(mode) || IsQuirksModeBehavior(mode); |
| 107 default: | 107 default: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 # CalledProcessError like subprocess would do when shell=True is set. | 180 # CalledProcessError like subprocess would do when shell=True is set. |
| 181 try: | 181 try: |
| 182 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s ubprocess.PIPE, universal_newlines=True) | 182 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s ubprocess.PIPE, universal_newlines=True) |
| 183 return gperf.communicate(gperf_input)[0] | 183 return gperf.communicate(gperf_input)[0] |
| 184 except OSError: | 184 except OSError: |
| 185 raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.') | 185 raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.') |
| 186 | 186 |
| 187 | 187 |
| 188 if __name__ == "__main__": | 188 if __name__ == "__main__": |
| 189 json5_generator.Maker(CSSValueKeywordsWriter).main() | 189 json5_generator.Maker(CSSValueKeywordsWriter).main() |
| OLD | NEW |