<!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 <mmaxfield@apple.com>
+
+ 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 <cdumez@apple.com>
</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 "italic"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test19')).fontStyle is "italic"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal"
</span><ins>+PASS window.getComputedStyle(document.getElementById('test21')).fontStyle is "14deg"
</ins><span class="cx"> PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test3')).font is "16px/18px Times"
</span><span class="lines">@@ -38,6 +39,7 @@
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test18')).font is "italic normal normal normal 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test19')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal normal normal 16px/18px Times"
</span><ins>+PASS window.getComputedStyle(document.getElementById('test21')).font is "48px/49px 'Helvetica Neue'"
</ins><span class="cx"> PASS document.getElementById('test1').style.font is ""
</span><span class="cx"> PASS document.getElementById('test15').style.font is "italic 100 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS document.getElementById('test16').style.font is "italic 100 48px/49px 'Helvetica Neue'"
</span><span class="lines">@@ -45,6 +47,7 @@
</span><span class="cx"> PASS document.getElementById('test18').style.font is "italic 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS document.getElementById('test19').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS document.getElementById('test20').style.font is ""
</span><ins>+PASS document.getElementById('test21').style.font is "14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'"
</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"> <div style="font-stretch: normal;"><div id="test18" style="font: italic 48px/49px 'Helvetica Neue';"></div></div>
</span><span class="cx"> <div id="test19" style="font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';"></div>
</span><span class="cx"> <div id="test20" style="font: 13deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div>
</span><ins>+<div id="test21" style="font: oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div>
</ins><span class="cx"> </div>
</span><span class="cx"> <script>
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontStyle", "normal");
</span><span class="lines">@@ -47,6 +48,7 @@
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).fontStyle", "italic");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).fontStyle", "italic");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontStyle", "normal");
</span><ins>+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontStyle", "14deg");
</ins><span class="cx">
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "16px/18px Times");
</span><span class="lines">@@ -68,6 +70,7 @@
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).font", "italic normal normal normal 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).font", "normal normal normal normal 16px/18px Times");
</span><ins>+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).font", "48px/49px 'Helvetica Neue'");
</ins><span class="cx">
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test1').style.font", "");
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test15').style.font", "italic 100 48px/49px 'Helvetica Neue'");
</span><span class="lines">@@ -76,6 +79,7 @@
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test18').style.font", "italic 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test19').style.font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test20').style.font", "");
</span><ins>+shouldBeEqualToString("document.getElementById('test21').style.font", "14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'");
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</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 "normal"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test22')).fontWeight is "100"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test23')).fontWeight is "100"
</span><del>-PASS window.getComputedStyle(document.getElementById('test24')).fontWeight is "normal"
</del><ins>+PASS window.getComputedStyle(document.getElementById('test24')).fontWeight is "123"
+PASS window.getComputedStyle(document.getElementById('test25')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test26')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test27')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test28')).fontWeight is "0"
+PASS window.getComputedStyle(document.getElementById('test29')).fontWeight is "1000"
</ins><span class="cx"> PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test3')).font is "normal normal 100 normal 16px/18px Times"
</span><span class="lines">@@ -45,7 +50,12 @@
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test21')).font is "normal normal normal extra-condensed 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test22')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS window.getComputedStyle(document.getElementById('test23')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
</span><del>-PASS window.getComputedStyle(document.getElementById('test24')).font is "italic small-caps normal extra-expanded 48px/49px 'Helvetica Neue'"
</del><ins>+PASS window.getComputedStyle(document.getElementById('test24')).font is "48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test25')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test26')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test27')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test28')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test29')).font is "16px/18px Times"
</ins><span class="cx"> PASS document.getElementById('test1').style.font is ""
</span><span class="cx"> PASS document.getElementById('test19').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS document.getElementById('test20').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
</span><span class="lines">@@ -52,7 +62,7 @@
</span><span class="cx"> PASS document.getElementById('test21').style.font is "extra-condensed 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS document.getElementById('test22').style.font is "100 48px/49px 'Helvetica Neue'"
</span><span class="cx"> PASS document.getElementById('test23').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
</span><del>-PASS document.getElementById('test24').style.font is "italic small-caps extra-expanded 48px/49px 'Helvetica Neue'"
</del><ins>+PASS document.getElementById('test24').style.font is "italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'"
</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"> <div style="font-weight: 275;"><div id="test22" style="font: 100 48px/49px 'Helvetica Neue';"></div></div>
</span><span class="cx"> <div id="test23" style="font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';"></div>
</span><span class="cx"> <div id="test24" style="font: italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div>
</span><ins>+<div id="test25" style="font-weight: 0;"></div>
+<div id="test26" style="font-weight: -7;"></div>
+<div id="test27" style="font-weight: 1623;"></div>
+<div id="test28" style="font-weight: calc(-4 - 5);"></div>
+<div id="test29" style="font-weight: calc(600 + 700);"></div>
</ins><span class="cx"> </div>
</span><span class="cx"> <script>
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontWeight", "normal");
</span><span class="lines">@@ -54,7 +59,12 @@
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontWeight", "normal");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).fontWeight", "100");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test23')).fontWeight", "100");
</span><del>-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).fontWeight", "normal");
</del><ins>+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).fontWeight", "123");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test25')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test26')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test27')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test28')).fontWeight", "0");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test29')).fontWeight", "1000");
</ins><span class="cx">
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "16px/18px Times");
</span><span class="lines">@@ -79,7 +89,12 @@
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).font", "normal normal normal extra-condensed 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).font", "normal normal 100 normal 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("window.getComputedStyle(document.getElementById('test23')).font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
</span><del>-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).font", "italic small-caps normal extra-expanded 48px/49px 'Helvetica Neue'");
</del><ins>+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).font", "48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test25')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test26')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test27')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test28')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test29')).font", "16px/18px Times");
</ins><span class="cx">
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test1').style.font", "");
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test19').style.font", "100 extra-condensed 48px/49px 'Helvetica Neue'");
</span><span class="lines">@@ -87,7 +102,7 @@
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test21').style.font", "extra-condensed 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test22').style.font", "100 48px/49px 'Helvetica Neue'");
</span><span class="cx"> shouldBeEqualToString("document.getElementById('test23').style.font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
</span><del>-shouldBeEqualToString("document.getElementById('test24').style.font", "italic small-caps extra-expanded 48px/49px 'Helvetica Neue'");
</del><ins>+shouldBeEqualToString("document.getElementById('test24').style.font", "italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'");
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</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 <mmaxfield@apple.com>
+
+ 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 <cdumez@apple.com>
</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<CSSValueNormal, CSSValueBold, CSSValueBolder, CSSValueLighter>(range);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static RefPtr<CSSPrimitiveValue> consumeFontWeightCSS21(CSSParserTokenRange& 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<CSSPrimitiveValue> consumeFontWeight(CSSParserTokenRange& 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<CSSPrimitiveValue> consumeFontWeightNumber(CSSParserTokenRange& range)
+{
+ // Values less than or equal to 0 or greater than or equal to 1000 are parse errors.
+ auto& token = range.peek();
+ if (token.type() == NumberToken && token.numericValue() > 0 && token.numericValue() < 1000)
+ return consumeNumber(range, ValueRangeAll);
+
+ // "[For calc()], the used value resulting from an expression must be clamped to the range allowed in the target context."
+ 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<CSSPrimitiveValue> consumePositiveInteger(CSSParserTokenRange&);
</span><span class="cx"> bool consumeNumberRaw(CSSParserTokenRange&, double& result);
</span><span class="cx"> RefPtr<CSSPrimitiveValue> consumeNumber(CSSParserTokenRange&, ValueRange);
</span><ins>+RefPtr<CSSPrimitiveValue> consumeFontWeightNumber(CSSParserTokenRange&);
</ins><span class="cx"> RefPtr<CSSPrimitiveValue> consumeLength(CSSParserTokenRange&, CSSParserMode, ValueRange, UnitlessQuirk = UnitlessQuirk::Forbid);
</span><span class="cx"> RefPtr<CSSPrimitiveValue> consumePercent(CSSParserTokenRange&, ValueRange);
</span><span class="cx"> RefPtr<CSSPrimitiveValue> consumeLengthOrPercent(CSSParserTokenRange&, CSSParserMode, ValueRange, UnitlessQuirk = UnitlessQuirk::Forbid);
</span></span></pre>
</div>
</div>
</body>
</html>