Chromium Code Reviews| Index: Tools/Scripts/webkitpy/w3c/test_converter.py |
| diff --git a/Tools/Scripts/webkitpy/w3c/test_converter.py b/Tools/Scripts/webkitpy/w3c/test_converter.py |
| index 5b102754d4d19ec2284a1de8dd0452f2c5baddf1..b6da61cca91537c4083c2be77e0579242c62dc8f 100644 |
| --- a/Tools/Scripts/webkitpy/w3c/test_converter.py |
| +++ b/Tools/Scripts/webkitpy/w3c/test_converter.py |
| @@ -68,7 +68,7 @@ class _W3CTestConverter(HTMLParser): |
| resources_path = self.path_from_webkit_root('LayoutTests', 'resources') |
| resources_relpath = self._filesystem.relpath(resources_path, new_path) |
| - self.new_test_harness_path = resources_relpath |
| + self.resources_relpath = resources_relpath |
| # These settings might vary between WebKit and Blink |
| self._css_property_file = self.path_from_webkit_root('Source', 'core', 'css', 'CSSPropertyNames.in') |
| @@ -76,8 +76,6 @@ class _W3CTestConverter(HTMLParser): |
| self.prefixed_properties = self.read_webkit_prefixed_css_property_list() |
| - self.test_harness_re = re.compile('/resources/testharness') |
| - |
| self.prefixed_properties = self.read_webkit_prefixed_css_property_list() |
| prop_regex = '([\s{]|^)(' + "|".join(prop.replace('-webkit-', '') for prop in self.prefixed_properties) + ')(\s+:|:)' |
| self.prop_re = re.compile(prop_regex) |
| @@ -138,18 +136,29 @@ class _W3CTestConverter(HTMLParser): |
| def convert_attributes_if_needed(self, tag, attrs): |
| converted = self.get_starttag_text() |
| if tag in ('script', 'link'): |
| - attr_name = 'src' |
| + target_attr = 'src' |
| if tag != 'script': |
| - attr_name = 'href' |
| - for attr in attrs: |
| - if attr[0] == attr_name: |
| - new_path = re.sub(self.test_harness_re, self.new_test_harness_path + '/testharness', attr[1]) |
| - converted = re.sub(attr[1], new_path, converted) |
| - |
| - for attr in attrs: |
| - if attr[0] == 'style': |
| - new_style = self.convert_style_data(attr[1]) |
| - converted = re.sub(attr[1], new_style, converted) |
| + target_attr = 'href' |
| + for attr_name, attr_value in attrs: |
| + if attr_name == target_attr: |
| + new_path = re.sub('/resources/testharness', |
| + self.resources_relpath + '/testharness', |
| + attr_value) |
| + converted = re.sub(attr_value, new_path, converted) |
| + new_path = re.sub('/common/vendor-prefix', |
|
Dirk Pranke
2014/06/26 21:16:47
I don't recall if you answered this question, but
|
| + self.resources_relpath + '/vendor-prefix', |
| + attr_value) |
| + converted = re.sub(attr_value, new_path, converted) |
| + |
| + for attr_name, attr_value in attrs: |
| + print attr_name, attr_value |
|
Dirk Pranke
2014/06/26 21:16:47
this print shouldn't be here ...
|
| + if attr_name == 'style': |
| + new_style = self.convert_style_data(attr_value) |
| + converted = re.sub(attr_value, new_style, converted) |
| + if attr_name == 'class' and 'instructions' in attr_value: |
|
Dirk Pranke
2014/06/26 21:16:47
can we put this logic in testharnessreport.js inst
|
| + # Always hide instructions, they're for manual testers. |
| + converted = re.sub(' style=".*?"', '', converted) |
| + converted = re.sub('\>', ' style="display:none">', converted) |
| self.converted_data.append(converted) |