Title: [214546] trunk
Revision
214546
Author
mmaxfi...@apple.com
Date
2017-03-29 10:40:21 -0700 (Wed, 29 Mar 2017)

Log Message

Variation fonts: Make sure that feature detection and preprocessor macros are right
https://bugs.webkit.org/show_bug.cgi?id=169518

Reviewed by Simon Fraser.

Source/WebCore:

When I added variable fonts support, I made all OSes parse the newly accepted values,
instead of just the OSes which support variable fonts.

Test: fast/text/font-variations-feature-detection.html

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontStretch):
(WebCore::consumeFontStyle):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::divisibleBy100):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):

LayoutTests:

Create platform-specific results for mac-elcapitan which doesn't support variation fonts.

* fast/text/font-variations-feature-detection-expected.html: Added.
* fast/text/font-variations-feature-detection.html: Added.
* platform/ios-simulator/TestExpectations:
* platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
* platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt: Added.
* platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt: Added.
* platform/mac-elcapitan/fast/text/font-style-parse-expected.txt: Added.
* platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt: Added.
* platform/mac/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214545 => 214546)


--- trunk/LayoutTests/ChangeLog	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/LayoutTests/ChangeLog	2017-03-29 17:40:21 UTC (rev 214546)
@@ -1,3 +1,22 @@
+2017-03-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Variation fonts: Make sure that feature detection and preprocessor macros are right
+        https://bugs.webkit.org/show_bug.cgi?id=169518
+
+        Reviewed by Simon Fraser.
+
+        Create platform-specific results for mac-elcapitan which doesn't support variation fonts.
+
+        * fast/text/font-variations-feature-detection-expected.html: Added.
+        * fast/text/font-variations-feature-detection.html: Added.
+        * platform/ios-simulator/TestExpectations:
+        * platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
+        * platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt: Added.
+        * platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt: Added.
+        * platform/mac-elcapitan/fast/text/font-style-parse-expected.txt: Added.
+        * platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt: Added.
+        * platform/mac/TestExpectations:
+
 2017-03-29  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Controls bar may disappear while captions menu is visible (redux)

Added: trunk/LayoutTests/fast/text/font-variations-feature-detection-expected.html (0 => 214546)


--- trunk/LayoutTests/fast/text/font-variations-feature-detection-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-variations-feature-detection-expected.html	2017-03-29 17:40:21 UTC (rev 214546)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that font-variations can be feature-detected on OSes which don't support it.
+<div id="container" style="font-size: 36px;">
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span style="font-family: 'Helvetica';">Hello</span>
+<span>Pass</span>
+<span>Pass</span>
+<span>Pass</span>
+<span>Pass</span>
+<span>Pass</span>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/font-variations-feature-detection.html (0 => 214546)


--- trunk/LayoutTests/fast/text/font-variations-feature-detection.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-variations-feature-detection.html	2017-03-29 17:40:21 UTC (rev 214546)
@@ -0,0 +1,157 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+	font-family: "WebFont";
+	src: url("../../resources/Ahem.otf") format("woff-variations"), local("Helvetica");
+}
+@font-face {
+	font-family: "WebFont2";
+	src: url("../../resources/Ahem.otf") format("truetype-variations"), local("Helvetica");
+}
+@font-face {
+	font-family: "WebFont3";
+	src: url("../../resources/Ahem.otf") format("opentype-variations"), local("Helvetica");
+}
+
+@font-face {
+	font-family: "WebFont4";
+	font-weight: 100;
+	font-weight: 332;
+	src: url("../../resources/Ahem.otf");
+}
+@font-face {
+	font-family: "WebFont4";
+	font-weight: 200;
+	src: local("Helvetica");
+}
+@font-face {
+	font-family: "WebFont5";
+	font-weight: 700;
+	src: url("../../resources/Ahem.otf");
+}
+@font-face {
+	font-family: "WebFont5";
+	font-weight: 400;
+	src: local("Helvetica");
+}
+
+@font-face {
+	font-family: "WebFont6";
+	font-stretch: ultra-expanded;
+	font-stretch: 110%;
+	src: url("../../resources/Ahem.otf");
+}
+@font-face {
+	font-family: "WebFont6";
+	font-stretch: expanded;
+	src: local("Helvetica");
+}
+@font-face {
+	font-family: "WebFont7";
+	font-stretch: extra-expanded;
+	src: url("../../resources/Ahem.otf");
+}
+@font-face {
+	font-family: "WebFont7";
+	font-stretch: semi-expanded;
+	src: local("Helvetica");
+}
+
+@font-face {
+	font-family: "WebFont8";
+	font-style: oblique;
+	src: url("../../resources/Ahem.otf");
+}
+@font-face {
+	font-family: "WebFont8";
+	font-style: normal;
+	src: local("Helvetica");
+}
+
+#supportsTest1 {
+	font-family: "Helvetica";
+}
+@supports (font-variation-settings: 'abcd' 3) {
+	#supportsTest1 {
+		font-family: "Ahem";
+	}
+}
+#supportsTest2 {
+	font-family: "Helvetica";
+}
+@supports (font-weight: 401) {
+	#supportsTest2 {
+		font-family: "Ahem";
+	}
+}
+#supportsTest3 {
+	font-family: "Helvetica";
+}
+@supports (font-stretch: 101%) {
+	#supportsTest3 {
+		font-family: "Ahem";
+	}
+}
+#supportsTest4 {
+	font-family: "Helvetica";
+}
+@supports (font-style: oblique 21deg) {
+	#supportsTest4 {
+		font-family: "Ahem";
+	}
+}
+</style>
+</head>
+<body>
+This test makes sure that font-variations can be feature-detected on OSes which don't support it.
+<div id="container" style="font-size: 36px;">
+<span style="font-family: 'WebFont';">Hello</span>
+<span style="font-family: 'WebFont2';">Hello</span>
+<span style="font-family: 'WebFont3';">Hello</span>
+<span style="font-family: 'WebFont4';">Hello</span>
+<span style="font-family: 'WebFont5'; font-weight: 899;">Hello</span>
+<span style="font-family: 'WebFont6';">Hello</span>
+<span style="font-family: 'WebFont7'; font-stretch: 200%;">Hello</span>
+<span style="font-family: 'WebFont7'; font-style: italic 80deg;">Hello</span>
+<span id="supportsTest1">Hello</span>
+<span id="supportsTest2">Hello</span>
+<span id="supportsTest3">Hello</span>
+<span id="supportsTest4">Hello</span>
+<span id="result1"></span>
+<span id="result2"></span>
+<span id="result3"></span>
+<span id="result4"></span>
+<span id="result5"></span>
+</div>
+<script>
+var container = document.getElementById("container");
+var result1 = document.getElementById("result1");
+var result2 = document.getElementById("result2");
+var result3 = document.getElementById("result3");
+var result4 = document.getElementById("result4");
+var result5 = document.getElementById("result5");
+if (!CSS.supports("font-variation-settings", "'abcd' 3"))
+	result1.textContent = "Pass";
+else
+	result1.textContent = "Fail";
+if (!CSS.supports("font-weight", "401"))
+	result2.textContent = "Pass";
+else
+	result2.textContent = "Fail";
+if (!CSS.supports("font-stretch", "101%"))
+	result3.textContent = "Pass";
+else
+	result3.textContent = "Fail";
+if (!CSS.supports("font-style", "oblique 21deg"))
+	result4.textContent = "Pass";
+else
+	result4.textContent = "Fail";
+if (!window.getComputedStyle(container).getPropertyValue("font-variation-settings"))
+	result5.textContent = "Pass";
+else
+	result5.textContent = "Fail";
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios/TestExpectations (214545 => 214546)


--- trunk/LayoutTests/platform/ios/TestExpectations	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2017-03-29 17:40:21 UTC (rev 214546)
@@ -2742,6 +2742,7 @@
 webkit.org/b/163093 fast/text/variations/advances.html [ Failure ]
 webkit.org/b/163093 fast/text/variations/outofbounds.html [ ImageOnlyFailure ]
 webkit.org/b/163093 fast/text/variations/default-value.html [ ImageOnlyFailure ]
+webkit.org/b/169518 fast/text/font-variations-feature-detection.html [ ImageOnlyFailure ]
 
 webkit.org/b/162647 http/tests/xmlhttprequest/onabort-response-getters.html [ Pass Failure ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (214545 => 214546)


--- trunk/LayoutTests/platform/mac/TestExpectations	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2017-03-29 17:40:21 UTC (rev 214546)
@@ -1431,6 +1431,11 @@
 [ ElCapitan Yosemite ] fast/text/variations [ Pass Failure ImageOnlyFailure ]
 [ ElCapitan Yosemite ] animations/font-variations [ Pass Failure ImageOnlyFailure ]
 
+# This test makes sure that variation fonts are disabled on OSes which don't support them. So,
+# the test should be skipped on OSes which do support them. As soon as all OSes support them,
+# we should delete the test.
+[ Sierra+ ] fast/text/font-variations-feature-detection.html [ ImageOnlyFailure ]
+
 [ Debug ] fast/selectors/slow-style-sharing-with-long-cousin-list.html [ Skip ]
 
 webkit.org/b/161720 [ Debug ] storage/indexeddb/key-type-array.html [ Pass Timeout ]

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


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt	2017-03-29 17:40:21 UTC (rev 214546)
@@ -1,4 +1,4 @@
-PASS weightTestSheet.cssRules[0].style.fontWeight is "1"
+FAIL weightTestSheet.cssRules[0].style.fontWeight should be 1. Was .
 PASS weightTestSheet.cssRules[1].style.fontWeight is "100"
 PASS weightTestSheet.cssRules[2].style.fontWeight is "200"
 PASS weightTestSheet.cssRules[3].style.fontWeight is "300"
@@ -13,7 +13,7 @@
 PASS weightTestSheet.cssRules[12].style.fontWeight is ""
 PASS weightTestSheet.cssRules[13].style.fontWeight is ""
 PASS weightTestSheet.cssRules[14].style.fontWeight is ""
-PASS weightTestSheet.cssRules[15].style.fontWeight is "7"
+FAIL weightTestSheet.cssRules[15].style.fontWeight should be 7. Was .
 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 .
@@ -29,7 +29,7 @@
 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 .
-PASS stretchTestSheet.cssRules[0].style.fontStretch is "1%"
+FAIL stretchTestSheet.cssRules[0].style.fontStretch should be 1%. Was .
 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"
@@ -71,10 +71,10 @@
 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 20grad"
-PASS styleTestSheet.cssRules[2].style.fontStyle is "oblique 0.28318rad"
-PASS styleTestSheet.cssRules[3].style.fontStyle is "oblique 0.04turn"
+FAIL styleTestSheet.cssRules[0].style.fontStyle should be oblique 1deg. Was .
+FAIL styleTestSheet.cssRules[1].style.fontStyle should be oblique 20grad. Was .
+FAIL styleTestSheet.cssRules[2].style.fontStyle should be oblique 0.28318rad. Was .
+FAIL styleTestSheet.cssRules[3].style.fontStyle should be oblique 0.04turn. Was .
 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(15.4deg)"
+FAIL styleTestSheet.cssRules[12].style.fontStyle should be oblique calc(15.4deg). Was .
 PASS styleTestSheet.cssRules[13].style.fontStyle is ""
 PASS styleTestSheet.cssRules[14].style.fontStyle is ""
 PASS styleTestSheet.cssRules[15].style.fontStyle is ""

Added: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt (0 => 214546)


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt	2017-03-29 17:40:21 UTC (rev 214546)
@@ -0,0 +1,54 @@
+PASS window.getComputedStyle(document.getElementById('test1')).fontStyle is "normal"
+FAIL window.getComputedStyle(document.getElementById('test2')).fontStyle should be oblique 1deg. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test3')).fontStyle should be oblique 18deg. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test4')).fontStyle should be oblique 16deg. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test5')).fontStyle should be oblique 14.25deg. Was normal.
+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 "normal"
+FAIL window.getComputedStyle(document.getElementById('test14')).fontStyle should be oblique 15.25deg. Was normal.
+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"
+PASS window.getComputedStyle(document.getElementById('test18')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test19')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal"
+FAIL window.getComputedStyle(document.getElementById('test21')).fontStyle should be oblique 14deg. Was normal.
+PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test2')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test3')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test4')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test5')).font should be 16px/18px Times. Was normal 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 "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test14')).font should be 16px/18px Times. Was normal normal normal normal 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'"
+PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test18')).font is "italic normal normal normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test19')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test21')).font should be 48px/49px 'Helvetica Neue'. Was normal normal normal normal 16px/18px Times.
+PASS document.getElementById('test1').style.font is ""
+PASS document.getElementById('test15').style.font is "italic 100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test16').style.font is "italic 100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test17').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test18').style.font is "italic 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test19').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test20').style.font is ""
+FAIL document.getElementById('test21').style.font should be oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'. Was .
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-loading-api-parse-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Author Date Id Rev URL \ No newline at end of property

Added: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt (0 => 214546)


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt	2017-03-29 17:40:21 UTC (rev 214546)
@@ -0,0 +1,52 @@
+PASS window.getComputedStyle(document.getElementById('test1')).fontStretch is "normal"
+FAIL window.getComputedStyle(document.getElementById('test2')).fontStretch should be 1%. Was normal.
+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"
+PASS window.getComputedStyle(document.getElementById('test7')).fontStretch is "semi-condensed"
+PASS window.getComputedStyle(document.getElementById('test8')).fontStretch is "normal"
+PASS window.getComputedStyle(document.getElementById('test9')).fontStretch is "semi-expanded"
+PASS window.getComputedStyle(document.getElementById('test10')).fontStretch is "expanded"
+PASS window.getComputedStyle(document.getElementById('test11')).fontStretch is "extra-expanded"
+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 "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"
+FAIL window.getComputedStyle(document.getElementById('test21')).fontStretch should be 7%. Was normal.
+PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test2')).font should be 16px/18px Times. Was normal normal normal normal 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"
+PASS window.getComputedStyle(document.getElementById('test7')).font is "normal normal normal semi-condensed 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test8')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test9')).font is "normal normal normal semi-expanded 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal normal expanded 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal normal extra-expanded 16px/18px Times"
+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 "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'"
+FAIL window.getComputedStyle(document.getElementById('test21')).font should be 16px/18px Times. Was normal normal normal normal 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'"
+PASS document.getElementById('test18').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test19').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test20').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-stretch-parse-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Author Date Id Rev URL \ No newline at end of property

Added: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-style-parse-expected.txt (0 => 214546)


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-style-parse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-style-parse-expected.txt	2017-03-29 17:40:21 UTC (rev 214546)
@@ -0,0 +1,54 @@
+PASS window.getComputedStyle(document.getElementById('test1')).fontStyle is "normal"
+FAIL window.getComputedStyle(document.getElementById('test2')).fontStyle should be oblique 1deg. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test3')).fontStyle should be oblique 180deg. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test4')).fontStyle should be oblique 359.75deg. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test5')).fontStyle should be oblique 1440deg. Was normal.
+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 "normal"
+FAIL window.getComputedStyle(document.getElementById('test14')).fontStyle should be oblique 1441deg. Was normal.
+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"
+PASS window.getComputedStyle(document.getElementById('test18')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test19')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal"
+FAIL window.getComputedStyle(document.getElementById('test21')).fontStyle should be oblique 14deg. Was normal.
+PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test2')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test3')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test4')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test5')).font should be 16px/18px Times. Was normal 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 "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test14')).font should be 16px/18px Times. Was normal normal normal normal 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'"
+PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test18')).font is "italic normal normal normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test19')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test21')).font should be 48px/49px 'Helvetica Neue'. Was normal normal normal normal 16px/18px Times.
+PASS document.getElementById('test1').style.font is ""
+PASS document.getElementById('test15').style.font is "italic 100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test16').style.font is "italic 100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test17').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test18').style.font is "italic 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test19').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test20').style.font is ""
+FAIL document.getElementById('test21').style.font should be oblique 14deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'. Was .
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-style-parse-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Author Date Id Rev URL \ No newline at end of property

Added: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt (0 => 214546)


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt	2017-03-29 17:40:21 UTC (rev 214546)
@@ -0,0 +1,69 @@
+PASS window.getComputedStyle(document.getElementById('test1')).fontWeight is "normal"
+FAIL window.getComputedStyle(document.getElementById('test2')).fontWeight should be 1. Was normal.
+PASS window.getComputedStyle(document.getElementById('test3')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test4')).fontWeight is "200"
+PASS window.getComputedStyle(document.getElementById('test5')).fontWeight is "300"
+PASS window.getComputedStyle(document.getElementById('test6')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test7')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test8')).fontWeight is "500"
+PASS window.getComputedStyle(document.getElementById('test9')).fontWeight is "600"
+PASS window.getComputedStyle(document.getElementById('test10')).fontWeight is "bold"
+PASS window.getComputedStyle(document.getElementById('test11')).fontWeight is "bold"
+PASS window.getComputedStyle(document.getElementById('test12')).fontWeight is "800"
+PASS window.getComputedStyle(document.getElementById('test13')).fontWeight is "900"
+PASS window.getComputedStyle(document.getElementById('test14')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test15')).fontWeight is "normal"
+FAIL window.getComputedStyle(document.getElementById('test16')).fontWeight should be 7. Was normal.
+PASS window.getComputedStyle(document.getElementById('test17')).fontWeight is "300"
+PASS window.getComputedStyle(document.getElementById('test18')).fontWeight is "200"
+PASS window.getComputedStyle(document.getElementById('test19')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test20')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test21')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test22')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test23')).fontWeight is "100"
+FAIL window.getComputedStyle(document.getElementById('test24')).fontWeight should be 123. Was normal.
+PASS window.getComputedStyle(document.getElementById('test25')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test26')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test27')).fontWeight is "normal"
+FAIL window.getComputedStyle(document.getElementById('test28')).fontWeight should be 0. Was normal.
+FAIL window.getComputedStyle(document.getElementById('test29')).fontWeight should be 1000. Was normal.
+PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test2')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+PASS window.getComputedStyle(document.getElementById('test3')).font is "normal normal 100 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test4')).font is "normal normal 200 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test5')).font is "normal normal 300 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 "normal normal 500 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test9')).font is "normal normal 600 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal bold normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal bold normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test12')).font is "normal normal 800 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test13')).font is "normal normal 900 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 "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test16')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 300 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test18')).font is "normal normal 200 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test19')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test21')).font is "normal normal normal extra-condensed 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test22')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test23')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+FAIL window.getComputedStyle(document.getElementById('test24')).font should be 48px/49px 'Helvetica Neue'. Was normal normal normal normal 16px/18px Times.
+PASS window.getComputedStyle(document.getElementById('test25')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test26')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test27')).font is "normal normal normal normal 16px/18px Times"
+FAIL window.getComputedStyle(document.getElementById('test28')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+FAIL window.getComputedStyle(document.getElementById('test29')).font should be 16px/18px Times. Was normal normal normal normal 16px/18px Times.
+PASS document.getElementById('test1').style.font is ""
+PASS document.getElementById('test19').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test20').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test21').style.font is "extra-condensed 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test22').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test23').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+FAIL document.getElementById('test24').style.font should be italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue'. Was .
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/platform/mac-elcapitan/fast/text/font-weight-parse-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Author Date Id Rev URL \ No newline at end of property

Modified: trunk/Source/WebCore/ChangeLog (214545 => 214546)


--- trunk/Source/WebCore/ChangeLog	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/Source/WebCore/ChangeLog	2017-03-29 17:40:21 UTC (rev 214546)
@@ -1,3 +1,22 @@
+2017-03-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Variation fonts: Make sure that feature detection and preprocessor macros are right
+        https://bugs.webkit.org/show_bug.cgi?id=169518
+
+        Reviewed by Simon Fraser.
+
+        When I added variable fonts support, I made all OSes parse the newly accepted values,
+        instead of just the OSes which support variable fonts.
+
+        Test: fast/text/font-variations-feature-detection.html
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontStretch):
+        (WebCore::consumeFontStyle):
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::divisibleBy100):
+        (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
+
 2017-03-29  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Controls bar may disappear while captions menu is visible (redux)

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (214545 => 214546)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2017-03-29 17:40:21 UTC (rev 214546)
@@ -903,17 +903,21 @@
     return consumeIdent<CSSValueUltraCondensed, CSSValueExtraCondensed, CSSValueCondensed, CSSValueSemiCondensed, CSSValueNormal, CSSValueSemiExpanded, CSSValueExpanded, CSSValueExtraExpanded, CSSValueUltraExpanded>(range);
 }
 
+#if ENABLE(VARIATION_FONTS)
 static bool fontStretchIsWithinRange(float stretch)
 {
     return stretch > 0;
 }
+#endif
 
 static RefPtr<CSSPrimitiveValue> consumeFontStretch(CSSParserTokenRange& range)
 {
     if (auto result = consumeFontStretchKeywordValue(range))
         return result;
+#if ENABLE(VARIATION_FONTS)
     if (auto percent = consumePercent(range, ValueRangeNonNegative))
         return fontStretchIsWithinRange(percent->value<float>()) ? percent : nullptr;
+#endif
     return nullptr;
 }
 
@@ -942,10 +946,12 @@
     return consumeIdent<CSSValueNormal, CSSValueItalic, CSSValueOblique>(range);
 }
 
+#if ENABLE(VARIATION_FONTS)
 static bool fontStyleIsWithinRange(float oblique)
 {
     return oblique > -90 && oblique < 90;
 }
+#endif
 
 static RefPtr<CSSFontStyleValue> consumeFontStyle(CSSParserTokenRange& range, CSSParserMode cssParserMode)
 {
@@ -953,18 +959,21 @@
     if (!result)
         return nullptr;
 
-    if (result->valueID() == CSSValueNormal)
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
-    if (result->valueID() == CSSValueItalic)
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueItalic));
+    auto valueID = result->valueID();
+    if (valueID == CSSValueNormal || valueID == CSSValueItalic)
+        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(valueID));
     ASSERT(result->valueID() == CSSValueOblique);
-    if (range.atEnd())
-        return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
-    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;
+#if ENABLE(VARIATION_FONTS)
+    if (!range.atEnd()) {
+        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;
+        }
     }
+#else
+    UNUSED_PARAM(cssParserMode);
+#endif
     return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique));
 }
 

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (214545 => 214546)


--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2017-03-29 17:28:48 UTC (rev 214545)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2017-03-29 17:40:21 UTC (rev 214546)
@@ -197,17 +197,32 @@
     return nullptr;
 }
 
+#if !ENABLE(VARIATION_FONTS)
+static inline bool divisibleBy100(double value)
+{
+    return static_cast<int>(value / 100) * 100 == value;
+}
+#endif
+
 RefPtr<CSSPrimitiveValue> consumeFontWeightNumber(CSSParserTokenRange& range)
 {
     // Values less than or equal to 0 or greater than or equal to 1000 are parse errors.
     auto& token = range.peek();
-    if (token.type() == NumberToken && token.numericValue() > 0 && token.numericValue() < 1000)
+    if (token.type() == NumberToken && token.numericValue() > 0 && token.numericValue() < 1000
+#if !ENABLE(VARIATION_FONTS)
+        && token.numericValueType() == IntegerValueType && divisibleBy100(token.numericValue())
+#endif
+    )
         return consumeNumber(range, ValueRangeAll);
 
     // "[For calc()], the used value resulting from an _expression_ must be clamped to the range allowed in the target context."
     CalcParser calcParser(range, ValueRangeAll);
     double result;
-    if (calcParser.consumeNumberRaw(result)) {
+    if (calcParser.consumeNumberRaw(result)
+#if !ENABLE(VARIATION_FONTS)
+        && result > 0 && result < 1000 && divisibleBy100(result)
+#endif
+    ) {
         result = std::min(std::max(result, std::nextafter(0., 1.)), std::nextafter(1000., 0.));
         return CSSValuePool::singleton().createValue(result, CSSPrimitiveValue::UnitType::CSS_NUMBER);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to