Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1617)

Unified Diff: chrome/browser/web_dev_style/css_checker.py

Issue 882243004: web_dev_style: allow 0ms or 0s while we hash out the breakage of crbug.com/454776 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/test_presubmit.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_dev_style/css_checker.py
diff --git a/chrome/browser/web_dev_style/css_checker.py b/chrome/browser/web_dev_style/css_checker.py
index 5707e1a870ed7c86ac2c3f40377162a661cf26ad..37f19a516a355440c93bf9f29d43f5948acf3a98 100644
--- a/chrome/browser/web_dev_style/css_checker.py
+++ b/chrome/browser/web_dev_style/css_checker.py
@@ -258,18 +258,18 @@ class CSSChecker(object):
def webkit_before_or_after(line):
return webkit_before_or_after_reg.search(line)
- def zero_length_values(contents):
+ def zero_width_lengths(contents):
hsl_reg = re.compile(r"""
hsl\([^\)]* # hsl(<maybe stuff>
(?:[, ]|(?<=\()) # a comma or space not followed by a (
(?:0?\.?)?0% # some equivalent to 0%""",
re.VERBOSE)
zeros_reg = re.compile(r"""
- ^.*(?:^|[^0-9.]) # start/non-number
- (?:\.0|0(?:\.0? # .0, 0, or 0.0
- |px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz)) # a length unit
Dan Beam 2015/02/03 16:09:16 this is the functional change
- (?:\D|$) # non-number/end
- (?=[^{}]+?}).*$ # only { rules }""",
+ ^.*(?:^|[^0-9.]) # start/non-number
+ (?:\.0|0(?:\.0? # .0, 0, or 0.0
+ |px|em|%|in|cm|mm|pc|pt|ex)) # a length unit
+ (?:\D|$) # non-number/end
+ (?=[^{}]+?}).*$ # only { rules }""",
re.MULTILINE | re.VERBOSE)
errors = []
for z in re.finditer(zeros_reg, contents):
@@ -336,9 +336,8 @@ class CSSChecker(object):
'test': webkit_before_or_after,
'after': suggest_top_or_bottom,
},
- { 'desc': 'Make all zero length terms (i.e. 0px) 0 unless inside of '
- 'hsl() or part of @keyframe.',
- 'test': zero_length_values,
+ { 'desc': 'Use "0" for zero-width lengths (i.e. 0px -> 0)',
+ 'test': zero_width_lengths,
'multiline': True,
},
]
« no previous file with comments | « chrome/browser/test_presubmit.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698