<!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>[214324] trunk</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/214324">214324</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2017-03-23 16:14:02 -0700 (Thu, 23 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>font shorthand should accept variation values
https://bugs.webkit.org/show_bug.cgi?id=168998

Reviewed by Simon Fraser.

Source/WebCore:

The CSS Fonts 4 spec has stabilized as to which variation values are allowed in
the font shorthand property. Weights are allowed because a 0 weight is considered
as a parse error, so there is no conflict with a unitless font-size of 0.
font-style accepts angles, so there is no conflict there. However, font-stretch
accepts percentages, which are also accepted by font-size, which means the newly
extended grammar for font-stretch can't be accepted in the shorthand.

Tests: fast/text/font-style-parse.html
       fast/text/font-weight-parse.html

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontWeight):
(WebCore::consumeFontStyle):
(WebCore::CSSPropertyParser::consumeFont):
(WebCore::consumeFontWeightCSS21): Deleted.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
* css/parser/CSSPropertyParserHelpers.h:

LayoutTests:

* fast/text/font-style-parse-expected.txt:
* fast/text/font-style-parse.html:
* fast/text/font-weight-parse-expected.txt:
* fast/text/font-weight-parse.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasttextfontstyleparseexpectedtxt">trunk/LayoutTests/fast/text/font-style-parse-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasttextfontstyleparsehtml">trunk/LayoutTests/fast/text/font-style-parse.html</a></li>
<li><a href="#trunkLayoutTestsfasttextfontweightparseexpectedtxt">trunk/LayoutTests/fast/text/font-weight-parse-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasttextfontweightparsehtml">trunk/LayoutTests/fast/text/font-weight-parse.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParsercpp">trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserHelperscpp">trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserHelpersh">trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/LayoutTests/ChangeLog        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-03-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        font shorthand should accept variation values
+        https://bugs.webkit.org/show_bug.cgi?id=168998
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/font-style-parse-expected.txt:
+        * fast/text/font-style-parse.html:
+        * fast/text/font-weight-parse-expected.txt:
+        * fast/text/font-weight-parse.html:
+
</ins><span class="cx"> 2017-03-23  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         SVG animations are not paused when inserted into a hidden page
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontstyleparseexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-style-parse-expected.txt (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-style-parse-expected.txt        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/LayoutTests/fast/text/font-style-parse-expected.txt        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -18,6 +18,7 @@
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test18')).fontStyle is &quot;italic&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test19')).fontStyle is &quot;italic&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is &quot;normal&quot;
</span><ins>+PASS window.getComputedStyle(document.getElementById('test21')).fontStyle is &quot;14deg&quot;
</ins><span class="cx"> PASS window.getComputedStyle(document.getElementById('test1')).font is &quot;normal normal normal normal 16px/18px Times&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test2')).font is &quot;16px/18px Times&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test3')).font is &quot;16px/18px Times&quot;
</span><span class="lines">@@ -38,6 +39,7 @@
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test18')).font is &quot;italic normal normal normal 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test19')).font is &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test20')).font is &quot;normal normal normal normal 16px/18px Times&quot;
</span><ins>+PASS window.getComputedStyle(document.getElementById('test21')).font is &quot;48px/49px 'Helvetica Neue'&quot;
</ins><span class="cx"> PASS document.getElementById('test1').style.font is &quot;&quot;
</span><span class="cx"> PASS document.getElementById('test15').style.font is &quot;italic 100 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS document.getElementById('test16').style.font is &quot;italic 100 48px/49px 'Helvetica Neue'&quot;
</span><span class="lines">@@ -45,6 +47,7 @@
</span><span class="cx"> PASS document.getElementById('test18').style.font is &quot;italic 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS document.getElementById('test19').style.font is &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS document.getElementById('test20').style.font is &quot;&quot;
</span><ins>+PASS document.getElementById('test21').style.font is &quot;14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontstyleparsehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-style-parse.html (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-style-parse.html        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/LayoutTests/fast/text/font-style-parse.html        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> &lt;div style=&quot;font-stretch: normal;&quot;&gt;&lt;div id=&quot;test18&quot; style=&quot;font: italic 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;test19&quot; style=&quot;font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;test20&quot; style=&quot;font: 13deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;
</span><ins>+&lt;div id=&quot;test21&quot; style=&quot;font: oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test1')).fontStyle&quot;, &quot;normal&quot;);
</span><span class="lines">@@ -47,6 +48,7 @@
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test18')).fontStyle&quot;, &quot;italic&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test19')).fontStyle&quot;, &quot;italic&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test20')).fontStyle&quot;, &quot;normal&quot;);
</span><ins>+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test21')).fontStyle&quot;, &quot;14deg&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test1')).font&quot;, &quot;normal normal normal normal 16px/18px Times&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test2')).font&quot;, &quot;16px/18px Times&quot;);
</span><span class="lines">@@ -68,6 +70,7 @@
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test18')).font&quot;, &quot;italic normal normal normal 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test19')).font&quot;, &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test20')).font&quot;, &quot;normal normal normal normal 16px/18px Times&quot;);
</span><ins>+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test21')).font&quot;, &quot;48px/49px 'Helvetica Neue'&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test1').style.font&quot;, &quot;&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test15').style.font&quot;, &quot;italic 100 48px/49px 'Helvetica Neue'&quot;);
</span><span class="lines">@@ -76,6 +79,7 @@
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test18').style.font&quot;, &quot;italic 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test19').style.font&quot;, &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test20').style.font&quot;, &quot;&quot;);
</span><ins>+shouldBeEqualToString(&quot;document.getElementById('test21').style.font&quot;, &quot;14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontweightparseexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-weight-parse-expected.txt (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-weight-parse-expected.txt        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/LayoutTests/fast/text/font-weight-parse-expected.txt        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -21,7 +21,12 @@
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test21')).fontWeight is &quot;normal&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test22')).fontWeight is &quot;100&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test23')).fontWeight is &quot;100&quot;
</span><del>-PASS window.getComputedStyle(document.getElementById('test24')).fontWeight is &quot;normal&quot;
</del><ins>+PASS window.getComputedStyle(document.getElementById('test24')).fontWeight is &quot;123&quot;
+PASS window.getComputedStyle(document.getElementById('test25')).fontWeight is &quot;normal&quot;
+PASS window.getComputedStyle(document.getElementById('test26')).fontWeight is &quot;normal&quot;
+PASS window.getComputedStyle(document.getElementById('test27')).fontWeight is &quot;normal&quot;
+PASS window.getComputedStyle(document.getElementById('test28')).fontWeight is &quot;0&quot;
+PASS window.getComputedStyle(document.getElementById('test29')).fontWeight is &quot;1000&quot;
</ins><span class="cx"> PASS window.getComputedStyle(document.getElementById('test1')).font is &quot;normal normal normal normal 16px/18px Times&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test2')).font is &quot;16px/18px Times&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test3')).font is &quot;normal normal 100 normal 16px/18px Times&quot;
</span><span class="lines">@@ -45,7 +50,12 @@
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test21')).font is &quot;normal normal normal extra-condensed 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test22')).font is &quot;normal normal 100 normal 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test23')).font is &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;
</span><del>-PASS window.getComputedStyle(document.getElementById('test24')).font is &quot;italic small-caps normal extra-expanded 48px/49px 'Helvetica Neue'&quot;
</del><ins>+PASS window.getComputedStyle(document.getElementById('test24')).font is &quot;48px/49px 'Helvetica Neue'&quot;
+PASS window.getComputedStyle(document.getElementById('test25')).font is &quot;normal normal normal normal 16px/18px Times&quot;
+PASS window.getComputedStyle(document.getElementById('test26')).font is &quot;normal normal normal normal 16px/18px Times&quot;
+PASS window.getComputedStyle(document.getElementById('test27')).font is &quot;normal normal normal normal 16px/18px Times&quot;
+PASS window.getComputedStyle(document.getElementById('test28')).font is &quot;16px/18px Times&quot;
+PASS window.getComputedStyle(document.getElementById('test29')).font is &quot;16px/18px Times&quot;
</ins><span class="cx"> PASS document.getElementById('test1').style.font is &quot;&quot;
</span><span class="cx"> PASS document.getElementById('test19').style.font is &quot;100 extra-condensed 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS document.getElementById('test20').style.font is &quot;100 extra-condensed 48px/49px 'Helvetica Neue'&quot;
</span><span class="lines">@@ -52,7 +62,7 @@
</span><span class="cx"> PASS document.getElementById('test21').style.font is &quot;extra-condensed 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS document.getElementById('test22').style.font is &quot;100 48px/49px 'Helvetica Neue'&quot;
</span><span class="cx"> PASS document.getElementById('test23').style.font is &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;
</span><del>-PASS document.getElementById('test24').style.font is &quot;italic small-caps extra-expanded 48px/49px 'Helvetica Neue'&quot;
</del><ins>+PASS document.getElementById('test24').style.font is &quot;italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontweightparsehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-weight-parse.html (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-weight-parse.html        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/LayoutTests/fast/text/font-weight-parse.html        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -29,6 +29,11 @@
</span><span class="cx"> &lt;div style=&quot;font-weight: 275;&quot;&gt;&lt;div id=&quot;test22&quot; style=&quot;font: 100 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;test23&quot; style=&quot;font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;test24&quot; style=&quot;font: italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';&quot;&gt;&lt;/div&gt;
</span><ins>+&lt;div id=&quot;test25&quot; style=&quot;font-weight: 0;&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;test26&quot; style=&quot;font-weight: -7;&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;test27&quot; style=&quot;font-weight: 1623;&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;test28&quot; style=&quot;font-weight: calc(-4 - 5);&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;test29&quot; style=&quot;font-weight: calc(600 + 700);&quot;&gt;&lt;/div&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test1')).fontWeight&quot;, &quot;normal&quot;);
</span><span class="lines">@@ -54,7 +59,12 @@
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test21')).fontWeight&quot;, &quot;normal&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test22')).fontWeight&quot;, &quot;100&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test23')).fontWeight&quot;, &quot;100&quot;);
</span><del>-shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test24')).fontWeight&quot;, &quot;normal&quot;);
</del><ins>+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test24')).fontWeight&quot;, &quot;123&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test25')).fontWeight&quot;, &quot;normal&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test26')).fontWeight&quot;, &quot;normal&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test27')).fontWeight&quot;, &quot;normal&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test28')).fontWeight&quot;, &quot;0&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test29')).fontWeight&quot;, &quot;1000&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test1')).font&quot;, &quot;normal normal normal normal 16px/18px Times&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test2')).font&quot;, &quot;16px/18px Times&quot;);
</span><span class="lines">@@ -79,7 +89,12 @@
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test21')).font&quot;, &quot;normal normal normal extra-condensed 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test22')).font&quot;, &quot;normal normal 100 normal 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test23')).font&quot;, &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</span><del>-shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test24')).font&quot;, &quot;italic small-caps normal extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</del><ins>+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test24')).font&quot;, &quot;48px/49px 'Helvetica Neue'&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test25')).font&quot;, &quot;normal normal normal normal 16px/18px Times&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test26')).font&quot;, &quot;normal normal normal normal 16px/18px Times&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test27')).font&quot;, &quot;normal normal normal normal 16px/18px Times&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test28')).font&quot;, &quot;16px/18px Times&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(document.getElementById('test29')).font&quot;, &quot;16px/18px Times&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test1').style.font&quot;, &quot;&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test19').style.font&quot;, &quot;100 extra-condensed 48px/49px 'Helvetica Neue'&quot;);
</span><span class="lines">@@ -87,7 +102,7 @@
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test21').style.font&quot;, &quot;extra-condensed 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test22').style.font&quot;, &quot;100 48px/49px 'Helvetica Neue'&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;document.getElementById('test23').style.font&quot;, &quot;italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</span><del>-shouldBeEqualToString(&quot;document.getElementById('test24').style.font&quot;, &quot;italic small-caps extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</del><ins>+shouldBeEqualToString(&quot;document.getElementById('test24').style.font&quot;, &quot;italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'&quot;);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/Source/WebCore/ChangeLog        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2017-03-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        font shorthand should accept variation values
+        https://bugs.webkit.org/show_bug.cgi?id=168998
+
+        Reviewed by Simon Fraser.
+
+        The CSS Fonts 4 spec has stabilized as to which variation values are allowed in
+        the font shorthand property. Weights are allowed because a 0 weight is considered
+        as a parse error, so there is no conflict with a unitless font-size of 0.
+        font-style accepts angles, so there is no conflict there. However, font-stretch
+        accepts percentages, which are also accepted by font-size, which means the newly
+        extended grammar for font-stretch can't be accepted in the shorthand.
+
+        Tests: fast/text/font-style-parse.html
+               fast/text/font-weight-parse.html
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontWeight):
+        (WebCore::consumeFontStyle):
+        (WebCore::CSSPropertyParser::consumeFont):
+        (WebCore::consumeFontWeightCSS21): Deleted.
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
+        * css/parser/CSSPropertyParserHelpers.h:
+
</ins><span class="cx"> 2017-03-23  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         SVG animations are not paused when inserted into a hidden page
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -869,23 +869,11 @@
</span><span class="cx">     return consumeIdent&lt;CSSValueNormal, CSSValueBold, CSSValueBolder, CSSValueLighter&gt;(range);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static RefPtr&lt;CSSPrimitiveValue&gt; consumeFontWeightCSS21(CSSParserTokenRange&amp; range)
-{
-    if (auto result = consumeFontWeightKeywordValue(range))
-        return result;
-    int weight;
-    if (!consumePositiveIntegerRaw(range, weight))
-        return nullptr;
-    if (!isCSS21Weight(weight))
-        return nullptr;
-    return CSSValuePool::singleton().createValue(weight, CSSPrimitiveValue::CSS_NUMBER);
-}
-
</del><span class="cx"> static RefPtr&lt;CSSPrimitiveValue&gt; consumeFontWeight(CSSParserTokenRange&amp; range)
</span><span class="cx"> {
</span><span class="cx">     if (auto result = consumeFontWeightKeywordValue(range))
</span><span class="cx">         return result;
</span><del>-    return consumeNumber(range, ValueRangeAll);
</del><ins>+    return consumeFontWeightNumber(range);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="lines">@@ -982,7 +970,6 @@
</span><span class="cx">                 return angle;
</span><span class="cx">             if (auto number = consumeNumber(range, ValueRangeAll))
</span><span class="cx">                 return number;
</span><del>-            return nullptr;
</del><span class="cx">         }
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -4430,7 +4417,7 @@
</span><span class="cx">     while (!m_range.atEnd()) {
</span><span class="cx">         CSSValueID id = m_range.peek().id();
</span><span class="cx">         if (!fontStyle) {
</span><del>-            fontStyle = consumeFontStyleKeywordValue(m_range);
</del><ins>+            fontStyle = consumeFontStyle(m_range, m_context.mode);
</ins><span class="cx">             if (fontStyle)
</span><span class="cx">                 continue;
</span><span class="cx">         }
</span><span class="lines">@@ -4442,7 +4429,7 @@
</span><span class="cx">                 continue;
</span><span class="cx">         }
</span><span class="cx">         if (!fontWeight) {
</span><del>-            fontWeight = consumeFontWeightCSS21(m_range);
</del><ins>+            fontWeight = consumeFontWeight(m_range);
</ins><span class="cx">             if (fontWeight)
</span><span class="cx">                 continue;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserHelperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -197,6 +197,24 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RefPtr&lt;CSSPrimitiveValue&gt; consumeFontWeightNumber(CSSParserTokenRange&amp; range)
+{
+    // Values less than or equal to 0 or greater than or equal to 1000 are parse errors.
+    auto&amp; token = range.peek();
+    if (token.type() == NumberToken &amp;&amp; token.numericValue() &gt; 0 &amp;&amp; token.numericValue() &lt; 1000)
+        return consumeNumber(range, ValueRangeAll);
+
+    // &quot;[For calc()], the used value resulting from an expression must be clamped to the range allowed in the target context.&quot;
+    CalcParser calcParser(range, ValueRangeAll);
+    double result;
+    if (calcParser.consumeNumberRaw(result)) {
+        result = std::min(std::max(result, std::nextafter(0., 1.)), std::nextafter(1000., 0.));
+        return CSSValuePool::singleton().createValue(result, CSSPrimitiveValue::UnitType::CSS_NUMBER);
+    }
+
+    return nullptr;
+}
+
</ins><span class="cx"> inline bool shouldAcceptUnitlessValue(double value, CSSParserMode cssParserMode, UnitlessQuirk unitless)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Presentational HTML attributes shouldn't use the CSS parser for lengths
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h (214323 => 214324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h        2017-03-23 22:53:54 UTC (rev 214323)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h        2017-03-23 23:14:02 UTC (rev 214324)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> RefPtr&lt;CSSPrimitiveValue&gt; consumePositiveInteger(CSSParserTokenRange&amp;);
</span><span class="cx"> bool consumeNumberRaw(CSSParserTokenRange&amp;, double&amp; result);
</span><span class="cx"> RefPtr&lt;CSSPrimitiveValue&gt; consumeNumber(CSSParserTokenRange&amp;, ValueRange);
</span><ins>+RefPtr&lt;CSSPrimitiveValue&gt; consumeFontWeightNumber(CSSParserTokenRange&amp;);
</ins><span class="cx"> RefPtr&lt;CSSPrimitiveValue&gt; consumeLength(CSSParserTokenRange&amp;, CSSParserMode, ValueRange, UnitlessQuirk = UnitlessQuirk::Forbid);
</span><span class="cx"> RefPtr&lt;CSSPrimitiveValue&gt; consumePercent(CSSParserTokenRange&amp;, ValueRange);
</span><span class="cx"> RefPtr&lt;CSSPrimitiveValue&gt; consumeLengthOrPercent(CSSParserTokenRange&amp;, CSSParserMode, ValueRange, UnitlessQuirk = UnitlessQuirk::Forbid);
</span></span></pre>
</div>
</div>

</body>
</html>