<!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>[209012] 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/209012">209012</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-11-28 13:37:07 -0800 (Mon, 28 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Teach webkitpy how to read CSSProperties.json <a href="http://trac.webkit.org/projects/webkit/changeset/209001">r209001</a>
https://bugs.webkit.org/show_bug.cgi?id=165108

Reviewed by Simon Fraser.

Fix webkitpy logic so that it can read CSS property names from CSSProperties.json following <a href="http://trac.webkit.org/projects/webkit/changeset/209001">r209001</a>.

Following <a href="http://trac.webkit.org/projects/webkit/changeset/209001">r209001</a> CSSPropertyNames.in no longer exists as it was replaced with CSSProperties.json.
We need to modify the webkitpy machinery that processed CSSPropertyNames.in to process CSSProperties.json.

* Scripts/webkitpy/w3c/test_converter.py:
(_W3CTestConverter.__init__): Make self._css_property_file and self._css_property_value_file local
variables as it is unnecessary for them to be instance variables. Call read_webkit_prefixed_css_property_list()
to read the property names from file CSSProperties.json. Call legacy_read_webkit_prefixed_css_property_list() to
read CSS keyword values from CSSValueKeywords.in.
(_W3CTestConverter.read_webkit_prefixed_css_property_list): Added.
(_W3CTestConverter):
(_W3CTestConverter.legacy_read_webkit_prefixed_css_property_list): Renamed from read_webkit_prefixed_css_property_list.
* Scripts/webkitpy/w3c/test_importer_unittest.py:
(TestImporterTest.test_harnesslinks_conversion): Substitute CSSProperties.json for CSSPropertyNames.in.</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_importer_unittestpy">trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209011 => 209012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-11-28 21:26:10 UTC (rev 209011)
+++ trunk/Tools/ChangeLog        2016-11-28 21:37:07 UTC (rev 209012)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-11-28  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Teach webkitpy how to read CSSProperties.json r209001
+        https://bugs.webkit.org/show_bug.cgi?id=165108
+
+        Reviewed by Simon Fraser.
+
+        Fix webkitpy logic so that it can read CSS property names from CSSProperties.json following r209001.
+
+        Following r209001 CSSPropertyNames.in no longer exists as it was replaced with CSSProperties.json.
+        We need to modify the webkitpy machinery that processed CSSPropertyNames.in to process CSSProperties.json.
+
+        * Scripts/webkitpy/w3c/test_converter.py:
+        (_W3CTestConverter.__init__): Make self._css_property_file and self._css_property_value_file local
+        variables as it is unnecessary for them to be instance variables. Call read_webkit_prefixed_css_property_list()
+        to read the property names from file CSSProperties.json. Call legacy_read_webkit_prefixed_css_property_list() to
+        read CSS keyword values from CSSValueKeywords.in.
+        (_W3CTestConverter.read_webkit_prefixed_css_property_list): Added.
+        (_W3CTestConverter):
+        (_W3CTestConverter.legacy_read_webkit_prefixed_css_property_list): Renamed from read_webkit_prefixed_css_property_list.
+        * Scripts/webkitpy/w3c/test_importer_unittest.py:
+        (TestImporterTest.test_harnesslinks_conversion): Substitute CSSProperties.json for CSSPropertyNames.in.
+
</ins><span class="cx"> 2016-11-28  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyw3ctest_converterpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter.py (209011 => 209012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/w3c/test_converter.py        2016-11-28 21:26:10 UTC (rev 209011)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter.py        2016-11-28 21:37:07 UTC (rev 209012)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
</span><span class="cx"> # SUCH DAMAGE.
</span><span class="cx"> 
</span><ins>+import json
</ins><span class="cx"> import logging
</span><span class="cx"> import re
</span><span class="cx"> 
</span><span class="lines">@@ -73,16 +74,16 @@
</span><span class="cx">         self.convert_test_harness_links = convert_test_harness_links
</span><span class="cx"> 
</span><span class="cx">         # These settings might vary between WebKit and Blink
</span><del>-        self._css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSPropertyNames.in')
-        self._css_property_value_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSValueKeywords.in')
</del><ins>+        css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSProperties.json')
+        css_property_value_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSValueKeywords.in')
</ins><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(self._css_property_file)
</del><ins>+        self.prefixed_properties = self.read_webkit_prefixed_css_property_list(css_property_file)
</ins><span class="cx">         prop_regex = '([\s{]|^)(' + &quot;|&quot;.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><del>-        self.prefixed_property_values = self.read_webkit_prefixed_css_property_list(self._css_property_value_file)
</del><ins>+        self.prefixed_property_values = self.legacy_read_webkit_prefixed_css_property_list(css_property_value_file)
</ins><span class="cx">         prop_value_regex = '(:\s*|^\s*)(' + &quot;|&quot;.join(value.replace('-webkit-', '') for value in self.prefixed_property_values) + ')(\s*;|\s*}|\s*$)'
</span><span class="cx">         self.prop_value_re = re.compile(prop_value_regex)
</span><span class="cx"> 
</span><span class="lines">@@ -94,9 +95,35 @@
</span><span class="cx"> 
</span><span class="cx">     def read_webkit_prefixed_css_property_list(self, file_name):
</span><span class="cx">         contents = self._filesystem.read_text_file(file_name)
</span><ins>+        if not contents:
+            return []
+        properties = json.loads(contents)['properties']
+        property_names = []
+        for property_name, property_dict in properties.iteritems():
+            property_names.append(property_name)
+            if 'codegen-properties' in property_dict:
+                codegen_options = property_dict['codegen-properties']
+                if 'aliases' in codegen_options:
+                    property_names.extend(codegen_options['aliases'])
+
</ins><span class="cx">         prefixed_properties = []
</span><span class="cx">         unprefixed_properties = set()
</span><ins>+        for property_name in property_names:
+            # Find properties starting with the -webkit- prefix.
+            match = re.match('-webkit-([\w|-]*)', property_name)
+            if match:
+                prefixed_properties.append(match.group(1))
+            else:
+                unprefixed_properties.add(property_name)
</ins><span class="cx"> 
</span><ins>+        # Ignore any prefixed properties for which an unprefixed version is supported
+        return [prop for prop in prefixed_properties if prop not in unprefixed_properties]
+
+    def legacy_read_webkit_prefixed_css_property_list(self, file_name):
+        contents = self._filesystem.read_text_file(file_name)
+        prefixed_properties = []
+        unprefixed_properties = set()
+
</ins><span class="cx">         for line in contents.splitlines():
</span><span class="cx">             if re.match('^(#|//)', line) or len(line.strip()) == 0:
</span><span class="cx">                 # skip comments and preprocessor directives and empty lines.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyw3ctest_importer_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py (209011 => 209012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py        2016-11-28 21:26:10 UTC (rev 209011)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py        2016-11-28 21:37:07 UTC (rev 209012)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">         FAKE_FILES = {
</span><span class="cx">             '/mock-checkout/WebKitBuild/w3c-tests/csswg-tests/t/test.html': '&lt;!doctype html&gt;&lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;',
</span><span class="cx">             '/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests/t/test.html': '&lt;!doctype html&gt;&lt;script src=&quot;/resources/testharness.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;/resources/testharnessreport.js&quot;&gt;&lt;/script&gt;',
</span><del>-            '/mock-checkout/Source/WebCore/css/CSSPropertyNames.in': '',
</del><ins>+            '/mock-checkout/Source/WebCore/css/CSSProperties.json': '',
</ins><span class="cx">             '/mock-checkout/Source/WebCore/css/CSSValueKeywords.in': '',
</span><span class="cx">         }
</span><span class="cx">         FAKE_FILES.update(FAKE_REPOSITORY)
</span></span></pre>
</div>
</div>

</body>
</html>