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 13 matching lines...) Expand all Loading... |
24 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
26 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 26 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
27 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 # SUCH DAMAGE. | 28 # SUCH DAMAGE. |
29 | 29 |
30 import logging | 30 import logging |
31 import re | 31 import re |
32 | 32 |
33 from webkitpy.common.host import Host | 33 from webkitpy.common.host import Host |
| 34 from webkitpy.common.webkit_finder import WebKitFinder |
34 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup, Tag | 35 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup, Tag |
35 | 36 |
36 | 37 |
37 _log = logging.getLogger(__name__) | 38 _log = logging.getLogger(__name__) |
38 | 39 |
39 | 40 |
40 class W3CTestConverter(object): | 41 class W3CTestConverter(object): |
41 | 42 |
42 def __init__(self): | 43 def __init__(self): |
43 self._host = Host() | 44 self._host = Host() |
44 self._filesystem = self._host.filesystem | 45 self._filesystem = self._host.filesystem |
45 self._host.initialize_scm() | 46 self._webkit_root = WebKitFinder(self._filesystem).webkit_base() |
46 self._webkit_root = self._host.scm().checkout_root | |
47 | 47 |
48 # These settings might vary between WebKit and Blink | 48 # These settings might vary between WebKit and Blink |
49 self._css_property_file = self.path_from_webkit_root('Source', 'core', '
css', 'CSSPropertyNames.in') | 49 self._css_property_file = self.path_from_webkit_root('Source', 'core', '
css', 'CSSPropertyNames.in') |
50 self._css_property_split_string = 'alias_for=' | 50 self._css_property_split_string = 'alias_for=' |
51 | 51 |
52 self.prefixed_properties = self.read_webkit_prefixed_css_property_list() | 52 self.prefixed_properties = self.read_webkit_prefixed_css_property_list() |
53 | 53 |
54 def path_from_webkit_root(self, *comps): | 54 def path_from_webkit_root(self, *comps): |
55 return self._filesystem.abspath(self._filesystem.join(self._webkit_root,
*comps)) | 55 return self._filesystem.abspath(self._filesystem.join(self._webkit_root,
*comps)) |
56 | 56 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 converted_properties.append(prefixed_property) | 184 converted_properties.append(prefixed_property) |
185 text = re.sub(pattern, prefixed_property + ':', text) | 185 text = re.sub(pattern, prefixed_property + ':', text) |
186 | 186 |
187 # FIXME: Handle the JS versions of these properties and GetComputedStyle
, too. | 187 # FIXME: Handle the JS versions of these properties and GetComputedStyle
, too. |
188 return (converted_properties, text) | 188 return (converted_properties, text) |
189 | 189 |
190 def replace_tag(self, old_tag, new_tag): | 190 def replace_tag(self, old_tag, new_tag): |
191 index = old_tag.parent.contents.index(old_tag) | 191 index = old_tag.parent.contents.index(old_tag) |
192 old_tag.parent.insert(index, new_tag) | 192 old_tag.parent.insert(index, new_tag) |
193 old_tag.extract() | 193 old_tag.extract() |
OLD | NEW |