Chromium Code Reviews| Index: chrome/browser/resources/web_dev_style/css_checker.py |
| diff --git a/chrome/browser/resources/web_dev_style/css_checker.py b/chrome/browser/resources/web_dev_style/css_checker.py |
| index dc2355e4b9a5e139217bde4a6a7bbb81a0b18562..dbb4c5a480c1f9762df2e4ce851da272d815dd7a 100644 |
| --- a/chrome/browser/resources/web_dev_style/css_checker.py |
| +++ b/chrome/browser/resources/web_dev_style/css_checker.py |
| @@ -124,11 +124,16 @@ class CSSChecker(object): |
| return ' (replace with #%s)' % (h[0] + h[2] + h[4]) |
| hsl = r'hsl\([^\)]*(?:[, ]|(?<=\())(?:0?\.?)?0%' |
| - zeros = (r'(?:^|\D)' |
| + zeros = (r'^.*(?:^|\D)' |
|
Yoyo Zhou
2012/04/20 01:31:40
It seems like for the example "state0." in the tes
|
| r'(?:\.0|0(?:\.0?|px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz))' |
| - r'(?:\D|$)(?!\s*\{)') |
| - def zero_length_values(line): |
| - return (re.search(zeros, line) and not re.search(hsl, line)) |
| + r'(?:\D|$)(?=[^{}]+?}).*$') |
|
Yoyo Zhou
2012/04/20 01:31:40
The last } is literal, right? It's confusing witho
|
| + def zero_length_values(contents): |
| + errors = [] |
| + for z in re.finditer(re.compile(zeros, re.MULTILINE), contents): |
| + first_line = z.group(0).strip().splitlines()[0] |
| + if not re.search(hsl, first_line): |
| + errors.append(' ' + first_line) |
| + return errors |
| added_or_modified_files_checks = [ |
| { 'desc': 'Alphabetize properties and list vendor specific (i.e. ' |
| @@ -178,6 +183,7 @@ class CSSChecker(object): |
| { 'desc': 'Make all zero length terms (i.e. 0px) 0 unless inside of ' |
| 'hsl() or part of @keyframe.', |
| 'test': zero_length_values, |
| + 'multiline': True, |
| }, |
| ] |