OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 from tvcm import style_sheet | 7 from py_vulcanize import style_sheet |
8 | 8 |
9 | 9 |
10 class HTMLGenerationController(object): | 10 class HTMLGenerationController(object): |
11 | 11 |
12 def __init__(self): | 12 def __init__(self): |
13 self.current_module = None | 13 self.current_module = None |
14 | 14 |
15 def GetHTMLForStylesheetHRef(self, href): # pylint: disable=unused-argument | 15 def GetHTMLForStylesheetHRef(self, href): # pylint: disable=unused-argument |
16 return None | 16 return None |
17 | 17 |
18 def GetHTMLForInlineStylesheet(self, contents): | 18 def GetHTMLForInlineStylesheet(self, contents): |
19 if self.current_module is None: | 19 if self.current_module is None: |
20 if re.search('url\(.+\)', contents): | 20 if re.search('url\(.+\)', contents): |
21 raise Exception( | 21 raise Exception( |
22 'Default HTMLGenerationController cannot handle inline style urls') | 22 'Default HTMLGenerationController cannot handle inline style urls') |
23 return contents | 23 return contents |
24 | 24 |
25 module_dirname = os.path.dirname(self.current_module.resource.absolute_path) | 25 module_dirname = os.path.dirname(self.current_module.resource.absolute_path) |
26 ss = style_sheet.ParsedStyleSheet( | 26 ss = style_sheet.ParsedStyleSheet( |
27 self.current_module.loader, module_dirname, contents) | 27 self.current_module.loader, module_dirname, contents) |
28 return ss.contents_with_inlined_images | 28 return ss.contents_with_inlined_images |
OLD | NEW |