Serialize font-variation-settings with double-quotes per spec
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 19:56:28 +0000 (19:56 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 19:56:28 +0000 (19:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182542

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

Source/WebCore:

According to the CSSOM spec [1], all strings should be serialized with double-quotes.
The axis name in font-variation-settings was previously serialized with single-quotes;
change this to double-quotes to match the spec and non-WebKit browsers.

[1]: https://drafts.csswg.org/cssom/#common-serializing-idioms

Updated fast/text/variations/getComputedStyle.html to test the change.

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

LayoutTests:

Updated test to verify double-quotes are used.

* fast/text/variations/getComputedStyle-expected.txt:
* fast/text/variations/getComputedStyle.html:

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

LayoutTests/ChangeLog
LayoutTests/fast/text/variations/getComputedStyle-expected.txt
LayoutTests/fast/text/variations/getComputedStyle.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontVariationValue.cpp

index e2a2a49..84908f1 100644 (file)
@@ -1,3 +1,15 @@
+2018-04-30  Chris Nardi  <cnardi@chromium.org>
+
+        Serialize font-variation-settings with double-quotes per spec
+        https://bugs.webkit.org/show_bug.cgi?id=182542
+
+        Reviewed by Myles C. Maxfield.
+
+        Updated test to verify double-quotes are used.
+
+        * fast/text/variations/getComputedStyle-expected.txt:
+        * fast/text/variations/getComputedStyle.html:
+
 2018-04-30  Simon Fraser  <simon.fraser@apple.com>
 
         Make color-filter affect caret-color
index 2214e1a..52b360a 100644 (file)
@@ -1,11 +1,11 @@
-PASS window.getComputedStyle(document.getElementById('test0')).getPropertyValue('font-variation-settings') is "'hght' 400"
-PASS window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-variation-settings') is "'hght' 500"
-PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-variation-settings') is "'wdth' 500, 'hght' 400"
+PASS window.getComputedStyle(document.getElementById('test0')).getPropertyValue('font-variation-settings') is "\"hght\" 400"
+PASS window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-variation-settings') is "\"hght\" 500"
+PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-variation-settings') is "\"wdth\" 500, \"hght\" 400"
 PASS window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-variation-settings') is window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-variation-settings')
 PASS window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-variation-settings') is "normal"
 PASS window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-variation-settings') is "normal"
 PASS window.getComputedStyle(document.getElementById('test6')).getPropertyValue('font-variation-settings') is "normal"
-PASS window.getComputedStyle(document.getElementById('test7')).getPropertyValue('font-variation-settings') is "'hght' 999999"
+PASS window.getComputedStyle(document.getElementById('test7')).getPropertyValue('font-variation-settings') is "\"hght\" 999999"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 39d7d28..c667051 100644 (file)
 <div id="test6" style="font-family: 'Boxis'; font-variation-settings: 'abc한국어e' 500;">a</div>
 <div id="test7" style="font-family: 'Boxis'; font-variation-settings: 'hght' 999999;">a</div>
 <script>
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test0')).getPropertyValue('font-variation-settings')", "'hght' 400");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-variation-settings')", "'hght' 500");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-variation-settings')", "'wdth' 500, 'hght' 400");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test0')).getPropertyValue('font-variation-settings')", "\"hght\" 400");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-variation-settings')", "\"hght\" 500");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-variation-settings')", "\"wdth\" 500, \"hght\" 400");
 shouldBe("window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-variation-settings')", "window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-variation-settings')");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-variation-settings')", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-variation-settings')", "normal");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).getPropertyValue('font-variation-settings')", "normal");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).getPropertyValue('font-variation-settings')", "'hght' 999999");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).getPropertyValue('font-variation-settings')", "\"hght\" 999999");
 </script>
 <script src="../../../resources/js-test-post.js"></script>
 </body>
index 6ec0631..5e3f12f 100644 (file)
@@ -1,3 +1,21 @@
+2018-04-30  Chris Nardi  <cnardi@chromium.org>
+
+        Serialize font-variation-settings with double-quotes per spec
+        https://bugs.webkit.org/show_bug.cgi?id=182542
+
+        Reviewed by Myles C. Maxfield.
+
+        According to the CSSOM spec [1], all strings should be serialized with double-quotes.
+        The axis name in font-variation-settings was previously serialized with single-quotes;
+        change this to double-quotes to match the spec and non-WebKit browsers.
+
+        [1]: https://drafts.csswg.org/cssom/#common-serializing-idioms
+
+        Updated fast/text/variations/getComputedStyle.html to test the change.
+
+        * css/CSSFontVariationValue.cpp:
+        (WebCore::CSSFontVariationValue::customCSSText const):
+
 2018-04-30  Chris Dumez  <cdumez@apple.com>
 
         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages()
index a208261..72ddc1a 100644 (file)
@@ -43,10 +43,10 @@ CSSFontVariationValue::CSSFontVariationValue(FontTag tag, float value)
 String CSSFontVariationValue::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();
 }