Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193693 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-08 05:40:47 UTC (rev 193694)
@@ -1,3 +1,17 @@
+2015-11-03 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ font-variant-* properties in @font-face declarations should be honored
+ https://bugs.webkit.org/show_bug.cgi?id=149771
+
+ Reviewed by Simon Fraser.
+
+ * css3/font-variant-font-face-override-expected.html: Added
+ * css3/font-variant-font-face-override.html: Added
+ * css3/font-feature-settings-font-face-rendering-expected.html: Added.
+ * css3/font-feature-settings-font-face-rendering.html: Added.
+ * css3/font-variant-font-face-all-expected.html: Added.
+ * css3/font-variant-font-face-all.html: Added.
+
2015-10-19 Myles C. Maxfield <mmaxfi...@apple.com>
FontCascade::typesettingFeatures() is not privy to font-variant-* nor font-feature-settings
Added: branches/safari-601.1.46-branch/LayoutTests/css3/font-feature-settings-font-face-rendering-expected.html (0 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/css3/font-feature-settings-font-face-rendering-expected.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/css3/font-feature-settings-font-face-rendering-expected.html 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: "FontFeaturesTestOTF";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+}
+@font-face {
+ font-family: "FontFeaturesTestTTF";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+This tests that font features are able to be turned on and off as desired. It uses a special font
+designed specifically for this purpose. The test passes if you see a sequence of alternating check
+marks and X below.
+<div><span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestOTF;">BBAA</span>
+</div>
+<div><span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+<span style="font-family: FontFeaturesTestTTF;">BBAA</span>
+</div>
+</body>
+</html>
Added: branches/safari-601.1.46-branch/LayoutTests/css3/font-feature-settings-font-face-rendering.html (0 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/css3/font-feature-settings-font-face-rendering.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/css3/font-feature-settings-font-face-rendering.html 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: "FontFeaturesTestOTF";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+}
+@font-face {
+ font-family: "FontFeaturesTestTTF";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+This tests that font features are able to be turned on and off as desired. It uses a special font
+designed specifically for this purpose. The test passes if you see a sequence of alternating check
+marks and X below.
+<div id="insertionPoint"></div>
+<div id="insertionPoint2"></div>
+<script>
+var insertionPoint = document.getElementById("insertionPoint");
+var insertionPoint2 = document.getElementById("insertionPoint2");
+
+var styleNode = document.createElement("style");
+document.head.appendChild(styleNode);
+
+function addElement(placeToInsert, familyName, extension, format, feature, c) {
+ ["0", "1"].map(function(state) {
+ styleNode.sheet.insertRule("@font-face { font-family: " + familyName + "_" + feature + "_" + state + "; src: url('resources/FontWithFeatures." + extension + "') format('" + format + "'); font-feature-settings: '" + feature + "'" + state + "; }", 0);
+ var element = document.createElement("span");
+ element.textContent = c + c;
+ element.style.fontFamily = familyName + "_" + feature + "_" + state;
+ placeToInsert.appendChild(element);
+ });
+ placeToInsert.appendChild(document.createTextNode(" "));
+}
+
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "liga", "C");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "clig", "D");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "dlig", "E");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "hlig", "F");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "calt", "G");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "subs", "H");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "sups", "I");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "smcp", "J");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "c2sc", "K");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "pcap", "L");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "c2pc", "M");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "unic", "N");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "titl", "O");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "lnum", "P");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "onum", "Q");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "pnum", "R");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "tnum", "S");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "frac", "T");
+//addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "afrc", "U");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "ordn", "V");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "zero", "W");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "hist", "X");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp78", "Y");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp83", "Z");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp90", "a");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "jp04", "b");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "smpl", "c");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "trad", "d");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "fwid", "e");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "pwid", "f");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "ruby", "g");
+
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "liga", "C");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "liga", "D");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "clig", "C");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "clig", "D");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "dlig", "G");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "hlig", "I");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "calt", "L");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "subs", "O");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "sups", "P");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "smcp", "S");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "c2sc", "V");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "pcap", "T");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "c2pc", "W");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "unic", "Y");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "titl", "a");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "lnum", "c");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "onum", "d");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "pnum", "f");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "tnum", "g");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "frac", "i");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "afrc", "j");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "ordn", "Q");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "zero", "k");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "hist", "K");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp78", "m");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp83", "n");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp90", "o");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "jp04", "p");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "smpl", "q");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "trad", "r");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "fwid", "t");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "pwid", "u");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "ruby", "v");
+</script>
+</body>
+</html>
\ No newline at end of file
Added: branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-all-expected.html (0 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-all-expected.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-all-expected.html 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: "FontFeaturesTestOTF";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+}
+@font-face {
+ font-family: "FontFeaturesTestTTF";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+}
+.fontWithFeaturesTTF {
+ font-family: "FontWithFeaturesTTF";
+}
+</style>
+</head>
+<body>
+<p>This test is a dump-render-tree test which makes sure that the following properties are appropriately applied:</p>
+<ul>
+<li>-webkit-font-variant-ligatures</li>
+<li>-webkit-font-variant-position</li>
+<li>-webkit-font-variant-caps</li>
+<li>-webkit-font-variant-numeric</li>
+<li>-webkit-font-variant-alternates</li>
+<li>-webkit-font-variant-east-asian</li>
+</ul>
+The test passes if there is a particular sequence of checks and x characters below. Note that some x characters are expected.
+<div id="insertionpoint"><span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+</div>
+<div id="insertionPoint2"><span style="font-family: FontFeaturesTestTTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">BB</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+<span style="font-family: FontFeaturesTestOTF;">AA</span>
+</div>
+</body>
+</html>
Added: branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-all.html (0 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-all.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-all.html 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,105 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<p>This test is a dump-render-tree test which makes sure that the following properties are appropriately applied:</p>
+<ul>
+<li>-webkit-font-variant-ligatures</li>
+<li>-webkit-font-variant-position</li>
+<li>-webkit-font-variant-caps</li>
+<li>-webkit-font-variant-numeric</li>
+<li>-webkit-font-variant-alternates</li>
+<li>-webkit-font-variant-east-asian</li>
+</ul>
+The test passes if there is a particular sequence of checks and x characters below. Note that some x characters are expected.
+<div id="insertionPoint"></div>
+<div id="insertionPoint2"></div>
+<script>
+var insertionPoint = document.getElementById("insertionPoint");
+var insertionPoint2 = document.getElementById("insertionPoint2");
+
+var styleNode = document.createElement("style");
+document.head.appendChild(styleNode);
+
+function addElement(pointToInsert, fontFamily, extension, format, property, value, text) {
+ styleNode.sheet.insertRule("@font-face { font-family: " + fontFamily + "_" + property + "_" + value + "; src: url('resources/FontWithFeatures." + extension + "') format('" + format + "'); " + property + ": " + value + "; }", 0);
+ var element = document.createElement("span");
+ element.textContent = text + text;
+ element.style.fontFamily = fontFamily + "_" + property + "_" + value;
+ pointToInsert.appendChild(element);
+ pointToInsert.appendChild(document.createTextNode(" "));
+}
+
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "common-ligatures", "C");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "no-common-ligatures", "C");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "discretionary-ligatures", "E");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "no-discretionary-ligatures", "E");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "historical-ligatures", "F");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "no-historical-ligatures", "F");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "contextual", "G");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-ligatures", "no-contextual", "G");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-position", "sub", "H");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-position", "super", "I");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-caps", "small-caps", "J");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-caps", "all-small-caps", "J");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-caps", "petite-caps", "L");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-caps", "all-petite-caps", "L");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-caps", "unicase", "N");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-caps", "titling-caps", "O");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "lining-nums", "P");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "oldstyle-nums", "Q");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "proportional-nums", "R");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "tabular-nums", "S");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "diagonal-fractions", "T");
+//addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "stacked-fractions", "U");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "ordinal", "V");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-numeric", "slashed-zero", "W");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-alternates", "historical-forms", "X");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "jis78", "Y");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "jis83", "Z");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "jis90", "a");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "jis04", "b");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "simplified", "c");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "traditional", "d");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "full-width", "e");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "proportional-width", "f");
+addElement(insertionPoint, "FontFeaturesTestOTF", "otf", "opentype", "font-variant-east-asian", "ruby", "g");
+
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "common-ligatures", "C");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "no-common-ligatures", "C");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "discretionary-ligatures", "G");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "no-discretionary-ligatures", "G");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "historical-ligatures", "I");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "no-historical-ligatures", "I");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "contextual", "L");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-ligatures", "no-contextual", "L");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-position", "sub", "O");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-position", "super", "P");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-caps", "small-caps", "S");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-caps", "all-small-caps", "S");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-caps", "petite-caps", "T");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-caps", "all-petite-caps", "T");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-caps", "unicase", "Y");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-caps", "titling-caps", "a");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "lining-nums", "c");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "oldstyle-nums", "d");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "proportional-nums", "f");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "tabular-nums", "g");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "diagonal-fractions", "i");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "stacked-fractions", "j");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "ordinal", "Q");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-numeric", "slashed-zero", "k");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-alternates", "historical-forms", "K");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "jis78", "m");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "jis83", "n");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "jis90", "o");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "jis04", "p");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "simplified", "q");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "traditional", "r");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "full-width", "t");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "proportional-width", "u");
+addElement(insertionPoint2, "FontFeaturesTestTTF", "ttf", "truetype", "font-variant-east-asian", "ruby", "v");
+</script>
+</body>
+</html>
Added: branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-override-expected.html (0 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-override-expected.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-override-expected.html 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: "FontFeaturesTestOTF";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+}
+@font-face {
+ font-family: "FontFeaturesTestTTF";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+This test makes sure that local font feature styles can override the font feature styles declared in @font-face blocks.
+<div style="font: 40px FontFeaturesTestOTF;">AA</div>
+<div style="font: 40px FontFeaturesTestOTF;">BB</div>
+<div style="font: 40px FontFeaturesTestOTF;">AA</div>
+<div style="font: 40px FontFeaturesTestOTF;">BB</div>
+<div style="font: 40px FontFeaturesTestTTF;">AA</div>
+<div style="font: 40px FontFeaturesTestTTF;">BB</div>
+<div style="font: 40px FontFeaturesTestTTF;">AA</div>
+<div style="font: 40px FontFeaturesTestTTF;">BB</div>
+</body>
+</html>
\ No newline at end of file
Added: branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-override.html (0 => 193694)
--- branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-override.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/css3/font-variant-font-face-override.html 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: "FontFeaturesTestOTF";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+ font-feature-settings: "titl" 1;
+}
+@font-face {
+ font-family: "FontFeaturesTestOTF2";
+ src: url("resources/FontWithFeatures.otf") format("opentype");
+ font-variant-caps: titling-caps;
+}
+@font-face {
+ font-family: "FontFeaturesTestTTF";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+ font-feature-settings: "titl" 1;
+}
+@font-face {
+ font-family: "FontFeaturesTestTTF2";
+ src: url("resources/FontWithFeatures.ttf") format("truetype");
+ font-variant-caps: titling-caps;
+}
+</style>
+</head>
+<body>
+This test makes sure that local font feature styles can override the font feature styles declared in @font-face blocks.
+<div style="font: 40px FontFeaturesTestOTF;">OO</div>
+<div style="font: 40px FontFeaturesTestOTF; font-feature-settings: 'titl' 0;">OO</div>
+<div style="font: 40px FontFeaturesTestOTF2;">OO</div>
+<div style="font: 40px FontFeaturesTestOTF2; font-feature-settings: 'titl' 0;">OO</div>
+<div style="font: 40px FontFeaturesTestTTF;">aa</div>
+<div style="font: 40px FontFeaturesTestTTF; font-feature-settings: 'titl' 0;">aa</div>
+<div style="font: 40px FontFeaturesTestTTF2;">aa</div>
+<div style="font: 40px FontFeaturesTestTTF2; font-feature-settings: 'titl' 0;">aa</div>
+</body>
+</html>
\ No newline at end of file
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-08 05:40:47 UTC (rev 193694)
@@ -1,3 +1,89 @@
+2015-11-03 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ font-variant-* properties in @font-face declarations should be honored
+ https://bugs.webkit.org/show_bug.cgi?id=149771
+
+ Reviewed by Simon Fraser.
+
+ According to the CSS Fonts Level 3 spec, web authors are allowed to put
+ font-feature-settings / font-variant-* inside @font-face blocks. These
+ properties are supposed to be applied at a specific time during the
+ font selection algorithm.
+
+ This patch gives a FontFeatureSettings object and a FontVariantSettings
+ object to CSSFontFace, and moves common parsing logic from
+ StyleBuilderCustom to a shared location. Then, once the two properties
+ are parsed from the @font-face block, the relevant data structures are
+ passed down into the font selection algorithm. This algorithm then
+ consults with these values at the correct time (inside
+ preparePlatformFont()).
+
+ Tests: css3/font-feature-settings-font-face-rendering.html
+ css3/font-variant-font-face-all.html
+ css3/font-variant-font-face-override.html
+
+ * WebCore.xcodeproj/project.pbxproj: Add a header for the common
+ location of parsing font-variant-ligatures, font-variant-numeric,
+ and font-variant-east-asian.
+ * css/CSSFontFace.cpp:
+ (WebCore::CSSFontFace::font): Pass the relevant data structures
+ into the font selection algorithm.
+ * css/CSSFontFace.h: Add FontFeatureSettings and FontVariantSettings
+ member variables.
+ (WebCore::CSSFontFace::insertFeature):
+ (WebCore::CSSFontFace::setVariantCommonLigatures):
+ (WebCore::CSSFontFace::setVariantDiscretionaryLigatures):
+ (WebCore::CSSFontFace::setVariantHistoricalLigatures):
+ (WebCore::CSSFontFace::setVariantContextualAlternates):
+ (WebCore::CSSFontFace::setVariantPosition):
+ (WebCore::CSSFontFace::setVariantCaps):
+ (WebCore::CSSFontFace::setVariantNumericFigure):
+ (WebCore::CSSFontFace::setVariantNumericSpacing):
+ (WebCore::CSSFontFace::setVariantNumericFraction):
+ (WebCore::CSSFontFace::setVariantNumericOrdinal):
+ (WebCore::CSSFontFace::setVariantNumericSlashedZero):
+ (WebCore::CSSFontFace::setVariantAlternates):
+ (WebCore::CSSFontFace::setVariantEastAsianVariant):
+ (WebCore::CSSFontFace::setVariantEastAsianWidth):
+ (WebCore::CSSFontFace::setVariantEastAsianRuby):
+ * css/CSSFontFaceSource.cpp:
+ (WebCore::CSSFontFaceSource::font): Pass the relevant data
+ structures into the font selection algorithm.
+ * css/CSSFontFaceSource.h: Ditto.
+ * css/CSSFontSelector.cpp:
+ (WebCore::CSSFontSelector::addFontFaceRule): Call the shared
+ parsing logic to populate the FontFeatureSettings and
+ FontVariantSettings members.
+ * css/FontVariantBuilder.h: Added. Destination for shared parsing
+ logic.
+ (WebCore::applyValueFontVariantLigatures):
+ (WebCore::applyValueFontVariantNumeric):
+ (WebCore::applyValueFontVariantEastAsian):
+ * css/StyleBuilderCustom.h: Source for shared parsing logic.
+ (WebCore::StyleBuilderCustom::applyValueFontVariantLigatures):
+ (WebCore::StyleBuilderCustom::applyValueFontVariantNumeric):
+ (WebCore::StyleBuilderCustom::applyValueFontVariantEastAsian):
+ * loader/cache/CachedFont.cpp: Pass the relevant data structures
+ into the font selection algorithm.
+ (WebCore::CachedFont::createFont):
+ (WebCore::CachedFont::platformDataFromCustomData):
+ * loader/cache/CachedFont.h: Ditto.
+ * loader/cache/CachedSVGFont.cpp: Ditto.
+ (WebCore::CachedSVGFont::createFont):
+ (WebCore::CachedSVGFont::platformDataFromCustomData):
+ * loader/cache/CachedSVGFont.h: Ditto.
+ * platform/graphics/FontCache.h: Ditto.
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::FontCascade::codePath): Adjust comment.
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::preparePlatformFont): Consult with the newly parsed values.
+ (WebCore::fontWithFamily): Pass the relevant data structures into the
+ font selection algorithm.
+ (WebCore::FontCache::systemFallbackForCharacters): Ditto.
+ * platform/graphics/mac/FontCustomPlatformData.cpp:
+ (WebCore::FontCustomPlatformData::fontPlatformData): Ditto.
+ * platform/graphics/mac/FontCustomPlatformData.h: Ditto.
+
2015-10-19 Myles C. Maxfield <mmaxfi...@apple.com>
FontCascade::typesettingFeatures() is not privy to font-variant-* nor font-feature-settings
Modified: branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-12-08 05:40:47 UTC (rev 193694)
@@ -5668,6 +5668,7 @@
C0F2A44113869AAB0066C534 /* preprocessor.pm in Headers */ = {isa = PBXBuildFile; fileRef = C0F2A43F13869A280066C534 /* preprocessor.pm */; settings = {ATTRIBUTES = (Private, ); }; };
C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; };
C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; };
+ C2015C0A1BE6FEB200822389 /* FontVariantBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */; };
C330A22313EC196B0000B45B /* ColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = C330A22113EC196B0000B45B /* ColorChooser.h */; settings = {ATTRIBUTES = (Private, ); }; };
C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */; };
C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; };
@@ -13272,6 +13273,7 @@
C0F2A43F13869A280066C534 /* preprocessor.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = preprocessor.pm; path = scripts/preprocessor.pm; sourceTree = "<group>"; };
C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingDetectorICU.cpp; sourceTree = "<group>"; };
C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEncodingDetector.h; sourceTree = "<group>"; };
+ C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontVariantBuilder.h; sourceTree = "<group>"; };
C24685131A148E1800811792 /* CoreGraphicsSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreGraphicsSPI.h; sourceTree = "<group>"; };
C2C4CB1D161A131200D214DA /* WebSafeIncrementalSweeperIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSafeIncrementalSweeperIOS.h; sourceTree = "<group>"; };
C330A22113EC196B0000B45B /* ColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooser.h; sourceTree = "<group>"; };
@@ -22799,6 +22801,7 @@
3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
+ C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */,
);
path = css;
sourceTree = "<group>";
@@ -24766,6 +24769,7 @@
8AD0A59814C88358000D83C5 /* DOMWebKitCSSRegionRuleInternal.h in Headers */,
31611E610E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h in Headers */,
31611E630E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h in Headers */,
+ C2015C0A1BE6FEB200822389 /* FontVariantBuilder.h in Headers */,
3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */,
3F2B33ED165AF15600E3987C /* DOMWebKitCSSViewportRuleInternal.h in Headers */,
8A195932147EA16E00D1EA61 /* DOMWebKitNamedFlow.h in Headers */,
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFace.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFace.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFace.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -124,7 +124,7 @@
size_t size = m_sources.size();
for (size_t i = 0; i < size; ++i) {
- if (RefPtr<Font> result = m_sources[i]->font(fontDescription, syntheticBold, syntheticItalic, fontSelector)) {
+ if (RefPtr<Font> result = m_sources[i]->font(fontDescription, syntheticBold, syntheticItalic, fontSelector, m_featureSettings, m_variantSettings)) {
m_activeSource = m_sources[i].get();
#if ENABLE(FONT_LOAD_EVENTS)
if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == Loading && m_sources[i]->isLoaded()) {
@@ -142,7 +142,7 @@
notifyLoadingDone();
}
#endif
- return 0;
+ return nullptr;
}
#if ENABLE(FONT_LOAD_EVENTS)
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFace.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFace.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFace.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -28,6 +28,7 @@
#include "CSSFontFaceRule.h"
#include "CSSFontFaceSource.h"
+#include "FontFeatureSettings.h"
#include "TextFlags.h"
#include <memory>
#include <wtf/Forward.h>
@@ -53,6 +54,24 @@
void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
const Vector<UnicodeRange>& ranges() const { return m_ranges; }
+ void insertFeature(FontFeature&& feature) { m_featureSettings.insert(WTF::move(feature)); }
+
+ void setVariantCommonLigatures(FontVariantLigatures ligatures) { m_variantSettings.commonLigatures = ligatures; }
+ void setVariantDiscretionaryLigatures(FontVariantLigatures ligatures) { m_variantSettings.discretionaryLigatures = ligatures; }
+ void setVariantHistoricalLigatures(FontVariantLigatures ligatures) { m_variantSettings.historicalLigatures = ligatures; }
+ void setVariantContextualAlternates(FontVariantLigatures ligatures) { m_variantSettings.contextualAlternates = ligatures; }
+ void setVariantPosition(FontVariantPosition position) { m_variantSettings.position = position; }
+ void setVariantCaps(FontVariantCaps caps) { m_variantSettings.caps = caps; }
+ void setVariantNumericFigure(FontVariantNumericFigure figure) { m_variantSettings.numericFigure = figure; }
+ void setVariantNumericSpacing(FontVariantNumericSpacing spacing) { m_variantSettings.numericSpacing = spacing; }
+ void setVariantNumericFraction(FontVariantNumericFraction fraction) { m_variantSettings.numericFraction = fraction; }
+ void setVariantNumericOrdinal(FontVariantNumericOrdinal ordinal) { m_variantSettings.numericOrdinal = ordinal; }
+ void setVariantNumericSlashedZero(FontVariantNumericSlashedZero slashedZero) { m_variantSettings.numericSlashedZero = slashedZero; }
+ void setVariantAlternates(FontVariantAlternates alternates) { m_variantSettings.alternates = alternates; }
+ void setVariantEastAsianVariant(FontVariantEastAsianVariant variant) { m_variantSettings.eastAsianVariant = variant; }
+ void setVariantEastAsianWidth(FontVariantEastAsianWidth width) { m_variantSettings.eastAsianWidth = width; }
+ void setVariantEastAsianRuby(FontVariantEastAsianRuby ruby) { m_variantSettings.eastAsianRuby = ruby; }
+
void addedToSegmentedFontFace(CSSSegmentedFontFace*);
void removedFromSegmentedFontFace(CSSSegmentedFontFace*);
@@ -107,6 +126,8 @@
FontTraitsMask m_traitsMask;
Vector<UnicodeRange> m_ranges;
HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
+ FontFeatureSettings m_featureSettings;
+ FontVariantSettings m_variantSettings;
Vector<std::unique_ptr<CSSFontFaceSource>> m_sources;
CSSFontFaceSource* m_activeSource;
bool m_isLocalFallback;
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFaceSource.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFaceSource.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFaceSource.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -101,7 +101,7 @@
m_face->fontLoaded(this);
}
-RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
+RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
// If the font hasn't loaded or an error occurred, then we've got nothing.
if (!isValid())
@@ -124,10 +124,8 @@
if (font)
return font.release();
- // If we are still loading, then we let the system pick a font.
if (isLoaded()) {
if (m_font) {
- // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef.
bool hasExternalSVGFont = false;
#if ENABLE(SVG_FONTS)
hasExternalSVGFont = m_hasExternalSVGFont;
@@ -135,7 +133,7 @@
if (!m_font->ensureCustomFontData(hasExternalSVGFont, m_string))
return nullptr;
- font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont);
+ font = m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, hasExternalSVGFont, fontFaceFeatures, fontFaceVariantSettings);
} else {
#if ENABLE(SVG_FONTS)
// In-Document SVG Fonts
@@ -153,7 +151,7 @@
auto customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
if (!customPlatformData)
return nullptr;
- font = Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic), true, false);
+ font = Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
#else
font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
#endif
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFaceSource.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFaceSource.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontFaceSource.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -44,6 +44,7 @@
class CSSFontSelector;
class Font;
class FontDescription;
+class FontFeatureSettings;
class CSSFontFaceSource final : public CachedFontClient {
WTF_MAKE_FAST_ALLOCATED;
@@ -60,7 +61,7 @@
virtual void fontLoaded(CachedFont*) override;
- RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
+ RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*, const FontFeatureSettings&, const FontVariantSettings&);
void pruneTable();
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontSelector.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontSelector.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSFontSelector.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -33,7 +33,9 @@
#include "CSSFontFaceSource.h"
#include "CSSFontFaceSrcValue.h"
#include "CSSFontFamily.h"
+#include "CSSFontFeatureValue.h"
#include "CSSPrimitiveValue.h"
+#include "CSSPrimitiveValueMappings.h"
#include "CSSPropertyNames.h"
#include "CSSSegmentedFontFace.h"
#include "CSSUnicodeRangeValue.h"
@@ -43,6 +45,7 @@
#include "Document.h"
#include "Font.h"
#include "FontCache.h"
+#include "FontVariantBuilder.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "SVGFontFaceElement.h"
@@ -91,6 +94,13 @@
RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
RefPtr<CSSValue> src = ""
RefPtr<CSSValue> unicodeRange = style.getPropertyCSSValue(CSSPropertyUnicodeRange);
+ RefPtr<CSSValue> featureSettings = style.getPropertyCSSValue(CSSPropertyFontFeatureSettings);
+ RefPtr<CSSValue> variantLigatures = style.getPropertyCSSValue(CSSPropertyFontVariantLigatures);
+ RefPtr<CSSValue> variantPosition = style.getPropertyCSSValue(CSSPropertyFontVariantPosition);
+ RefPtr<CSSValue> variantCaps = style.getPropertyCSSValue(CSSPropertyFontVariantCaps);
+ RefPtr<CSSValue> variantNumeric = style.getPropertyCSSValue(CSSPropertyFontVariantNumeric);
+ RefPtr<CSSValue> variantAlternates = style.getPropertyCSSValue(CSSPropertyFontVariantAlternates);
+ RefPtr<CSSValue> variantEastAsian = style.getPropertyCSSValue(CSSPropertyFontVariantEastAsian);
if (!is<CSSValueList>(fontFamily.get()) || !is<CSSValueList>(src.get()) || (unicodeRange && !is<CSSValueList>(*unicodeRange)))
return;
@@ -256,6 +266,31 @@
}
}
+ if (featureSettings) {
+ for (auto& item : downcast<CSSValueList>(*featureSettings)) {
+ auto& feature = downcast<CSSFontFeatureValue>(item.get());
+ fontFace->insertFeature(FontFeature(feature.tag(), feature.value()));
+ }
+ }
+
+ if (variantLigatures)
+ applyValueFontVariantLigatures(*fontFace, *variantLigatures);
+
+ if (variantPosition)
+ fontFace->setVariantPosition(downcast<CSSPrimitiveValue>(*variantPosition));
+
+ if (variantCaps)
+ fontFace->setVariantCaps(downcast<CSSPrimitiveValue>(*variantCaps));
+
+ if (variantNumeric)
+ applyValueFontVariantNumeric(*fontFace, *variantNumeric);
+
+ if (variantAlternates)
+ fontFace->setVariantAlternates(downcast<CSSPrimitiveValue>(*variantAlternates));
+
+ if (variantEastAsian)
+ applyValueFontVariantEastAsian(*fontFace, *variantEastAsian);
+
// Hash under every single family name.
for (auto& item : familyList) {
auto& value = downcast<CSSPrimitiveValue>(item.get());
Added: branches/safari-601.1.46-branch/Source/WebCore/css/FontVariantBuilder.h (0 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/FontVariantBuilder.h (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/FontVariantBuilder.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontVariantBuilder_h
+#define FontVariantBuilder_h
+
+namespace WebCore {
+
+template <typename T>
+inline void applyValueFontVariantLigatures(T& receiver, CSSValue& value)
+{
+ FontVariantLigatures common = FontVariantLigatures::Normal;
+ FontVariantLigatures discretionary = FontVariantLigatures::Normal;
+ FontVariantLigatures historical = FontVariantLigatures::Normal;
+ FontVariantLigatures contextualAlternates = FontVariantLigatures::Normal;
+
+ if (is<CSSValueList>(value)) {
+ for (auto& item : downcast<CSSValueList>(value)) {
+ switch (downcast<CSSPrimitiveValue>(item.get()).getValueID()) {
+ case CSSValueNoCommonLigatures:
+ common = FontVariantLigatures::No;
+ break;
+ case CSSValueCommonLigatures:
+ common = FontVariantLigatures::Yes;
+ break;
+ case CSSValueNoDiscretionaryLigatures:
+ discretionary = FontVariantLigatures::No;
+ break;
+ case CSSValueDiscretionaryLigatures:
+ discretionary = FontVariantLigatures::Yes;
+ break;
+ case CSSValueNoHistoricalLigatures:
+ historical = FontVariantLigatures::No;
+ break;
+ case CSSValueHistoricalLigatures:
+ historical = FontVariantLigatures::Yes;
+ break;
+ case CSSValueContextual:
+ contextualAlternates = FontVariantLigatures::Yes;
+ break;
+ case CSSValueNoContextual:
+ contextualAlternates = FontVariantLigatures::No;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+ } else {
+ switch (downcast<CSSPrimitiveValue>(value).getValueID()) {
+ case CSSValueNormal:
+ break;
+ case CSSValueNone:
+ common = FontVariantLigatures::No;
+ discretionary = FontVariantLigatures::No;
+ historical = FontVariantLigatures::No;
+ contextualAlternates = FontVariantLigatures::No;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+
+ receiver.setVariantCommonLigatures(common);
+ receiver.setVariantDiscretionaryLigatures(discretionary);
+ receiver.setVariantHistoricalLigatures(historical);
+ receiver.setVariantContextualAlternates(contextualAlternates);
+}
+
+template <typename T>
+inline void applyValueFontVariantNumeric(T& receiver, CSSValue& value)
+{
+ FontVariantNumericFigure figure = FontVariantNumericFigure::Normal;
+ FontVariantNumericSpacing spacing = FontVariantNumericSpacing::Normal;
+ FontVariantNumericFraction fraction = FontVariantNumericFraction::Normal;
+ FontVariantNumericOrdinal ordinal = FontVariantNumericOrdinal::Normal;
+ FontVariantNumericSlashedZero slashedZero = FontVariantNumericSlashedZero::Normal;
+
+ if (is<CSSValueList>(value)) {
+ for (auto& item : downcast<CSSValueList>(value)) {
+ switch (downcast<CSSPrimitiveValue>(item.get()).getValueID()) {
+ case CSSValueLiningNums:
+ figure = FontVariantNumericFigure::LiningNumbers;
+ break;
+ case CSSValueOldstyleNums:
+ figure = FontVariantNumericFigure::OldStyleNumbers;
+ break;
+ case CSSValueProportionalNums:
+ spacing = FontVariantNumericSpacing::ProportionalNumbers;
+ break;
+ case CSSValueTabularNums:
+ spacing = FontVariantNumericSpacing::TabularNumbers;
+ break;
+ case CSSValueDiagonalFractions:
+ fraction = FontVariantNumericFraction::DiagonalFractions;
+ break;
+ case CSSValueStackedFractions:
+ fraction = FontVariantNumericFraction::StackedFractions;
+ break;
+ case CSSValueOrdinal:
+ ordinal = FontVariantNumericOrdinal::Yes;
+ break;
+ case CSSValueSlashedZero:
+ slashedZero = FontVariantNumericSlashedZero::Yes;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+ } else
+ ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNormal);
+
+ receiver.setVariantNumericFigure(figure);
+ receiver.setVariantNumericSpacing(spacing);
+ receiver.setVariantNumericFraction(fraction);
+ receiver.setVariantNumericOrdinal(ordinal);
+ receiver.setVariantNumericSlashedZero(slashedZero);
+}
+
+template <typename T>
+inline void applyValueFontVariantEastAsian(T& receiver, CSSValue& value)
+{
+ FontVariantEastAsianVariant variant = FontVariantEastAsianVariant::Normal;
+ FontVariantEastAsianWidth width = FontVariantEastAsianWidth::Normal;
+ FontVariantEastAsianRuby ruby = FontVariantEastAsianRuby::Normal;
+
+ if (is<CSSValueList>(value)) {
+ for (auto& item : downcast<CSSValueList>(value)) {
+ switch (downcast<CSSPrimitiveValue>(item.get()).getValueID()) {
+ case CSSValueJis78:
+ variant = FontVariantEastAsianVariant::Jis78;
+ break;
+ case CSSValueJis83:
+ variant = FontVariantEastAsianVariant::Jis83;
+ break;
+ case CSSValueJis90:
+ variant = FontVariantEastAsianVariant::Jis90;
+ break;
+ case CSSValueJis04:
+ variant = FontVariantEastAsianVariant::Jis04;
+ break;
+ case CSSValueSimplified:
+ variant = FontVariantEastAsianVariant::Simplified;
+ break;
+ case CSSValueTraditional:
+ variant = FontVariantEastAsianVariant::Traditional;
+ break;
+ case CSSValueFullWidth:
+ width = FontVariantEastAsianWidth::FullWidth;
+ break;
+ case CSSValueProportionalWidth:
+ width = FontVariantEastAsianWidth::ProportionalWidth;
+ break;
+ case CSSValueRuby:
+ ruby = FontVariantEastAsianRuby::Yes;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+ } else
+ ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNormal);
+
+ receiver.setVariantEastAsianVariant(variant);
+ receiver.setVariantEastAsianWidth(width);
+ receiver.setVariantEastAsianRuby(ruby);
+}
+
+}
+
+#endif
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/StyleBuilderCustom.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/css/StyleBuilderCustom.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/StyleBuilderCustom.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -38,6 +38,7 @@
#include "CursorList.h"
#include "DashboardRegion.h"
#include "ElementAncestorIterator.h"
+#include "FontVariantBuilder.h"
#include "Frame.h"
#include "HTMLElement.h"
#include "LocaleToScriptMapping.h"
@@ -1404,64 +1405,8 @@
inline void StyleBuilderCustom::applyValueFontVariantLigatures(StyleResolver& styleResolver, CSSValue& value)
{
- FontVariantLigatures common = FontVariantLigatures::Normal;
- FontVariantLigatures discretionary = FontVariantLigatures::Normal;
- FontVariantLigatures historical = FontVariantLigatures::Normal;
- FontVariantLigatures contextualAlternates = FontVariantLigatures::Normal;
-
- if (is<CSSValueList>(value)) {
- for (auto& item : downcast<CSSValueList>(value)) {
- switch (downcast<CSSPrimitiveValue>(item.get()).getValueID()) {
- case CSSValueNoCommonLigatures:
- common = FontVariantLigatures::No;
- break;
- case CSSValueCommonLigatures:
- common = FontVariantLigatures::Yes;
- break;
- case CSSValueNoDiscretionaryLigatures:
- discretionary = FontVariantLigatures::No;
- break;
- case CSSValueDiscretionaryLigatures:
- discretionary = FontVariantLigatures::Yes;
- break;
- case CSSValueNoHistoricalLigatures:
- historical = FontVariantLigatures::No;
- break;
- case CSSValueHistoricalLigatures:
- historical = FontVariantLigatures::Yes;
- break;
- case CSSValueContextual:
- contextualAlternates = FontVariantLigatures::Yes;
- break;
- case CSSValueNoContextual:
- contextualAlternates = FontVariantLigatures::No;
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- }
- } else {
- switch (downcast<CSSPrimitiveValue>(value).getValueID()) {
- case CSSValueNormal:
- break;
- case CSSValueNone:
- common = FontVariantLigatures::No;
- discretionary = FontVariantLigatures::No;
- historical = FontVariantLigatures::No;
- contextualAlternates = FontVariantLigatures::No;
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- }
-
auto fontDescription = styleResolver.fontDescription();
- fontDescription.setVariantCommonLigatures(common);
- fontDescription.setVariantDiscretionaryLigatures(discretionary);
- fontDescription.setVariantHistoricalLigatures(historical);
- fontDescription.setVariantContextualAlternates(contextualAlternates);
+ WebCore::applyValueFontVariantLigatures(fontDescription, value);
styleResolver.setFontDescription(fontDescription);
}
@@ -1489,53 +1434,8 @@
inline void StyleBuilderCustom::applyValueFontVariantNumeric(StyleResolver& styleResolver, CSSValue& value)
{
- FontVariantNumericFigure figure = FontVariantNumericFigure::Normal;
- FontVariantNumericSpacing spacing = FontVariantNumericSpacing::Normal;
- FontVariantNumericFraction fraction = FontVariantNumericFraction::Normal;
- FontVariantNumericOrdinal ordinal = FontVariantNumericOrdinal::Normal;
- FontVariantNumericSlashedZero slashedZero = FontVariantNumericSlashedZero::Normal;
-
- if (is<CSSValueList>(value)) {
- for (auto& item : downcast<CSSValueList>(value)) {
- switch (downcast<CSSPrimitiveValue>(item.get()).getValueID()) {
- case CSSValueLiningNums:
- figure = FontVariantNumericFigure::LiningNumbers;
- break;
- case CSSValueOldstyleNums:
- figure = FontVariantNumericFigure::OldStyleNumbers;
- break;
- case CSSValueProportionalNums:
- spacing = FontVariantNumericSpacing::ProportionalNumbers;
- break;
- case CSSValueTabularNums:
- spacing = FontVariantNumericSpacing::TabularNumbers;
- break;
- case CSSValueDiagonalFractions:
- fraction = FontVariantNumericFraction::DiagonalFractions;
- break;
- case CSSValueStackedFractions:
- fraction = FontVariantNumericFraction::StackedFractions;
- break;
- case CSSValueOrdinal:
- ordinal = FontVariantNumericOrdinal::Yes;
- break;
- case CSSValueSlashedZero:
- slashedZero = FontVariantNumericSlashedZero::Yes;
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- }
- } else
- ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNormal);
-
auto fontDescription = styleResolver.fontDescription();
- fontDescription.setVariantNumericFigure(figure);
- fontDescription.setVariantNumericSpacing(spacing);
- fontDescription.setVariantNumericFraction(fraction);
- fontDescription.setVariantNumericOrdinal(ordinal);
- fontDescription.setVariantNumericSlashedZero(slashedZero);
+ WebCore::applyValueFontVariantNumeric(fontDescription, value);
styleResolver.setFontDescription(fontDescription);
}
@@ -1559,52 +1459,8 @@
inline void StyleBuilderCustom::applyValueFontVariantEastAsian(StyleResolver& styleResolver, CSSValue& value)
{
- FontVariantEastAsianVariant variant = FontVariantEastAsianVariant::Normal;
- FontVariantEastAsianWidth width = FontVariantEastAsianWidth::Normal;
- FontVariantEastAsianRuby ruby = FontVariantEastAsianRuby::Normal;
-
- if (is<CSSValueList>(value)) {
- for (auto& item : downcast<CSSValueList>(value)) {
- switch (downcast<CSSPrimitiveValue>(item.get()).getValueID()) {
- case CSSValueJis78:
- variant = FontVariantEastAsianVariant::Jis78;
- break;
- case CSSValueJis83:
- variant = FontVariantEastAsianVariant::Jis83;
- break;
- case CSSValueJis90:
- variant = FontVariantEastAsianVariant::Jis90;
- break;
- case CSSValueJis04:
- variant = FontVariantEastAsianVariant::Jis04;
- break;
- case CSSValueSimplified:
- variant = FontVariantEastAsianVariant::Simplified;
- break;
- case CSSValueTraditional:
- variant = FontVariantEastAsianVariant::Traditional;
- break;
- case CSSValueFullWidth:
- width = FontVariantEastAsianWidth::FullWidth;
- break;
- case CSSValueProportionalWidth:
- width = FontVariantEastAsianWidth::ProportionalWidth;
- break;
- case CSSValueRuby:
- ruby = FontVariantEastAsianRuby::Yes;
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- }
- } else
- ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNormal);
-
auto fontDescription = styleResolver.fontDescription();
- fontDescription.setVariantEastAsianVariant(variant);
- fontDescription.setVariantEastAsianWidth(width);
- fontDescription.setVariantEastAsianRuby(ruby);
+ WebCore::applyValueFontVariantEastAsian(fontDescription, value);
styleResolver.setFontDescription(fontDescription);
}
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedFont.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedFont.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedFont.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -121,15 +121,21 @@
return m_fontCustomPlatformData.get();
}
-RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
+RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
- return Font::create(platformDataFromCustomData(fontDescription, syntheticBold, syntheticItalic), true, false);
+ return Font::create(platformDataFromCustomData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
}
-FontPlatformData CachedFont::platformDataFromCustomData(const FontDescription& fontDescription, bool bold, bool italic)
+FontPlatformData CachedFont::platformDataFromCustomData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
ASSERT(m_fontCustomPlatformData);
+#if PLATFORM(COCOA)
+ return m_fontCustomPlatformData->fontPlatformData(fontDescription, bold, italic, fontFaceFeatures, fontFaceVariantSettings);
+#else
+ UNUSED_PARAM(fontFaceFeatures);
+ UNUSED_PARAM(fontFaceVariantSettings);
return m_fontCustomPlatformData->fontPlatformData(fontDescription, bold, italic);
+#endif
}
void CachedFont::allClientsRemoved()
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedFont.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedFont.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedFont.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -35,6 +35,7 @@
class CachedResourceLoader;
class FontDescription;
+class FontFeatureSettings;
class FontPlatformData;
class SVGDocument;
class SVGFontElement;
@@ -50,10 +51,10 @@
virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI);
- virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG);
+ virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG, const FontFeatureSettings&, const FontVariantSettings&);
protected:
- FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic);
+ FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&);
bool ensureCustomFontData(SharedBuffer* data);
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedSVGFont.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedSVGFont.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedSVGFont.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -51,14 +51,14 @@
{
}
-RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG)
+RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
#if ENABLE(SVG_OTF_CONVERTER)
if (!externalSVG || firstFontFace(remoteURI))
- return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
+ return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG, fontFaceFeatures, fontFaceVariantSettings);
#else
if (!externalSVG)
- return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG);
+ return CachedFont::createFont(fontDescription, remoteURI, syntheticBold, syntheticItalic, externalSVG, fontFaceFeatures, fontFaceVariantSettings);
if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI))
return Font::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
@@ -66,11 +66,11 @@
return nullptr;
}
-FontPlatformData CachedSVGFont::platformDataFromCustomData(const FontDescription& fontDescription, bool bold, bool italic)
+FontPlatformData CachedSVGFont::platformDataFromCustomData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
if (m_externalSVGDocument)
return FontPlatformData(fontDescription.computedPixelSize(), bold, italic);
- return CachedFont::platformDataFromCustomData(fontDescription, bold, italic);
+ return CachedFont::platformDataFromCustomData(fontDescription, bold, italic, fontFaceFeatures, fontFaceVariantSettings);
}
bool CachedSVGFont::ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI)
Modified: branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedSVGFont.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedSVGFont.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/loader/cache/CachedSVGFont.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -40,10 +40,10 @@
virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI) override;
- virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override;
+ virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG, const FontFeatureSettings&, const FontVariantSettings&) override;
private:
- FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic);
+ FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&);
SVGFontElement* getSVGFontById(const String&) const;
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCache.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCache.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCache.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -232,7 +232,7 @@
};
#if PLATFORM(COCOA)
-RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef, const FontFeatureSettings&, const FontVariantSettings&);
+RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings&);
#endif
#if !PLATFORM(MAC)
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCascade.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCascade.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCascade.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -623,7 +623,8 @@
return Simple;
#endif
- // Because Font::applyTransforms() doesn't know which features to enable/disable it the simple code path can’t properly handle feature or variant settings.
+ // Because Font::applyTransforms() doesn't know which features to enable/disable in the simple code path, it can't properly handle feature or variant settings.
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=150791: @font-face features should also cause this to be complex.
if (m_fontDescription.featureSettings().size() > 0 || !m_fontDescription.variantSettings().isAllNormal())
return Complex;
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -143,202 +143,260 @@
#endif
}
-typedef HashMap<FontFeatureTag, int, FontFeatureTagHash, FontFeatureTagHashTraits> FeaturesMap;
-
-static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings& variantSettings)
-{
- FeaturesMap result;
-
- switch (variantSettings.commonLigatures) {
- case FontVariantLigatures::Yes:
- result.add(fontFeatureTag("liga"), 1);
- result.add(fontFeatureTag("clig"), 1);
- break;
- case FontVariantLigatures::No:
- result.add(fontFeatureTag("liga"), 0);
- result.add(fontFeatureTag("clig"), 0);
- break;
- default:
- break;
- }
-
- switch (variantSettings.discretionaryLigatures) {
- case FontVariantLigatures::Yes:
- result.add(fontFeatureTag("dlig"), 1);
- break;
- case FontVariantLigatures::No:
- result.add(fontFeatureTag("dlig"), 0);
- break;
- default:
- break;
- }
-
- switch (variantSettings.historicalLigatures) {
- case FontVariantLigatures::Yes:
- result.add(fontFeatureTag("hlig"), 1);
- break;
- case FontVariantLigatures::No:
- result.add(fontFeatureTag("hlig"), 0);
- break;
- default:
- break;
- }
-
- switch (variantSettings.contextualAlternates) {
- case FontVariantLigatures::Yes:
- result.add(fontFeatureTag("calt"), 1);
- break;
- case FontVariantLigatures::No:
- result.add(fontFeatureTag("calt"), 0);
- break;
- default:
- break;
- }
-
- switch (variantSettings.position) {
- case FontVariantPosition::Subscript:
- result.add(fontFeatureTag("subs"), 1);
- break;
- case FontVariantPosition::Superscript:
- result.add(fontFeatureTag("sups"), 1);
- break;
- default:
- break;
- }
-
- switch (variantSettings.caps) {
- case FontVariantCaps::AllSmall:
- result.add(fontFeatureTag("c2sc"), 1);
- FALLTHROUGH;
- case FontVariantCaps::Small:
- result.add(fontFeatureTag("smcp"), 1);
- break;
- case FontVariantCaps::AllPetite:
- result.add(fontFeatureTag("c2pc"), 1);
- FALLTHROUGH;
- case FontVariantCaps::Petite:
- result.add(fontFeatureTag("pcap"), 1);
- break;
- case FontVariantCaps::Unicase:
- result.add(fontFeatureTag("unic"), 1);
- break;
- case FontVariantCaps::Titling:
- result.add(fontFeatureTag("titl"), 1);
- break;
- default:
- break;
- }
-
- switch (variantSettings.numericFigure) {
- case FontVariantNumericFigure::LiningNumbers:
- result.add(fontFeatureTag("lnum"), 1);
- break;
- case FontVariantNumericFigure::OldStyleNumbers:
- result.add(fontFeatureTag("onum"), 1);
- break;
- default:
- break;
- }
-
- switch (variantSettings.numericSpacing) {
- case FontVariantNumericSpacing::ProportionalNumbers:
- result.add(fontFeatureTag("pnum"), 1);
- break;
- case FontVariantNumericSpacing::TabularNumbers:
- result.add(fontFeatureTag("tnum"), 1);
- break;
- default:
- break;
- }
-
- switch (variantSettings.numericFraction) {
- case FontVariantNumericFraction::DiagonalFractions:
- result.add(fontFeatureTag("frac"), 1);
- break;
- case FontVariantNumericFraction::StackedFractions:
- result.add(fontFeatureTag("afrc"), 1);
- break;
- default:
- break;
- }
-
- if (variantSettings.numericOrdinal == FontVariantNumericOrdinal::Yes)
- result.add(fontFeatureTag("ordn"), 1);
- if (variantSettings.numericSlashedZero == FontVariantNumericSlashedZero::Yes)
- result.add(fontFeatureTag("zero"), 1);
-
- switch (variantSettings.alternates) {
- case FontVariantAlternates::HistoricalForms:
- result.add(fontFeatureTag("hist"), 1);
- break;
- default:
- break;
- }
-
- switch (variantSettings.eastAsianVariant) {
- case FontVariantEastAsianVariant::Jis78:
- result.add(fontFeatureTag("jp78"), 1);
- break;
- case FontVariantEastAsianVariant::Jis83:
- result.add(fontFeatureTag("jp83"), 1);
- break;
- case FontVariantEastAsianVariant::Jis90:
- result.add(fontFeatureTag("jp90"), 1);
- break;
- case FontVariantEastAsianVariant::Jis04:
- result.add(fontFeatureTag("jp04"), 1);
- break;
- case FontVariantEastAsianVariant::Simplified:
- result.add(fontFeatureTag("smpl"), 1);
- break;
- case FontVariantEastAsianVariant::Traditional:
- result.add(fontFeatureTag("trad"), 1);
- break;
+typedef HashMap<FontFeatureTag, int, FontFeatureTagHash, FontFeatureTagHashTraits> FeaturesMap;
+
+static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings& variantSettings)
+{
+ FeaturesMap result;
+
+ switch (variantSettings.commonLigatures) {
+ case FontVariantLigatures::Normal:
+ break;
+ case FontVariantLigatures::Yes:
+ result.add(fontFeatureTag("liga"), 1);
+ result.add(fontFeatureTag("clig"), 1);
+ break;
+ case FontVariantLigatures::No:
+ result.add(fontFeatureTag("liga"), 0);
+ result.add(fontFeatureTag("clig"), 0);
+ break;
default:
- break;
- }
-
- switch (variantSettings.eastAsianWidth) {
- case FontVariantEastAsianWidth::FullWidth:
- result.add(fontFeatureTag("fwid"), 1);
- break;
- case FontVariantEastAsianWidth::ProportionalWidth:
- result.add(fontFeatureTag("pwid"), 1);
- break;
- default:
- break;
- }
-
- if (variantSettings.eastAsianRuby == FontVariantEastAsianRuby::Yes)
- result.add(fontFeatureTag("ruby"), 1);
-
- return result;
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.discretionaryLigatures) {
+ case FontVariantLigatures::Normal:
+ break;
+ case FontVariantLigatures::Yes:
+ result.add(fontFeatureTag("dlig"), 1);
+ break;
+ case FontVariantLigatures::No:
+ result.add(fontFeatureTag("dlig"), 0);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.historicalLigatures) {
+ case FontVariantLigatures::Normal:
+ break;
+ case FontVariantLigatures::Yes:
+ result.add(fontFeatureTag("hlig"), 1);
+ break;
+ case FontVariantLigatures::No:
+ result.add(fontFeatureTag("hlig"), 0);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.contextualAlternates) {
+ case FontVariantLigatures::Normal:
+ break;
+ case FontVariantLigatures::Yes:
+ result.add(fontFeatureTag("calt"), 1);
+ break;
+ case FontVariantLigatures::No:
+ result.add(fontFeatureTag("calt"), 0);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.position) {
+ case FontVariantPosition::Normal:
+ break;
+ case FontVariantPosition::Subscript:
+ result.add(fontFeatureTag("subs"), 1);
+ break;
+ case FontVariantPosition::Superscript:
+ result.add(fontFeatureTag("sups"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.caps) {
+ case FontVariantCaps::Normal:
+ break;
+ case FontVariantCaps::AllSmall:
+ result.add(fontFeatureTag("c2sc"), 1);
+ FALLTHROUGH;
+ case FontVariantCaps::Small:
+ result.add(fontFeatureTag("smcp"), 1);
+ break;
+ case FontVariantCaps::AllPetite:
+ result.add(fontFeatureTag("c2pc"), 1);
+ FALLTHROUGH;
+ case FontVariantCaps::Petite:
+ result.add(fontFeatureTag("pcap"), 1);
+ break;
+ case FontVariantCaps::Unicase:
+ result.add(fontFeatureTag("unic"), 1);
+ break;
+ case FontVariantCaps::Titling:
+ result.add(fontFeatureTag("titl"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.numericFigure) {
+ case FontVariantNumericFigure::Normal:
+ break;
+ case FontVariantNumericFigure::LiningNumbers:
+ result.add(fontFeatureTag("lnum"), 1);
+ break;
+ case FontVariantNumericFigure::OldStyleNumbers:
+ result.add(fontFeatureTag("onum"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.numericSpacing) {
+ case FontVariantNumericSpacing::Normal:
+ break;
+ case FontVariantNumericSpacing::ProportionalNumbers:
+ result.add(fontFeatureTag("pnum"), 1);
+ break;
+ case FontVariantNumericSpacing::TabularNumbers:
+ result.add(fontFeatureTag("tnum"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.numericFraction) {
+ case FontVariantNumericFraction::Normal:
+ break;
+ case FontVariantNumericFraction::DiagonalFractions:
+ result.add(fontFeatureTag("frac"), 1);
+ break;
+ case FontVariantNumericFraction::StackedFractions:
+ result.add(fontFeatureTag("afrc"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.numericOrdinal) {
+ case FontVariantNumericOrdinal::Normal:
+ break;
+ case FontVariantNumericOrdinal::Yes:
+ result.add(fontFeatureTag("ordn"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.numericSlashedZero) {
+ case FontVariantNumericSlashedZero::Normal:
+ break;
+ case FontVariantNumericSlashedZero::Yes:
+ result.add(fontFeatureTag("zero"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.alternates) {
+ case FontVariantAlternates::Normal:
+ break;
+ case FontVariantAlternates::HistoricalForms:
+ result.add(fontFeatureTag("hist"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.eastAsianVariant) {
+ case FontVariantEastAsianVariant::Normal:
+ break;
+ case FontVariantEastAsianVariant::Jis78:
+ result.add(fontFeatureTag("jp78"), 1);
+ break;
+ case FontVariantEastAsianVariant::Jis83:
+ result.add(fontFeatureTag("jp83"), 1);
+ break;
+ case FontVariantEastAsianVariant::Jis90:
+ result.add(fontFeatureTag("jp90"), 1);
+ break;
+ case FontVariantEastAsianVariant::Jis04:
+ result.add(fontFeatureTag("jp04"), 1);
+ break;
+ case FontVariantEastAsianVariant::Simplified:
+ result.add(fontFeatureTag("smpl"), 1);
+ break;
+ case FontVariantEastAsianVariant::Traditional:
+ result.add(fontFeatureTag("trad"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.eastAsianWidth) {
+ case FontVariantEastAsianWidth::Normal:
+ break;
+ case FontVariantEastAsianWidth::FullWidth:
+ result.add(fontFeatureTag("fwid"), 1);
+ break;
+ case FontVariantEastAsianWidth::ProportionalWidth:
+ result.add(fontFeatureTag("pwid"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ switch (variantSettings.eastAsianRuby) {
+ case FontVariantEastAsianRuby::Normal:
+ break;
+ case FontVariantEastAsianRuby::Yes:
+ result.add(fontFeatureTag("ruby"), 1);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return result;
}
-RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef originalFont, const FontFeatureSettings& features, const FontVariantSettings& variantSettings)
+RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef originalFont, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings& variantSettings)
{
- if (!originalFont || (!features.size() && variantSettings.isAllNormal()))
+ if (!originalFont || (!features.size() && variantSettings.isAllNormal()
+ && (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal())))
return originalFont;
// This algorithm is described at http://www.w3.org/TR/css3-fonts/#feature-precedence
+ FeaturesMap featuresToBeApplied;
// Step 1: CoreText handles default features (such as required ligatures).
- // Steps 2-3: Consult with @font-face
- // FIXME: This is not yet implemented.
+ // Step 2: Consult with font-variant-* inside @font-face
+ if (fontFaceVariantSettings)
+ featuresToBeApplied = computeFeatureSettingsFromVariants(*fontFaceVariantSettings);
+ // Step 3: Consult with font-feature-settings inside @font-face
+ if (fontFaceFeatures) {
+ for (auto& fontFaceFeature : *fontFaceFeatures)
+ featuresToBeApplied.set(fontFaceFeature.tag(), fontFaceFeature.value());
+ }
+
// Step 4: Font-variant
- auto fontFeatureSettingsFromVariants = computeFeatureSettingsFromVariants(variantSettings);
+ for (auto& newFeature : computeFeatureSettingsFromVariants(variantSettings))
+ featuresToBeApplied.set(newFeature.key, newFeature.value);
+ // Step 5: Other properties
+
// Step 6: Font-feature-settings
for (auto& newFeature : features)
- fontFeatureSettingsFromVariants.set(newFeature.tag(), newFeature.value());
+ featuresToBeApplied.set(newFeature.tag(), newFeature.value());
- if (!fontFeatureSettingsFromVariants.size())
+ if (!featuresToBeApplied.size())
return originalFont;
RetainPtr<CFMutableArrayRef> featureArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, features.size(), &kCFTypeArrayCallBacks));
- for (auto& p : fontFeatureSettingsFromVariants) {
+ for (auto& p : featuresToBeApplied) {
auto feature = FontFeature(p.key, p.value);
appendTrueTypeFeature(featureArray.get(), feature);
appendOpenTypeFeature(featureArray.get(), feature);
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2015-12-08 05:40:47 UTC (rev 193694)
@@ -287,7 +287,7 @@
NSString *desiredFamily = family;
RetainPtr<CTFontRef> foundFont = adoptCF(CTFontCreateForCSS((CFStringRef)desiredFamily, toCoreTextFontWeight(weight), requestedTraits, size));
- foundFont = applyFontFeatureSettings(foundFont.get(), featureSettings, variantSettings);
+ foundFont = applyFontFeatureSettings(foundFont.get(), nullptr, nullptr, featureSettings, variantSettings);
if (!foundFont)
return nil;
font = CFBridgingRelease(CFRetain(foundFont.get()));
@@ -513,7 +513,7 @@
const FontPlatformData& platformData = originalFontData->platformData();
NSFont *nsFont = platformData.nsFont();
RetainPtr<CTFontRef> result = lookupCTFont(platformData.font(), platformData.size(), characters, length);
- result = applyFontFeatureSettings(result.get(), description.featureSettings(), description.variantSettings());
+ result = applyFontFeatureSettings(result.get(), nullptr, nullptr, description.featureSettings(), description.variantSettings());
if (!result)
return nullptr;
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp 2015-12-08 05:40:47 UTC (rev 193694)
@@ -34,16 +34,18 @@
{
}
-FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic)
+FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
int size = fontDescription.computedPixelSize();
FontOrientation orientation = fontDescription.orientation();
FontWidthVariant widthVariant = fontDescription.widthVariant();
#if CORETEXT_WEB_FONTS
RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
- font = applyFontFeatureSettings(font.get(), fontDescription.featureSettings(), fontDescription.variantSettings());
+ font = applyFontFeatureSettings(font.get(), &fontFaceFeatures, &fontFaceVariantSettings, fontDescription.featureSettings(), fontDescription.variantSettings());
return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant);
#else
+ UNUSED_PARAM(fontFaceFeatures);
+ UNUSED_PARAM(fontFaceVariantSettings);
return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant);
#endif
}
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -33,6 +33,7 @@
namespace WebCore {
class FontDescription;
+class FontFeatureSettings;
class FontPlatformData;
class SharedBuffer;
@@ -51,7 +52,7 @@
~FontCustomPlatformData();
- FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic);
+ FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings);
static bool supportsFormat(const String&);
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/text/TextFlags.h (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/text/TextFlags.h 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/text/TextFlags.h 2015-12-08 05:40:47 UTC (rev 193694)
@@ -149,6 +149,59 @@
};
struct FontVariantSettings {
+ FontVariantSettings()
+ : commonLigatures(FontVariantLigatures::Normal)
+ , discretionaryLigatures(FontVariantLigatures::Normal)
+ , historicalLigatures(FontVariantLigatures::Normal)
+ , contextualAlternates(FontVariantLigatures::Normal)
+ , position(FontVariantPosition::Normal)
+ , caps(FontVariantCaps::Normal)
+ , numericFigure(FontVariantNumericFigure::Normal)
+ , numericSpacing(FontVariantNumericSpacing::Normal)
+ , numericFraction(FontVariantNumericFraction::Normal)
+ , numericOrdinal(FontVariantNumericOrdinal::Normal)
+ , numericSlashedZero(FontVariantNumericSlashedZero::Normal)
+ , alternates(FontVariantAlternates::Normal)
+ , eastAsianVariant(FontVariantEastAsianVariant::Normal)
+ , eastAsianWidth(FontVariantEastAsianWidth::Normal)
+ , eastAsianRuby(FontVariantEastAsianRuby::Normal)
+ {
+ }
+
+ FontVariantSettings(
+ FontVariantLigatures commonLigatures,
+ FontVariantLigatures discretionaryLigatures,
+ FontVariantLigatures historicalLigatures,
+ FontVariantLigatures contextualAlternates,
+ FontVariantPosition position,
+ FontVariantCaps caps,
+ FontVariantNumericFigure numericFigure,
+ FontVariantNumericSpacing numericSpacing,
+ FontVariantNumericFraction numericFraction,
+ FontVariantNumericOrdinal numericOrdinal,
+ FontVariantNumericSlashedZero numericSlashedZero,
+ FontVariantAlternates alternates,
+ FontVariantEastAsianVariant eastAsianVariant,
+ FontVariantEastAsianWidth eastAsianWidth,
+ FontVariantEastAsianRuby eastAsianRuby)
+ : commonLigatures(commonLigatures)
+ , discretionaryLigatures(discretionaryLigatures)
+ , historicalLigatures(historicalLigatures)
+ , contextualAlternates(contextualAlternates)
+ , position(position)
+ , caps(caps)
+ , numericFigure(numericFigure)
+ , numericSpacing(numericSpacing)
+ , numericFraction(numericFraction)
+ , numericOrdinal(numericOrdinal)
+ , numericSlashedZero(numericSlashedZero)
+ , alternates(alternates)
+ , eastAsianVariant(eastAsianVariant)
+ , eastAsianWidth(eastAsianWidth)
+ , eastAsianRuby(eastAsianRuby)
+ {
+ }
+
bool isAllNormal() const
{
return commonLigatures == FontVariantLigatures::Normal
Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeIOS.mm (193693 => 193694)
--- branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeIOS.mm 2015-12-08 05:40:37 UTC (rev 193693)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderThemeIOS.mm 2015-12-08 05:40:47 UTC (rev 193694)
@@ -1271,7 +1271,7 @@
ASSERT(fontDescriptor);
RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
- font = applyFontFeatureSettings(font.get(), fontDescription.featureSettings(), fontDescription.variantSettings());
+ font = applyFontFeatureSettings(font.get(), nullptr, nullptr, fontDescription.featureSettings(), fontDescription.variantSettings());
fontDescription.setIsAbsoluteSize(true);
fontDescription.setOneFamily(textStyle);
fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));