Title: [214507] trunk
Revision
214507
Author
mmaxfi...@apple.com
Date
2017-03-28 16:53:28 -0700 (Tue, 28 Mar 2017)

Log Message

Ranges for variation font properties are not enforced
https://bugs.webkit.org/show_bug.cgi?id=169979

Reviewed by David Hyatt.

Source/WebCore:

The spec specifies that:
- Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors
- Font stretch values less than or equal to 0% are parse errors
- Font style values less than or equal to -90deg or greater than or equal to 90deg are parse errors

Test: fast/text/variations/out-of-bounds-selection-properties.html

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontWeightRange):
(WebCore::fontStretchIsWithinRange):
(WebCore::consumeFontStretch):
(WebCore::consumeFontStretchRange):
(WebCore::fontStyleIsWithinRange):
(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-style-parse-expected.txt:
* fast/text/font-style-parse.html:
* fast/text/variations/font-loading-api-parse-ranges-expected.txt:
* fast/text/variations/font-loading-api-parse-ranges.html:
* fast/text/variations/out-of-bounds-selection-properties-expected.txt: Added.
* fast/text/variations/out-of-bounds-selection-properties.html: Added.
* platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214506 => 214507)


--- trunk/LayoutTests/ChangeLog	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/ChangeLog	2017-03-28 23:53:28 UTC (rev 214507)
@@ -1,3 +1,22 @@
+2017-03-28  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Ranges for variation font properties are not enforced
+        https://bugs.webkit.org/show_bug.cgi?id=169979
+
+        Reviewed by David Hyatt.
+
+        * 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-style-parse-expected.txt:
+        * fast/text/font-style-parse.html:
+        * fast/text/variations/font-loading-api-parse-ranges-expected.txt:
+        * fast/text/variations/font-loading-api-parse-ranges.html:
+        * fast/text/variations/out-of-bounds-selection-properties-expected.txt: Added.
+        * fast/text/variations/out-of-bounds-selection-properties.html: Added.
+        * platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
+
 2017-03-28  Andy Estes  <aes...@apple.com>
 
         [iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php

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


--- trunk/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt	2017-03-28 23:53:28 UTC (rev 214507)
@@ -25,7 +25,7 @@
 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[27].style.fontWeight is ""
 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"
@@ -63,7 +63,7 @@
 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[34].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[35].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[36].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[37].style.fontStretch is ""
@@ -72,9 +72,9 @@
 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[1].style.fontStyle is "oblique 20grad"
+PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 0.28318rad"
+PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 0.04turn"
 PASS styleTestSheet.cssRules[4].style.fontStyle is ""
 PASS styleTestSheet.cssRules[5].style.fontStyle is ""
 PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
@@ -83,7 +83,7 @@
 PASS styleTestSheet.cssRules[9].style.fontStyle is ""
 PASS styleTestSheet.cssRules[10].style.fontStyle is ""
 PASS styleTestSheet.cssRules[11].style.fontStyle is ""
-PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(1441deg)"
+PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(15.4deg)"
 PASS styleTestSheet.cssRules[13].style.fontStyle is ""
 PASS styleTestSheet.cssRules[14].style.fontStyle is ""
 PASS styleTestSheet.cssRules[15].style.fontStyle is ""
@@ -95,8 +95,8 @@
 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"
+PASS styleTestSheet.cssRules[24].style.fontStyle is "oblique 10deg 20deg"
+PASS styleTestSheet.cssRules[25].style.fontStyle is "oblique 10deg 20deg"
 PASS styleTestSheet.cssRules[26].style.fontStyle is ""
 PASS styleTestSheet.cssRules[27].style.fontStyle is ""
 PASS styleTestSheet.cssRules[28].style.fontStyle is ""
@@ -108,7 +108,7 @@
 PASS styleTestSheet.cssRules[34].style.fontStyle is ""
 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[37].style.fontStyle is "oblique 2deg 4grad"
 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"

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


--- trunk/LayoutTests/fast/text/font-selection-font-face-parse.html	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/font-selection-font-face-parse.html	2017-03-28 23:53:28 UTC (rev 214507)
@@ -231,13 +231,13 @@
     font-style: oblique 1deg;
 }
 @font-face {
-    font-style: oblique 200grad;
+    font-style: oblique 20grad;
 }
 @font-face {
-    font-style: oblique 6.28318rad;
+    font-style: oblique 0.28318rad;
 }
 @font-face {
-    font-style: oblique 4turn;
+    font-style: oblique 0.04turn;
 }
 @font-face {
     font-style: oblique 5;
@@ -264,31 +264,31 @@
     font-style: oblique calc(3 + 4);
 }
 @font-face {
-    font-style: oblique calc(4turn + 1deg);
+    font-style: oblique calc(0.04turn + 1deg);
 }
 @font-face {
-    font-style: oblique 100 200;
+    font-style: oblique 10 20;
 }
 @font-face {
-    font-style: oblique 100  200;
+    font-style: oblique 10  20;
 }
 @font-face {
-    font-style: oblique a 100 200;
+    font-style: oblique a 10 20;
 }
 @font-face {
-    font-style: oblique 100 200 a;
+    font-style: oblique 10 20 a;
 }
 @font-face {
-    font-style: oblique 100 a 200;
+    font-style: oblique 10 a 20;
 }
 @font-face {
-    font-style: oblique 100 a200;
+    font-style: oblique 10 a20;
 }
 @font-face {
-    font-style: oblique 100a 200;
+    font-style: oblique 10a 20;
 }
 @font-face {
-    font-style: oblique 100  a200;
+    font-style: oblique 10  a20;
 }
 @font-face {
     font-style: oblique 1 2;
@@ -300,28 +300,28 @@
     font-style: oblique 2 1;
 }
 @font-face {
-    font-style: oblique 100deg 200deg;
+    font-style: oblique 10deg 20deg;
 }
 @font-face {
-    font-style: oblique 100deg   200deg;
+    font-style: oblique 10deg   20deg;
 }
 @font-face {
-    font-style: oblique a 100deg 200deg;
+    font-style: oblique a 10deg 20deg;
 }
 @font-face {
-    font-style: oblique 100deg 200deg a;
+    font-style: oblique 10deg 20deg a;
 }
 @font-face {
-    font-style: oblique 100deg a 200deg;
+    font-style: oblique 10deg a 20deg;
 }
 @font-face {
-    font-style: oblique 100deg a200deg;
+    font-style: oblique 10deg a20deg;
 }
 @font-face {
-    font-style: oblique 100dega 200deg;
+    font-style: oblique 10dega 20deg;
 }
 @font-face {
-    font-style: oblique 100deg  a200deg;
+    font-style: oblique 10deg  a20deg;
 }
 @font-face {
     font-style: oblique 1deg 2deg;
@@ -339,7 +339,7 @@
     font-style: oblique 1deg 2;
 }
 @font-face {
-    font-style: oblique 2deg 1turn;
+    font-style: oblique 2deg 4grad;
 }
 @font-face {
     font-style: oblique calc(3 + 4) 8;
@@ -385,7 +385,7 @@
 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[27].style.fontWeight", "");
 shouldBeEqualToString("weightTestSheet.cssRules[28].style.fontWeight", "");
 shouldBeEqualToString("weightTestSheet.cssRules[29].style.fontWeight", "7 8");
 shouldBeEqualToString("weightTestSheet.cssRules[30].style.fontWeight", "2 7");
@@ -425,7 +425,7 @@
 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[34].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[35].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[36].style.fontStretch", "");
 shouldBeEqualToString("stretchTestSheet.cssRules[37].style.fontStretch", "");
@@ -436,9 +436,9 @@
 
 var styleTestSheet = document.getElementById("styleTest").sheet;
 shouldBeEqualToString("styleTestSheet.cssRules[0].style.fontStyle", "oblique 1deg");
-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[1].style.fontStyle", "oblique 20grad");
+shouldBeEqualToString("styleTestSheet.cssRules[2].style.fontStyle", "oblique 0.28318rad");
+shouldBeEqualToString("styleTestSheet.cssRules[3].style.fontStyle", "oblique 0.04turn");
 shouldBeEqualToString("styleTestSheet.cssRules[4].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[5].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[6].style.fontStyle", "italic");
@@ -447,7 +447,7 @@
 shouldBeEqualToString("styleTestSheet.cssRules[9].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[10].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[11].style.fontStyle", "");
-shouldBeEqualToString("styleTestSheet.cssRules[12].style.fontStyle", "oblique calc(1441deg)");
+shouldBeEqualToString("styleTestSheet.cssRules[12].style.fontStyle", "oblique calc(15.4deg)");
 
 shouldBeEqualToString("styleTestSheet.cssRules[13].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[14].style.fontStyle", "");
@@ -460,8 +460,8 @@
 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");
+shouldBeEqualToString("styleTestSheet.cssRules[24].style.fontStyle", "oblique 10deg 20deg");
+shouldBeEqualToString("styleTestSheet.cssRules[25].style.fontStyle", "oblique 10deg 20deg");
 shouldBeEqualToString("styleTestSheet.cssRules[26].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[27].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[28].style.fontStyle", "");
@@ -473,7 +473,7 @@
 shouldBeEqualToString("styleTestSheet.cssRules[34].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[35].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[36].style.fontStyle", "");
-shouldBeEqualToString("styleTestSheet.cssRules[37].style.fontStyle", "oblique 2deg 1turn");
+shouldBeEqualToString("styleTestSheet.cssRules[37].style.fontStyle", "oblique 2deg 4grad");
 shouldBeEqualToString("styleTestSheet.cssRules[38].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[39].style.fontStyle", "");
 shouldBeEqualToString("styleTestSheet.cssRules[40].style.fontStyle", "oblique calc(7deg) 8deg");
@@ -481,4 +481,4 @@
 </script>
 <script src=""
 </body>
-</html>
\ No newline at end of file
+</html>

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


--- trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt	2017-03-28 23:53:28 UTC (rev 214507)
@@ -31,9 +31,9 @@
 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.75deg"
-PASS setFontFaceStyle(fontFace, 'oblique 4turn') is "oblique 1440deg"
+PASS setFontFaceStyle(fontFace, 'oblique 20grad') is "oblique 18deg"
+PASS setFontFaceStyle(fontFace, 'oblique 0.28318rad') is "oblique 16deg"
+PASS setFontFaceStyle(fontFace, 'oblique 0.04turn') is "oblique 14.25deg"
 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"
@@ -42,7 +42,7 @@
 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)') 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 setFontFaceStyle(fontFace, 'oblique calc(0.04turn + 1deg)') is "oblique 15.25deg"
 PASS successfullyParsed is true
 
 TEST COMPLETE

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


--- trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse.html	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/font-selection-font-loading-api-parse.html	2017-03-28 23:53:28 UTC (rev 214507)
@@ -56,9 +56,9 @@
 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.75deg");
-shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 4turn')", "oblique 1440deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 20grad')", "oblique 18deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 0.28318rad')", "oblique 16deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 0.04turn')", "oblique 14.25deg");
 shouldThrow("setFontFaceStyle(fontFace, 'oblique 5')");
 shouldThrow("setFontFaceStyle(fontFace, 'oblique 20')");
 shouldBeEqualToString("setFontFaceStyle(fontFace, 'italic')", "italic");
@@ -67,8 +67,8 @@
 shouldThrow("setFontFaceStyle(fontFace, 'garbage')");
 shouldThrow("setFontFaceStyle(fontFace, 'initial')");
 shouldThrow("setFontFaceStyle(fontFace, 'oblique calc(3 + 4)')");
-shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique calc(4turn + 1deg)')", "oblique 1441deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique calc(0.04turn + 1deg)')", "oblique 15.25deg");
 </script>
 <script src=""
 </body>
-</html>
\ No newline at end of file
+</html>

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


--- trunk/LayoutTests/fast/text/font-style-parse-expected.txt	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/font-style-parse-expected.txt	2017-03-28 23:53:28 UTC (rev 214507)
@@ -1,8 +1,8 @@
 PASS window.getComputedStyle(document.getElementById('test1')).fontStyle is "normal"
 PASS window.getComputedStyle(document.getElementById('test2')).fontStyle is "oblique 1deg"
-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('test3')).fontStyle is "oblique 18deg"
+PASS window.getComputedStyle(document.getElementById('test4')).fontStyle is "oblique 16deg"
+PASS window.getComputedStyle(document.getElementById('test5')).fontStyle is "oblique 14.25deg"
 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"
@@ -11,7 +11,7 @@
 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 "normal"
-PASS window.getComputedStyle(document.getElementById('test14')).fontStyle is "oblique 1441deg"
+PASS window.getComputedStyle(document.getElementById('test14')).fontStyle is "oblique 15.25deg"
 PASS window.getComputedStyle(document.getElementById('test15')).fontStyle is "italic"
 PASS window.getComputedStyle(document.getElementById('test16')).fontStyle is "italic"
 PASS window.getComputedStyle(document.getElementById('test17')).fontStyle is "normal"

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


--- trunk/LayoutTests/fast/text/font-style-parse.html	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/font-style-parse.html	2017-03-28 23:53:28 UTC (rev 214507)
@@ -7,9 +7,9 @@
 <div style="font: 16px/18px 'Times';">
 <div id="test1"></div>
 <div id="test2" style="font-style: oblique 1deg;"></div>
-<div id="test3" style="font-style: oblique 200grad;"></div>
-<div id="test4" style="font-style: oblique 6.28318rad;"></div>
-<div id="test5" style="font-style: oblique 4turn;"></div>
+<div id="test3" style="font-style: oblique 20grad;"></div>
+<div id="test4" style="font-style: oblique 0.28318rad;"></div>
+<div id="test5" style="font-style: oblique 0.04turn;"></div>
 <div id="test6" style="font-style: oblique 5;"></div>
 <div id="test7" style="font-style: oblique 20;"></div>
 <div id="test8" style="font-style: italic;"></div>
@@ -18,7 +18,7 @@
 <div id="test11" style="font-style: garbage;"></div>
 <div id="test12" style="font-style: initial;"></div>
 <div id="test13" style="font-style: oblique calc(3 + 4);"></div>
-<div id="test14" style="font-style: oblique calc(4turn + 1deg);"></div>
+<div id="test14" style="font-style: oblique calc(0.04turn + 1deg);"></div>
 <div id="test15" style="font: 100 italic 48px/49px 'Helvetica Neue';"></div>
 <div id="test16" style="font: italic 100 48px/49px 'Helvetica Neue';"></div>
 <div id="test17" style="font: 100 48px/49px 'Helvetica Neue';"></div>
@@ -30,9 +30,9 @@
 <script>
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontStyle", "oblique 1deg");
-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('test3')).fontStyle", "oblique 18deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontStyle", "oblique 16deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontStyle", "oblique 14.25deg");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).fontStyle", "italic");
@@ -41,7 +41,7 @@
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).fontStyle", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStyle", "normal");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStyle", "oblique 1441deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStyle", "oblique 15.25deg");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontStyle", "italic");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).fontStyle", "italic");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).fontStyle", "normal");

Modified: trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges-expected.txt (214506 => 214507)


--- trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges-expected.txt	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges-expected.txt	2017-03-28 23:53:28 UTC (rev 214507)
@@ -7,11 +7,11 @@
 PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200a' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { weight: '50 150' })).weight is "50 150"
 PASS (new FontFace('asdf', 'url(notreal)', { weight: '2 3' })).weight is "2 3"
-PASS (new FontFace('asdf', 'url(notreal)', { weight: '-3 -2' })).weight is "-3 -2"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '-3 -2' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { weight: '5 4' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200 3' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200 a' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
-PASS (new FontFace('asdf', 'url(notreal)', { weight: '-3' })).weight is "-3"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '-3' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: 'semi-expanded expanded' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%' })).stretch is "100% 200%"
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: 'a100% 200%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
@@ -22,11 +22,11 @@
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%a' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '50% 60%' })).stretch is "50% 60%"
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '2% 3%' })).stretch is "2% 3%"
-PASS (new FontFace('asdf', 'url(notreal)', { stretch: '-3% -2%' })).stretch is "-3% -2%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '-3% -2%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '5% 4%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% 3%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% a' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
-PASS (new FontFace('asdf', 'url(notreal)', { stretch: '-3%' })).stretch is "-3%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '-3%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg' })).style is "oblique 10deg 20deg"
 PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique a10deg 20deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
 PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10dega 20deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..

Modified: trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges.html (214506 => 214507)


--- trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges.html	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges.html	2017-03-28 23:53:28 UTC (rev 214507)
@@ -14,11 +14,11 @@
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 200a' })).weight");
 shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '50 150' })).weight", "50 150");
 shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '2 3' })).weight", "2 3");
-shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '-3 -2' })).weight", "-3 -2");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '-3 -2' })).weight");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '5 4' })).weight");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 200 3' })).weight");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 200 a' })).weight");
-shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '-3' })).weight", "-3");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '-3' })).weight");
 
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: 'semi-expanded expanded' })).stretch");
 shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%' })).stretch", "100% 200%");
@@ -30,11 +30,11 @@
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%a' })).stretch");
 shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '50% 60%' })).stretch", "50% 60%");
 shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '2% 3%' })).stretch", "2% 3%");
-shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '-3% -2%' })).stretch", "-3% -2%");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '-3% -2%' })).stretch");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '5% 4%' })).stretch");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% 3%' })).stretch");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% a' })).stretch");
-shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '-3%' })).stretch", "-3%");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '-3%' })).stretch");
 
 shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg' })).style", "oblique 10deg 20deg");
 shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique a10deg 20deg' })).style");
@@ -53,4 +53,4 @@
 </script>
 <script src=""
 </body>
-</html>
\ No newline at end of file
+</html>

Added: trunk/LayoutTests/fast/text/variations/out-of-bounds-selection-properties-expected.txt (0 => 214507)


--- trunk/LayoutTests/fast/text/variations/out-of-bounds-selection-properties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/variations/out-of-bounds-selection-properties-expected.txt	2017-03-28 23:53:28 UTC (rev 214507)
@@ -0,0 +1,18 @@
+PASS window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-style') is "normal"
+PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-stretch') is "normal"
+PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-style') is "normal"
+PASS window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-style') is "normal"
+PASS window.getComputedStyle(document.getElementById('test6')).getPropertyValue('font-style') is "normal"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Hello
+Hello
+Hello
+Hello
+Hello
+Hello

Added: trunk/LayoutTests/fast/text/variations/out-of-bounds-selection-properties.html (0 => 214507)


--- trunk/LayoutTests/fast/text/variations/out-of-bounds-selection-properties.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/variations/out-of-bounds-selection-properties.html	2017-03-28 23:53:28 UTC (rev 214507)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="test1" style="font-weight: 1001; font-style: oblique 91deg;">Hello</div>
+<div id="test2" style="font-weight: -1; font-stretch: -1%; font-style: oblique -91deg;">Hello</div>
+<div id="test3" style="font: 1001 16px 'Times';">Hello</div>
+<div id="test4" style="font: -1 16px 'Times';">Hello</div>
+<div id="test5" style="font: oblique 91deg 16px 'Times';">Hello</div>
+<div id="test6" style="font: oblique -91deg 16px 'Times';">Hello</div>
+<script>
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-weight')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-style')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-weight')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-stretch')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-style')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-weight')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-weight')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-style')", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).getPropertyValue('font-style')", "normal");
+</script>
+<script src=""
+</body>
+</html>
\ No newline at end of file

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


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt	2017-03-28 23:53:28 UTC (rev 214507)
@@ -25,7 +25,7 @@
 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 .
+PASS weightTestSheet.cssRules[27].style.fontWeight is ""
 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 .
@@ -63,7 +63,7 @@
 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 .
+PASS stretchTestSheet.cssRules[34].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[35].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[36].style.fontStretch is ""
 PASS stretchTestSheet.cssRules[37].style.fontStretch is ""
@@ -72,9 +72,9 @@
 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"
+PASS styleTestSheet.cssRules[1].style.fontStyle is "oblique 20grad"
+PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 0.28318rad"
+PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 0.04turn"
 PASS styleTestSheet.cssRules[4].style.fontStyle is ""
 PASS styleTestSheet.cssRules[5].style.fontStyle is ""
 PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
@@ -83,7 +83,7 @@
 PASS styleTestSheet.cssRules[9].style.fontStyle is ""
 PASS styleTestSheet.cssRules[10].style.fontStyle is ""
 PASS styleTestSheet.cssRules[11].style.fontStyle is ""
-PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(1441deg)"
+PASS styleTestSheet.cssRules[12].style.fontStyle is "oblique calc(15.4deg)"
 PASS styleTestSheet.cssRules[13].style.fontStyle is ""
 PASS styleTestSheet.cssRules[14].style.fontStyle is ""
 PASS styleTestSheet.cssRules[15].style.fontStyle is ""
@@ -95,8 +95,8 @@
 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 .
+FAIL styleTestSheet.cssRules[24].style.fontStyle should be oblique 10deg 20deg. Was .
+FAIL styleTestSheet.cssRules[25].style.fontStyle should be oblique 10deg 20deg. Was .
 PASS styleTestSheet.cssRules[26].style.fontStyle is ""
 PASS styleTestSheet.cssRules[27].style.fontStyle is ""
 PASS styleTestSheet.cssRules[28].style.fontStyle is ""
@@ -108,7 +108,7 @@
 PASS styleTestSheet.cssRules[34].style.fontStyle is ""
 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[37].style.fontStyle should be oblique 2deg 4grad. 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 .

Modified: trunk/Source/WebCore/ChangeLog (214506 => 214507)


--- trunk/Source/WebCore/ChangeLog	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/Source/WebCore/ChangeLog	2017-03-28 23:53:28 UTC (rev 214507)
@@ -1,3 +1,26 @@
+2017-03-28  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Ranges for variation font properties are not enforced
+        https://bugs.webkit.org/show_bug.cgi?id=169979
+
+        Reviewed by David Hyatt.
+
+        The spec specifies that:
+        - Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors
+        - Font stretch values less than or equal to 0% are parse errors
+        - Font style values less than or equal to -90deg or greater than or equal to 90deg are parse errors
+
+        Test: fast/text/variations/out-of-bounds-selection-properties.html
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontWeightRange):
+        (WebCore::fontStretchIsWithinRange):
+        (WebCore::consumeFontStretch):
+        (WebCore::consumeFontStretchRange):
+        (WebCore::fontStyleIsWithinRange):
+        (WebCore::consumeFontStyle):
+        (WebCore::consumeFontStyleRange):
+
 2017-03-28  Andy Estes  <aes...@apple.com>
 
         [iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (214506 => 214507)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2017-03-28 23:50:55 UTC (rev 214506)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2017-03-28 23:53:28 UTC (rev 214507)
@@ -883,16 +883,14 @@
 {
     if (auto result = consumeFontWeightKeywordValue(range))
         return result;
-    auto firstNumber = consumeNumber(range, ValueRangeAll);
+    auto firstNumber = consumeFontWeightNumber(range);
     if (!firstNumber)
         return nullptr;
     if (range.atEnd())
         return firstNumber;
-    auto secondNumber = consumeNumber(range, ValueRangeAll);
-    if (!secondNumber)
+    auto secondNumber = consumeFontWeightNumber(range);
+    if (!secondNumber || firstNumber->floatValue() > secondNumber->floatValue())
         return nullptr;
-    if (firstNumber->floatValue() > secondNumber->floatValue())
-        return nullptr;
     auto result = CSSValueList::createSpaceSeparated();
     result->append(firstNumber.releaseNonNull());
     result->append(secondNumber.releaseNonNull());
@@ -905,11 +903,18 @@
     return consumeIdent<CSSValueUltraCondensed, CSSValueExtraCondensed, CSSValueCondensed, CSSValueSemiCondensed, CSSValueNormal, CSSValueSemiExpanded, CSSValueExpanded, CSSValueExtraExpanded, CSSValueUltraExpanded>(range);
 }
 
+static bool fontStretchIsWithinRange(float stretch)
+{
+    return stretch > 0;
+}
+
 static RefPtr<CSSPrimitiveValue> consumeFontStretch(CSSParserTokenRange& range)
 {
     if (auto result = consumeFontStretchKeywordValue(range))
         return result;
-    return consumePercent(range, ValueRangeAll);
+    if (auto percent = consumePercent(range, ValueRangeNonNegative))
+        return fontStretchIsWithinRange(percent->value<float>()) ? percent : nullptr;
+    return nullptr;
 }
 
 #if ENABLE(VARIATION_FONTS)
@@ -917,16 +922,14 @@
 {
     if (auto result = consumeFontStretchKeywordValue(range))
         return result;
-    auto firstPercent = consumePercent(range, ValueRangeAll);
-    if (!firstPercent)
+    auto firstPercent = consumePercent(range, ValueRangeNonNegative);
+    if (!firstPercent || !fontStretchIsWithinRange(firstPercent->value<float>()))
         return nullptr;
     if (range.atEnd())
         return firstPercent;
-    auto secondPercent = consumePercent(range, ValueRangeAll);
-    if (!secondPercent)
+    auto secondPercent = consumePercent(range, ValueRangeNonNegative);
+    if (!secondPercent || !fontStretchIsWithinRange(secondPercent->value<float>()) || firstPercent->floatValue() > secondPercent->floatValue())
         return nullptr;
-    if (firstPercent->floatValue() > secondPercent->floatValue())
-        return nullptr;
     auto result = CSSValueList::createSpaceSeparated();
     result->append(firstPercent.releaseNonNull());
     result->append(secondPercent.releaseNonNull());
@@ -939,6 +942,11 @@
     return consumeIdent<CSSValueNormal, CSSValueItalic, CSSValueOblique>(range);
 }
 
+static bool fontStyleIsWithinRange(float oblique)
+{
+    return oblique > -90 && oblique < 90;
+}
+
 static RefPtr<CSSFontStyleValue> consumeFontStyle(CSSParserTokenRange& range, CSSParserMode cssParserMode)
 {
     auto result = consumeFontStyleKeywordValue(range);
@@ -952,8 +960,11 @@
     ASSERT(result->valueID() == CSSValueOblique);
     if (range.atEnd())
         return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
-    if (auto angle = consumeAngle(range, cssParserMode))
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle));
+    if (auto angle = consumeAngle(range, cssParserMode)) {
+        if (fontStyleIsWithinRange(angle->value<float>(CSSPrimitiveValue::CSS_DEG)))
+            return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), WTFMove(angle));
+        return nullptr;
+    }
     return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
 }
 
@@ -968,6 +979,8 @@
         return CSSFontStyleRangeValue::create(keyword.releaseNonNull());
 
     if (auto firstAngle = consumeAngle(range, cssParserMode)) {
+        if (!fontStyleIsWithinRange(firstAngle->value<float>(CSSPrimitiveValue::CSS_DEG)))
+            return nullptr;
         if (range.atEnd()) {
             auto result = CSSValueList::createSpaceSeparated();
             result->append(firstAngle.releaseNonNull());
@@ -974,10 +987,8 @@
             return CSSFontStyleRangeValue::create(keyword.releaseNonNull(), WTFMove(result));
         }
         auto secondAngle = consumeAngle(range, cssParserMode);
-        if (!secondAngle)
+        if (!secondAngle || !fontStyleIsWithinRange(secondAngle->value<float>(CSSPrimitiveValue::CSS_DEG)) || firstAngle->floatValue(CSSPrimitiveValue::CSS_DEG) > secondAngle->floatValue(CSSPrimitiveValue::CSS_DEG))
             return nullptr;
-        if (firstAngle->floatValue(CSSPrimitiveValue::CSS_DEG) > secondAngle->floatValue(CSSPrimitiveValue::CSS_DEG))
-            return nullptr;
         auto result = CSSValueList::createSpaceSeparated();
         result->append(firstAngle.releaseNonNull());
         result->append(secondAngle.releaseNonNull());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to