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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter.py

Issue 2016953002: update-w3c-deps: Do not rewrite links to /resources and /common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a comment, fix python tests Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if converted[0]: 143 if converted[0]:
144 self.converted_properties.extend(list(converted[0])) 144 self.converted_properties.extend(list(converted[0]))
145 145
146 if self.reference_support_info is None or self.reference_support_info == {}: 146 if self.reference_support_info is None or self.reference_support_info == {}:
147 return converted[1] 147 return converted[1]
148 148
149 return self.convert_reference_relpaths(converted[1]) 149 return self.convert_reference_relpaths(converted[1])
150 150
151 def convert_attributes_if_needed(self, tag, attrs): 151 def convert_attributes_if_needed(self, tag, attrs):
152 converted = self.get_starttag_text() 152 converted = self.get_starttag_text()
153 if tag in ('script', 'link'):
154 target_attr = 'src'
155 if tag != 'script':
156 target_attr = 'href'
157 for attr_name, attr_value in attrs:
158 if attr_name == target_attr:
159 new_path = re.sub('/resources/(?=testharness|idlharness|WebI DLParser)',
160 self.resources_relpath + '/',
161 attr_value)
162 converted = re.sub(re.escape(attr_value), new_path, converte d)
163 new_path = re.sub('/common/vendor-prefix',
164 self.resources_relpath + '/vendor-prefix',
165 attr_value)
166 converted = re.sub(re.escape(attr_value), new_path, converte d)
167
168 for attr_name, attr_value in attrs: 153 for attr_name, attr_value in attrs:
169 if attr_name == 'style': 154 if attr_name == 'style':
170 new_style = self.convert_style_data(attr_value) 155 new_style = self.convert_style_data(attr_value)
171 converted = re.sub(re.escape(attr_value), new_style, converted) 156 converted = re.sub(re.escape(attr_value), new_style, converted)
172 if attr_name == 'class' and 'instructions' in attr_value: 157 if attr_name == 'class' and 'instructions' in attr_value:
173 # Always hide instructions, they're for manual testers. 158 # Always hide instructions, they're for manual testers.
174 converted = re.sub(' style=".*?"', '', converted) 159 converted = re.sub(' style=".*?"', '', converted)
175 converted = re.sub('\>', ' style="display:none">', converted) 160 converted = re.sub('\>', ' style="display:none">', converted)
176 161
177 src_tags = ('script', 'img', 'style', 'frame', 'iframe', 'input', 'layer ', 'textarea', 'video', 'audio') 162 src_tags = ('script', 'img', 'style', 'frame', 'iframe', 'input', 'layer ', 'textarea', 'video', 'audio')
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 self.converted_data.extend(['&#', name, ';']) 196 self.converted_data.extend(['&#', name, ';'])
212 197
213 def handle_comment(self, data): 198 def handle_comment(self, data):
214 self.converted_data.extend(['<!-- ', data, ' -->']) 199 self.converted_data.extend(['<!-- ', data, ' -->'])
215 200
216 def handle_decl(self, decl): 201 def handle_decl(self, decl):
217 self.converted_data.extend(['<!', decl, '>']) 202 self.converted_data.extend(['<!', decl, '>'])
218 203
219 def handle_pi(self, data): 204 def handle_pi(self, data):
220 self.converted_data.extend(['<?', data, '>']) 205 self.converted_data.extend(['<?', data, '>'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698