<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174672] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174672">174672</a></dd>
<dt>Author</dt> <dd>rego@igalia.com</dd>
<dt>Date</dt> <dd>2014-10-14 01:08:05 -0700 (Tue, 14 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>import-w3c-tests doesn't prefix property values
https://bugs.webkit.org/show_bug.cgi?id=137600
Reviewed by Bem Jones-Bey.
Some property values are prefixed in WebKit. Modified the W3C import
script in order to prefix property values and not only properties.
The patch re-uses most of the already existent logic to prefix
properties.
* Scripts/webkitpy/w3c/test_converter.py: Read prefixed property values
from CSSValueKeywords.in and adapt converter to modify both properties
and property values.
(convert_for_webkit):
(_W3CTestConverter.__init__):
(_W3CTestConverter.output):
(_W3CTestConverter.read_webkit_prefixed_css_property_list):
(_W3CTestConverter):
(_W3CTestConverter.add_webkit_prefix_to_unprefixed_properties_and_values):
(_W3CTestConverter.add_webkit_prefix_following_regex):
(_W3CTestConverter.convert_reference_relpaths):
(_W3CTestConverter.convert_style_data):
(_W3CTestConverter.convert_attributes_if_needed):
(_W3CTestConverter.add_webkit_prefix_to_unprefixed_properties): Deleted.
* Scripts/webkitpy/w3c/test_converter_unittest.py: Updated unit test to
include checks for property values too.
(W3CTestConverterTest.test_read_prefixed_property_list):
(verify_no_conversion_happened):
(verify_prefixed_properties):
(verify_prefixed_property_values):
(generate_test_content_properties_and_values):
(generate_test_content):
* Scripts/webkitpy/w3c/test_importer.py: Modified importer to manage
prefixed property values and inform about them.
(TestImporter.import_tests):
(TestImporter.write_import_log):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyw3ctest_converterpy">trunk/Tools/Scripts/webkitpy/w3c/test_converter.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyw3ctest_converter_unittestpy">trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyw3ctest_importerpy">trunk/Tools/Scripts/webkitpy/w3c/test_importer.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (174671 => 174672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-10-14 06:58:15 UTC (rev 174671)
+++ trunk/Tools/ChangeLog        2014-10-14 08:08:05 UTC (rev 174672)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-10-14 Manuel Rego Casasnovas <rego@igalia.com>
+
+ import-w3c-tests doesn't prefix property values
+ https://bugs.webkit.org/show_bug.cgi?id=137600
+
+ Reviewed by Bem Jones-Bey.
+
+ Some property values are prefixed in WebKit. Modified the W3C import
+ script in order to prefix property values and not only properties.
+ The patch re-uses most of the already existent logic to prefix
+ properties.
+
+ * Scripts/webkitpy/w3c/test_converter.py: Read prefixed property values
+ from CSSValueKeywords.in and adapt converter to modify both properties
+ and property values.
+ (convert_for_webkit):
+ (_W3CTestConverter.__init__):
+ (_W3CTestConverter.output):
+ (_W3CTestConverter.read_webkit_prefixed_css_property_list):
+ (_W3CTestConverter):
+ (_W3CTestConverter.add_webkit_prefix_to_unprefixed_properties_and_values):
+ (_W3CTestConverter.add_webkit_prefix_following_regex):
+ (_W3CTestConverter.convert_reference_relpaths):
+ (_W3CTestConverter.convert_style_data):
+ (_W3CTestConverter.convert_attributes_if_needed):
+ (_W3CTestConverter.add_webkit_prefix_to_unprefixed_properties): Deleted.
+ * Scripts/webkitpy/w3c/test_converter_unittest.py: Updated unit test to
+ include checks for property values too.
+ (W3CTestConverterTest.test_read_prefixed_property_list):
+ (verify_no_conversion_happened):
+ (verify_prefixed_properties):
+ (verify_prefixed_property_values):
+ (generate_test_content_properties_and_values):
+ (generate_test_content):
+ * Scripts/webkitpy/w3c/test_importer.py: Modified importer to manage
+ prefixed property values and inform about them.
+ (TestImporter.import_tests):
+ (TestImporter.write_import_log):
+
</ins><span class="cx"> 2014-10-13 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> MediaPlayer::characteristicChanged() is not called when new tracks are found in SourceBufferPrivateAVFObjC
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyw3ctest_converterpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter.py (174671 => 174672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/w3c/test_converter.py        2014-10-14 06:58:15 UTC (rev 174671)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter.py        2014-10-14 08:08:05 UTC (rev 174672)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> contents = host.filesystem.read_binary_file(filename)
</span><span class="cx"> converter = _W3CTestConverter(new_path, filename, reference_support_info, host)
</span><span class="cx"> if filename.endswith('.css'):
</span><del>- return converter.add_webkit_prefix_to_unprefixed_properties(contents)
</del><ins>+ return converter.add_webkit_prefix_to_unprefixed_properties_and_values(contents)
</ins><span class="cx"> else:
</span><span class="cx"> converter.feed(contents)
</span><span class="cx"> converter.close()
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">
</span><span class="cx"> self.converted_data = []
</span><span class="cx"> self.converted_properties = []
</span><ins>+ self.converted_property_values = []
</ins><span class="cx"> self.in_style_tag = False
</span><span class="cx"> self.style_data = []
</span><span class="cx"> self.filename = filename
</span><span class="lines">@@ -72,25 +73,30 @@
</span><span class="cx">
</span><span class="cx"> # These settings might vary between WebKit and Blink
</span><span class="cx"> self._css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSPropertyNames.in')
</span><ins>+ self._css_property_value_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSValueKeywords.in')
</ins><span class="cx"> self._css_property_split_string = '='
</span><span class="cx">
</span><span class="cx"> self.test_harness_re = re.compile('/resources/testharness')
</span><span class="cx">
</span><del>- self.prefixed_properties = self.read_webkit_prefixed_css_property_list()
</del><ins>+ self.prefixed_properties = self.read_webkit_prefixed_css_property_list(self._css_property_file)
</ins><span class="cx"> prop_regex = '([\s{]|^)(' + "|".join(prop.replace('-webkit-', '') for prop in self.prefixed_properties) + ')(\s+:|:)'
</span><span class="cx"> self.prop_re = re.compile(prop_regex)
</span><span class="cx">
</span><ins>+ self.prefixed_property_values = self.read_webkit_prefixed_css_property_list(self._css_property_value_file)
+ prop_value_regex = '(:\s*|^\s*)(' + "|".join(value.replace('-webkit-', '') for value in self.prefixed_property_values) + ')(\s*;|\s*}|\s*$)'
+ self.prop_value_re = re.compile(prop_value_regex)
+
</ins><span class="cx"> def output(self):
</span><del>- return (self.converted_properties, ''.join(self.converted_data))
</del><ins>+ return (self.converted_properties, self.converted_property_values, ''.join(self.converted_data))
</ins><span class="cx">
</span><span class="cx"> def path_from_webkit_root(self, *comps):
</span><span class="cx"> return self._filesystem.abspath(self._filesystem.join(self._webkit_root, *comps))
</span><span class="cx">
</span><del>- def read_webkit_prefixed_css_property_list(self):
</del><ins>+ def read_webkit_prefixed_css_property_list(self, file_name):
+ contents = self._filesystem.read_text_file(file_name)
</ins><span class="cx"> prefixed_properties = []
</span><span class="cx"> unprefixed_properties = set()
</span><span class="cx">
</span><del>- contents = self._filesystem.read_text_file(self._css_property_file)
</del><span class="cx"> for line in contents.splitlines():
</span><span class="cx"> if re.match('^(#|//)', line):
</span><span class="cx"> # skip comments and preprocessor directives
</span><span class="lines">@@ -107,25 +113,31 @@
</span><span class="cx"> # Ignore any prefixed properties for which an unprefixed version is supported
</span><span class="cx"> return [prop for prop in prefixed_properties if prop not in unprefixed_properties]
</span><span class="cx">
</span><del>- def add_webkit_prefix_to_unprefixed_properties(self, text):
- """ Searches |text| for instances of properties requiring the -webkit- prefix and adds the prefix to them.
</del><ins>+ def add_webkit_prefix_to_unprefixed_properties_and_values(self, text):
+ """ Searches |text| for instances of properties and values requiring the -webkit- prefix and adds the prefix to them.
</ins><span class="cx">
</span><del>- Returns the list of converted properties and the modified text."""
</del><ins>+ Returns the list of converted properties, values and the modified text."""
</ins><span class="cx">
</span><del>- converted_properties = set()
</del><ins>+ converted_properties = self.add_webkit_prefix_following_regex(text, self.prop_re)
+ converted_property_values = self.add_webkit_prefix_following_regex(converted_properties[1], self.prop_value_re)
+
+ # FIXME: Handle the JS versions of these properties and values and GetComputedStyle, too.
+ return (converted_properties[0], converted_property_values[0], converted_property_values[1])
+
+ def add_webkit_prefix_following_regex(self, text, regex):
+ converted_list = set()
</ins><span class="cx"> text_chunks = []
</span><span class="cx"> cur_pos = 0
</span><del>- for m in self.prop_re.finditer(text):
</del><ins>+ for m in regex.finditer(text):
</ins><span class="cx"> text_chunks.extend([text[cur_pos:m.start()], m.group(1), '-webkit-', m.group(2), m.group(3)])
</span><del>- converted_properties.add(m.group(2))
</del><ins>+ converted_list.add(m.group(2))
</ins><span class="cx"> cur_pos = m.end()
</span><span class="cx"> text_chunks.append(text[cur_pos:])
</span><span class="cx">
</span><del>- for prop in converted_properties:
- _log.info(' converting %s', prop)
</del><ins>+ for item in converted_list:
+ _log.info(' converting %s', item)
</ins><span class="cx">
</span><del>- # FIXME: Handle the JS versions of these properties and GetComputedStyle, too.
- return (converted_properties, ''.join(text_chunks))
</del><ins>+ return (converted_list, ''.join(text_chunks))
</ins><span class="cx">
</span><span class="cx"> def convert_reference_relpaths(self, text):
</span><span class="cx"> """ Searches |text| for instances of files in reference_support_info and updates the relative path to be correct for the new ref file location"""
</span><span class="lines">@@ -140,14 +152,16 @@
</span><span class="cx"> return converted
</span><span class="cx">
</span><span class="cx"> def convert_style_data(self, data):
</span><del>- converted = self.add_webkit_prefix_to_unprefixed_properties(data)
</del><ins>+ converted = self.add_webkit_prefix_to_unprefixed_properties_and_values(data)
</ins><span class="cx"> if converted[0]:
</span><span class="cx"> self.converted_properties.extend(list(converted[0]))
</span><ins>+ if converted[1]:
+ self.converted_property_values.extend(list(converted[1]))
</ins><span class="cx">
</span><span class="cx"> if self.reference_support_info is None or self.reference_support_info == {}:
</span><del>- return converted[1]
</del><ins>+ return converted[2]
</ins><span class="cx">
</span><del>- return self.convert_reference_relpaths(converted[1])
</del><ins>+ return self.convert_reference_relpaths(converted[2])
</ins><span class="cx">
</span><span class="cx"> def convert_attributes_if_needed(self, tag, attrs):
</span><span class="cx"> converted = self.get_starttag_text()
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyw3ctest_converter_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py (174671 => 174672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py        2014-10-14 06:58:15 UTC (rev 174671)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py        2014-10-14 08:08:05 UTC (rev 174672)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx"> converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None)
</span><span class="cx"> prop_list = converter.prefixed_properties
</span><span class="cx"> self.assertTrue(prop_list, 'No prefixed properties found')
</span><ins>+ property_values_list = converter.prefixed_property_values
+ self.assertTrue(property_values_list, 'No prefixed property values found')
</ins><span class="cx">
</span><span class="cx"> def test_convert_for_webkit_nothing_to_convert(self):
</span><span class="cx"> """ Tests convert_for_webkit() using a basic test that has nothing to convert """
</span><span class="lines">@@ -104,8 +106,9 @@
</span><span class="cx"> converted = converter.output()
</span><span class="cx">
</span><span class="cx"> self.verify_conversion_happened(converted)
</span><del>- self.verify_test_harness_paths(converter, converted[1], fake_dir_path, 1, 1)
</del><ins>+ self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 1, 1)
</ins><span class="cx"> self.verify_prefixed_properties(converted, [])
</span><ins>+ self.verify_prefixed_property_values(converted, [])
</ins><span class="cx">
</span><span class="cx"> def test_convert_for_webkit_properties_only(self):
</span><span class="cx"> """ Tests convert_for_webkit() using a test that has 2 prefixed properties: 1 in a style block + 1 inline style """
</span><span class="lines">@@ -116,31 +119,32 @@
</span><span class="cx"> <script src="/resources/testharness.js"></script>
</span><span class="cx"> <style type="text/css">
</span><span class="cx">
</span><del>-#block1 { @test0@: propvalue; }
</del><ins>+#block1 { @test0@: @propvalue0@; }
</ins><span class="cx">
</span><span class="cx"> </style>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><del>-<div id="elem1" style="@test1@: propvalue;"></div>
</del><ins>+<div id="elem1" style="@test1@: @propvalue1@;"></div>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span><span class="cx"> """
</span><span class="cx"> fake_dir_path = self.fake_dir_path('harnessandprops')
</span><span class="cx"> converter = _W3CTestConverter(fake_dir_path, DUMMY_FILENAME, None)
</span><del>- test_content = self.generate_test_content(converter.prefixed_properties, 1, test_html)
</del><ins>+ test_content = self.generate_test_content_properties_and_values(converter.prefixed_properties, converter.prefixed_property_values, 1, test_html)
</ins><span class="cx">
</span><span class="cx"> oc = OutputCapture()
</span><span class="cx"> oc.capture_output()
</span><span class="cx"> try:
</span><del>- converter.feed(test_content[1])
</del><ins>+ converter.feed(test_content[2])
</ins><span class="cx"> converter.close()
</span><span class="cx"> converted = converter.output()
</span><span class="cx"> finally:
</span><span class="cx"> oc.restore_output()
</span><span class="cx">
</span><span class="cx"> self.verify_conversion_happened(converted)
</span><del>- self.verify_test_harness_paths(converter, converted[1], fake_dir_path, 1, 1)
</del><ins>+ self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 1, 1)
</ins><span class="cx"> self.verify_prefixed_properties(converted, test_content[0])
</span><ins>+ self.verify_prefixed_property_values(converted, test_content[1])
</ins><span class="cx">
</span><span class="cx"> def test_convert_for_webkit_harness_and_properties(self):
</span><span class="cx"> """ Tests convert_for_webkit() using a basic JS test that uses testharness.js and testharness.css and has 4 prefixed properties: 3 in a style block + 1 inline style """
</span><span class="lines">@@ -151,14 +155,14 @@
</span><span class="cx"> <script src="/resources/testharness.js"></script>
</span><span class="cx"> <style type="text/css">
</span><span class="cx">
</span><del>-#block1 { @test0@: propvalue; }
-#block2 { @test1@: propvalue; }
-#block3 { @test2@: propvalue; }
</del><ins>+#block1 { @test0@: @propvalue0@; }
+#block2 { @test1@: @propvalue1@; }
+#block3 { @test2@: @propvalue2@; }
</ins><span class="cx">
</span><span class="cx"> </style>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><del>-<div id="elem1" style="@test3@: propvalue;"></div>
</del><ins>+<div id="elem1" style="@test3@: @propvalue3@;"></div>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span><span class="cx"> """
</span><span class="lines">@@ -168,16 +172,17 @@
</span><span class="cx"> oc = OutputCapture()
</span><span class="cx"> oc.capture_output()
</span><span class="cx"> try:
</span><del>- test_content = self.generate_test_content(converter.prefixed_properties, 2, test_html)
- converter.feed(test_content[1])
</del><ins>+ test_content = self.generate_test_content_properties_and_values(converter.prefixed_properties, converter.prefixed_property_values, 2, test_html)
+ converter.feed(test_content[2])
</ins><span class="cx"> converter.close()
</span><span class="cx"> converted = converter.output()
</span><span class="cx"> finally:
</span><span class="cx"> oc.restore_output()
</span><span class="cx">
</span><span class="cx"> self.verify_conversion_happened(converted)
</span><del>- self.verify_test_harness_paths(converter, converted[1], fake_dir_path, 1, 1)
</del><ins>+ self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 1, 1)
</ins><span class="cx"> self.verify_prefixed_properties(converted, test_content[0])
</span><ins>+ self.verify_prefixed_property_values(converted, test_content[1])
</ins><span class="cx">
</span><span class="cx"> def test_convert_test_harness_paths(self):
</span><span class="cx"> """ Tests convert_testharness_paths() with a test that uses all three testharness files """
</span><span class="lines">@@ -201,7 +206,7 @@
</span><span class="cx"> oc.restore_output()
</span><span class="cx">
</span><span class="cx"> self.verify_conversion_happened(converted)
</span><del>- self.verify_test_harness_paths(converter, converted[1], fake_dir_path, 2, 1)
</del><ins>+ self.verify_test_harness_paths(converter, converted[2], fake_dir_path, 2, 1)
</ins><span class="cx">
</span><span class="cx"> def test_convert_prefixed_properties(self):
</span><span class="cx"> """ Tests convert_prefixed_properties() file that has 20 properties requiring the -webkit- prefix:
</span><span class="lines">@@ -219,60 +224,62 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .block2 {
</span><del>- @test0@: propvalue;
</del><ins>+ @test0@: @propvalue0@;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.block3{@test1@: propvalue;}
</del><ins>+.block3{@test1@: @propvalue1@;}
</ins><span class="cx">
</span><del>-.block4 { @test2@:propvalue; }
</del><ins>+.block4 { @test2@:@propvalue2@; }
</ins><span class="cx">
</span><del>-.block5{ @test3@ :propvalue; }
</del><ins>+.block5{ @test3@ :@propvalue3@; }
</ins><span class="cx">
</span><del>-#block6 { @test4@ : propvalue; }
</del><ins>+#block6 { @test4@ : @propvalue4@ ; }
</ins><span class="cx">
</span><span class="cx"> #block7
</span><span class="cx"> {
</span><del>- @test5@: propvalue;
</del><ins>+ @test5@: @propvalue5@;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-#block8 { @test6@: propvalue; }
</del><ins>+#block8 { @test6@: @propvalue6@ }
</ins><span class="cx">
</span><span class="cx"> #block9:pseudo
</span><span class="cx"> {
</span><span class="cx">
</span><del>- @test7@: propvalue;
</del><ins>+ @test7@: @propvalue7@;
</ins><span class="cx"> @test8@: propvalue propvalue propvalue;;
</span><ins>+ propname:
+@propvalue8@;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ]]></style>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><del>- <div id="elem1" style="@test9@: propvalue;"></div>
- <div id="elem2" style="propname: propvalue; @test10@ : propvalue; propname:propvalue;"></div>
- <div id="elem2" style="@test11@: propvalue; @test12@ : propvalue; @test13@ :propvalue;"></div>
- <div id="elem3" style="@test14@:propvalue"></div>
</del><ins>+ <div id="elem1" style="@test9@: @propvalue9@;"></div>
+ <div id="elem2" style="propname: propvalue; @test10@ : @propvalue10@; propname:propvalue;"></div>
+ <div id="elem2" style="@test11@: @propvalue11@; @test12@ : @propvalue12@; @test13@ : @propvalue13@ ;"></div>
+ <div id="elem3" style="@test14@:@propvalue14@"></div>
</ins><span class="cx"> </body>
</span><span class="cx"> <style type="text/css"><![CDATA[
</span><span class="cx">
</span><del>-.block10{ @test15@: propvalue; }
-.block11{ @test16@: propvalue; }
-.block12{ @test17@: propvalue; }
</del><ins>+.block10{ @test15@: @propvalue15@; }
+.block11{ @test16@: @propvalue16@; }
+.block12{ @test17@: @propvalue17@; }
</ins><span class="cx"> #block13:pseudo
</span><span class="cx"> {
</span><del>- @test18@: propvalue;
- @test19@: propvalue;
</del><ins>+ @test18@: @propvalue18@;
+ @test19@: @propvalue19@;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ]]></style>
</span><span class="cx"> </html>
</span><span class="cx"> """
</span><span class="cx"> converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None)
</span><del>- test_content = self.generate_test_content(converter.prefixed_properties, 20, test_html)
</del><ins>+ test_content = self.generate_test_content_properties_and_values(converter.prefixed_properties, converter.prefixed_property_values, 20, test_html)
</ins><span class="cx">
</span><span class="cx"> oc = OutputCapture()
</span><span class="cx"> oc.capture_output()
</span><span class="cx"> try:
</span><del>- converter.feed(test_content[1])
</del><ins>+ converter.feed(test_content[2])
</ins><span class="cx"> converter.close()
</span><span class="cx"> converted = converter.output()
</span><span class="cx"> finally:
</span><span class="lines">@@ -280,12 +287,13 @@
</span><span class="cx">
</span><span class="cx"> self.verify_conversion_happened(converted)
</span><span class="cx"> self.verify_prefixed_properties(converted, test_content[0])
</span><ins>+ self.verify_prefixed_property_values(converted, test_content[1])
</ins><span class="cx">
</span><span class="cx"> def verify_conversion_happened(self, converted):
</span><span class="cx"> self.assertTrue(converted, "conversion didn't happen")
</span><span class="cx">
</span><span class="cx"> def verify_no_conversion_happened(self, converted, original):
</span><del>- self.assertEqual(converted[1], original, 'test should not have been converted')
</del><ins>+ self.assertEqual(converted[2], original, 'test should not have been converted')
</ins><span class="cx">
</span><span class="cx"> def verify_test_harness_paths(self, converter, converted, test_path, num_src_paths, num_href_paths):
</span><span class="cx"> if isinstance(converted, basestring):
</span><span class="lines">@@ -306,24 +314,34 @@
</span><span class="cx"> def verify_prefixed_properties(self, converted, test_properties):
</span><span class="cx"> self.assertEqual(len(set(converted[0])), len(set(test_properties)), 'Incorrect number of properties converted')
</span><span class="cx"> for test_prop in test_properties:
</span><del>- self.assertTrue((test_prop in converted[1]), 'Property ' + test_prop + ' not found in converted doc')
</del><ins>+ self.assertTrue((test_prop in converted[2]), 'Property ' + test_prop + ' not found in converted doc')
</ins><span class="cx">
</span><del>- def generate_test_content(self, full_property_list, num_test_properties, html):
- """Inserts properties requiring a -webkit- prefix into the content, replacing \'@testXX@\' with a property."""
- test_properties = []
</del><ins>+ def verify_prefixed_property_values(self, converted, test_property_values):
+ self.assertEqual(len(set(converted[1])), len(set(test_property_values)), 'Incorrect number of property values converted ' + str(len(set(converted[1]))) + ' vs ' + str(len(set(test_property_values))))
+ for test_value in test_property_values:
+ self.assertTrue((test_value in converted[2]), 'Property value ' + test_value + ' not found in converted doc')
+
+ def generate_test_content_properties_and_values(self, full_property_list, fully_property_values_list, num_test_properties_and_values, html):
+ """Inserts properties requiring a -webkit- prefix into the content, replacing \'@testXX@\' with a property and \'@propvalueXX@\' with a value."""
+ test_content_properties = self.generate_test_content(full_property_list, num_test_properties_and_values, 'test', html)
+ test_content_property_values = self.generate_test_content(fully_property_values_list, num_test_properties_and_values, 'propvalue', test_content_properties[1])
+ return (test_content_properties[0], test_content_property_values[0], test_content_property_values[1])
+
+ def generate_test_content(self, full_list, num_test, suffix, html):
+ test_list = []
</ins><span class="cx"> count = 0
</span><del>- while count < num_test_properties:
- test_properties.append(full_property_list[count])
</del><ins>+ while count < num_test:
+ test_list.append(full_list[count])
</ins><span class="cx"> count += 1
</span><span class="cx">
</span><del>- # Replace the tokens in the testhtml with the test properties. Walk backward
- # through the list to replace the double-digit tokens first
- index = len(test_properties) - 1
</del><ins>+ # Replace the tokens in the testhtml with the test properties or values.
+ # Walk backward through the list to replace the double-digit tokens first.
+ index = len(test_list) - 1
</ins><span class="cx"> while index >= 0:
</span><span class="cx"> # Use the unprefixed version
</span><del>- test_prop = test_properties[index].replace('-webkit-', '')
</del><ins>+ test = test_list[index].replace('-webkit-', '')
</ins><span class="cx"> # Replace the token
</span><del>- html = html.replace('@test' + str(index) + '@', test_prop)
</del><ins>+ html = html.replace('@' + suffix + str(index) + '@', test)
</ins><span class="cx"> index -= 1
</span><span class="cx">
</span><del>- return (test_properties, html)
</del><ins>+ return (test_list, html)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyw3ctest_importerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer.py (174671 => 174672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/w3c/test_importer.py        2014-10-14 06:58:15 UTC (rev 174671)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer.py        2014-10-14 08:08:05 UTC (rev 174672)
</span><span class="lines">@@ -239,6 +239,7 @@
</span><span class="cx"> total_imported_reftests = 0
</span><span class="cx"> total_imported_jstests = 0
</span><span class="cx"> total_prefixed_properties = {}
</span><ins>+ total_prefixed_property_values = {}
</ins><span class="cx">
</span><span class="cx"> failed_conversion_files = []
</span><span class="cx">
</span><span class="lines">@@ -248,6 +249,7 @@
</span><span class="cx"> total_imported_jstests += dir_to_copy['jstests']
</span><span class="cx">
</span><span class="cx"> prefixed_properties = []
</span><ins>+ prefixed_property_values = []
</ins><span class="cx">
</span><span class="cx"> if not dir_to_copy['copy_list']:
</span><span class="cx"> continue
</span><span class="lines">@@ -312,8 +314,15 @@
</span><span class="cx"> total_prefixed_properties[prefixed_property] += 1
</span><span class="cx">
</span><span class="cx"> prefixed_properties.extend(set(converted_file[0]) - set(prefixed_properties))
</span><ins>+
+ for prefixed_value in converted_file[1]:
+ total_prefixed_property_values.setdefault(prefixed_value, 0)
+ total_prefixed_property_values[prefixed_value] += 1
+
+ prefixed_property_values.extend(set(converted_file[1]) - set(prefixed_property_values))
+
</ins><span class="cx"> outfile = open(new_filepath, 'wb')
</span><del>- outfile.write(converted_file[1])
</del><ins>+ outfile.write(converted_file[2])
</ins><span class="cx"> outfile.close()
</span><span class="cx"> else:
</span><span class="cx"> shutil.copyfile(orig_filepath, new_filepath)
</span><span class="lines">@@ -321,7 +330,7 @@
</span><span class="cx"> copied_files.append(new_filepath.replace(self._webkit_root, ''))
</span><span class="cx">
</span><span class="cx"> self.remove_deleted_files(new_path, copied_files)
</span><del>- self.write_import_log(new_path, copied_files, prefixed_properties)
</del><ins>+ self.write_import_log(new_path, copied_files, prefixed_properties, prefixed_property_values)
</ins><span class="cx">
</span><span class="cx"> _log.info('Import complete')
</span><span class="cx">
</span><span class="lines">@@ -336,7 +345,12 @@
</span><span class="cx">
</span><span class="cx"> for prefixed_property in sorted(total_prefixed_properties, key=lambda p: total_prefixed_properties[p]):
</span><span class="cx"> _log.info(' %s: %s', prefixed_property, total_prefixed_properties[prefixed_property])
</span><ins>+ _log.info('')
+ _log.info('Property values needing prefixes (by count):')
</ins><span class="cx">
</span><ins>+ for prefixed_value in sorted(total_prefixed_property_values, key=lambda p: total_prefixed_property_values[p]):
+ _log.info(' %s: %s', prefixed_value, total_prefixed_property_values[prefixed_value])
+
</ins><span class="cx"> def remove_deleted_files(self, import_directory, new_file_list):
</span><span class="cx"> """ Reads an import log in |import_directory|, compares it to the |new_file_list|, and removes files not in the new list."""
</span><span class="cx">
</span><span class="lines">@@ -361,7 +375,7 @@
</span><span class="cx">
</span><span class="cx"> import_log.close()
</span><span class="cx">
</span><del>- def write_import_log(self, import_directory, file_list, prop_list):
</del><ins>+ def write_import_log(self, import_directory, file_list, prop_list, property_values_list):
</ins><span class="cx"> """ Writes a w3c-import.log file in each directory with imported files. """
</span><span class="cx">
</span><span class="cx"> now = datetime.datetime.now()
</span><span class="lines">@@ -384,6 +398,12 @@
</span><span class="cx"> import_log.write(prop + '\n')
</span><span class="cx"> else:
</span><span class="cx"> import_log.write('None\n')
</span><ins>+ import_log.write('Property values requiring vendor prefixes:\n')
+ if property_values_list:
+ for value in property_values_list:
+ import_log.write(value + '\n')
+ else:
+ import_log.write('None\n')
</ins><span class="cx"> import_log.write('------------------------------------------------------------------------\n')
</span><span class="cx"> import_log.write('List of files:\n')
</span><span class="cx"> for item in file_list:
</span></span></pre>
</div>
</div>
</body>
</html>