Title: [214419] trunk
Revision
214419
Author
mmaxfi...@apple.com
Date
2017-03-27 10:50:33 -0700 (Mon, 27 Mar 2017)

Log Message

font variation properties don't need to accept numbers
https://bugs.webkit.org/show_bug.cgi?id=169357

Reviewed by Antti Koivisto.

Source/WebCore:

The CSS Fonts level 4 spec stabilized the grammar accepted by font-weight,
font-style, and font-stretch. The changes are that font-style and
font-stretch no longer accept raw numbers, and the @font-face descriptor
ranges are now separated by spaces instead of slashes.

Tests: fast/text/font-selection-font-face-parse.html
       fast/text/font-selection-font-loading-api-parse.html
       fast/text/font-stretch-parse.html
       fast/text/font-style-parse.html
       fast/text/variations/font-selection-properties.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
(WebCore::fontWeightFromStyle):
(WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
(WebCore::fontStretchFromStyle):
(WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
(WebCore::fontStyleFromStyle):
* css/CSSComputedStyleDeclaration.h:
* css/FontFace.cpp:
(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):
(WebCore::rangeIsSingleValue): Deleted.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontStretchFromValue):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontWeightRange):
(WebCore::consumeFontStretch):
(WebCore::consumeFontStretchRange):
(WebCore::consumeFontStyle):
(WebCore::consumeFontStyleRange):

LayoutTests:

* fast/text/font-selection-font-face-parse-expected.txt:
* fast/text/font-selection-font-face-parse.html:
* fast/text/font-selection-font-loading-api-parse-expected.txt:
* fast/text/font-selection-font-loading-api-parse.html:
* fast/text/font-stretch-parse-expected.txt:
* fast/text/font-stretch-parse.html:
* fast/text/font-style-parse-expected.txt:
* fast/text/font-style-parse.html:
* fast/text/variations/font-selection-properties.html:
* platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214418 => 214419)


--- trunk/LayoutTests/ChangeLog	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/ChangeLog	2017-03-27 17:50:33 UTC (rev 214419)
@@ -1,5 +1,23 @@
 2017-03-27  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        font variation properties don't need to accept numbers
+        https://bugs.webkit.org/show_bug.cgi?id=169357
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/font-selection-font-face-parse-expected.txt:
+        * fast/text/font-selection-font-face-parse.html:
+        * fast/text/font-selection-font-loading-api-parse-expected.txt:
+        * fast/text/font-selection-font-loading-api-parse.html:
+        * fast/text/font-stretch-parse-expected.txt:
+        * fast/text/font-stretch-parse.html:
+        * fast/text/font-style-parse-expected.txt:
+        * fast/text/font-style-parse.html:
+        * fast/text/variations/font-selection-properties.html:
+        * platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
+
+2017-03-27  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         Implement format specifier for variation fonts
         https://bugs.webkit.org/show_bug.cgi?id=169327
 

Modified: trunk/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt	2017-03-27 17:50:33 UTC (rev 214419)
@@ -16,8 +16,8 @@
 PASS weightTestSheet.cssRules[15].style.fontWeight is "7"
 PASS weightTestSheet.cssRules[16].style.fontWeight is "300"
 PASS weightTestSheet.cssRules[17].style.fontWeight is "200"
-PASS weightTestSheet.cssRules[18].style.fontWeight is "100 / 200"
-PASS weightTestSheet.cssRules[19].style.fontWeight is "100 / 200"
+PASS weightTestSheet.cssRules[18].style.fontWeight is "100 200"
+PASS weightTestSheet.cssRules[19].style.fontWeight is "100 200"
 PASS weightTestSheet.cssRules[20].style.fontWeight is ""
 PASS weightTestSheet.cssRules[21].style.fontWeight is ""
 PASS weightTestSheet.cssRules[22].style.fontWeight is ""
@@ -24,13 +24,13 @@
 PASS weightTestSheet.cssRules[23].style.fontWeight is ""
 PASS weightTestSheet.cssRules[24].style.fontWeight is ""
 PASS weightTestSheet.cssRules[25].style.fontWeight is ""
-PASS weightTestSheet.cssRules[26].style.fontWeight is "1 / 2"
-PASS weightTestSheet.cssRules[27].style.fontWeight is "-2 / -1"
+PASS weightTestSheet.cssRules[26].style.fontWeight is "1 2"
+PASS weightTestSheet.cssRules[27].style.fontWeight is "-2 -1"
 PASS weightTestSheet.cssRules[28].style.fontWeight is ""
-PASS weightTestSheet.cssRules[29].style.fontWeight is "7 / 8"
-PASS weightTestSheet.cssRules[30].style.fontWeight is "2 / 7"
+PASS weightTestSheet.cssRules[29].style.fontWeight is "7 8"
+PASS weightTestSheet.cssRules[30].style.fontWeight is "2 7"
 PASS stretchTestSheet.cssRules[0].style.fontStretch is "1%"
-PASS stretchTestSheet.cssRules[1].style.fontStretch is "2"
+PASS stretchTestSheet.cssRules[1].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[2].style.fontStretch is "ultra-condensed"
 PASS stretchTestSheet.cssRules[3].style.fontStretch is "extra-condensed"
 PASS stretchTestSheet.cssRules[4].style.fontStretch is "condensed"
@@ -42,9 +42,9 @@
 PASS stretchTestSheet.cssRules[10].style.fontStretch is "ultra-expanded"
 PASS stretchTestSheet.cssRules[11].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[12].style.fontStretch is ""
-PASS stretchTestSheet.cssRules[13].style.fontStretch is "7"
-PASS stretchTestSheet.cssRules[14].style.fontStretch is "100 / 200"
-PASS stretchTestSheet.cssRules[15].style.fontStretch is "100 / 200"
+PASS stretchTestSheet.cssRules[13].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[14].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[15].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[16].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[17].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[18].style.fontStretch is ""
@@ -51,11 +51,11 @@
 PASS stretchTestSheet.cssRules[19].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[20].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[21].style.fontStretch is ""
-PASS stretchTestSheet.cssRules[22].style.fontStretch is "1 / 2"
-PASS stretchTestSheet.cssRules[23].style.fontStretch is "-2 / -1"
+PASS stretchTestSheet.cssRules[22].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[23].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[24].style.fontStretch is ""
-PASS stretchTestSheet.cssRules[25].style.fontStretch is "100% / 200%"
-PASS stretchTestSheet.cssRules[26].style.fontStretch is "100% / 200%"
+PASS stretchTestSheet.cssRules[25].style.fontStretch is "100% 200%"
+PASS stretchTestSheet.cssRules[26].style.fontStretch is "100% 200%"
 PASS stretchTestSheet.cssRules[27].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[28].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[29].style.fontStretch is ""
@@ -62,28 +62,30 @@
 PASS stretchTestSheet.cssRules[30].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[31].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[32].style.fontStretch is ""
-PASS stretchTestSheet.cssRules[33].style.fontStretch is "1% / 2%"
-PASS stretchTestSheet.cssRules[34].style.fontStretch is "-2% / -1%"
+PASS stretchTestSheet.cssRules[33].style.fontStretch is "1% 2%"
+PASS stretchTestSheet.cssRules[34].style.fontStretch is "-2% -1%"
 PASS stretchTestSheet.cssRules[35].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[36].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[37].style.fontStretch is ""
-PASS stretchTestSheet.cssRules[38].style.fontStretch is "7 / 8"
-PASS stretchTestSheet.cssRules[39].style.fontStretch is "2 / 7"
+PASS stretchTestSheet.cssRules[38].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[39].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[40].style.fontStretch is "calc(7%) 8%"
+PASS stretchTestSheet.cssRules[41].style.fontStretch is "2% calc(7%)"
 PASS styleTestSheet.cssRules[0].style.fontStyle is "oblique 1deg"
 PASS styleTestSheet.cssRules[1].style.fontStyle is "oblique 200grad"
 PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 6.28318rad"
 PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 4turn"
-PASS styleTestSheet.cssRules[4].style.fontStyle is "oblique 5"
-PASS styleTestSheet.cssRules[5].style.fontStyle is "oblique 20"
+PASS styleTestSheet.cssRules[4].style.fontStyle is ""
+PASS styleTestSheet.cssRules[5].style.fontStyle is ""
 PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
 PASS styleTestSheet.cssRules[7].style.fontStyle is "oblique"
 PASS styleTestSheet.cssRules[8].style.fontStyle is "normal"
 PASS styleTestSheet.cssRules[9].style.fontStyle is ""
 PASS styleTestSheet.cssRules[10].style.fontStyle is ""
-PASS styleTestSheet.cssRules[11].style.fontStyle is "oblique 7"
+PASS styleTestSheet.cssRules[11].style.fontStyle is ""
 PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(1441deg)"
-PASS styleTestSheet.cssRules[13].style.fontStyle is "oblique 100deg 200deg"
-PASS styleTestSheet.cssRules[14].style.fontStyle is "oblique 100deg 200deg"
+PASS styleTestSheet.cssRules[13].style.fontStyle is ""
+PASS styleTestSheet.cssRules[14].style.fontStyle is ""
 PASS styleTestSheet.cssRules[15].style.fontStyle is ""
 PASS styleTestSheet.cssRules[16].style.fontStyle is ""
 PASS styleTestSheet.cssRules[17].style.fontStyle is ""
@@ -90,8 +92,8 @@
 PASS styleTestSheet.cssRules[18].style.fontStyle is ""
 PASS styleTestSheet.cssRules[19].style.fontStyle is ""
 PASS styleTestSheet.cssRules[20].style.fontStyle is ""
-PASS styleTestSheet.cssRules[21].style.fontStyle is "oblique 1deg 2deg"
-PASS styleTestSheet.cssRules[22].style.fontStyle is "oblique -2deg -1deg"
+PASS styleTestSheet.cssRules[21].style.fontStyle is ""
+PASS styleTestSheet.cssRules[22].style.fontStyle is ""
 PASS styleTestSheet.cssRules[23].style.fontStyle is ""
 PASS styleTestSheet.cssRules[24].style.fontStyle is "oblique 100deg 200deg"
 PASS styleTestSheet.cssRules[25].style.fontStyle is "oblique 100deg 200deg"
@@ -107,8 +109,10 @@
 PASS styleTestSheet.cssRules[35].style.fontStyle is ""
 PASS styleTestSheet.cssRules[36].style.fontStyle is ""
 PASS styleTestSheet.cssRules[37].style.fontStyle is "oblique 2deg 1turn"
-PASS styleTestSheet.cssRules[38].style.fontStyle is "oblique 7deg 8deg"
-PASS styleTestSheet.cssRules[39].style.fontStyle is "oblique 2deg 7deg"
+PASS styleTestSheet.cssRules[38].style.fontStyle is ""
+PASS styleTestSheet.cssRules[39].style.fontStyle is ""
+PASS styleTestSheet.cssRules[40].style.fontStyle is "oblique calc(7deg) 8deg"
+PASS styleTestSheet.cssRules[41].style.fontStyle is "oblique 2deg calc(7deg)"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/text/font-selection-font-face-parse.html (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-selection-font-face-parse.html	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-selection-font-face-parse.html	2017-03-27 17:50:33 UTC (rev 214419)
@@ -57,43 +57,43 @@
     font-weight: calc(150 + 50);
 }
 @font-face {
-    font-weight: 100/200;
+    font-weight: 100 200;
 }
 @font-face {
-    font-weight: 100 / 200;
+    font-weight: 100  200;
 }
 @font-face {
-    font-weight: a 100 / 200;
+    font-weight: a 100 200;
 }
 @font-face {
-    font-weight: 100 / 200 a;
+    font-weight: 100 200 a;
 }
 @font-face {
-    font-weight: 100 a / 200;
+    font-weight: 100 a 200;
 }
 @font-face {
-    font-weight: 100 a/ 200;
+    font-weight: 100a 200;
 }
 @font-face {
-    font-weight: 100 /a 200;
+    font-weight: 100 a200;
 }
 @font-face {
-    font-weight: 100 / a200;
+    font-weight: 100 a200;
 }
 @font-face {
-    font-weight: 1 / 2;
+    font-weight: 1 2;
 }
 @font-face {
-    font-weight: -2 / -1;
+    font-weight: -2 -1;
 }
 @font-face {
-    font-weight: 2 / 1;
+    font-weight: 2 1;
 }
 @font-face {
-    font-weight: calc(3 + 4) / 8;
+    font-weight: calc(3 + 4) 8;
 }
 @font-face {
-    font-weight: 2 / calc(3 + 4);
+    font-weight: 2 calc(3 + 4);
 }
 </style>
 
@@ -141,83 +141,89 @@
     font-stretch: calc(3 + 4);
 }
 @font-face {
-    font-stretch: 100/200;
+    font-stretch: 100 200;
 }
 @font-face {
-    font-stretch: 100 / 200;
+    font-stretch: 100  200;
 }
 @font-face {
-    font-stretch: a 100 / 200;
+    font-stretch: a 100 200;
 }
 @font-face {
-    font-stretch: 100 / 200 a;
+    font-stretch: 100 200 a;
 }
 @font-face {
-    font-stretch: 100 a / 200;
+    font-stretch: 100 a 200;
 }
 @font-face {
-    font-stretch: 100 a/ 200;
+    font-stretch: 100a 200;
 }
 @font-face {
-    font-stretch: 100 /a 200;
+    font-stretch: 100 a200;
 }
 @font-face {
-    font-stretch: 100 / a200;
+    font-stretch: 100 a200;
 }
 @font-face {
-    font-stretch: 1 / 2;
+    font-stretch: 1 2;
 }
 @font-face {
-    font-stretch: -2 / -1;
+    font-stretch: -2 -1;
 }
 @font-face {
-    font-stretch: 2 / 1;
+    font-stretch: 2 1;
 }
 @font-face {
-    font-stretch: 100%/200%;
+    font-stretch: 100% 200%;
 }
 @font-face {
-    font-stretch: 100% / 200%;
+    font-stretch: 100%   200%;
 }
 @font-face {
-    font-stretch: a 100% / 200%;
+    font-stretch: a 100% 200%;
 }
 @font-face {
-    font-stretch: 100% / 200% a;
+    font-stretch: 100% 200% a;
 }
 @font-face {
-    font-stretch: 100% a / 200%;
+    font-stretch: 100% a 200%;
 }
 @font-face {
-    font-stretch: 100% a/ 200%;
+    font-stretch: 100%a 200%;
 }
 @font-face {
-    font-stretch: 100% /a 200%;
+    font-stretch: 100% a200%;
 }
 @font-face {
-    font-stretch: 100% / a200%;
+    font-stretch: 100% a200%;
 }
 @font-face {
-    font-stretch: 1% / 2%;
+    font-stretch: 1% 2%;
 }
 @font-face {
-    font-stretch: -2% / -1%;
+    font-stretch: -2% -1%;
 }
 @font-face {
-    font-stretch: 2% / 1%;
+    font-stretch: 2% 1%;
 }
 @font-face {
-    font-stretch: 1 / 2%;
+    font-stretch: 1 2%;
 }
 @font-face {
-    font-stretch: 1% / 2;
+    font-stretch: 1% 2;
 }
 @font-face {
-    font-stretch: calc(3 + 4) / 8;
+    font-stretch: calc(3 + 4) 8;
 }
 @font-face {
-    font-stretch: 2 / calc(3 + 4);
+    font-stretch: 2 calc(3 + 4);
 }
+@font-face {
+    font-stretch: calc(3% + 4%) 8%;
+}
+@font-face {
+    font-stretch: 2% calc(3% + 4%);
+}
 </style>
 
 <style id="styleTest">
@@ -341,6 +347,12 @@
 @font-face {
     font-style: oblique 2 calc(3 + 4);
 }
+@font-face {
+    font-style: oblique calc(3deg + 4deg) 8deg;
+}
+@font-face {
+    font-style: oblique 2deg calc(3deg + 4deg);
+}
 </style>
 </head>
 <body>
@@ -364,8 +376,8 @@
 shouldBeEqualToString("weightTestSheet.cssRules[15].style.fontWeight", "7");
 shouldBeEqualToString("weightTestSheet.cssRules[16].style.fontWeight", "300");
 shouldBeEqualToString("weightTestSheet.cssRules[17].style.fontWeight", "200");
-shouldBeEqualToString("weightTestSheet.cssRules[18].style.fontWeight", "100 / 200");
-shouldBeEqualToString("weightTestSheet.cssRules[19].style.fontWeight", "100 / 200");
+shouldBeEqualToString("weightTestSheet.cssRules[18].style.fontWeight", "100 200");
+shouldBeEqualToString("weightTestSheet.cssRules[19].style.fontWeight", "100 200");
 shouldBeEqualToString("weightTestSheet.cssRules[20].style.fontWeight", "");
 shouldBeEqualToString("weightTestSheet.cssRules[21].style.fontWeight", "");
 shouldBeEqualToString("weightTestSheet.cssRules[22].style.fontWeight", "");
@@ -372,15 +384,15 @@
 shouldBeEqualToString("weightTestSheet.cssRules[23].style.fontWeight", "");
 shouldBeEqualToString("weightTestSheet.cssRules[24].style.fontWeight", "");
 shouldBeEqualToString("weightTestSheet.cssRules[25].style.fontWeight", "");
-shouldBeEqualToString("weightTestSheet.cssRules[26].style.fontWeight", "1 / 2");
-shouldBeEqualToString("weightTestSheet.cssRules[27].style.fontWeight", "-2 / -1");
+shouldBeEqualToString("weightTestSheet.cssRules[26].style.fontWeight", "1 2");
+shouldBeEqualToString("weightTestSheet.cssRules[27].style.fontWeight", "-2 -1");
 shouldBeEqualToString("weightTestSheet.cssRules[28].style.fontWeight", "");
-shouldBeEqualToString("weightTestSheet.cssRules[29].style.fontWeight", "7 / 8");
-shouldBeEqualToString("weightTestSheet.cssRules[30].style.fontWeight", "2 / 7");
+shouldBeEqualToString("weightTestSheet.cssRules[29].style.fontWeight", "7 8");
+shouldBeEqualToString("weightTestSheet.cssRules[30].style.fontWeight", "2 7");
 
 var stretchTestSheet = document.getElementById("stretchTest").sheet;
 shouldBeEqualToString("stretchTestSheet.cssRules[0].style.fontStretch", "1%");
-shouldBeEqualToString("stretchTestSheet.cssRules[1].style.fontStretch", "2");
+shouldBeEqualToString("stretchTestSheet.cssRules[1].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[2].style.fontStretch", "ultra-condensed");
 shouldBeEqualToString("stretchTestSheet.cssRules[3].style.fontStretch", "extra-condensed");
 shouldBeEqualToString("stretchTestSheet.cssRules[4].style.fontStretch", "condensed");
@@ -392,9 +404,9 @@
 shouldBeEqualToString("stretchTestSheet.cssRules[10].style.fontStretch", "ultra-expanded");
 shouldBeEqualToString("stretchTestSheet.cssRules[11].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[12].style.fontStretch", "");
-shouldBeEqualToString("stretchTestSheet.cssRules[13].style.fontStretch", "7");
-shouldBeEqualToString("stretchTestSheet.cssRules[14].style.fontStretch", "100 / 200");
-shouldBeEqualToString("stretchTestSheet.cssRules[15].style.fontStretch", "100 / 200");
+shouldBeEqualToString("stretchTestSheet.cssRules[13].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[14].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[15].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[16].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[17].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[18].style.fontStretch", "");
@@ -401,11 +413,11 @@
 shouldBeEqualToString("stretchTestSheet.cssRules[19].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[20].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[21].style.fontStretch", "");
-shouldBeEqualToString("stretchTestSheet.cssRules[22].style.fontStretch", "1 / 2");
-shouldBeEqualToString("stretchTestSheet.cssRules[23].style.fontStretch", "-2 / -1");
+shouldBeEqualToString("stretchTestSheet.cssRules[22].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[23].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[24].style.fontStretch", "");
-shouldBeEqualToString("stretchTestSheet.cssRules[25].style.fontStretch", "100% / 200%");
-shouldBeEqualToString("stretchTestSheet.cssRules[26].style.fontStretch", "100% / 200%");
+shouldBeEqualToString("stretchTestSheet.cssRules[25].style.fontStretch", "100% 200%");
+shouldBeEqualToString("stretchTestSheet.cssRules[26].style.fontStretch", "100% 200%");
 shouldBeEqualToString("stretchTestSheet.cssRules[27].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[28].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[29].style.fontStretch", "");
@@ -412,13 +424,15 @@
 shouldBeEqualToString("stretchTestSheet.cssRules[30].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[31].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[32].style.fontStretch", "");
-shouldBeEqualToString("stretchTestSheet.cssRules[33].style.fontStretch", "1% / 2%");
-shouldBeEqualToString("stretchTestSheet.cssRules[34].style.fontStretch", "-2% / -1%");
+shouldBeEqualToString("stretchTestSheet.cssRules[33].style.fontStretch", "1% 2%");
+shouldBeEqualToString("stretchTestSheet.cssRules[34].style.fontStretch", "-2% -1%");
 shouldBeEqualToString("stretchTestSheet.cssRules[35].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[36].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[37].style.fontStretch", "");
-shouldBeEqualToString("stretchTestSheet.cssRules[38].style.fontStretch", "7 / 8");
-shouldBeEqualToString("stretchTestSheet.cssRules[39].style.fontStretch", "2 / 7");
+shouldBeEqualToString("stretchTestSheet.cssRules[38].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[39].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[40].style.fontStretch", "calc(7%) 8%");
+shouldBeEqualToString("stretchTestSheet.cssRules[41].style.fontStretch", "2% calc(7%)");
 
 var styleTestSheet = document.getElementById("styleTest").sheet;
 shouldBeEqualToString("styleTestSheet.cssRules[0].style.fontStyle", "oblique 1deg");
@@ -425,18 +439,18 @@
 shouldBeEqualToString("styleTestSheet.cssRules[1].style.fontStyle", "oblique 200grad");
 shouldBeEqualToString("styleTestSheet.cssRules[2].style.fontStyle", "oblique 6.28318rad");
 shouldBeEqualToString("styleTestSheet.cssRules[3].style.fontStyle", "oblique 4turn");
-shouldBeEqualToString("styleTestSheet.cssRules[4].style.fontStyle", "oblique 5");
-shouldBeEqualToString("styleTestSheet.cssRules[5].style.fontStyle", "oblique 20");
+shouldBeEqualToString("styleTestSheet.cssRules[4].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[5].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[6].style.fontStyle", "italic");
 shouldBeEqualToString("styleTestSheet.cssRules[7].style.fontStyle", "oblique");
 shouldBeEqualToString("styleTestSheet.cssRules[8].style.fontStyle", "normal");
 shouldBeEqualToString("styleTestSheet.cssRules[9].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[10].style.fontStyle", "");
-shouldBeEqualToString("styleTestSheet.cssRules[11].style.fontStyle", "oblique 7");
+shouldBeEqualToString("styleTestSheet.cssRules[11].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[12].style.fontStyle", "oblique calc(1441deg)");
 
-shouldBeEqualToString("styleTestSheet.cssRules[13].style.fontStyle", "oblique 100deg 200deg");
-shouldBeEqualToString("styleTestSheet.cssRules[14].style.fontStyle", "oblique 100deg 200deg");
+shouldBeEqualToString("styleTestSheet.cssRules[13].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[14].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[15].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[16].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[17].style.fontStyle", "");
@@ -443,8 +457,8 @@
 shouldBeEqualToString("styleTestSheet.cssRules[18].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[19].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[20].style.fontStyle", "");
-shouldBeEqualToString("styleTestSheet.cssRules[21].style.fontStyle", "oblique 1deg 2deg");
-shouldBeEqualToString("styleTestSheet.cssRules[22].style.fontStyle", "oblique -2deg -1deg");
+shouldBeEqualToString("styleTestSheet.cssRules[21].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[22].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[23].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[24].style.fontStyle", "oblique 100deg 200deg");
 shouldBeEqualToString("styleTestSheet.cssRules[25].style.fontStyle", "oblique 100deg 200deg");
@@ -460,8 +474,10 @@
 shouldBeEqualToString("styleTestSheet.cssRules[35].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[36].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[37].style.fontStyle", "oblique 2deg 1turn");
-shouldBeEqualToString("styleTestSheet.cssRules[38].style.fontStyle", "oblique 7deg 8deg");
-shouldBeEqualToString("styleTestSheet.cssRules[39].style.fontStyle", "oblique 2deg 7deg");
+shouldBeEqualToString("styleTestSheet.cssRules[38].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[39].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[40].style.fontStyle", "oblique calc(7deg) 8deg");
+shouldBeEqualToString("styleTestSheet.cssRules[41].style.fontStyle", "oblique 2deg calc(7deg)");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt	2017-03-27 17:50:33 UTC (rev 214419)
@@ -16,7 +16,7 @@
 PASS setFontFaceWeight(fontFace, 'calc(100 + 200)') is "300"
 PASS setFontFaceWeight(fontFace, 'calc(150 + 50)') is "200"
 PASS setFontFaceStretch(fontFace, '1%') is "1%"
-PASS setFontFaceStretch(fontFace, '2') is "2%"
+PASS setFontFaceStretch(fontFace, '2') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS setFontFaceStretch(fontFace, 'ultra-condensed') is "ultra-condensed"
 PASS setFontFaceStretch(fontFace, 'extra-condensed') is "extra-condensed"
 PASS setFontFaceStretch(fontFace, 'condensed') is "condensed"
@@ -28,19 +28,20 @@
 PASS setFontFaceStretch(fontFace, 'ultra-expanded') is "ultra-expanded"
 PASS setFontFaceStretch(fontFace, 'garbage') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS setFontFaceStretch(fontFace, 'initial') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
-PASS setFontFaceStretch(fontFace, 'calc(3 + 4)') is "7%"
+PASS setFontFaceStretch(fontFace, 'calc(3 + 4)') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceStretch(fontFace, 'calc(3% + 4%)') is "7%"
 PASS setFontFaceStyle(fontFace, 'oblique 1deg') is "oblique 1deg"
 PASS setFontFaceStyle(fontFace, 'oblique 200grad') is "oblique 180deg"
-PASS setFontFaceStyle(fontFace, 'oblique 6.28318rad') is "oblique 359.750000deg"
+PASS setFontFaceStyle(fontFace, 'oblique 6.28318rad') is "oblique 359.75deg"
 PASS setFontFaceStyle(fontFace, 'oblique 4turn') is "oblique 1440deg"
-PASS setFontFaceStyle(fontFace, 'oblique 5') is "oblique 5deg"
-PASS setFontFaceStyle(fontFace, 'oblique 20') is "italic"
+PASS setFontFaceStyle(fontFace, 'oblique 5') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceStyle(fontFace, 'oblique 20') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS setFontFaceStyle(fontFace, 'italic') is "italic"
 PASS setFontFaceStyle(fontFace, 'oblique') is "italic"
 PASS setFontFaceStyle(fontFace, 'normal') is "normal"
 PASS setFontFaceStyle(fontFace, 'garbage') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS setFontFaceStyle(fontFace, 'initial') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
-PASS setFontFaceStyle(fontFace, 'oblique calc(3 + 4)') is "oblique 7deg"
+PASS setFontFaceStyle(fontFace, 'oblique calc(3 + 4)') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS setFontFaceStyle(fontFace, 'oblique calc(4turn + 1deg)') is "oblique 1441deg"
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse.html (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse.html	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse.html	2017-03-27 17:50:33 UTC (rev 214419)
@@ -40,7 +40,7 @@
 shouldBeEqualToString("setFontFaceWeight(fontFace, 'calc(150 + 50)')", "200");
 
 shouldBeEqualToString("setFontFaceStretch(fontFace, '1%')", "1%");
-shouldBeEqualToString("setFontFaceStretch(fontFace, '2')", "2%");
+shouldThrow("setFontFaceStretch(fontFace, '2')");
 shouldBeEqualToString("setFontFaceStretch(fontFace, 'ultra-condensed')", "ultra-condensed");
 shouldBeEqualToString("setFontFaceStretch(fontFace, 'extra-condensed')", "extra-condensed");
 shouldBeEqualToString("setFontFaceStretch(fontFace, 'condensed')", "condensed");
@@ -52,20 +52,21 @@
 shouldBeEqualToString("setFontFaceStretch(fontFace, 'ultra-expanded')", "ultra-expanded");
 shouldThrow("setFontFaceStretch(fontFace, 'garbage')");
 shouldThrow("setFontFaceStretch(fontFace, 'initial')");
-shouldBeEqualToString("setFontFaceStretch(fontFace, 'calc(3 + 4)')", "7%");
+shouldThrow("setFontFaceStretch(fontFace, 'calc(3 + 4)')");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'calc(3% + 4%)')", "7%");
 
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 1deg')", "oblique 1deg");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 200grad')", "oblique 180deg");
-shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 6.28318rad')", "oblique 359.750000deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 6.28318rad')", "oblique 359.75deg");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 4turn')", "oblique 1440deg");
-shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 5')", "oblique 5deg");
-shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 20')", "italic");
+shouldThrow("setFontFaceStyle(fontFace, 'oblique 5')");
+shouldThrow("setFontFaceStyle(fontFace, 'oblique 20')");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'italic')", "italic");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique')", "italic");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'normal')", "normal");
 shouldThrow("setFontFaceStyle(fontFace, 'garbage')");
 shouldThrow("setFontFaceStyle(fontFace, 'initial')");
-shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique calc(3 + 4)')", "oblique 7deg");
+shouldThrow("setFontFaceStyle(fontFace, 'oblique calc(3 + 4)')");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique calc(4turn + 1deg)')", "oblique 1441deg");
 </script>
 <script src=""

Modified: trunk/LayoutTests/fast/text/font-stretch-parse-expected.txt (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-stretch-parse-expected.txt	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-stretch-parse-expected.txt	2017-03-27 17:50:33 UTC (rev 214419)
@@ -1,6 +1,6 @@
 PASS window.getComputedStyle(document.getElementById('test1')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test2')).fontStretch is "1%"
-PASS window.getComputedStyle(document.getElementById('test3')).fontStretch is "2%"
+PASS window.getComputedStyle(document.getElementById('test3')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test4')).fontStretch is "ultra-condensed"
 PASS window.getComputedStyle(document.getElementById('test5')).fontStretch is "extra-condensed"
 PASS window.getComputedStyle(document.getElementById('test6')).fontStretch is "condensed"
@@ -12,15 +12,16 @@
 PASS window.getComputedStyle(document.getElementById('test12')).fontStretch is "ultra-expanded"
 PASS window.getComputedStyle(document.getElementById('test13')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test14')).fontStretch is "normal"
-PASS window.getComputedStyle(document.getElementById('test15')).fontStretch is "7%"
+PASS window.getComputedStyle(document.getElementById('test15')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test16')).fontStretch is "extra-condensed"
 PASS window.getComputedStyle(document.getElementById('test17')).fontStretch is "extra-condensed"
 PASS window.getComputedStyle(document.getElementById('test18')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test19')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test20')).fontStretch is "extra-expanded"
+PASS window.getComputedStyle(document.getElementById('test21')).fontStretch is "7%"
 PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test3')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test3')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test4')).font is "normal normal normal ultra-condensed 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test5')).font is "normal normal normal extra-condensed 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test6')).font is "normal normal normal condensed 16px/18px Times"
@@ -32,12 +33,13 @@
 PASS window.getComputedStyle(document.getElementById('test12')).font is "normal normal normal ultra-expanded 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test13')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test14')).font is "normal normal normal normal 16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test15')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test15')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test16')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test18')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test19')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test20')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test21')).font is "16px/18px Times"
 PASS document.getElementById('test1').style.font is ""
 PASS document.getElementById('test16').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
 PASS document.getElementById('test17').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"

Modified: trunk/LayoutTests/fast/text/font-stretch-parse.html (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-stretch-parse.html	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-stretch-parse.html	2017-03-27 17:50:33 UTC (rev 214419)
@@ -25,11 +25,12 @@
 <div id="test18" style="font: 100 48px/49px 'Helvetica Neue';"></div>
 <div style="font-stretch: extra-expanded;"><div id="test19" style="font: 100 48px/49px 'Helvetica Neue';"></div></div>
 <div id="test20" style="font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';"></div>
+<div id="test21" style="font-stretch: calc(3% + 4%);"></div>
 </div>
 <script>
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontStretch", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontStretch", "1%");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontStretch", "2%");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontStretch", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontStretch", "ultra-condensed");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontStretch", "extra-condensed");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStretch", "condensed");
@@ -41,16 +42,17 @@
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).fontStretch", "ultra-expanded");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStretch", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStretch", "normal");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontStretch", "7%");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontStretch", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).fontStretch", "extra-condensed");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).fontStretch", "extra-condensed");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).fontStretch", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).fontStretch", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontStretch", "extra-expanded");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontStretch", "7%");
 
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).font", "normal normal normal ultra-condensed 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).font", "normal normal normal extra-condensed 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).font", "normal normal normal condensed 16px/18px Times");
@@ -62,12 +64,13 @@
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).font", "normal normal normal ultra-expanded 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).font", "normal normal normal normal 16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).font", "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).font", "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).font", "normal normal 100 normal 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).font", "normal normal 100 normal 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).font", "16px/18px Times");
 
 shouldBeEqualToString("document.getElementById('test1').style.font", "");
 shouldBeEqualToString("document.getElementById('test16').style.font", "100 extra-condensed 48px/49px 'Helvetica Neue'");

Modified: trunk/LayoutTests/fast/text/font-style-parse-expected.txt (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-style-parse-expected.txt	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-style-parse-expected.txt	2017-03-27 17:50:33 UTC (rev 214419)
@@ -3,14 +3,14 @@
 PASS window.getComputedStyle(document.getElementById('test3')).fontStyle is "oblique 180deg"
 PASS window.getComputedStyle(document.getElementById('test4')).fontStyle is "oblique 359.75deg"
 PASS window.getComputedStyle(document.getElementById('test5')).fontStyle is "oblique 1440deg"
-PASS window.getComputedStyle(document.getElementById('test6')).fontStyle is "oblique 5deg"
-PASS window.getComputedStyle(document.getElementById('test7')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test6')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test7')).fontStyle is "normal"
 PASS window.getComputedStyle(document.getElementById('test8')).fontStyle is "italic"
 PASS window.getComputedStyle(document.getElementById('test9')).fontStyle is "italic"
 PASS window.getComputedStyle(document.getElementById('test10')).fontStyle is "normal"
 PASS window.getComputedStyle(document.getElementById('test11')).fontStyle is "normal"
 PASS window.getComputedStyle(document.getElementById('test12')).fontStyle is "normal"
-PASS window.getComputedStyle(document.getElementById('test13')).fontStyle is "oblique 7deg"
+PASS window.getComputedStyle(document.getElementById('test13')).fontStyle is "normal"
 PASS window.getComputedStyle(document.getElementById('test14')).fontStyle is "oblique 1441deg"
 PASS window.getComputedStyle(document.getElementById('test15')).fontStyle is "italic"
 PASS window.getComputedStyle(document.getElementById('test16')).fontStyle is "italic"
@@ -24,14 +24,14 @@
 PASS window.getComputedStyle(document.getElementById('test3')).font is "16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test4')).font is "16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test5')).font is "16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test6')).font is "16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test7')).font is "italic normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test6')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test7')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test8')).font is "italic normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test9')).font is "italic normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test12')).font is "normal normal normal normal 16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test13')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test13')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test14')).font is "16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test15')).font is "italic normal 100 normal 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test16')).font is "italic normal 100 normal 48px/49px 'Helvetica Neue'"

Modified: trunk/LayoutTests/fast/text/font-style-parse.html (214418 => 214419)


--- trunk/LayoutTests/fast/text/font-style-parse.html	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/font-style-parse.html	2017-03-27 17:50:33 UTC (rev 214419)
@@ -33,14 +33,14 @@
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontStyle", "oblique 180deg");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontStyle", "oblique 359.75deg");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontStyle", "oblique 1440deg");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStyle", "oblique 5deg");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStyle", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).fontStyle", "italic");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).fontStyle", "italic");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).fontStyle", "normal");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStyle", "oblique 7deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStyle", "oblique 1441deg");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontStyle", "italic");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).fontStyle", "italic");
@@ -55,14 +55,14 @@
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).font", "16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).font", "16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).font", "16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).font", "italic normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).font", "italic normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).font", "italic normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).font", "normal normal normal normal 16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).font", "16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "italic normal 100 normal 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).font", "italic normal 100 normal 48px/49px 'Helvetica Neue'");

Modified: trunk/LayoutTests/fast/text/variations/font-selection-properties.html (214418 => 214419)


--- trunk/LayoutTests/fast/text/variations/font-selection-properties.html	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/fast/text/variations/font-selection-properties.html	2017-03-27 17:50:33 UTC (rev 214419)
@@ -10,7 +10,7 @@
 </head>
 <body>
 This test makes sure that the font selection properties affect font variations.
-<div style="font-family: Boxis; font-stretch: 900;">Hello</div>
-<div style="font-family: Boxis; font-stretch: 900; font-variation-settings: 'wdth' 100;">Hello</div>
+<div style="font-family: Boxis; font-stretch: 900%;">Hello</div>
+<div style="font-family: Boxis; font-stretch: 900%; font-variation-settings: 'wdth' 100;">Hello</div>
 </body>
 </html>

Modified: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt (214418 => 214419)


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt	2017-03-27 17:50:33 UTC (rev 214419)
@@ -16,8 +16,8 @@
 PASS weightTestSheet.cssRules[15].style.fontWeight is "7"
 PASS weightTestSheet.cssRules[16].style.fontWeight is "300"
 PASS weightTestSheet.cssRules[17].style.fontWeight is "200"
-FAIL weightTestSheet.cssRules[18].style.fontWeight should be 100 / 200. Was .
-FAIL weightTestSheet.cssRules[19].style.fontWeight should be 100 / 200. Was .
+FAIL weightTestSheet.cssRules[18].style.fontWeight should be 100 200. Was .
+FAIL weightTestSheet.cssRules[19].style.fontWeight should be 100 200. Was .
 PASS weightTestSheet.cssRules[20].style.fontWeight is ""
 PASS weightTestSheet.cssRules[21].style.fontWeight is ""
 PASS weightTestSheet.cssRules[22].style.fontWeight is ""
@@ -24,13 +24,13 @@
 PASS weightTestSheet.cssRules[23].style.fontWeight is ""
 PASS weightTestSheet.cssRules[24].style.fontWeight is ""
 PASS weightTestSheet.cssRules[25].style.fontWeight is ""
-FAIL weightTestSheet.cssRules[26].style.fontWeight should be 1 / 2. Was .
-FAIL weightTestSheet.cssRules[27].style.fontWeight should be -2 / -1. Was .
+FAIL weightTestSheet.cssRules[26].style.fontWeight should be 1 2. Was .
+FAIL weightTestSheet.cssRules[27].style.fontWeight should be -2 -1. Was .
 PASS weightTestSheet.cssRules[28].style.fontWeight is ""
-FAIL weightTestSheet.cssRules[29].style.fontWeight should be 7 / 8. Was .
-FAIL weightTestSheet.cssRules[30].style.fontWeight should be 2 / 7. Was .
+FAIL weightTestSheet.cssRules[29].style.fontWeight should be 7 8. Was .
+FAIL weightTestSheet.cssRules[30].style.fontWeight should be 2 7. Was .
 PASS stretchTestSheet.cssRules[0].style.fontStretch is "1%"
-PASS stretchTestSheet.cssRules[1].style.fontStretch is "2"
+PASS stretchTestSheet.cssRules[1].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[2].style.fontStretch is "ultra-condensed"
 PASS stretchTestSheet.cssRules[3].style.fontStretch is "extra-condensed"
 PASS stretchTestSheet.cssRules[4].style.fontStretch is "condensed"
@@ -42,9 +42,9 @@
 PASS stretchTestSheet.cssRules[10].style.fontStretch is "ultra-expanded"
 PASS stretchTestSheet.cssRules[11].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[12].style.fontStretch is ""
-PASS stretchTestSheet.cssRules[13].style.fontStretch is "7"
-FAIL stretchTestSheet.cssRules[14].style.fontStretch should be 100 / 200. Was .
-FAIL stretchTestSheet.cssRules[15].style.fontStretch should be 100 / 200. Was .
+PASS stretchTestSheet.cssRules[13].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[14].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[15].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[16].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[17].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[18].style.fontStretch is ""
@@ -51,11 +51,11 @@
 PASS stretchTestSheet.cssRules[19].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[20].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[21].style.fontStretch is ""
-FAIL stretchTestSheet.cssRules[22].style.fontStretch should be 1 / 2. Was .
-FAIL stretchTestSheet.cssRules[23].style.fontStretch should be -2 / -1. Was .
+PASS stretchTestSheet.cssRules[22].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[23].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[24].style.fontStretch is ""
-FAIL stretchTestSheet.cssRules[25].style.fontStretch should be 100% / 200%. Was .
-FAIL stretchTestSheet.cssRules[26].style.fontStretch should be 100% / 200%. Was .
+FAIL stretchTestSheet.cssRules[25].style.fontStretch should be 100% 200%. Was .
+FAIL stretchTestSheet.cssRules[26].style.fontStretch should be 100% 200%. Was .
 PASS stretchTestSheet.cssRules[27].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[28].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[29].style.fontStretch is ""
@@ -62,28 +62,30 @@
 PASS stretchTestSheet.cssRules[30].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[31].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[32].style.fontStretch is ""
-FAIL stretchTestSheet.cssRules[33].style.fontStretch should be 1% / 2%. Was .
-FAIL stretchTestSheet.cssRules[34].style.fontStretch should be -2% / -1%. Was .
+FAIL stretchTestSheet.cssRules[33].style.fontStretch should be 1% 2%. Was .
+FAIL stretchTestSheet.cssRules[34].style.fontStretch should be -2% -1%. Was .
 PASS stretchTestSheet.cssRules[35].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[36].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[37].style.fontStretch is ""
-FAIL stretchTestSheet.cssRules[38].style.fontStretch should be 7 / 8. Was .
-FAIL stretchTestSheet.cssRules[39].style.fontStretch should be 2 / 7. Was .
+PASS stretchTestSheet.cssRules[38].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[39].style.fontStretch is ""
+FAIL stretchTestSheet.cssRules[40].style.fontStretch should be calc(7%) 8%. Was .
+FAIL stretchTestSheet.cssRules[41].style.fontStretch should be 2% calc(7%). Was .
 PASS styleTestSheet.cssRules[0].style.fontStyle is "oblique 1deg"
 PASS styleTestSheet.cssRules[1].style.fontStyle is "oblique 200grad"
 PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 6.28318rad"
 PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 4turn"
-FAIL styleTestSheet.cssRules[4].style.fontStyle should be oblique 5. Was oblique 5deg.
-FAIL styleTestSheet.cssRules[5].style.fontStyle should be oblique 20. Was oblique 20deg.
+PASS styleTestSheet.cssRules[4].style.fontStyle is ""
+PASS styleTestSheet.cssRules[5].style.fontStyle is ""
 PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
 PASS styleTestSheet.cssRules[7].style.fontStyle is "oblique"
 PASS styleTestSheet.cssRules[8].style.fontStyle is "normal"
 PASS styleTestSheet.cssRules[9].style.fontStyle is ""
 PASS styleTestSheet.cssRules[10].style.fontStyle is ""
-FAIL styleTestSheet.cssRules[11].style.fontStyle should be oblique 7. Was oblique 7deg.
+PASS styleTestSheet.cssRules[11].style.fontStyle is ""
 PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(1441deg)"
-FAIL styleTestSheet.cssRules[13].style.fontStyle should be oblique 100deg 200deg. Was .
-FAIL styleTestSheet.cssRules[14].style.fontStyle should be oblique 100deg 200deg. Was .
+PASS styleTestSheet.cssRules[13].style.fontStyle is ""
+PASS styleTestSheet.cssRules[14].style.fontStyle is ""
 PASS styleTestSheet.cssRules[15].style.fontStyle is ""
 PASS styleTestSheet.cssRules[16].style.fontStyle is ""
 PASS styleTestSheet.cssRules[17].style.fontStyle is ""
@@ -90,8 +92,8 @@
 PASS styleTestSheet.cssRules[18].style.fontStyle is ""
 PASS styleTestSheet.cssRules[19].style.fontStyle is ""
 PASS styleTestSheet.cssRules[20].style.fontStyle is ""
-FAIL styleTestSheet.cssRules[21].style.fontStyle should be oblique 1deg 2deg. Was .
-FAIL styleTestSheet.cssRules[22].style.fontStyle should be oblique -2deg -1deg. Was .
+PASS styleTestSheet.cssRules[21].style.fontStyle is ""
+PASS styleTestSheet.cssRules[22].style.fontStyle is ""
 PASS styleTestSheet.cssRules[23].style.fontStyle is ""
 FAIL styleTestSheet.cssRules[24].style.fontStyle should be oblique 100deg 200deg. Was .
 FAIL styleTestSheet.cssRules[25].style.fontStyle should be oblique 100deg 200deg. Was .
@@ -107,8 +109,10 @@
 PASS styleTestSheet.cssRules[35].style.fontStyle is ""
 PASS styleTestSheet.cssRules[36].style.fontStyle is ""
 FAIL styleTestSheet.cssRules[37].style.fontStyle should be oblique 2deg 1turn. Was .
-FAIL styleTestSheet.cssRules[38].style.fontStyle should be oblique 7deg 8deg. Was .
-FAIL styleTestSheet.cssRules[39].style.fontStyle should be oblique 2deg 7deg. Was .
+PASS styleTestSheet.cssRules[38].style.fontStyle is ""
+PASS styleTestSheet.cssRules[39].style.fontStyle is ""
+FAIL styleTestSheet.cssRules[40].style.fontStyle should be oblique calc(7deg) 8deg. Was .
+FAIL styleTestSheet.cssRules[41].style.fontStyle should be oblique 2deg calc(7deg). Was .
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/Source/WebCore/ChangeLog (214418 => 214419)


--- trunk/Source/WebCore/ChangeLog	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/Source/WebCore/ChangeLog	2017-03-27 17:50:33 UTC (rev 214419)
@@ -1,3 +1,43 @@
+2017-03-27  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        font variation properties don't need to accept numbers
+        https://bugs.webkit.org/show_bug.cgi?id=169357
+
+        Reviewed by Antti Koivisto.
+
+        The CSS Fonts level 4 spec stabilized the grammar accepted by font-weight,
+        font-style, and font-stretch. The changes are that font-style and
+        font-stretch no longer accept raw numbers, and the @font-face descriptor
+        ranges are now separated by spaces instead of slashes.
+
+        Tests: fast/text/font-selection-font-face-parse.html
+               fast/text/font-selection-font-loading-api-parse.html
+               fast/text/font-stretch-parse.html
+               fast/text/font-style-parse.html
+               fast/text/variations/font-selection-properties.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
+        (WebCore::fontWeightFromStyle):
+        (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
+        (WebCore::fontStretchFromStyle):
+        (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
+        (WebCore::fontStyleFromStyle):
+        * css/CSSComputedStyleDeclaration.h:
+        * css/FontFace.cpp:
+        (WebCore::FontFace::style):
+        (WebCore::FontFace::weight):
+        (WebCore::FontFace::stretch):
+        (WebCore::rangeIsSingleValue): Deleted.
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertFontStretchFromValue):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontWeightRange):
+        (WebCore::consumeFontStretch):
+        (WebCore::consumeFontStretchRange):
+        (WebCore::consumeFontStyle):
+        (WebCore::consumeFontStyleRange):
+
 2017-03-27  Youenn Fablet  <you...@apple.com>
 
         Further optimize checkWebRTCAvailability

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (214418 => 214419)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2017-03-27 17:50:33 UTC (rev 214419)
@@ -1917,32 +1917,42 @@
     return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style);
 }
 
-static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
+Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontWeightFromStyleValue(FontSelectionValue weight)
 {
-    auto weight = style.fontDescription().weight();
     if (auto value = fontWeightKeyword(weight))
         return CSSValuePool::singleton().createIdentifierValue(value.value());
     return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
 }
 
-static Ref<CSSPrimitiveValue> fontStretchFromStyle(const RenderStyle& style)
+static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
 {
-    auto stretch = style.fontDescription().stretch();
+    return ComputedStyleExtractor::fontWeightFromStyleValue(style.fontDescription().weight());
+}
+
+Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontStretchFromStyleValue(FontSelectionValue stretch)
+{
     if (auto keyword = fontStretchKeyword(stretch))
         return CSSValuePool::singleton().createIdentifierValue(keyword.value());
     return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
 }
 
-static Ref<CSSFontStyleValue> fontStyleFromStyle(const RenderStyle& style)
+static Ref<CSSPrimitiveValue> fontStretchFromStyle(const RenderStyle& style)
 {
-    FontSelectionValue italic = style.fontDescription().italic();
-    if (italic == normalItalicValue())
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
-    if (italic == italicValue())
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueItalic));
+    return ComputedStyleExtractor::fontStretchFromStyleValue(style.fontDescription().stretch());
+}
+
+Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(FontSelectionValue italic)
+{
+    if (auto keyword = fontStyleKeyword(italic))
+        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(keyword.value()));
     return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
 }
 
+static Ref<CSSFontStyleValue> fontStyleFromStyle(const RenderStyle& style)
+{
+    return ComputedStyleExtractor::fontStyleFromStyleValue(style.fontDescription().italic());
+}
+
 static Ref<CSSValue> fontVariantFromStyle(const RenderStyle& style)
 {
     if (style.fontDescription().variantSettings().isAllNormal())

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (214418 => 214419)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2017-03-27 17:50:33 UTC (rev 214419)
@@ -28,11 +28,13 @@
 
 namespace WebCore {
 
+class CSSFontStyleValue;
 class CSSPrimitiveValue;
 class CSSValueList;
 class Color;
 class Element;
 class FilterOperations;
+class FontSelectionValue;
 class MutableStyleProperties;
 class Node;
 class RenderObject;
@@ -64,6 +66,10 @@
 
     static Ref<CSSValue> valueForFilter(const RenderStyle&, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
 
+    static Ref<CSSPrimitiveValue> fontWeightFromStyleValue(FontSelectionValue);
+    static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue);
+    static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue);
+
 private:
     // The styled element is either the element passed into computedPropertyValue, or the
     // PseudoElement for :before and :after if they exist.

Modified: trunk/Source/WebCore/css/FontFace.cpp (214418 => 214419)


--- trunk/Source/WebCore/css/FontFace.cpp	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/Source/WebCore/css/FontFace.cpp	2017-03-27 17:50:33 UTC (rev 214419)
@@ -26,8 +26,10 @@
 #include "config.h"
 #include "FontFace.h"
 
+#include "CSSComputedStyleDeclaration.h"
 #include "CSSFontFaceSource.h"
 #include "CSSFontFeatureValue.h"
+#include "CSSFontStyleValue.h"
 #include "CSSParser.h"
 #include "CSSUnicodeRangeValue.h"
 #include "CSSValueList.h"
@@ -39,6 +41,7 @@
 #include <runtime/ArrayBuffer.h>
 #include <runtime/ArrayBufferView.h>
 #include <runtime/JSCInlines.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -280,32 +283,30 @@
     return m_backing->families()->cssText();
 }
 
-static inline bool rangeIsSingleValue(FontSelectionRange range, FontSelectionValue value)
-{
-    return range.minimum == value && range.maximum == value;
-};
-
 String FontFace::style() const
 {
     m_backing->updateStyleIfNeeded();
     auto style = m_backing->italic();
 
-    if (rangeIsSingleValue(style, italicValue()))
-        return ASCIILiteral("italic");
-    if (rangeIsSingleValue(style, normalItalicValue()))
-        return ASCIILiteral("normal");
+    auto minimum = ComputedStyleExtractor::fontStyleFromStyleValue(style.minimum);
+    auto maximum = ComputedStyleExtractor::fontStyleFromStyleValue(style.maximum);
 
-    if (style.minimum == style.maximum) {
-        auto value = static_cast<float>(style.minimum);
-        if (value >= 0) {
-            auto floored = std::floor(value);
-            if (floored == value)
-                return String::format("oblique %ddeg", static_cast<int>(floored));
-        }
-        return String::format("oblique %fdeg", static_cast<float>(style.minimum));
+    if (minimum.get().equals(maximum.get()))
+        return minimum->cssText();
+
+    ASSERT(minimum->fontStyleValue->valueID() == CSSValueOblique);
+    ASSERT(maximum->fontStyleValue->valueID() == CSSValueOblique);
+
+    StringBuilder builder;
+    builder.append(minimum->fontStyleValue->cssText());
+    builder.append(' ');
+    if (minimum->obliqueValue.get() == maximum->obliqueValue.get())
+        builder.append(minimum->obliqueValue->cssText());
+    else {
+        builder.append(minimum->obliqueValue->cssText());
+        builder.append(maximum->obliqueValue->cssText());
     }
-
-    return String::format("oblique %fdeg %fdeg", static_cast<float>(style.minimum), static_cast<float>(style.maximum));
+    return builder.toString();
 }
 
 String FontFace::weight() const
@@ -313,22 +314,17 @@
     m_backing->updateStyleIfNeeded();
     auto weight = m_backing->weight();
 
-    if (rangeIsSingleValue(weight, normalWeightValue()))
-        return ASCIILiteral("normal");
-    if (rangeIsSingleValue(weight, boldWeightValue()))
-        return ASCIILiteral("bold");
+    auto minimum = ComputedStyleExtractor::fontWeightFromStyleValue(weight.minimum);
+    auto maximum = ComputedStyleExtractor::fontWeightFromStyleValue(weight.maximum);
 
-    if (weight.minimum == weight.maximum) {
-        auto value = static_cast<float>(weight.minimum);
-        if (value >= 0) {
-            auto floored = std::floor(value);
-            if (floored == value)
-                return String::format("%d", static_cast<int>(floored));
-        }
-        return String::format("%f", static_cast<float>(weight.minimum));
-    }
+    if (minimum.get().equals(maximum.get()))
+        return minimum->cssText();
 
-    return String::format("%f %f", static_cast<float>(weight.minimum), static_cast<float>(weight.maximum));
+    StringBuilder builder;
+    builder.append(minimum->cssText());
+    builder.append(' ');
+    builder.append(maximum->cssText());
+    return builder.toString();
 }
 
 String FontFace::stretch() const
@@ -336,36 +332,17 @@
     m_backing->updateStyleIfNeeded();
     auto stretch = m_backing->stretch();
 
-    if (rangeIsSingleValue(stretch, ultraCondensedStretchValue()))
-        return ASCIILiteral("ultra-condensed");
-    if (rangeIsSingleValue(stretch, extraCondensedStretchValue()))
-        return ASCIILiteral("extra-condensed");
-    if (rangeIsSingleValue(stretch, condensedStretchValue()))
-        return ASCIILiteral("condensed");
-    if (rangeIsSingleValue(stretch, semiCondensedStretchValue()))
-        return ASCIILiteral("semi-condensed");
-    if (rangeIsSingleValue(stretch, normalStretchValue()))
-        return ASCIILiteral("normal");
-    if (rangeIsSingleValue(stretch, semiExpandedStretchValue()))
-        return ASCIILiteral("semi-expanded");
-    if (rangeIsSingleValue(stretch, expandedStretchValue()))
-        return ASCIILiteral("expanded");
-    if (rangeIsSingleValue(stretch, extraExpandedStretchValue()))
-        return ASCIILiteral("extra-expanded");
-    if (rangeIsSingleValue(stretch, ultraExpandedStretchValue()))
-        return ASCIILiteral("ultra-expanded");
+    auto minimum = ComputedStyleExtractor::fontStretchFromStyleValue(stretch.minimum);
+    auto maximum = ComputedStyleExtractor::fontStretchFromStyleValue(stretch.maximum);
 
-    if (stretch.minimum == stretch.maximum) {
-        auto value = static_cast<float>(stretch.minimum);
-        if (value >= 0) {
-            auto floored = std::floor(value);
-            if (floored == value)
-                return String::format("%d%%", static_cast<int>(floored));
-        }
-        return String::format("%f%%", static_cast<float>(stretch.minimum));
-    }
+    if (minimum.get().equals(maximum.get()))
+        return minimum->cssText();
 
-    return String::format("%f%% %f%%", static_cast<float>(stretch.minimum), static_cast<float>(stretch.maximum));
+    StringBuilder builder;
+    builder.append(minimum->cssText());
+    builder.append(' ');
+    builder.append(maximum->cssText());
+    return builder.toString();
 }
 
 String FontFace::unicodeRange() const

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (214418 => 214419)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2017-03-27 17:50:33 UTC (rev 214419)
@@ -1193,7 +1193,7 @@
     ASSERT(is<CSSPrimitiveValue>(value));
     const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
 
-    if (primitiveValue.isPercentage() || primitiveValue.isNumber())
+    if (primitiveValue.isPercentage())
         return FontSelectionValue::clampFloat(primitiveValue.floatValue());
 
     ASSERT(primitiveValue.isValueID());

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (214418 => 214419)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2017-03-27 17:48:22 UTC (rev 214418)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2017-03-27 17:50:33 UTC (rev 214419)
@@ -888,14 +888,12 @@
         return nullptr;
     if (range.atEnd())
         return firstNumber;
-    if (!consumeSlashIncludingWhitespace(range))
-        return nullptr;
     auto secondNumber = consumeNumber(range, ValueRangeAll);
     if (!secondNumber)
         return nullptr;
     if (firstNumber->floatValue() > secondNumber->floatValue())
         return nullptr;
-    auto result = CSSValueList::createSlashSeparated();
+    auto result = CSSValueList::createSpaceSeparated();
     result->append(firstNumber.releaseNonNull());
     result->append(secondNumber.releaseNonNull());
     return RefPtr<CSSValue>(WTFMove(result));
@@ -911,9 +909,7 @@
 {
     if (auto result = consumeFontStretchKeywordValue(range))
         return result;
-    if (auto percent = consumePercent(range, ValueRangeAll))
-        return percent;
-    return consumeNumber(range, ValueRangeAll);
+    return consumePercent(range, ValueRangeAll);
 }
 
 #if ENABLE(VARIATION_FONTS)
@@ -921,39 +917,20 @@
 {
     if (auto result = consumeFontStretchKeywordValue(range))
         return result;
-    if (auto firstPercent = consumePercent(range, ValueRangeAll)) {
-        if (range.atEnd())
-            return firstPercent;
-        if (!consumeSlashIncludingWhitespace(range))
-            return nullptr;
-        auto secondPercent = consumePercent(range, ValueRangeAll);
-        if (!secondPercent)
-            return nullptr;
-        if (firstPercent->floatValue() > secondPercent->floatValue())
-            return nullptr;
-        auto result = CSSValueList::createSlashSeparated();
-        result->append(firstPercent.releaseNonNull());
-        result->append(secondPercent.releaseNonNull());
-        return RefPtr<CSSValue>(WTFMove(result));
-    }
-
-    if (auto firstNumber = consumeNumber(range, ValueRangeAll)) {
-        if (range.atEnd())
-            return firstNumber;
-        if (!consumeSlashIncludingWhitespace(range))
-            return nullptr;
-        auto secondNumber = consumeNumber(range, ValueRangeAll);
-        if (!secondNumber)
-            return nullptr;
-        if (firstNumber->floatValue() > secondNumber->floatValue())
-            return nullptr;
-        auto result = CSSValueList::createSlashSeparated();
-        result->append(firstNumber.releaseNonNull());
-        result->append(secondNumber.releaseNonNull());
-        return RefPtr<CSSValue>(WTFMove(result));
-    }
-
-    return nullptr;
+    auto firstPercent = consumePercent(range, ValueRangeAll);
+    if (!firstPercent)
+        return nullptr;
+    if (range.atEnd())
+        return firstPercent;
+    auto secondPercent = consumePercent(range, ValueRangeAll);
+    if (!secondPercent)
+        return nullptr;
+    if (firstPercent->floatValue() > secondPercent->floatValue())
+        return nullptr;
+    auto result = CSSValueList::createSpaceSeparated();
+    result->append(firstPercent.releaseNonNull());
+    result->append(secondPercent.releaseNonNull());
+    return RefPtr<CSSValue>(WTFMove(result));
 }
 #endif
 
@@ -977,8 +954,6 @@
         return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
     if (auto angle = consumeAngle(range, cssParserMode))
         return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle));
-    if (auto number = consumeNumber(range, ValueRangeAll))
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(number->value<double>(), CSSPrimitiveValue::CSS_DEG));
     return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
 }
 
@@ -1009,23 +984,6 @@
         return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
     }
 
-    if (auto firstNumber = consumeNumber(range, ValueRangeAll)) {
-        if (range.atEnd()) {
-            auto result = CSSValueList::createSpaceSeparated();
-            result->append(firstNumber.releaseNonNull());
-            return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
-        }
-        auto secondNumber = consumeNumber(range, ValueRangeAll);
-        if (!secondNumber)
-            return nullptr;
-        if (firstNumber->floatValue() > secondNumber->floatValue())
-            return nullptr;
-        auto result = CSSValueList::createSpaceSeparated();
-        result->append(CSSValuePool::singleton().createValue(firstNumber->value<double>(), CSSPrimitiveValue::CSS_DEG));
-        result->append(CSSValuePool::singleton().createValue(secondNumber->value<double>(), CSSPrimitiveValue::CSS_DEG));
-        return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
-    }
-
     return nullptr;
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to