font-variant-* properties in @font-face declarations should be honored
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 20:31:33 +0000 (20:31 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 20:31:33 +0000 (20:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149771

Reviewed by Simon Fraser.

Source/WebCore:

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.

LayoutTests:

* 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.

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

28 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/font-feature-settings-font-face-rendering-expected.html [new file with mode: 0644]
LayoutTests/css3/font-feature-settings-font-face-rendering.html [new file with mode: 0644]
LayoutTests/css3/font-variant-font-face-all-expected.html [new file with mode: 0644]
LayoutTests/css3/font-variant-font-face-all.html [new file with mode: 0644]
LayoutTests/css3/font-variant-font-face-override-expected.html [new file with mode: 0644]
LayoutTests/css3/font-variant-font-face-override.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontFace.h
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/CSSFontFaceSource.h
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/FontVariantBuilder.h [new file with mode: 0644]
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/loader/cache/CachedFont.cpp
Source/WebCore/loader/cache/CachedFont.h
Source/WebCore/loader/cache/CachedSVGFont.cpp
Source/WebCore/loader/cache/CachedSVGFont.h
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
Source/WebCore/platform/text/TextFlags.h
Source/WebCore/rendering/RenderThemeIOS.mm

index 4b84440..851cc54 100644 (file)
@@ -1,3 +1,17 @@
+2015-11-03  Myles C. Maxfield  <mmaxfield@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-11-03  Keith Rollin  <krollin@apple.com>
 
         HTMLOptionElement.text should never return the value of label
 2015-11-03  Keith Rollin  <krollin@apple.com>
 
         HTMLOptionElement.text should never return the value of label
diff --git a/LayoutTests/css3/font-feature-settings-font-face-rendering-expected.html b/LayoutTests/css3/font-feature-settings-font-face-rendering-expected.html
new file mode 100644 (file)
index 0000000..b6cc58f
--- /dev/null
@@ -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>
diff --git a/LayoutTests/css3/font-feature-settings-font-face-rendering.html b/LayoutTests/css3/font-feature-settings-font-face-rendering.html
new file mode 100644 (file)
index 0000000..58de671
--- /dev/null
@@ -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
diff --git a/LayoutTests/css3/font-variant-font-face-all-expected.html b/LayoutTests/css3/font-variant-font-face-all-expected.html
new file mode 100644 (file)
index 0000000..7441493
--- /dev/null
@@ -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>
diff --git a/LayoutTests/css3/font-variant-font-face-all.html b/LayoutTests/css3/font-variant-font-face-all.html
new file mode 100644 (file)
index 0000000..745fd26
--- /dev/null
@@ -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>
diff --git a/LayoutTests/css3/font-variant-font-face-override-expected.html b/LayoutTests/css3/font-variant-font-face-override-expected.html
new file mode 100644 (file)
index 0000000..a9414ba
--- /dev/null
@@ -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
diff --git a/LayoutTests/css3/font-variant-font-face-override.html b/LayoutTests/css3/font-variant-font-face-override.html
new file mode 100644 (file)
index 0000000..fce2b02
--- /dev/null
@@ -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
index 96d6368..a131ac6 100644 (file)
@@ -261,6 +261,9 @@ fast/css/draggable-region-parser.html
 # Font features are not implemented on Mavericks.
 webkit.org/b/149246 [ Mavericks ] css3/font-feature-settings-rendering.html [ ImageOnlyFailure ]
 webkit.org/b/149246 [ Mavericks ] css3/font-variant-all.html [ ImageOnlyFailure ]
 # Font features are not implemented on Mavericks.
 webkit.org/b/149246 [ Mavericks ] css3/font-feature-settings-rendering.html [ ImageOnlyFailure ]
 webkit.org/b/149246 [ Mavericks ] css3/font-variant-all.html [ ImageOnlyFailure ]
+webkit.org/b/149246 [ Mavericks ] css3/font-feature-settings-font-face-rendering.html [ ImageOnlyFailure ]
+webkit.org/b/149246 [ Mavericks ] css3/font-variant-font-face-all.html [ ImageOnlyFailure ]
+webkit.org/b/149246 [ Mavericks ] css3/font-variant-font-face-override.html [ ImageOnlyFailure ]
 
 # This feature is disabled on Mavericks.
 [ Mavericks ] http/tests/navigation/page-cache-pending-image-load.html [ Skip ]
 
 # This feature is disabled on Mavericks.
 [ Mavericks ] http/tests/navigation/page-cache-pending-image-load.html [ Skip ]
index 93892e9..5f102b3 100644 (file)
@@ -1,3 +1,89 @@
+2015-11-03  Myles C. Maxfield  <mmaxfield@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-11-03  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Handle or Remove ParseHTML Timeline Event Records
 2015-11-03  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Handle or Remove ParseHTML Timeline Event Records
index 45b4464..50b9cde 100644 (file)
                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 */; };
                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 */; };
                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 */; };
                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>"; };
                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>"; };
                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>"; };
                                3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
                                3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
                                3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
                                3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
                                3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
                                3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
+                               C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */,
                        );
                        path = css;
                        sourceTree = "<group>";
                        );
                        path = css;
                        sourceTree = "<group>";
                                8AD0A59814C88358000D83C5 /* DOMWebKitCSSRegionRuleInternal.h in Headers */,
                                31611E610E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h in Headers */,
                                31611E630E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h in Headers */,
                                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 */,
                                3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */,
                                3F2B33ED165AF15600E3987C /* DOMWebKitCSSViewportRuleInternal.h in Headers */,
                                8A195932147EA16E00D1EA61 /* DOMWebKitNamedFlow.h in Headers */,
index 4214acd..fbaaeed 100644 (file)
@@ -123,7 +123,7 @@ RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool synt
 
     size_t size = m_sources.size();
     for (size_t i = 0; i < size; ++i) {
 
     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()) {
             m_activeSource = m_sources[i].get();
 #if ENABLE(FONT_LOAD_EVENTS)
             if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == Loading && m_sources[i]->isLoaded()) {
@@ -141,7 +141,7 @@ RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool synt
         notifyLoadingDone();
     }
 #endif
         notifyLoadingDone();
     }
 #endif
-    return 0;
+    return nullptr;
 }
 
 #if ENABLE(FONT_LOAD_EVENTS)
 }
 
 #if ENABLE(FONT_LOAD_EVENTS)
index 9eb021a..19cb79e 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CSSFontFaceRule.h"
 #include "CSSFontFaceSource.h"
 
 #include "CSSFontFaceRule.h"
 #include "CSSFontFaceSource.h"
+#include "FontFeatureSettings.h"
 #include "TextFlags.h"
 #include <memory>
 #include <wtf/Forward.h>
 #include "TextFlags.h"
 #include <memory>
 #include <wtf/Forward.h>
@@ -53,6 +54,24 @@ public:
     void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
     const Vector<UnicodeRange>& ranges() const { return m_ranges; }
 
     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*);
 
     void addedToSegmentedFontFace(CSSSegmentedFontFace*);
     void removedFromSegmentedFontFace(CSSSegmentedFontFace*);
 
@@ -107,6 +126,8 @@ private:
     FontTraitsMask m_traitsMask;
     Vector<UnicodeRange> m_ranges;
     HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
     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;
     Vector<std::unique_ptr<CSSFontFaceSource>> m_sources;
     CSSFontFaceSource* m_activeSource;
     bool m_isLocalFallback;
index 7715f00..5b25a0b 100644 (file)
@@ -101,7 +101,7 @@ void CSSFontFaceSource::fontLoaded(CachedFont*)
         m_face->fontLoaded(this);
 }
 
         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())
 {
     // If the font hasn't loaded or an error occurred, then we've got nothing.
     if (!isValid())
@@ -124,10 +124,8 @@ RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, boo
     if (font)
         return font.release();
 
     if (font)
         return font.release();
 
-    // If we are still loading, then we let the system pick a font.
     if (isLoaded()) {
         if (m_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;
             bool hasExternalSVGFont = false;
 #if ENABLE(SVG_FONTS)
             hasExternalSVGFont = m_hasExternalSVGFont;
@@ -135,7 +133,7 @@ RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, boo
             if (!m_font->ensureCustomFontData(hasExternalSVGFont, m_string))
                 return nullptr;
 
             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
         } else {
 #if ENABLE(SVG_FONTS)
             // In-Document SVG Fonts
@@ -153,7 +151,7 @@ RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, boo
                 auto customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
                 if (!customPlatformData)
                     return nullptr;
                 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
 #else
                 font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
 #endif
index a260413..2e76f95 100644 (file)
@@ -44,6 +44,7 @@ class CSSFontFace;
 class CSSFontSelector;
 class Font;
 class FontDescription;
 class CSSFontSelector;
 class Font;
 class FontDescription;
+class FontFeatureSettings;
 
 class CSSFontFaceSource final : public CachedFontClient {
     WTF_MAKE_FAST_ALLOCATED;
 
 class CSSFontFaceSource final : public CachedFontClient {
     WTF_MAKE_FAST_ALLOCATED;
@@ -60,7 +61,7 @@ public:
 
     virtual void fontLoaded(CachedFont*) override;
 
 
     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();
 
 
     void pruneTable();
 
index 1e09964..aed0b6e 100644 (file)
@@ -33,7 +33,9 @@
 #include "CSSFontFaceSource.h"
 #include "CSSFontFaceSrcValue.h"
 #include "CSSFontFamily.h"
 #include "CSSFontFaceSource.h"
 #include "CSSFontFaceSrcValue.h"
 #include "CSSFontFamily.h"
+#include "CSSFontFeatureValue.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSPrimitiveValue.h"
+#include "CSSPrimitiveValueMappings.h"
 #include "CSSPropertyNames.h"
 #include "CSSSegmentedFontFace.h"
 #include "CSSUnicodeRangeValue.h"
 #include "CSSPropertyNames.h"
 #include "CSSSegmentedFontFace.h"
 #include "CSSUnicodeRangeValue.h"
@@ -43,6 +45,7 @@
 #include "Document.h"
 #include "Font.h"
 #include "FontCache.h"
 #include "Document.h"
 #include "Font.h"
 #include "FontCache.h"
+#include "FontVariantBuilder.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "SVGFontFaceElement.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "SVGFontFaceElement.h"
@@ -283,6 +286,13 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace& fontFaceRule, boo
     RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
     RefPtr<CSSValue> src = style.getPropertyCSSValue(CSSPropertySrc);
     RefPtr<CSSValue> unicodeRange = style.getPropertyCSSValue(CSSPropertyUnicodeRange);
     RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
     RefPtr<CSSValue> src = style.getPropertyCSSValue(CSSPropertySrc);
     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;
 
     if (!is<CSSValueList>(fontFamily.get()) || !is<CSSValueList>(src.get()) || (unicodeRange && !is<CSSValueList>(*unicodeRange)))
         return;
 
@@ -313,6 +323,31 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace& fontFaceRule, boo
         }
     }
 
         }
     }
 
+    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.get(), *variantLigatures);
+
+    if (variantPosition)
+        fontFace->setVariantPosition(downcast<CSSPrimitiveValue>(*variantPosition));
+
+    if (variantCaps)
+        fontFace->setVariantCaps(downcast<CSSPrimitiveValue>(*variantCaps));
+
+    if (variantNumeric)
+        applyValueFontVariantNumeric(fontFace.get(), *variantNumeric);
+
+    if (variantAlternates)
+        fontFace->setVariantAlternates(downcast<CSSPrimitiveValue>(*variantAlternates));
+
+    if (variantEastAsian)
+        applyValueFontVariantEastAsian(fontFace.get(), *variantEastAsian);
+
     for (auto& item : familyList) {
         String familyName = familyNameFromPrimitive(downcast<CSSPrimitiveValue>(item.get()));
         if (familyName.isEmpty())
     for (auto& item : familyList) {
         String familyName = familyNameFromPrimitive(downcast<CSSPrimitiveValue>(item.get()));
         if (familyName.isEmpty())
diff --git a/Source/WebCore/css/FontVariantBuilder.h b/Source/WebCore/css/FontVariantBuilder.h
new file mode 100644 (file)
index 0000000..2980d7a
--- /dev/null
@@ -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
index 17d4f78..e647378 100644 (file)
@@ -38,6 +38,7 @@
 #include "CursorList.h"
 #include "DashboardRegion.h"
 #include "ElementAncestorIterator.h"
 #include "CursorList.h"
 #include "DashboardRegion.h"
 #include "ElementAncestorIterator.h"
+#include "FontVariantBuilder.h"
 #include "Frame.h"
 #include "HTMLElement.h"
 #include "LocaleToScriptMapping.h"
 #include "Frame.h"
 #include "HTMLElement.h"
 #include "LocaleToScriptMapping.h"
@@ -1414,64 +1415,8 @@ inline void StyleBuilderCustom::applyInitialFontVariantLigatures(StyleResolver&
 
 inline void StyleBuilderCustom::applyValueFontVariantLigatures(StyleResolver& styleResolver, CSSValue& value)
 {
 
 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();
     auto fontDescription = styleResolver.fontDescription();
-    fontDescription.setVariantCommonLigatures(common);
-    fontDescription.setVariantDiscretionaryLigatures(discretionary);
-    fontDescription.setVariantHistoricalLigatures(historical);
-    fontDescription.setVariantContextualAlternates(contextualAlternates);
+    WebCore::applyValueFontVariantLigatures(fontDescription, value);
     styleResolver.setFontDescription(fontDescription);
 }
 
     styleResolver.setFontDescription(fontDescription);
 }
 
@@ -1499,53 +1444,8 @@ inline void StyleBuilderCustom::applyInitialFontVariantNumeric(StyleResolver& st
 
 inline void StyleBuilderCustom::applyValueFontVariantNumeric(StyleResolver& styleResolver, CSSValue& value)
 {
 
 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();
     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);
 }
 
     styleResolver.setFontDescription(fontDescription);
 }
 
@@ -1569,52 +1469,8 @@ inline void StyleBuilderCustom::applyInitialFontVariantEastAsian(StyleResolver&
 
 inline void StyleBuilderCustom::applyValueFontVariantEastAsian(StyleResolver& styleResolver, CSSValue& value)
 {
 
 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();
     auto fontDescription = styleResolver.fontDescription();
-    fontDescription.setVariantEastAsianVariant(variant);
-    fontDescription.setVariantEastAsianWidth(width);
-    fontDescription.setVariantEastAsianRuby(ruby);
+    WebCore::applyValueFontVariantEastAsian(fontDescription, value);
     styleResolver.setFontDescription(fontDescription);
 }
 
     styleResolver.setFontDescription(fontDescription);
 }
 
index 101cc45..7b9c1f5 100644 (file)
@@ -121,15 +121,21 @@ bool CachedFont::ensureCustomFontData(SharedBuffer* data)
     return m_fontCustomPlatformData.get();
 }
 
     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);
 {
     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);
     return m_fontCustomPlatformData->fontPlatformData(fontDescription, bold, italic);
+#endif
 }
 
 void CachedFont::allClientsRemoved()
 }
 
 void CachedFont::allClientsRemoved()
index 8f28d57..e6e8a4c 100644 (file)
@@ -35,6 +35,7 @@ namespace WebCore {
 
 class CachedResourceLoader;
 class FontDescription;
 
 class CachedResourceLoader;
 class FontDescription;
+class FontFeatureSettings;
 class FontPlatformData;
 class SVGDocument;
 class SVGFontElement;
 class FontPlatformData;
 class SVGDocument;
 class SVGFontElement;
@@ -50,10 +51,10 @@ public:
 
     virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI);
 
 
     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:
 
 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);
 
 
     bool ensureCustomFontData(SharedBuffer* data);
 
index 4d459fa..92745b1 100644 (file)
@@ -51,14 +51,14 @@ CachedSVGFont::CachedSVGFont(const ResourceRequest& resourceRequest, SessionID s
 {
 }
 
 {
 }
 
-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))
 {
 #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)
 #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);
 
     if (SVGFontFaceElement* firstFontFace = this->firstFontFace(remoteURI))
         return Font::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
@@ -66,11 +66,11 @@ RefPtr<Font> CachedSVGFont::createFont(const FontDescription& fontDescription, c
     return nullptr;
 }
 
     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);
 {
     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)
 }
 
 bool CachedSVGFont::ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI)
index 5e373b4..ef2f72f 100644 (file)
@@ -40,10 +40,10 @@ public:
 
     virtual bool ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI) override;
     
 
     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:
 
 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;
 
 
     SVGFontElement* getSVGFontById(const String&) const;
 
index 93ad089..f2eeba2 100644 (file)
@@ -254,7 +254,7 @@ struct SynthesisPair {
     bool needsSyntheticOblique;
 };
 
     bool needsSyntheticOblique;
 };
 
-RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, TextRenderingMode, const FontFeatureSettings&, const FontVariantSettings&);
+RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, TextRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings&);
 FontWeight fontWeightFromCoreText(CGFloat weight);
 uint16_t toCoreTextFontWeight(FontWeight);
 bool isFontWeightBold(FontWeight);
 FontWeight fontWeightFromCoreText(CGFloat weight);
 uint16_t toCoreTextFontWeight(FontWeight);
 bool isFontWeightBold(FontWeight);
index 49c7adb..d35216a 100644 (file)
@@ -594,7 +594,8 @@ FontCascade::CodePath FontCascade::codePath(const TextRun& run) const
         return Simple;
 #endif
 
         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;
 
     if (m_fontDescription.featureSettings().size() > 0 || !m_fontDescription.variantSettings().isAllNormal())
         return Complex;
 
index 21a674d..b95de44 100644 (file)
@@ -154,6 +154,8 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
     FeaturesMap result;
 
     switch (variantSettings.commonLigatures) {
     FeaturesMap result;
 
     switch (variantSettings.commonLigatures) {
+    case FontVariantLigatures::Normal:
+        break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("liga"), 1);
         result.add(fontFeatureTag("clig"), 1);
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("liga"), 1);
         result.add(fontFeatureTag("clig"), 1);
@@ -163,10 +165,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("clig"), 0);
         break;
     default:
         result.add(fontFeatureTag("clig"), 0);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.discretionaryLigatures) {
     }
 
     switch (variantSettings.discretionaryLigatures) {
+    case FontVariantLigatures::Normal:
+        break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("dlig"), 1);
         break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("dlig"), 1);
         break;
@@ -174,10 +178,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("dlig"), 0);
         break;
     default:
         result.add(fontFeatureTag("dlig"), 0);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.historicalLigatures) {
     }
 
     switch (variantSettings.historicalLigatures) {
+    case FontVariantLigatures::Normal:
+        break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("hlig"), 1);
         break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("hlig"), 1);
         break;
@@ -185,10 +191,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("hlig"), 0);
         break;
     default:
         result.add(fontFeatureTag("hlig"), 0);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.contextualAlternates) {
     }
 
     switch (variantSettings.contextualAlternates) {
+    case FontVariantLigatures::Normal:
+        break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("calt"), 1);
         break;
     case FontVariantLigatures::Yes:
         result.add(fontFeatureTag("calt"), 1);
         break;
@@ -196,10 +204,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("calt"), 0);
         break;
     default:
         result.add(fontFeatureTag("calt"), 0);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.position) {
     }
 
     switch (variantSettings.position) {
+    case FontVariantPosition::Normal:
+        break;
     case FontVariantPosition::Subscript:
         result.add(fontFeatureTag("subs"), 1);
         break;
     case FontVariantPosition::Subscript:
         result.add(fontFeatureTag("subs"), 1);
         break;
@@ -207,10 +217,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("sups"), 1);
         break;
     default:
         result.add(fontFeatureTag("sups"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.caps) {
     }
 
     switch (variantSettings.caps) {
+    case FontVariantCaps::Normal:
+        break;
     case FontVariantCaps::AllSmall:
         result.add(fontFeatureTag("c2sc"), 1);
         FALLTHROUGH;
     case FontVariantCaps::AllSmall:
         result.add(fontFeatureTag("c2sc"), 1);
         FALLTHROUGH;
@@ -230,10 +242,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("titl"), 1);
         break;
     default:
         result.add(fontFeatureTag("titl"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.numericFigure) {
     }
 
     switch (variantSettings.numericFigure) {
+    case FontVariantNumericFigure::Normal:
+        break;
     case FontVariantNumericFigure::LiningNumbers:
         result.add(fontFeatureTag("lnum"), 1);
         break;
     case FontVariantNumericFigure::LiningNumbers:
         result.add(fontFeatureTag("lnum"), 1);
         break;
@@ -241,10 +255,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("onum"), 1);
         break;
     default:
         result.add(fontFeatureTag("onum"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.numericSpacing) {
     }
 
     switch (variantSettings.numericSpacing) {
+    case FontVariantNumericSpacing::Normal:
+        break;
     case FontVariantNumericSpacing::ProportionalNumbers:
         result.add(fontFeatureTag("pnum"), 1);
         break;
     case FontVariantNumericSpacing::ProportionalNumbers:
         result.add(fontFeatureTag("pnum"), 1);
         break;
@@ -252,10 +268,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("tnum"), 1);
         break;
     default:
         result.add(fontFeatureTag("tnum"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.numericFraction) {
     }
 
     switch (variantSettings.numericFraction) {
+    case FontVariantNumericFraction::Normal:
+        break;
     case FontVariantNumericFraction::DiagonalFractions:
         result.add(fontFeatureTag("frac"), 1);
         break;
     case FontVariantNumericFraction::DiagonalFractions:
         result.add(fontFeatureTag("frac"), 1);
         break;
@@ -263,23 +281,42 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("afrc"), 1);
         break;
     default:
         result.add(fontFeatureTag("afrc"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     }
 
-    if (variantSettings.numericOrdinal == FontVariantNumericOrdinal::Yes)
+    switch (variantSettings.numericOrdinal) {
+    case FontVariantNumericOrdinal::Normal:
+        break;
+    case FontVariantNumericOrdinal::Yes:
         result.add(fontFeatureTag("ordn"), 1);
         result.add(fontFeatureTag("ordn"), 1);
-    if (variantSettings.numericSlashedZero == FontVariantNumericSlashedZero::Yes)
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    switch (variantSettings.numericSlashedZero) {
+    case FontVariantNumericSlashedZero::Normal:
+        break;
+    case FontVariantNumericSlashedZero::Yes:
         result.add(fontFeatureTag("zero"), 1);
         result.add(fontFeatureTag("zero"), 1);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
 
     switch (variantSettings.alternates) {
 
     switch (variantSettings.alternates) {
+    case FontVariantAlternates::Normal:
+        break;
     case FontVariantAlternates::HistoricalForms:
         result.add(fontFeatureTag("hist"), 1);
         break;
     default:
     case FontVariantAlternates::HistoricalForms:
         result.add(fontFeatureTag("hist"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.eastAsianVariant) {
     }
 
     switch (variantSettings.eastAsianVariant) {
+    case FontVariantEastAsianVariant::Normal:
+        break;
     case FontVariantEastAsianVariant::Jis78:
         result.add(fontFeatureTag("jp78"), 1);
         break;
     case FontVariantEastAsianVariant::Jis78:
         result.add(fontFeatureTag("jp78"), 1);
         break;
@@ -299,10 +336,12 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("trad"), 1);
         break;
     default:
         result.add(fontFeatureTag("trad"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     switch (variantSettings.eastAsianWidth) {
     }
 
     switch (variantSettings.eastAsianWidth) {
+    case FontVariantEastAsianWidth::Normal:
+        break;
     case FontVariantEastAsianWidth::FullWidth:
         result.add(fontFeatureTag("fwid"), 1);
         break;
     case FontVariantEastAsianWidth::FullWidth:
         result.add(fontFeatureTag("fwid"), 1);
         break;
@@ -310,47 +349,64 @@ static FeaturesMap computeFeatureSettingsFromVariants(const FontVariantSettings&
         result.add(fontFeatureTag("pwid"), 1);
         break;
     default:
         result.add(fontFeatureTag("pwid"), 1);
         break;
     default:
-        break;
+        ASSERT_NOT_REACHED();
     }
 
     }
 
-    if (variantSettings.eastAsianRuby == FontVariantEastAsianRuby::Yes)
+    switch (variantSettings.eastAsianRuby) {
+    case FontVariantEastAsianRuby::Normal:
+        break;
+    case FontVariantEastAsianRuby::Yes:
         result.add(fontFeatureTag("ruby"), 1);
         result.add(fontFeatureTag("ruby"), 1);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
 
     return result;
 }
 
 
     return result;
 }
 
-RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings& features, const FontVariantSettings& variantSettings)
+RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings& variantSettings)
 {
 {
-    if (!originalFont || (!features.size() && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()))
+    if (!originalFont || (!features.size() && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()
+        && (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal())))
         return originalFont;
 
     // This algorithm is described at http://www.w3.org/TR/css3-fonts/#feature-precedence
         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).
 
 
     // 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
 
     // Step 4: Font-variant
-    auto fontFeatureSettingsFromVariants = computeFeatureSettingsFromVariants(variantSettings);
+    for (auto& newFeature : computeFeatureSettingsFromVariants(variantSettings))
+        featuresToBeApplied.set(newFeature.key, newFeature.value);
 
     // Step 5: Other properties (text-rendering)
     if (textRenderingMode == OptimizeSpeed) {
 
     // Step 5: Other properties (text-rendering)
     if (textRenderingMode == OptimizeSpeed) {
-        fontFeatureSettingsFromVariants.set(fontFeatureTag("liga"), 0);
-        fontFeatureSettingsFromVariants.set(fontFeatureTag("clig"), 0);
-        fontFeatureSettingsFromVariants.set(fontFeatureTag("dlig"), 0);
-        fontFeatureSettingsFromVariants.set(fontFeatureTag("hlig"), 0);
-        fontFeatureSettingsFromVariants.set(fontFeatureTag("calt"), 0);
+        featuresToBeApplied.set(fontFeatureTag("liga"), 0);
+        featuresToBeApplied.set(fontFeatureTag("clig"), 0);
+        featuresToBeApplied.set(fontFeatureTag("dlig"), 0);
+        featuresToBeApplied.set(fontFeatureTag("hlig"), 0);
+        featuresToBeApplied.set(fontFeatureTag("calt"), 0);
     }
 
     // Step 6: Font-feature-settings
     for (auto& newFeature : features)
     }
 
     // Step 6: Font-feature-settings
     for (auto& newFeature : features)
-        fontFeatureSettingsFromVariants.set(newFeature.tag(), newFeature.value());
+        featuresToBeApplied.set(newFeature.tag(), newFeature.value());
 
     RetainPtr<CFMutableDictionaryRef> attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
     RetainPtr<CFMutableDictionaryRef> attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
-    if (fontFeatureSettingsFromVariants.size()) {
+    if (featuresToBeApplied.size()) {
         RetainPtr<CFMutableArrayRef> featureArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, features.size(), &kCFTypeArrayCallBacks));
         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);
             auto feature = FontFeature(p.key, p.value);
             appendTrueTypeFeature(featureArray.get(), feature);
             appendOpenTypeFeature(featureArray.get(), feature);
@@ -363,7 +419,8 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMo
         CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, sizeNumber.get());
     }
     RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
         CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, sizeNumber.get());
     }
     RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
-    return adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get()));
+    auto result = adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get()));
+    return result;
 }
 
 FontWeight fontWeightFromCoreText(CGFloat weight)
 }
 
 FontWeight fontWeightFromCoreText(CGFloat weight)
@@ -634,7 +691,7 @@ static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, CTFontSym
     UNUSED_PARAM(variantSettings);
     RetainPtr<CTFontRef> foundFont = platformFontWithFamily(family, desiredTraits, weight, textRenderingMode, size);
 #endif
     UNUSED_PARAM(variantSettings);
     RetainPtr<CTFontRef> foundFont = platformFontWithFamily(family, desiredTraits, weight, textRenderingMode, size);
 #endif
-    return preparePlatformFont(foundFont.get(), textRenderingMode, featureSettings, variantSettings);
+    return preparePlatformFont(foundFont.get(), textRenderingMode, nullptr, nullptr, featureSettings, variantSettings);
 }
 
 #if PLATFORM(MAC)
 }
 
 #if PLATFORM(MAC)
@@ -730,7 +787,7 @@ RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& descr
     const FontPlatformData& platformData = originalFontData->platformData();
     // FIXME: Should pass in the locale instead of nullAtom.
     RetainPtr<CTFontRef> result = platformLookupFallbackFont(platformData.font(), description.weight(), nullAtom, characters, length);
     const FontPlatformData& platformData = originalFontData->platformData();
     // FIXME: Should pass in the locale instead of nullAtom.
     RetainPtr<CTFontRef> result = platformLookupFallbackFont(platformData.font(), description.weight(), nullAtom, characters, length);
-    result = preparePlatformFont(result.get(), description.textRenderingMode(), description.featureSettings(), description.variantSettings());
+    result = preparePlatformFont(result.get(), description.textRenderingMode(), nullptr, nullptr, description.featureSettings(), description.variantSettings());
     if (!result)
         return lastResortFallbackFont(description);
 
     if (!result)
         return lastResortFallbackFont(description);
 
index 62ffc7f..1f64158 100644 (file)
@@ -34,16 +34,18 @@ FontCustomPlatformData::~FontCustomPlatformData()
 {
 }
 
 {
 }
 
-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));
 {
     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 = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), fontDescription.featureSettings(), fontDescription.variantSettings());
+    font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), &fontFaceFeatures, &fontFaceVariantSettings, fontDescription.featureSettings(), fontDescription.variantSettings());
     return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
 #else
     return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
 #else
+    UNUSED_PARAM(fontFaceFeatures);
+    UNUSED_PARAM(fontFaceVariantSettings);
     return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
 #endif
 }
     return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
 #endif
 }
index 98ae44c..efde9e7 100644 (file)
@@ -33,6 +33,7 @@ typedef const struct __CTFontDescriptor* CTFontDescriptorRef;
 namespace WebCore {
 
 class FontDescription;
 namespace WebCore {
 
 class FontDescription;
+class FontFeatureSettings;
 class FontPlatformData;
 class SharedBuffer;
 
 class FontPlatformData;
 class SharedBuffer;
 
@@ -51,7 +52,7 @@ public:
 
     ~FontCustomPlatformData();
 
 
     ~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&);
 
 
     static bool supportsFormat(const String&);
 
index c142d4e..d4ab7fb 100644 (file)
@@ -149,6 +149,59 @@ enum class FontVariantEastAsianRuby {
 };
 
 struct FontVariantSettings {
 };
 
 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
     bool isAllNormal() const
     {
         return commonLigatures == FontVariantLigatures::Normal
index 19287e0..1bf2052 100644 (file)
@@ -1224,7 +1224,7 @@ void RenderThemeIOS::updateCachedSystemFontDescription(CSSValueID valueID, FontC
 
     ASSERT(fontDescriptor);
     RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
 
     ASSERT(fontDescriptor);
     RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
-    font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), fontDescription.featureSettings(), fontDescription.variantSettings());
+    font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), nullptr, nullptr, fontDescription.featureSettings(), fontDescription.variantSettings());
     fontDescription.setIsAbsoluteSize(true);
     fontDescription.setOneFamily(textStyle);
     fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));
     fontDescription.setIsAbsoluteSize(true);
     fontDescription.setOneFamily(textStyle);
     fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));