OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions | 6 # modification, are permitted provided that the following conditions |
7 # are met: | 7 # are met: |
8 # | 8 # |
9 # 1. Redistributions of source code must retain the above | 9 # 1. Redistributions of source code must retain the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho
st) | 46 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho
st) |
47 if filename.endswith('.css'): | 47 if filename.endswith('.css'): |
48 return converter.add_webkit_prefix_to_unprefixed_properties(contents.dec
ode('utf-8')) | 48 return converter.add_webkit_prefix_to_unprefixed_properties(contents.dec
ode('utf-8')) |
49 else: | 49 else: |
50 converter.feed(contents.decode('utf-8')) | 50 converter.feed(contents.decode('utf-8')) |
51 converter.close() | 51 converter.close() |
52 return converter.output() | 52 return converter.output() |
53 | 53 |
54 | 54 |
55 class _W3CTestConverter(HTMLParser): | 55 class _W3CTestConverter(HTMLParser): |
| 56 |
56 def __init__(self, new_path, filename, reference_support_info, host=Host()): | 57 def __init__(self, new_path, filename, reference_support_info, host=Host()): |
57 HTMLParser.__init__(self) | 58 HTMLParser.__init__(self) |
58 | 59 |
59 self._host = host | 60 self._host = host |
60 self._filesystem = self._host.filesystem | 61 self._filesystem = self._host.filesystem |
61 self._webkit_root = WebKitFinder(self._filesystem).webkit_base() | 62 self._webkit_root = WebKitFinder(self._filesystem).webkit_base() |
62 | 63 |
63 self.converted_data = [] | 64 self.converted_data = [] |
64 self.converted_properties = [] | 65 self.converted_properties = [] |
65 self.in_style_tag = False | 66 self.in_style_tag = False |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 self.converted_data.extend(['&#', name, ';']) | 211 self.converted_data.extend(['&#', name, ';']) |
211 | 212 |
212 def handle_comment(self, data): | 213 def handle_comment(self, data): |
213 self.converted_data.extend(['<!-- ', data, ' -->']) | 214 self.converted_data.extend(['<!-- ', data, ' -->']) |
214 | 215 |
215 def handle_decl(self, decl): | 216 def handle_decl(self, decl): |
216 self.converted_data.extend(['<!', decl, '>']) | 217 self.converted_data.extend(['<!', decl, '>']) |
217 | 218 |
218 def handle_pi(self, data): | 219 def handle_pi(self, data): |
219 self.converted_data.extend(['<?', data, '>']) | 220 self.converted_data.extend(['<?', data, '>']) |
OLD | NEW |