Chromium Code Reviews| Index: grit/gather/chrome_html.py |
| diff --git a/grit/gather/chrome_html.py b/grit/gather/chrome_html.py |
| index d554776fac1aa0ba620173dbae56799104bf54f9..211ee72de609efd63fb8e633b2da447775325fcc 100644 |
| --- a/grit/gather/chrome_html.py |
| +++ b/grit/gather/chrome_html.py |
| @@ -30,6 +30,8 @@ DIST_SUBSTR = '%DISTRIBUTION%' |
| # Matches a chrome theme source URL. |
| _THEME_SOURCE = lazy_re.compile('chrome://theme/IDR_[A-Z0-9_]*') |
| +# Matches a chrome theme source URL with "?". |
| +_THEME_SOURCE_WITH_QUESTIONMARK = lazy_re.compile('chrome://theme/IDR_[A-Z0-9_]*\?') |
|
flackr
2013/06/12 01:05:44
You should use matching groups in the regex to get
sschmitz
2013/06/12 18:00:14
Done.
|
| # Matches CSS image urls with the capture group 'filename'. |
| _CSS_IMAGE_URLS = lazy_re.compile( |
| '(?P<attribute>content|background|[\w-]*-image):[ ]*' + |
| @@ -71,6 +73,16 @@ def GetImageList( |
| # can simply request all scale factors. |
| if _THEME_SOURCE.match(filename): |
| images = [('1x', filename)] |
| + # If the URL contains a question mark, insert the scale factor text |
| + # before it. |
| + if _THEME_SOURCE_WITH_QUESTIONMARK.match(filename): |
| + fnparts = re.split('\?', filename) |
| + for scale_factor in scale_factors: |
| + fnscaled = fnparts[0]+'@'+scale_factor+'?'+('?'.join(fnparts[1:])) |
| + images.append((scale_factor, fnscaled)) |
| + return images |
| + # If the URL does not contain a question mark, append the scale factor |
| + # text. |
| for scale_factor in scale_factors: |
| images.append((scale_factor, "%s@%s" % (filename, scale_factor))) |
| return images |