Unprefix -webkit-font-feature-settings
[WebKit-https.git] / LayoutTests / css3 / font-feature-settings-parsing.html
index 4c0be0f..d157ec7 100644 (file)
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
 <style>
 #valid_normal {
-    -webkit-font-feature-settings: normal;
+    font-feature-settings: normal;
 }
 
 #valid_value_1 {
-    -webkit-font-feature-settings: "dlig" 1;
+    font-feature-settings: "dlig" 1;
 }
 
 #valid_value_2 {
-    -webkit-font-feature-settings: "swsh" 2;
+    font-feature-settings: "swsh" 2;
 }
 
 #valid_value_on {
-    -webkit-font-feature-settings: "smcp" on;
+    font-feature-settings: "smcp" on;
 }
 
 #valid_value_off {
-    -webkit-font-feature-settings: "liga" off;
+    font-feature-settings: "liga" off;
 }
 
 #valid_value_omit {
-    -webkit-font-feature-settings: "c2sc";
+    font-feature-settings: "c2sc";
 }
 
 #valid_valuelist {
-    -webkit-font-feature-settings: "tnum", 'hist';
+    font-feature-settings: "tnum", 'hist';
 }
 
 #valid_singlequote {
-    -webkit-font-feature-settings: 'PKRN';
+    font-feature-settings: 'PKRN';
 }
 
-#valid_ident {
-    -webkit-font-feature-settings: dlig;
+#valid_unusual_tag {
+    font-feature-settings: "!@#$";
 }
 
-#valid_unusual_tag {
-    -webkit-font-feature-settings: "!@#$";
+#valid_tag_space {
+    font-feature-settings: "a bc";
 }
 
-#valid_cases {
-    -webkit-font-feature-settings: dlig, DLIG, DLig;
+#valid_composite {
+    font-feature-settings: "dlig" 1, 'smcp' on, 'lig ' off;
 }
 
-#valid_tag_space {
-    -webkit-font-feature-settings: "a bc";
+#invalid_ident {
+    font-feature-settings: dlig;
 }
 
-#valid_composite {
-    -webkit-font-feature-settings: "dlig" 1, 'smcp' on, liga off;
+#invalid_cases {
+    font-feature-settings: dlig, DLIG, DLig;
 }
 
 #invalid_1 {
-    -webkit-font-feature-settings: 1;
+    font-feature-settings: 1;
 }
 
 #invalid_off {
-    -webkit-font-feature-settings: off;
+    font-feature-settings: off;
 }
 
 #invalid_normal_duplicate {
-    -webkit-font-feature-settings: normal, normal;
+    font-feature-settings: normal, normal;
 }
 
 #invalid_normal_list {
-    -webkit-font-feature-settings: normal, aaaa;
+    font-feature-settings: normal, aaaa;
 }
 
 #invalid_longer_ident {
-    -webkit-font-feature-settings: aaaaa;
+    font-feature-settings: aaaaa;
 }
 
 #invalid_longer_quote {
-    -webkit-font-feature-settings: "aaaaa";
+    font-feature-settings: "aaaaa";
 }
 
 #invalid_negative {
-    -webkit-font-feature-settings: aaaa -1;
+    font-feature-settings: aaaa -1;
 }
 
 #invalid_float {
-    -webkit-font-feature-settings: aaaa 1.5;
+    font-feature-settings: aaaa 1.5;
 }
 
 #invalid_missing_comma {
-    -webkit-font-feature-settings: aaaa "bbbb";
+    font-feature-settings: aaaa "bbbb";
 }
 
 #invalid_missing_comma_ident {
-    -webkit-font-feature-settings: aaaa bbbb;
+    font-feature-settings: aaaa bbbb;
 }
 
 #invalid_comma {
-    -webkit-font-feature-settings: ,;
+    font-feature-settings: ,;
 }
 
 #invalid_ending_comma {
-    -webkit-font-feature-settings: aaaa,;
+    font-feature-settings: aaaa,;
 }
 
 #invalid_beginning_comma {
-    -webkit-font-feature-settings: ,aaaa;
+    font-feature-settings: ,aaaa;
 }
 
 #invalid_on {
-    -webkit-font-feature-settings: aaaa, on;
+    font-feature-settings: aaaa, on;
 }
 
 #invalid_0 {
-    -webkit-font-feature-settings: "aaaa" 1, "bbbb", 0;
+    font-feature-settings: "aaaa" 1, "bbbb", 0;
 }
 
 #invalid_composite {
-    -webkit-font-feature-settings: aaaaa on, dlig on, PKRN -1;
+    font-feature-settings: aaaaa on, dlig on, PKRN -1;
 }
 </style>
 <style>
 @font-face {
-    -webkit-font-feature-settings: 'liga';
+    font-feature-settings: 'liga';
 }
 
 @font-face {
-    -webkit-font-feature-settings: aaaaa;
+    font-feature-settings: aaaaa;
 }
 </style>
+<script src="../resources/js-test-pre.js"></script>
 </head>
 <body>
 <div id="valid_normal"></div>
 <div id="valid_value_omit"></div>
 <div id="valid_valuelist"></div>
 <div id="valid_singlequote"></div>
-<div id="valid_ident"></div>
 <div id="valid_unusual_tag"></div>
 <div id="valid_tag_space"></div>
-<div id="valid_cases"></div>
 <div id="valid_composite"></div>
 
+<div id="invalid_ident"></div>
+<div id="invalid_cases"></div>
 <div id="invalid_1"></div>
 <div id="invalid_off"></div>
 <div id="invalid_normal_duplicate"></div>
 <div id="invalid_on"></div>
 <div id="invalid_0"></div>
 
-<div id="outer" style="-webkit-font-feature-settings: dlig;">
+<div id="outer" style="font-feature-settings: 'dlig';">
   <div id="inner"></div>
 </div>
 
 <script>
 description('Test parsing of the CSS3 font-feature-settings property.');
 
+function canonicalize(fontFeatureSettingsString) {
+    var pieces = fontFeatureSettingsString.split(", ");
+    var lowered = pieces.map(function(piece) {
+        return piece.toLowerCase();
+    });
+    var sorted = lowered.sort();
+    return sorted.join(", ");
+}
+
 function parseResultOf(id) {
     var element = document.getElementById(id);
-    return window.getComputedStyle(element)['-webkit-font-feature-settings'];
+    return window.getComputedStyle(element)['font-feature-settings'];
 }
 
 debug('- Tests valid inputs.');
-shouldBeEqualToString('parseResultOf("valid_normal")', "normal");
-shouldBeEqualToString('parseResultOf("valid_value_1")', "'dlig' 1");
-shouldBeEqualToString('parseResultOf("valid_value_2")', "'swsh' 2");
-shouldBeEqualToString('parseResultOf("valid_value_on")', "'smcp' 1");
-shouldBeEqualToString('parseResultOf("valid_value_off")', "'liga' 0");
-shouldBeEqualToString('parseResultOf("valid_value_omit")', "'c2sc' 1");
-shouldBeEqualToString('parseResultOf("valid_valuelist")', "'tnum' 1, 'hist' 1");
-shouldBeEqualToString('parseResultOf("valid_singlequote")', "'PKRN' 1");
-shouldBeEqualToString('parseResultOf("valid_ident")', "'dlig' 1");
-shouldBeEqualToString('parseResultOf("valid_unusual_tag")', "'!@#$' 1");
-shouldBeEqualToString('parseResultOf("valid_tag_space")', "'a bc' 1");
-shouldBeEqualToString('parseResultOf("valid_cases")', "'dlig' 1, 'DLIG' 1, 'DLig' 1");
-shouldBeEqualToString('parseResultOf("valid_composite")', "'dlig' 1, 'smcp' 1, 'liga' 0");
+shouldBeEqualToString('canonicalize(parseResultOf("valid_normal"))', canonicalize("normal"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_value_1"))', canonicalize("'dlig' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_value_2"))', canonicalize("'swsh' 2"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_value_on"))', canonicalize("'smcp' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_value_off"))', canonicalize("'liga' 0"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_value_omit"))', canonicalize("'c2sc' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_valuelist"))', canonicalize("'tnum' 1, 'hist' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_singlequote"))', canonicalize("'PKRN' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_unusual_tag"))', canonicalize("'!@#$' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_tag_space"))', canonicalize("'a bc' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("valid_composite"))', canonicalize("'dlig' 1, 'smcp' 1, 'lig ' 0"));
 
 debug('- Tests invalid inputs.  Results should be "normal".');
+shouldBe('parseResultOf("invalid_ident")', '"normal"');
+shouldBe('parseResultOf("invalid_cases")', '"normal"');
 shouldBe('parseResultOf("invalid_1")', '"normal"');
 shouldBe('parseResultOf("invalid_off")', '"normal"');
 shouldBe('parseResultOf("invalid_normal_duplicate")', '"normal"');
@@ -206,17 +215,16 @@ shouldBe('parseResultOf("invalid_on")', '"normal"');
 shouldBe('parseResultOf("invalid_0")', '"normal"');
 
 debug('- Tests inherit.');
-shouldBeEqualToString('parseResultOf("outer")', "'dlig' 1");
-shouldBeEqualToString('parseResultOf("inner")', "'dlig' 1");
+shouldBeEqualToString('canonicalize(parseResultOf("outer"))', canonicalize("'dlig' 1"));
+shouldBeEqualToString('canonicalize(parseResultOf("inner"))', canonicalize("'dlig' 1"));
 
 debug('- Tests @font-face.');
-var fontFaceRuleValid = document.styleSheets[1].cssRules[0].style['-webkit-font-feature-settings'];
-var fontFaceRuleInvalid = document.styleSheets[1].cssRules[1].style['-webkit-font-feature-settings'];
-shouldBeEqualToString('fontFaceRuleValid', "'liga' 1");
+var fontFaceRuleValid = document.styleSheets[1].cssRules[0].style['font-feature-settings'];
+var fontFaceRuleInvalid = document.styleSheets[1].cssRules[1].style['font-feature-settings'];
+shouldBeEqualToString('canonicalize(fontFaceRuleValid)', canonicalize("'liga' 1"));
 shouldBeEqualToString('fontFaceRuleInvalid', "");
 
-var successfullyParsed = true;
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../resources/js-test-post.js"></script>
 </body>
 </html>