Use double-quotes when serializing font-feature-settings
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 00:08:44 +0000 (00:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 00:08:44 +0000 (00:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182201

Source/WebCore:

According to the CSSOM spec, all strings should be serialized with double-quotes. The feature
tag value was previously serialized with single-quotes; change this to double-quotes to match
the spec and non-WebKit browsers.

Patch by Chris Nardi <cnardi@chromium.org> on 2018-01-30
Reviewed by Myles C. Maxfield.

Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
and fast/text/font-face-javascript.html.

* css/CSSFontFeatureValue.cpp:
(WebCore::CSSFontFeatureValue::customCSSText const):

LayoutTests:

Update tests with double-quotes instead of single-quotes.

Patch by Chris Nardi <cnardi@chromium.org> on 2018-01-30
Reviewed by Myles C. Maxfield.

* css3/font-feature-settings-parsing-expected.txt:
* css3/font-feature-settings-parsing.html:
* fast/css/inherited-properties-rare-text-expected.txt:
* fast/text/font-face-javascript-expected.txt:
* fast/text/font-face-javascript.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/css3/font-feature-settings-parsing-expected.txt
LayoutTests/css3/font-feature-settings-parsing.html
LayoutTests/fast/css/inherited-properties-rare-text-expected.txt
LayoutTests/fast/text/font-face-javascript-expected.txt
LayoutTests/fast/text/font-face-javascript.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontFeatureValue.cpp

index bc45096..c45a758 100644 (file)
@@ -1,3 +1,18 @@
+2018-01-30  Chris Nardi  <cnardi@chromium.org>
+
+        Use double-quotes when serializing font-feature-settings
+        https://bugs.webkit.org/show_bug.cgi?id=182201
+
+        Update tests with double-quotes instead of single-quotes.
+
+        Reviewed by Myles C. Maxfield.
+
+        * css3/font-feature-settings-parsing-expected.txt:
+        * css3/font-feature-settings-parsing.html:
+        * fast/css/inherited-properties-rare-text-expected.txt:
+        * fast/text/font-face-javascript-expected.txt:
+        * fast/text/font-face-javascript.html:
+
 2018-01-30  Ryosuke Niwa  <rniwa@webkit.org>
 
         Release assert in updateLayout() via AXObjectCache::childrenChanged
index 3b0cc52..c4a2293 100644 (file)
@@ -5,16 +5,16 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 - Tests valid inputs.
 PASS canonicalize(parseResultOf("valid_normal")) is "normal"
-PASS canonicalize(parseResultOf("valid_value_1")) is "'dlig' 1"
-PASS canonicalize(parseResultOf("valid_value_2")) is "'swsh' 2"
-PASS canonicalize(parseResultOf("valid_value_on")) is "'smcp' 1"
-PASS canonicalize(parseResultOf("valid_value_off")) is "'liga' 0"
-PASS canonicalize(parseResultOf("valid_value_omit")) is "'c2sc' 1"
-PASS canonicalize(parseResultOf("valid_valuelist")) is "'hist' 1, 'tnum' 1"
-PASS canonicalize(parseResultOf("valid_singlequote")) is "'pkrn' 1"
-PASS canonicalize(parseResultOf("valid_unusual_tag")) is "'!@#$' 1"
-PASS canonicalize(parseResultOf("valid_tag_space")) is "'a bc' 1"
-PASS canonicalize(parseResultOf("valid_composite")) is "'dlig' 1, 'lig ' 0, 'smcp' 1"
+PASS canonicalize(parseResultOf("valid_value_1")) is "\"dlig\" 1"
+PASS canonicalize(parseResultOf("valid_value_2")) is "\"swsh\" 2"
+PASS canonicalize(parseResultOf("valid_value_on")) is "\"smcp\" 1"
+PASS canonicalize(parseResultOf("valid_value_off")) is "\"liga\" 0"
+PASS canonicalize(parseResultOf("valid_value_omit")) is "\"c2sc\" 1"
+PASS canonicalize(parseResultOf("valid_valuelist")) is "\"hist\" 1, \"tnum\" 1"
+PASS canonicalize(parseResultOf("valid_singlequote")) is "\"pkrn\" 1"
+PASS canonicalize(parseResultOf("valid_unusual_tag")) is "\"!@#$\" 1"
+PASS canonicalize(parseResultOf("valid_tag_space")) is "\"a bc\" 1"
+PASS canonicalize(parseResultOf("valid_composite")) is "\"dlig\" 1, \"lig \" 0, \"smcp\" 1"
 - Tests invalid inputs.  Results should be "normal".
 PASS parseResultOf("invalid_ident") is "normal"
 PASS parseResultOf("invalid_cases") is "normal"
@@ -34,10 +34,10 @@ PASS parseResultOf("invalid_beginning_comma") is "normal"
 PASS parseResultOf("invalid_on") is "normal"
 PASS parseResultOf("invalid_0") is "normal"
 - Tests inherit.
-PASS canonicalize(parseResultOf("outer")) is "'dlig' 1"
-PASS canonicalize(parseResultOf("inner")) is "'dlig' 1"
+PASS canonicalize(parseResultOf("outer")) is "\"dlig\" 1"
+PASS canonicalize(parseResultOf("inner")) is "\"dlig\" 1"
 - Tests @font-face.
-PASS canonicalize(fontFaceRuleValid) is "'liga' 1"
+PASS canonicalize(fontFaceRuleValid) is "\"liga\" 1"
 PASS fontFaceRuleInvalid is ""
 PASS successfullyParsed is true
 
index d157ec7..badf9cf 100644 (file)
@@ -184,16 +184,16 @@ function parseResultOf(id) {
 
 debug('- Tests valid inputs.');
 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"));
+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"');
@@ -215,13 +215,13 @@ shouldBe('parseResultOf("invalid_on")', '"normal"');
 shouldBe('parseResultOf("invalid_0")', '"normal"');
 
 debug('- Tests inherit.');
-shouldBeEqualToString('canonicalize(parseResultOf("outer"))', canonicalize("'dlig' 1"));
-shouldBeEqualToString('canonicalize(parseResultOf("inner"))', canonicalize("'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['font-feature-settings'];
 var fontFaceRuleInvalid = document.styleSheets[1].cssRules[1].style['font-feature-settings'];
-shouldBeEqualToString('canonicalize(fontFaceRuleValid)', canonicalize("'liga' 1"));
+shouldBeEqualToString('canonicalize(fontFaceRuleValid)', canonicalize("\"liga\" 1"));
 shouldBeEqualToString('fontFaceRuleInvalid', "");
 
 </script>
index 6023b13..5ec1c37 100644 (file)
@@ -1,4 +1,4 @@
-test1 font-feature-settings: 'dlig' 1
+test1 font-feature-settings: "dlig" 1
 test2 font-feature-settings: normal
 test1 -webkit-font-smoothing: antialiased
 test2 -webkit-font-smoothing: auto
index 778ab3b..5234b77 100644 (file)
@@ -22,20 +22,20 @@ PASS new FontFace('family_name', 'url(\'asdf\')', {'unicodeRange': 'U+0-7F'}).un
 PASS new FontFace('family_name', 'url(\'asdf\')', {'variant': 'variant_name'}).variant threw exception SyntaxError: The string did not match the expected pattern..
 PASS new FontFace('family_name', 'url(\'asdf\')', {'variant': 'small-caps'}).variant is "small-caps"
 PASS new FontFace('family_name', 'url(\'asdf\')', {'variant': 'small-caps common-ligatures'}).variant is "common-ligatures small-caps"
-PASS new FontFace('family_name', 'url(\'asdf\')', {'featureSettings': '\'titl\''}).featureSettings is "'titl' 1"
+PASS new FontFace('family_name', 'url(\'asdf\')', {'featureSettings': '\'titl\''}).featureSettings is "\"titl\" 1"
 PASS everything.style is "italic"
 PASS everything.weight is "bold"
 PASS everything.stretch is "extra-expanded"
 PASS everything.unicodeRange is "U+26-26"
 PASS everything.variant is "small-caps"
-PASS everything.featureSettings is "'titl' 1"
+PASS everything.featureSettings is "\"titl\" 1"
 PASS everything.family is "other_family_name"
 PASS everything.style is "normal"
 PASS everything.weight is "300"
 PASS everything.stretch is "condensed"
 PASS everything.unicodeRange is "U+0-7f"
 PASS everything.variant is "stacked-fractions"
-PASS everything.featureSettings is "'smcp' 1"
+PASS everything.featureSettings is "\"smcp\" 1"
 PASS new FontFace('family_name', 'url(\'asdf\')', {}) did not throw exception.
 PASS new FontFace('family_name', newArrayBuffer, {}) did not throw exception.
 PASS new FontFace('family_name', new DataView(newArrayBuffer), {}) did not throw exception.
index 46f547c..99d85e5 100644 (file)
@@ -30,7 +30,7 @@ shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'unicodeR
 shouldThrow("new FontFace('family_name', 'url(\\'asdf\\')', {'variant': 'variant_name'}).variant");
 shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'variant': 'small-caps'}).variant", "small-caps");
 shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'variant': 'small-caps common-ligatures'}).variant", "common-ligatures small-caps");
-shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'featureSettings': '\\'titl\\''}).featureSettings", "'titl' 1");
+shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'featureSettings': '\\'titl\\''}).featureSettings", "\"titl\" 1");
 
 var everything = new FontFace('family_name', 'url(\'asdf\')', {'style': 'italic', 'weight': 'bold', 'stretch': 'extra-expanded', 'unicodeRange': 'U+26', 'variant': 'small-caps', 'featureSettings': '\'titl\''});
 shouldBeEqualToString("everything.style", "italic");
@@ -38,7 +38,7 @@ shouldBeEqualToString("everything.weight", "bold");
 shouldBeEqualToString("everything.stretch", "extra-expanded");
 shouldBeEqualToString("everything.unicodeRange", "U+26-26");
 shouldBeEqualToString("everything.variant", "small-caps");
-shouldBeEqualToString("everything.featureSettings", "'titl' 1");
+shouldBeEqualToString("everything.featureSettings", "\"titl\" 1");
 
 everything.family = "other_family_name";
 shouldBeEqualToString("everything.family", "other_family_name");
@@ -53,7 +53,7 @@ shouldBeEqualToString("everything.unicodeRange", "U+0-7f");
 everything.variant = "stacked-fractions";
 shouldBeEqualToString("everything.variant", "stacked-fractions");
 everything.featureSettings = "'smcp'";
-shouldBeEqualToString("everything.featureSettings", "'smcp' 1");
+shouldBeEqualToString("everything.featureSettings", "\"smcp\" 1");
 
 shouldNotThrow("new FontFace('family_name', 'url(\\'asdf\\')', {})");
 var newArrayBuffer = new ArrayBuffer(100);
index dbfef12..d0f44db 100644 (file)
@@ -1,3 +1,20 @@
+2018-01-30  Chris Nardi  <cnardi@chromium.org>
+
+        Use double-quotes when serializing font-feature-settings
+        https://bugs.webkit.org/show_bug.cgi?id=182201
+
+        According to the CSSOM spec, all strings should be serialized with double-quotes. The feature
+        tag value was previously serialized with single-quotes; change this to double-quotes to match
+        the spec and non-WebKit browsers.
+
+        Reviewed by Myles C. Maxfield.
+
+        Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
+        and fast/text/font-face-javascript.html.
+
+        * css/CSSFontFeatureValue.cpp:
+        (WebCore::CSSFontFeatureValue::customCSSText const):
+
 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
 
         Add telemetry to track storage access API adoption
index 04d032d..d1a783b 100644 (file)
@@ -41,10 +41,10 @@ CSSFontFeatureValue::CSSFontFeatureValue(FontTag&& tag, int value)
 String CSSFontFeatureValue::customCSSText() const
 {
     StringBuilder builder;
-    builder.append('\'');
+    builder.append('"');
     for (char c : m_tag)
         builder.append(c);
-    builder.appendLiteral("' ");
+    builder.appendLiteral("\" ");
     builder.appendNumber(m_value);
     return builder.toString();
 }