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

Unified Diff: grit/gather/chrome_html.py

Issue 15713020: High DPI support for Themes: change chrome_html.py (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698