Diff
Modified: trunk/LayoutTests/ChangeLog (209874 => 209875)
--- trunk/LayoutTests/ChangeLog 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/ChangeLog 2016-12-15 22:12:21 UTC (rev 209875)
@@ -1,3 +1,21 @@
+2016-12-15 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Implement font-synthesis: small-caps
+ https://bugs.webkit.org/show_bug.cgi?id=165892
+
+ Reviewed by David Hyatt.
+
+ * fast/text/font-synthesis-parsing-expected.txt: Added.
+ * fast/text/font-synthesis-parsing.html: Added.
+ * css3/font-synthesis-small-caps-expected.html: Added.
+ * css3/font-synthesis-small-caps.html: Added.
+ * fast/css/getComputedStyle/computed-style-expected.txt:
+ * fast/css/getComputedStyle/computed-style-font-family-expected.txt:
+ * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * fast/css3-text/font-synthesis-parse-expected.txt:
+ * fast/css3-text/font-synthesis-parse.html:
+ * svg/css/getComputedStyle-basic-expected.txt:
+
2016-12-15 Simon Fraser <[email protected]>
[iOS WK2] Don't disable position:fixed when a form element has focus
Added: trunk/LayoutTests/css3/font-synthesis-small-caps-expected.html (0 => 209875)
--- trunk/LayoutTests/css3/font-synthesis-small-caps-expected.html (rev 0)
+++ trunk/LayoutTests/css3/font-synthesis-small-caps-expected.html 2016-12-15 22:12:21 UTC (rev 209875)
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+/* Only test OpenType fonts for now, because our TrueType font is busted when disabling features. */
+@font-face {
+ /* Opentype. "J" responds to smcp; "K" responds to c2sc */
+ font-family: "testfontotf";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+}
+@font-face {
+ /* Truetype. "S" responds to smcp; "V" responds to c2sc */
+ font-family: "testfontttf";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+}
+@font-face {
+ /* Opentype. "f" responds to smcp; "g" responds to c2sc */
+ font-family: "testfontlowercasesmallcapsotf";
+ src: url("resources/FontWithFeaturesLowercaseSmallCaps.otf") format("opentype");
+}
+@font-face {
+ /* Truetype. "r" responds to smcp; "u" responds to c2sc */
+ font-family: "testfontlowercasesmallcapsttf";
+ src: url("resources/FontWithFeaturesLowercaseSmallCaps.ttf") format("truetype");
+}
+.test {
+ font-size: 20px;
+ display: inline-block;
+}
+</style>
+</head>
+<body>
+This test makes sure that the font-synthesis: none value gets correctly applied. The test passes when a particular pattern of Xs and checks appear below. Also note that the correct size of the character is required.
+<div style="font-family: testfontotf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">J</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">J</div>
+<div class="test" style="font-variant: small-caps;">aJ</div>
+<div class="test" style="font-variant: small-caps;">aJ</div>
+<div class="test" style="">BA</div>
+<div class="test" style="">BA</div>
+</div>
+<div style="font-family: testfontttf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">S</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">S</div>
+<div class="test" style="font-variant: small-caps;">aS</div>
+<div class="test" style="font-variant: small-caps;">aS</div>
+<div class="test" style="">BA</div>
+<div class="test" style="">BA</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsotf; border: solid black 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">f</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">f</div>
+<div class="test" style="font-variant: small-caps;">af</div>
+<div class="test" style="font-variant: small-caps;">af</div>
+<div class="test" style="">BA</div>
+<div class="test" style="">BA</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsttf; border: solid blue 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">r</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">r</div>
+<div class="test" style="font-variant: small-caps;">ar</div>
+<div class="test" style="font-variant: small-caps;">ar</div>
+<div class="test" style="">BA</div>
+<div class="test" style="">BA</div>
+</div>
+<div style="font-family: testfontotf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">K</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">K</div>
+<div class="test" style="font-variant: small-caps;">aK</div>
+<div class="test" style="font-variant: small-caps;">aK</div>
+<div class="test" style="">BB</div>
+<div class="test" style="">BB</div>
+</div>
+<div style="font-family: testfontttf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">V</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">V</div>
+<div class="test" style="font-variant: small-caps;">aV</div>
+<div class="test" style="font-variant: small-caps;">aV</div>
+<div class="test" style="">BB</div>
+<div class="test" style="">BB</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsotf; border: solid black 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">g</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">g</div>
+<div class="test" style="font-variant: small-caps;">ag</div>
+<div class="test" style="font-variant: small-caps;">ag</div>
+<div class="test" style="">BB</div>
+<div class="test" style="">BB</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsttf; border: solid blue 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">u</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">u</div>
+<div class="test" style="font-variant: small-caps;">au</div>
+<div class="test" style="font-variant: small-caps;">au</div>
+<div class="test" style="">BB</div>
+<div class="test" style="">BB</div>
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/css3/font-synthesis-small-caps.html (0 => 209875)
--- trunk/LayoutTests/css3/font-synthesis-small-caps.html (rev 0)
+++ trunk/LayoutTests/css3/font-synthesis-small-caps.html 2016-12-15 22:12:21 UTC (rev 209875)
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+/* Only test OpenType fonts for now, because our TrueType font is busted when disabling features. */
+@font-face {
+ /* Opentype. "J" responds to smcp; "K" responds to c2sc */
+ font-family: "testfontotf";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+}
+@font-face {
+ /* Truetype. "S" responds to smcp; "V" responds to c2sc */
+ font-family: "testfontttf";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+}
+@font-face {
+ /* Opentype. "f" responds to smcp; "g" responds to c2sc */
+ font-family: "testfontlowercasesmallcapsotf";
+ src: url("resources/FontWithFeaturesLowercaseSmallCaps.otf") format("opentype");
+}
+@font-face {
+ /* Truetype. "r" responds to smcp; "u" responds to c2sc */
+ font-family: "testfontlowercasesmallcapsttf";
+ src: url("resources/FontWithFeaturesLowercaseSmallCaps.ttf") format("truetype");
+}
+.test {
+ font-size: 20px;
+ display: inline-block;
+}
+</style>
+</head>
+<body>
+This test makes sure that the font-synthesis: none value gets correctly applied. The test passes when a particular pattern of Xs and checks appear below. Also note that the correct size of the character is required.
+<div style="font-family: testfontotf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">J</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">J</div>
+<div class="test" style="font-variant: small-caps;">aJ</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">aJ</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">aJ</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">aJ</div>
+</div>
+<div style="font-family: testfontttf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">S</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">S</div>
+<div class="test" style="font-variant: small-caps;">aS</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">aS</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">aS</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">aS</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsotf; border: solid black 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">f</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">f</div>
+<div class="test" style="font-variant: small-caps;">af</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">af</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">af</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">af</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsttf; border: solid blue 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">r</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">r</div>
+<div class="test" style="font-variant: small-caps;">ar</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">ar</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">ar</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">ar</div>
+</div>
+<div style="font-family: testfontotf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">K</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">K</div>
+<div class="test" style="font-variant: small-caps;">aK</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">aK</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">aK</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">aK</div>
+</div>
+<div style="font-family: testfontttf; border: solid green 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">V</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">V</div>
+<div class="test" style="font-variant: small-caps;">aV</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">aV</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">aV</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">aV</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsotf; border: solid black 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">g</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">g</div>
+<div class="test" style="font-variant: small-caps;">ag</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">ag</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">ag</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">ag</div>
+</div>
+<div style="font-family: testfontlowercasesmallcapsttf; border: solid blue 1px; margin: 5px; font-feature-settings: 'ntrl';">
+<div class="test" style="">u</div>
+<div class="test" style="">a</div>
+<div class="test" style="font-variant: small-caps;">u</div>
+<div class="test" style="font-variant: small-caps;">au</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: small-caps;">au</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: none;">au</div>
+<div class="test" style="font-variant: small-caps; font-synthesis: weight;">au</div>
+</div>
+</body>
+</html>
Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt (209874 => 209875)
--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt 2016-12-15 22:12:21 UTC (rev 209875)
@@ -45,7 +45,7 @@
float: none;
font-size: 16px;
font-style: normal;
-font-synthesis: style weight;
+font-synthesis: style weight small-caps;
font-variant: normal;
font-weight: normal;
height: 576px;
Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt (209874 => 209875)
--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt 2016-12-15 22:12:21 UTC (rev 209875)
@@ -3,7 +3,7 @@
font-family: monospace, 'Lucida Grande', sans-serif;
font-size: 16px;
font-style: normal;
-font-synthesis: style weight;
+font-synthesis: style weight small-caps;
font-variant: normal;
font-weight: normal;
font-variant-ligatures: normal;
Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt (209874 => 209875)
--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt 2016-12-15 22:12:21 UTC (rev 209875)
@@ -44,7 +44,7 @@
float: none
font-size: 16px
font-style: normal
-font-synthesis: style weight
+font-synthesis: style weight small-caps
font-variant: normal
font-weight: normal
height: 100px
Modified: trunk/LayoutTests/fast/css3-text/font-synthesis-parse-expected.txt (209874 => 209875)
--- trunk/LayoutTests/fast/css3-text/font-synthesis-parse-expected.txt 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/fast/css3-text/font-synthesis-parse-expected.txt 2016-12-15 22:12:21 UTC (rev 209875)
@@ -1,11 +1,11 @@
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 0
PASS declaration.getPropertyValue('font-synthesis') is ""
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 1
PASS declaration.getPropertyValue('font-synthesis') is "initial"
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 1
PASS declaration.getPropertyValue('font-synthesis') is "weight"
@@ -25,23 +25,23 @@
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 0
PASS declaration.getPropertyValue('font-synthesis') is ""
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 0
PASS declaration.getPropertyValue('font-synthesis') is ""
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 0
PASS declaration.getPropertyValue('font-synthesis') is ""
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 0
PASS declaration.getPropertyValue('font-synthesis') is ""
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS cssRule.type is cssRule.STYLE_RULE
PASS declaration.length is 0
PASS declaration.getPropertyValue('font-synthesis') is ""
-PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight"
+PASS computedStyle.getPropertyCSSValue('font-synthesis').cssText is "style weight small-caps"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/css3-text/font-synthesis-parse.html (209874 => 209875)
--- trunk/LayoutTests/fast/css3-text/font-synthesis-parse.html 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/fast/css3-text/font-synthesis-parse.html 2016-12-15 22:12:21 UTC (rev 209875)
@@ -14,7 +14,7 @@
shouldBe("declaration.length", "0");
shouldBeEqualToString("declaration.getPropertyValue('font-synthesis')", "");
computedStyle = window.getComputedStyle(target, null);
- shouldBeEqualToString("computedStyle.getPropertyCSSValue('font-synthesis').cssText", "style weight");
+ shouldBeEqualToString("computedStyle.getPropertyCSSValue('font-synthesis').cssText", "style weight small-caps");
stylesheet.deleteRule(0);
}
@@ -25,7 +25,7 @@
shouldBe("declaration.length", "1");
shouldBeEqualToString("declaration.getPropertyValue('font-synthesis')", "initial");
computedStyle = window.getComputedStyle(target, null);
- shouldBeEqualToString("computedStyle.getPropertyCSSValue('font-synthesis').cssText", "style weight");
+ shouldBeEqualToString("computedStyle.getPropertyCSSValue('font-synthesis').cssText", "style weight small-caps");
stylesheet.deleteRule(0);
}
Added: trunk/LayoutTests/fast/text/font-synthesis-parsing-expected.txt (0 => 209875)
--- trunk/LayoutTests/fast/text/font-synthesis-parsing-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/font-synthesis-parsing-expected.txt 2016-12-15 22:12:21 UTC (rev 209875)
@@ -0,0 +1,12 @@
+PASS CSS.supports('font-synthesis', 'small-caps') is true
+PASS window.getComputedStyle(document.getElementById('test1')).fontSynthesis is "weight"
+PASS window.getComputedStyle(document.getElementById('test2')).fontSynthesis is "small-caps"
+PASS window.getComputedStyle(document.getElementById('test3')).fontSynthesis is "none"
+PASS window.getComputedStyle(document.getElementById('test4')).fontSynthesis is "style weight small-caps"
+PASS window.getComputedStyle(document.getElementById('test5')).fontSynthesis is "style weight small-caps"
+PASS window.getComputedStyle(document.getElementById('test6')).fontSynthesis is "style small-caps"
+PASS window.getComputedStyle(document.getElementById('test7')).fontSynthesis is "style small-caps"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/text/font-synthesis-parsing-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/fast/text/font-synthesis-parsing.html (0 => 209875)
--- trunk/LayoutTests/fast/text/font-synthesis-parsing.html (rev 0)
+++ trunk/LayoutTests/fast/text/font-synthesis-parsing.html 2016-12-15 22:12:21 UTC (rev 209875)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="test1" style="font-synthesis: weight;"></div>
+<div id="test2" style="font-synthesis: small-caps;"></div>
+<div id="test3" style="font-synthesis: none;"></div>
+<div id="test4" style="font-synthesis: garbage;"></div>
+<div id="test5" style="font-synthesis: initial;"></div>
+<div id="test6" style="font-synthesis: style small-caps;"></div>
+<div id="test7" style="font-synthesis: small-caps style;"></div>
+<script>
+shouldBeTrue("CSS.supports('font-synthesis', 'small-caps')");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontSynthesis", "weight");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontSynthesis", "small-caps");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontSynthesis", "none");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontSynthesis", "style weight small-caps");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontSynthesis", "style weight small-caps");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontSynthesis", "style small-caps");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontSynthesis", "style small-caps");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt (209874 => 209875)
--- trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt 2016-12-15 22:12:21 UTC (rev 209875)
@@ -88,7 +88,7 @@
rect: style.getPropertyCSSValue(font-size) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(font-style) : normal
rect: style.getPropertyCSSValue(font-style) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(font-synthesis) : style weight
+rect: style.getPropertyValue(font-synthesis) : style weight small-caps
rect: style.getPropertyCSSValue(font-synthesis) : [object CSSValueList]
rect: style.getPropertyValue(font-variant) : normal
rect: style.getPropertyCSSValue(font-variant) : [object CSSPrimitiveValue]
@@ -596,7 +596,7 @@
g: style.getPropertyCSSValue(font-size) : [object CSSPrimitiveValue]
g: style.getPropertyValue(font-style) : normal
g: style.getPropertyCSSValue(font-style) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(font-synthesis) : style weight
+g: style.getPropertyValue(font-synthesis) : style weight small-caps
g: style.getPropertyCSSValue(font-synthesis) : [object CSSValueList]
g: style.getPropertyValue(font-variant) : normal
g: style.getPropertyCSSValue(font-variant) : [object CSSPrimitiveValue]
Modified: trunk/Source/WebCore/ChangeLog (209874 => 209875)
--- trunk/Source/WebCore/ChangeLog 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/ChangeLog 2016-12-15 22:12:21 UTC (rev 209875)
@@ -1,3 +1,34 @@
+2016-12-15 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Implement font-synthesis: small-caps
+ https://bugs.webkit.org/show_bug.cgi?id=165892
+
+ Reviewed by David Hyatt.
+
+ The CSS Fonts level 4 spec adds a new value to the "font-synthesis"
+ property which controls whether or not small-caps is allowed to be
+ synthesized. Luckily, we already have an implementation of this
+ straightforward, so the implementation is quite simple.
+
+ Tests: css3/font-synthesis-small-caps.html
+ fast/text/font-synthesis-parsing.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::fontSynthesisFromStyle):
+ * css/StyleBuilderConverter.h:
+ (WebCore::StyleBuilderConverter::convertFontSynthesis):
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeFontSynthesis):
+ * platform/graphics/FontCache.h:
+ (WebCore::FontDescriptionKey::makeFlagsKey):
+ * platform/graphics/FontDescription.cpp:
+ (WebCore::FontDescription::FontDescription):
+ * platform/graphics/FontDescription.h:
+ (WebCore::FontCascadeDescription::initialFontSynthesis):
+ * platform/graphics/mac/ComplexTextController.cpp:
+ (WebCore::shouldSynthesize):
+ (WebCore::ComplexTextController::collectComplexTextRuns):
+
2016-12-15 Brady Eidson <[email protected]>
Add a new Logging Channel for IndexedDB Operation scheduling.
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (209874 => 209875)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2016-12-15 22:12:21 UTC (rev 209875)
@@ -2144,6 +2144,8 @@
list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueStyle));
if (style.fontDescription().fontSynthesis() & FontSynthesisWeight)
list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueWeight));
+ if (style.fontDescription().fontSynthesis() & FontSynthesisSmallCaps)
+ list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps));
return Ref<CSSValue>(list.get());
}
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (209874 => 209875)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2016-12-15 22:12:21 UTC (rev 209875)
@@ -1441,6 +1441,9 @@
case CSSValueStyle:
result |= FontSynthesisStyle;
break;
+ case CSSValueSmallCaps:
+ result |= FontSynthesisSmallCaps;
+ break;
default:
ASSERT_NOT_REACHED();
break;
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (209874 => 209875)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-12-15 22:12:21 UTC (rev 209875)
@@ -948,7 +948,7 @@
static RefPtr<CSSValue> consumeFontSynthesis(CSSParserTokenRange& range)
{
- // none | [ weight || style ]
+ // none | [ weight || style || small-caps ]
CSSValueID id = range.peek().id();
if (id == CSSValueNone)
return consumeIdent(range);
@@ -955,7 +955,7 @@
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
while (true) {
- auto ident = consumeIdent<CSSValueWeight, CSSValueStyle>(range);
+ auto ident = consumeIdent<CSSValueWeight, CSSValueStyle, CSSValueSmallCaps>(range);
if (!ident)
break;
if (list->hasValue(ident.get()))
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (209874 => 209875)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2016-12-15 22:12:21 UTC (rev 209875)
@@ -121,8 +121,8 @@
static std::array<unsigned, 2> makeFlagsKey(const FontDescription& description)
{
static_assert(USCRIPT_CODE_LIMIT < 0x1000, "Script code must fit in an unsigned along with the other flags");
- unsigned first = static_cast<unsigned>(description.script()) << 10
- | static_cast<unsigned>(description.textRenderingMode()) << 8
+ unsigned first = static_cast<unsigned>(description.script()) << 11
+ | static_cast<unsigned>(description.textRenderingMode()) << 9
| static_cast<unsigned>(description.fontSynthesis()) << 6
| static_cast<unsigned>(description.widthVariant()) << 4
| static_cast<unsigned>(description.nonCJKGlyphOrientation()) << 3
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.cpp (209874 => 209875)
--- trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2016-12-15 22:12:21 UTC (rev 209875)
@@ -61,7 +61,7 @@
, m_renderingMode(static_cast<unsigned>(FontRenderingMode::Normal))
, m_textRendering(AutoTextRendering)
, m_script(USCRIPT_COMMON)
- , m_fontSynthesis(FontSynthesisWeight | FontSynthesisStyle)
+ , m_fontSynthesis(FontSynthesisWeight | FontSynthesisStyle | FontSynthesisSmallCaps)
, m_variantCommonLigatures(static_cast<unsigned>(FontVariantLigatures::Normal))
, m_variantDiscretionaryLigatures(static_cast<unsigned>(FontVariantLigatures::Normal))
, m_variantHistoricalLigatures(static_cast<unsigned>(FontVariantLigatures::Normal))
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (209874 => 209875)
--- trunk/Source/WebCore/platform/graphics/FontDescription.h 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h 2016-12-15 22:12:21 UTC (rev 209875)
@@ -143,7 +143,7 @@
unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows.
unsigned m_textRendering : 2; // TextRenderingMode
unsigned m_script : 7; // Used to help choose an appropriate font for generic font families.
- unsigned m_fontSynthesis : 2; // FontSynthesis type
+ unsigned m_fontSynthesis : 3; // FontSynthesis type
unsigned m_variantCommonLigatures : 2; // FontVariantLigatures
unsigned m_variantDiscretionaryLigatures : 2; // FontVariantLigatures
unsigned m_variantHistoricalLigatures : 2; // FontVariantLigatures
@@ -265,7 +265,7 @@
static Kerning initialKerning() { return Kerning::Auto; }
static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; }
static TextRenderingMode initialTextRenderingMode() { return AutoTextRendering; }
- static FontSynthesis initialFontSynthesis() { return FontSynthesisWeight | FontSynthesisStyle; }
+ static FontSynthesis initialFontSynthesis() { return FontSynthesisWeight | FontSynthesisStyle | FontSynthesisSmallCaps; }
static FontVariantPosition initialVariantPosition() { return FontVariantPosition::Normal; }
static FontVariantCaps initialVariantCaps() { return FontVariantCaps::Normal; }
static FontVariantAlternates initialVariantAlternates() { return FontVariantAlternates::Normal; }
Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (209874 => 209875)
--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp 2016-12-15 22:12:21 UTC (rev 209875)
@@ -288,8 +288,10 @@
return std::nullopt;
}
-static bool shouldSynthesize(const Font* nextFont, UChar32 baseCharacter, std::optional<UChar32> capitalizedBase, FontVariantCaps fontVariantCaps, bool engageAllSmallCapsProcessing)
+static bool shouldSynthesize(bool dontSynthesizeSmallCaps, const Font* nextFont, UChar32 baseCharacter, std::optional<UChar32> capitalizedBase, FontVariantCaps fontVariantCaps, bool engageAllSmallCapsProcessing)
{
+ if (dontSynthesizeSmallCaps)
+ return false;
if (!nextFont || nextFont == Font::systemFallback())
return false;
if (engageAllSmallCapsProcessing && isASCIISpace(baseCharacter))
@@ -315,6 +317,7 @@
cp = m_run.characters16();
auto fontVariantCaps = m_font.fontDescription().variantCaps();
+ bool dontSynthesizeSmallCaps = !static_cast<bool>(m_font.fontDescription().fontSynthesis() & FontSynthesisSmallCaps);
bool engageAllSmallCapsProcessing = fontVariantCaps == FontVariantCaps::AllSmall || fontVariantCaps == FontVariantCaps::AllPetite;
bool engageSmallCapsProcessing = engageAllSmallCapsProcessing || fontVariantCaps == FontVariantCaps::Small || fontVariantCaps == FontVariantCaps::Petite;
@@ -341,7 +344,7 @@
bool nextIsSmallCaps = false;
auto capitalizedBase = capitalized(baseCharacter);
- if (shouldSynthesize(nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) {
+ if (shouldSynthesize(dontSynthesizeSmallCaps, nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) {
synthesizedFont = &nextFont->noSynthesizableFeaturesFont();
smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription());
UChar32 characterToWrite = capitalizedBase ? capitalizedBase.value() : cp[0];
@@ -382,7 +385,7 @@
nextFont = m_font.fontForCombiningCharacterSequence(cp + index, curr - cp - index);
capitalizedBase = capitalized(baseCharacter);
- if (!synthesizedFont && shouldSynthesize(nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) {
+ if (!synthesizedFont && shouldSynthesize(dontSynthesizeSmallCaps, nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) {
// Rather than synthesize each character individually, we should synthesize the entire "run" if any character requires synthesis.
synthesizedFont = &nextFont->noSynthesizableFeaturesFont();
smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription());
Modified: trunk/Source/WebCore/platform/text/TextFlags.h (209874 => 209875)
--- trunk/Source/WebCore/platform/text/TextFlags.h 2016-12-15 22:08:38 UTC (rev 209874)
+++ trunk/Source/WebCore/platform/text/TextFlags.h 2016-12-15 22:12:21 UTC (rev 209875)
@@ -60,10 +60,11 @@
enum FontSynthesisValues {
FontSynthesisNone = 0x0,
FontSynthesisWeight = 0x1,
- FontSynthesisStyle = 0x2
+ FontSynthesisStyle = 0x2,
+ FontSynthesisSmallCaps = 0x4
};
typedef unsigned FontSynthesis;
-const unsigned FontSynthesisWidth = 2;
+const unsigned FontSynthesisWidth = 3;
enum class FontVariantLigatures {
Normal,