<rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jan 2012 04:10:01 +0000 (04:10 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jan 2012 04:10:01 +0000 (04:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76103

Reviewed by Sam Weinig.

Source/WebCore:

Tests: fast/css/parsing-font-variant-ligatures.html
       fast/text/font-variant-ligatures-expected.html
       fast/text/font-variant-ligatures.html

Added support for all font-variant-ligatures values in the style system and in
FontDescription, and made the {no-}common-ligatures value keywords control basic ligatures.
The {no-}{discretionary,historical}-ligatures keywords have no effect on rendering at this
time.

font-variant-ligatures was not made part of the font shorthand property.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added code to handle
font-variant-ligatures.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Added code to handle font-variant-ligatures.
(WebCore::CSSParser::parseFontVariantLigatures): Added. Parses font-variant-ligatures.
* css/CSSParser.h:
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty): Added font-variant-ligatures to the set of
inherited properties.
* css/CSSPropertyNames.in: Added -webkit-font-variant-ligatures.
* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyFontVariantLigatures::applyInheritValue): Added. Copies
{common,discretionary,historical}LigaturesState from the parent style font description.
(WebCore::ApplyPropertyFontVariantLigatures::applyInitialValue): Added. Sets
{common,discretionary,historical}LigaturesState to normal.
(WebCore::ApplyPropertyFontVariantLigatures::applyValue): Added.
(WebCore::ApplyPropertyFontVariantLigatures::createHandler): Added.
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): Added a handler for
font-variant-ligatures.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyDeclaration): Updated for the number of properties that
affect the font.
(WebCore::CSSStyleSelector::applyProperty): Added CSSPropertyWebkitFontVariantLigatures to
the switch statement, which needs to list all values in SVG-disabled builds.
* css/CSSValueKeywords.in: Added the value keywords
{no-}{common,discretionary,historical}-ligatures.
* platform/graphics/Font.h:
(WebCore::Font::typesettingFeatures): Changed to enable ligatures if common ligatures are
enabled in the font description, disable them if they are disabled, and leave them to the
default (determined by the text-rendering property) if they are in the normal state.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::FontDescription): Added initializers.
(WebCore::FontDescription::commonLigaturesState): Added this accessor.
(WebCore::FontDescription::discretionaryLigaturesState): Ditto.
(WebCore::FontDescription::historicalLigaturesState): Ditto.
(WebCore::FontDescription::setCommonLigaturesState): Ditto.
(WebCore::FontDescription::setDiscretionaryLigaturesState): Ditto.
(WebCore::FontDescription::setHistoricalLigaturesState): Ditto.
(WebCore::FontDescription::operator==): Updated to compare the ligatures state members.

LayoutTests:

* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/parsing-font-variant-ligatures.html: Added.
* fast/text/font-variant-ligatures-expected.html: Added.
* fast/text/font-variant-ligatures.html: Added.
* platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
* platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

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

25 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/fast/css/parsing-font-variant-ligatures.html [new file with mode: 0644]
LayoutTests/fast/text/font-variant-ligatures-expected.html [new file with mode: 0644]
LayoutTests/fast/text/font-variant-ligatures.html [new file with mode: 0644]
LayoutTests/platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt
LayoutTests/platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt
LayoutTests/platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSStyleApplyProperty.cpp
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/FontDescription.h

index a698ede..6765055 100644 (file)
@@ -1,3 +1,24 @@
+2012-01-11  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
+        https://bugs.webkit.org/show_bug.cgi?id=76103
+
+        Reviewed by Sam Weinig.
+
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * fast/css/parsing-font-variant-ligatures.html: Added.
+        * fast/text/font-variant-ligatures-expected.html: Added.
+        * fast/text/font-variant-ligatures.html: Added.
+        * platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt:
+        * platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt:
+        * platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
+        * platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * svg/css/getComputedStyle-basic-expected.txt:
+
 2012-01-11  Tony Chang  <tony@chromium.org>
 
         Overflow on flexitems doesn't work
index 5d585b8..37c596c 100644 (file)
@@ -150,6 +150,7 @@ zoom: 1;
 -webkit-flex-wrap: nowrap;
 -webkit-font-kerning: auto;
 -webkit-font-smoothing: auto;
+-webkit-font-variant-ligatures: normal;
 -webkit-highlight: none;
 -webkit-hyphenate-character: auto;
 -webkit-hyphenate-limit-after: auto;
index d29a2ac..01a0cc9 100644 (file)
@@ -146,6 +146,7 @@ Computed style of an element whose parent's 'display' value is 'none':
     -webkit-flex-align: stretch
     -webkit-flex-flow: row nowrap
     -webkit-font-smoothing: auto
+    -webkit-font-variant-ligatures: normal
     -webkit-highlight: none
     -webkit-hyphenate-character: auto
     -webkit-hyphenate-limit-after: auto
diff --git a/LayoutTests/fast/css/parsing-font-variant-ligatures.html b/LayoutTests/fast/css/parsing-font-variant-ligatures.html
new file mode 100644 (file)
index 0000000..41882fe
--- /dev/null
@@ -0,0 +1,50 @@
+<pre id="console"></pre>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function test(value, expectedCSSText, expectedComputedCSSText)
+    {
+        var element = document.createElement("div");
+        element.style.setProperty("-webkit-font-variant-ligatures", value);
+        var cssText = element.style.webkitFontVariantLigatures;
+        document.body.appendChild(element);
+        var computedCSSText = getComputedStyle(element).webkitFontVariantLigatures;
+        document.body.removeChild(element);
+        if (cssText === expectedCSSText && computedCSSText == expectedComputedCSSText)
+            log("PASS: '" + value + "' parsed as '" + expectedCSSText + "' and computed to '" + computedCSSText + "'");
+        else {
+            if (cssText !== expectedCSSText)
+                log("FAIL: '" + value + "' parsed as '" + cssText + "' rather than '" + expectedCSSText + "'");
+            if (computedCSSText !== expectedComputedCSSText)
+                log("FAIL: '" + value + "' computed to '" + computedCSSText + "' rather than '" + expectedComputedCSSText + "'");
+        }
+    }
+
+    test('initial', 'initial', 'normal');
+    test('inherit', 'inherit', 'normal');
+    test('normal', 'normal', 'normal');
+    test('large', '', 'normal');
+    test('25px', '', 'normal');
+    test('normal normal', '', 'normal');
+    test('normal no-common-ligatures', '', 'normal');
+
+    log("");
+    test('no-common-ligatures', 'no-common-ligatures', 'no-common-ligatures');
+    test('common-ligatures', 'common-ligatures', 'common-ligatures');
+    test('no-discretionary-ligatures', 'no-discretionary-ligatures', 'no-discretionary-ligatures');
+    test('discretionary-ligatures', 'discretionary-ligatures', 'discretionary-ligatures');
+    test('no-historical-ligatures', 'no-historical-ligatures', 'no-historical-ligatures');
+    test('historical-ligatures', 'historical-ligatures', 'historical-ligatures');
+
+    log("");
+    test('no-common-ligatures no-common-ligatures', '', 'normal');
+    test('common-ligatures no-discretionary-ligatures', 'common-ligatures no-discretionary-ligatures', 'common-ligatures no-discretionary-ligatures');
+    test('common-ligatures no-discretionary-ligatures historical-ligatures', 'common-ligatures no-discretionary-ligatures historical-ligatures', 'common-ligatures no-discretionary-ligatures historical-ligatures');
+    test('common-ligatures no-discretionary-ligatures normal', '', 'normal');
+</script>
diff --git a/LayoutTests/fast/text/font-variant-ligatures-expected.html b/LayoutTests/fast/text/font-variant-ligatures-expected.html
new file mode 100644 (file)
index 0000000..eb82e6b
--- /dev/null
@@ -0,0 +1,11 @@
+<style>
+    .ligatures { text-rendering: optimizelegibility; }
+</style>
+<body style="font-size: 36px;">
+    <div>file</div>
+    <div>file</div>
+    <div class="ligatures">file</div>
+    <div>file</div>
+    <div class="ligatures">file</div>
+    <div class="ligatures">file</div>
+</body>
diff --git a/LayoutTests/fast/text/font-variant-ligatures.html b/LayoutTests/fast/text/font-variant-ligatures.html
new file mode 100644 (file)
index 0000000..7f4a74b
--- /dev/null
@@ -0,0 +1,17 @@
+<style>
+    .common-ligatures-disabled { -webkit-font-variant-ligatures: no-common-ligatures; }
+    .common-ligatures-enabled { -webkit-font-variant-ligatures: common-ligatures; }
+    .common-ligatures-normal { -webkit-font-variant-ligatures: normal; }
+</style>
+<body style="font-size: 36px;">
+    <div>
+        <div class="common-ligatures-disabled">file</div>
+        <div class="common-ligatures-normal">file</div>
+        <div class="common-ligatures-enabled">file</div>
+    </div>
+    <div style="text-rendering: optimizelegibility">
+        <div class="common-ligatures-disabled">file</div>
+        <div class="common-ligatures-normal">file</div>
+        <div class="common-ligatures-enabled">file</div>
+    </div>
+</body>
index b37c179..e9904b4 100644 (file)
@@ -298,6 +298,8 @@ rect: style.getPropertyValue(-webkit-font-kerning) : auto
 rect: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-font-smoothing) : auto
 rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
+rect: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-highlight) : none
 rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-hyphenate-character) : auto
@@ -808,6 +810,8 @@ g: style.getPropertyValue(-webkit-font-kerning) : auto
 g: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-font-smoothing) : auto
 g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
+g: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-highlight) : none
 g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-hyphenate-character) : auto
index 78078e3..8fa00ba 100644 (file)
@@ -150,6 +150,7 @@ zoom: 1;
 -webkit-flex-wrap: nowrap;
 -webkit-font-kerning: auto;
 -webkit-font-smoothing: auto;
+-webkit-font-variant-ligatures: normal;
 -webkit-highlight: none;
 -webkit-hyphenate-character: auto;
 -webkit-hyphenate-limit-after: auto;
index 4d53571..27ad6a0 100644 (file)
@@ -149,6 +149,7 @@ Computed style of an element whose parent's 'display' value is 'none':
     -webkit-flex-wrap: nowrap
     -webkit-font-kerning: auto
     -webkit-font-smoothing: auto
+    -webkit-font-variant-ligatures: normal
     -webkit-highlight: none
     -webkit-hyphenate-character: auto
     -webkit-hyphenate-limit-after: auto
index a7c9e90..3f96dab 100644 (file)
@@ -298,6 +298,8 @@ rect: style.getPropertyValue(-webkit-font-kerning) : auto
 rect: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-font-smoothing) : auto
 rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
+rect: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-highlight) : none
 rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-hyphenate-character) : auto
@@ -808,6 +810,8 @@ g: style.getPropertyValue(-webkit-font-kerning) : auto
 g: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-font-smoothing) : auto
 g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
+g: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-highlight) : none
 g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-hyphenate-character) : auto
index ed62ef6..e4b509d 100644 (file)
@@ -149,6 +149,7 @@ Computed style of an element whose parent's 'display' value is 'none':
     -webkit-flex-wrap: nowrap
     -webkit-font-kerning: auto
     -webkit-font-smoothing: auto
+    -webkit-font-variant-ligatures: normal
     -webkit-highlight: none
     -webkit-hyphenate-character: auto
     -webkit-hyphenate-limit-after: auto
index 4c70aad..87c33d3 100644 (file)
@@ -149,6 +149,7 @@ Computed style of an element whose parent's 'display' value is 'none':
     -webkit-flex-wrap: nowrap
     -webkit-font-kerning: auto
     -webkit-font-smoothing: auto
+    -webkit-font-variant-ligatures: normal
     -webkit-highlight: none
     -webkit-hyphenate-character: auto
     -webkit-hyphenate-limit-after: auto
index ed62ef6..e4b509d 100644 (file)
@@ -149,6 +149,7 @@ Computed style of an element whose parent's 'display' value is 'none':
     -webkit-flex-wrap: nowrap
     -webkit-font-kerning: auto
     -webkit-font-smoothing: auto
+    -webkit-font-variant-ligatures: normal
     -webkit-highlight: none
     -webkit-hyphenate-character: auto
     -webkit-hyphenate-limit-after: auto
index b37c179..e9904b4 100644 (file)
@@ -298,6 +298,8 @@ rect: style.getPropertyValue(-webkit-font-kerning) : auto
 rect: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-font-smoothing) : auto
 rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
+rect: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-highlight) : none
 rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-hyphenate-character) : auto
@@ -808,6 +810,8 @@ g: style.getPropertyValue(-webkit-font-kerning) : auto
 g: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-font-smoothing) : auto
 g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
+g: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-highlight) : none
 g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-hyphenate-character) : auto
index 5618f51..ed444eb 100644 (file)
@@ -1,3 +1,62 @@
+2012-01-11  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
+        https://bugs.webkit.org/show_bug.cgi?id=76103
+
+        Reviewed by Sam Weinig.
+
+        Tests: fast/css/parsing-font-variant-ligatures.html
+               fast/text/font-variant-ligatures-expected.html
+               fast/text/font-variant-ligatures.html
+
+        Added support for all font-variant-ligatures values in the style system and in
+        FontDescription, and made the {no-}common-ligatures value keywords control basic ligatures.
+        The {no-}{discretionary,historical}-ligatures keywords have no effect on rendering at this
+        time.
+
+        font-variant-ligatures was not made part of the font shorthand property.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added code to handle
+        font-variant-ligatures.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue): Added code to handle font-variant-ligatures.
+        (WebCore::CSSParser::parseFontVariantLigatures): Added. Parses font-variant-ligatures.
+        * css/CSSParser.h:
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty): Added font-variant-ligatures to the set of
+        inherited properties.
+        * css/CSSPropertyNames.in: Added -webkit-font-variant-ligatures.
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyFontVariantLigatures::applyInheritValue): Added. Copies
+        {common,discretionary,historical}LigaturesState from the parent style font description.
+        (WebCore::ApplyPropertyFontVariantLigatures::applyInitialValue): Added. Sets
+        {common,discretionary,historical}LigaturesState to normal.
+        (WebCore::ApplyPropertyFontVariantLigatures::applyValue): Added.
+        (WebCore::ApplyPropertyFontVariantLigatures::createHandler): Added.
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): Added a handler for
+        font-variant-ligatures.
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyDeclaration): Updated for the number of properties that
+        affect the font.
+        (WebCore::CSSStyleSelector::applyProperty): Added CSSPropertyWebkitFontVariantLigatures to
+        the switch statement, which needs to list all values in SVG-disabled builds.
+        * css/CSSValueKeywords.in: Added the value keywords
+        {no-}{common,discretionary,historical}-ligatures.
+        * platform/graphics/Font.h:
+        (WebCore::Font::typesettingFeatures): Changed to enable ligatures if common ligatures are
+        enabled in the font description, disable them if they are disabled, and leave them to the
+        default (determined by the text-rendering property) if they are in the normal state.
+        * platform/graphics/FontDescription.h:
+        (WebCore::FontDescription::FontDescription): Added initializers.
+        (WebCore::FontDescription::commonLigaturesState): Added this accessor.
+        (WebCore::FontDescription::discretionaryLigaturesState): Ditto.
+        (WebCore::FontDescription::historicalLigaturesState): Ditto.
+        (WebCore::FontDescription::setCommonLigaturesState): Ditto.
+        (WebCore::FontDescription::setDiscretionaryLigaturesState): Ditto.
+        (WebCore::FontDescription::setHistoricalLigaturesState): Ditto.
+        (WebCore::FontDescription::operator==): Updated to compare the ligatures state members.
+
 2012-01-11  Adrienne Walker  <enne@google.com>
 
         Repaint all graphics layers when their renderer offset changes
index 1aaa264..9b9abd5 100644 (file)
@@ -224,6 +224,7 @@ static const int computedProperties[] = {
     CSSPropertyWebkitFlexWrap,
     CSSPropertyWebkitFontKerning,
     CSSPropertyWebkitFontSmoothing,
+    CSSPropertyWebkitFontVariantLigatures,
 #if ENABLE(CSS_GRID_LAYOUT)
     CSSPropertyWebkitGridColumns,
     CSSPropertyWebkitGridRows,
@@ -1875,6 +1876,23 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
             return cssValuePool->createValue(style->fontDescription().kerning());
         case CSSPropertyWebkitFontSmoothing:
             return cssValuePool->createValue(style->fontDescription().fontSmoothing());
+        case CSSPropertyWebkitFontVariantLigatures: {
+            FontDescription::LigaturesState commonLigaturesState = style->fontDescription().commonLigaturesState();
+            FontDescription::LigaturesState discretionaryLigaturesState = style->fontDescription().discretionaryLigaturesState();
+            FontDescription::LigaturesState historicalLigaturesState = style->fontDescription().historicalLigaturesState();
+            if (commonLigaturesState == FontDescription::NormalLigaturesState && discretionaryLigaturesState == FontDescription::NormalLigaturesState
+                && historicalLigaturesState == FontDescription::NormalLigaturesState)
+                return cssValuePool->createIdentifierValue(CSSValueNormal);
+
+            RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
+            if (commonLigaturesState != FontDescription::NormalLigaturesState)
+                valueList->append(cssValuePool->createIdentifierValue(commonLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
+            if (discretionaryLigaturesState != FontDescription::NormalLigaturesState)
+                valueList->append(cssValuePool->createIdentifierValue(discretionaryLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryLigatures : CSSValueDiscretionaryLigatures));
+            if (historicalLigaturesState != FontDescription::NormalLigaturesState)
+                valueList->append(cssValuePool->createIdentifierValue(historicalLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatures : CSSValueHistoricalLigatures));
+            return valueList;
+        }
         case CSSPropertyZIndex:
             if (style->hasAutoZIndex())
                 return cssValuePool->createIdentifierValue(CSSValueAuto);
index 7c8bd1b..46b3044 100644 (file)
@@ -2233,6 +2233,13 @@ bool CSSParser::parseValue(int propId, bool important)
             validPrimitive = true;
         break;
 
+    case CSSPropertyWebkitFontVariantLigatures:
+        if (id == CSSValueNormal)
+            validPrimitive = true;
+        else
+            return parseFontVariantLigatures(important);
+        break;
+
     case CSSPropertyWebkitWrapShapeInside:
     case CSSPropertyWebkitWrapShapeOutside:
         if (id == CSSValueAuto)
@@ -7227,6 +7234,51 @@ bool CSSParser::parseFontFeatureSettings(bool important)
     return false;
 }
 
+bool CSSParser::parseFontVariantLigatures(bool important)
+{
+    RefPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated();
+    bool sawCommonLigaturesValue = false;
+    bool sawDiscretionaryLigaturesValue = false;
+    bool sawHistoricalLigaturesValue = false;
+
+    for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
+        if (value->unit != CSSPrimitiveValue::CSS_IDENT)
+            return false;
+
+        switch (value->id) {
+        case CSSValueNoCommonLigatures:
+        case CSSValueCommonLigatures:
+            if (sawCommonLigaturesValue)
+                return false;
+            sawCommonLigaturesValue = true;
+            ligatureValues->append(cssValuePool()->createIdentifierValue(value->id));
+            break;
+        case CSSValueNoDiscretionaryLigatures:
+        case CSSValueDiscretionaryLigatures:
+            if (sawDiscretionaryLigaturesValue)
+                return false;
+            sawDiscretionaryLigaturesValue = true;
+            ligatureValues->append(cssValuePool()->createIdentifierValue(value->id));
+            break;
+        case CSSValueNoHistoricalLigatures:
+        case CSSValueHistoricalLigatures:
+            if (sawHistoricalLigaturesValue)
+                return false;
+            sawHistoricalLigaturesValue = true;
+            ligatureValues->append(cssValuePool()->createIdentifierValue(value->id));
+            break;
+        default:
+            return false;
+        }
+    }
+
+    if (!ligatureValues->length())
+        return false;
+
+    addProperty(CSSPropertyWebkitFontVariantLigatures, ligatureValues.release(), important);
+    return true;
+}
+
 static inline int yyerror(const char*) { return 1; }
 
 #define END_TOKEN 0
index adc1902..a0df696 100644 (file)
@@ -218,6 +218,8 @@ public:
     bool parseFlowThread(int propId, bool important);
     bool parseRegionThread(int propId, bool important);
 
+    bool parseFontVariantLigatures(bool important);
+
     int yyparse();
 
     CSSParserSelector* createFloatingSelector();
index b3d056c..7b2d201 100644 (file)
@@ -320,6 +320,7 @@ bool CSSProperty::isInheritedProperty(unsigned propertyID)
     case CSSPropertyWebkitFontFeatureSettings:
     case CSSPropertyWebkitFontKerning:
     case CSSPropertyWebkitFontSmoothing:
+    case CSSPropertyWebkitFontVariantLigatures:
     case CSSPropertyWebkitLocale:
     case CSSPropertyWebkitHighlight:
     case CSSPropertyWebkitHyphenateCharacter:
index e69875b..501447f 100644 (file)
@@ -23,6 +23,7 @@ text-rendering
 -webkit-font-feature-settings
 -webkit-font-kerning
 -webkit-font-smoothing
+-webkit-font-variant-ligatures
 -webkit-locale
 -webkit-text-orientation
 -epub-text-orientation = -webkit-text-orientation
index 0b4a633..e4d8eec 100644 (file)
@@ -724,6 +724,90 @@ public:
     }
 };
 
+class ApplyPropertyFontVariantLigatures {
+public:
+    static void applyInheritValue(CSSStyleSelector* selector)
+    {
+        const FontDescription& parentFontDescription = selector->parentFontDescription();
+        FontDescription fontDescription = selector->fontDescription();
+
+        fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
+        fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
+        fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
+
+        selector->setFontDescription(fontDescription);
+    }
+
+    static void applyInitialValue(CSSStyleSelector* selector)
+    {
+        FontDescription fontDescription = selector->fontDescription();
+
+        fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
+        fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
+        fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
+
+        selector->setFontDescription(fontDescription);
+    }
+
+    static void applyValue(CSSStyleSelector* selector, CSSValue* value)
+    {
+        FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
+        FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
+        FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
+
+        if (value->isValueList()) {
+            CSSValueList* valueList = static_cast<CSSValueList*>(value);
+            for (size_t i = 0; i < valueList->length(); ++i) {
+                CSSValue* item = valueList->itemWithoutBoundsCheck(i);
+                ASSERT(item->isPrimitiveValue());
+                if (item->isPrimitiveValue()) {
+                    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
+                    switch (primitiveValue->getIdent()) {
+                    case CSSValueNoCommonLigatures:
+                        commonLigaturesState = FontDescription::DisabledLigaturesState;
+                        break;
+                    case CSSValueCommonLigatures:
+                        commonLigaturesState = FontDescription::EnabledLigaturesState;
+                        break;
+                    case CSSValueNoDiscretionaryLigatures:
+                        discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
+                        break;
+                    case CSSValueDiscretionaryLigatures:
+                        discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
+                        break;
+                    case CSSValueNoHistoricalLigatures:
+                        historicalLigaturesState = FontDescription::DisabledLigaturesState;
+                        break;
+                    case CSSValueHistoricalLigatures:
+                        historicalLigaturesState = FontDescription::EnabledLigaturesState;
+                        break;
+                    default:
+                        ASSERT_NOT_REACHED();
+                        break;
+                    }
+                }
+            }
+        }
+#if !ASSERT_DISABLED
+        else {
+            ASSERT(value->isPrimitiveValue());
+            ASSERT(static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNormal);
+        }
+#endif
+
+        FontDescription fontDescription = selector->fontDescription();
+        fontDescription.setCommonLigaturesState(commonLigaturesState);
+        fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
+        fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
+        selector->setFontDescription(fontDescription);
+    }
+
+    static PropertyHandler createHandler()
+    {
+        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
+    }
+};
+
 enum BorderImageType { Image = 0, Mask };
 template <BorderImageType borderImageType,
           CSSPropertyID property,
@@ -1684,6 +1768,7 @@ CSSStyleApplyProperty::CSSStyleApplyProperty()
     setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
     setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont<TextOrientation, &FontDescription::textOrientation, &FontDescription::setTextOrientation, TextOrientationVerticalRight>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
     setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
 
     setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
index 9a9dad0..6b3a691 100644 (file)
@@ -2228,7 +2228,7 @@ void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclara
         int property = current.id();
         if (applyFirst) {
             COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
-            COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 17, CSS_zoom_is_end_of_first_prop_range);
+            COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 18, CSS_zoom_is_end_of_first_prop_range);
             COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
             // give special priority to font-xxx, color properties, etc
             if (property > CSSPropertyLineHeight)
@@ -3814,6 +3814,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     case CSSPropertyWebkitFlowInto:
     case CSSPropertyWebkitFlowFrom:
     case CSSPropertyWebkitFontKerning:
+    case CSSPropertyWebkitFontVariantLigatures:
     case CSSPropertyWebkitHighlight:
     case CSSPropertyWebkitHyphenateCharacter:
     case CSSPropertyWebkitHyphenateLimitAfter:
index ba1c5f6..b5a8d78 100644 (file)
@@ -52,6 +52,17 @@ all
 //
 //normal
 small-caps
+
+// -webkit-font-variant-ligatures:
+//
+// normal
+common-ligatures
+no-common-ligatures
+discretionary-ligatures
+no-discretionary-ligatures
+historical-ligatures
+no-historical-ligatures
+
 //
 // CSS_PROP_FONT_WEIGHT:
 //
index 114962e..d15a77f 100644 (file)
@@ -129,6 +129,17 @@ public:
             break;
         }
 
+        switch (m_fontDescription.commonLigaturesState()) {
+        case FontDescription::DisabledLigaturesState:
+            features &= ~Ligatures;
+            break;
+        case FontDescription::EnabledLigaturesState:
+            features |= Ligatures;
+            break;
+        case FontDescription::NormalLigaturesState:
+            break;
+        }
+
         return features;
     }
 
index 51a257b..e832976 100644 (file)
@@ -74,6 +74,8 @@ public:
 
     enum Kerning { AutoKerning, NormalKerning, NoneKerning };
 
+    enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledLigaturesState };
+
     FontDescription()
         : m_specifiedSize(0)
         , m_computedSize(0)
@@ -88,6 +90,9 @@ public:
         , m_usePrinterFont(false)
         , m_renderingMode(NormalRenderingMode)
         , m_kerning(AutoKerning)
+        , m_commonLigaturesState(NormalLigaturesState)
+        , m_discretionaryLigaturesState(NormalLigaturesState)
+        , m_historicalLigaturesState(NormalLigaturesState)
         , m_keywordSize(0)
         , m_fontSmoothing(AutoSmoothing)
         , m_textRendering(AutoTextRendering)
@@ -116,6 +121,9 @@ public:
     bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == monospaceFamily; }
     FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
     Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
+    LigaturesState commonLigaturesState() const { return static_cast<LigaturesState>(m_commonLigaturesState); }
+    LigaturesState discretionaryLigaturesState() const { return static_cast<LigaturesState>(m_discretionaryLigaturesState); }
+    LigaturesState historicalLigaturesState() const { return static_cast<LigaturesState>(m_historicalLigaturesState); }
     unsigned keywordSize() const { return m_keywordSize; }
     FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); }
     TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); }
@@ -146,6 +154,9 @@ public:
 #endif
     void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
     void setKerning(Kerning kerning) { m_kerning = kerning; }
+    void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; }
+    void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesState) { m_discretionaryLigaturesState = discretionaryLigaturesState; }
+    void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; }
     void setKeywordSize(unsigned s) { m_keywordSize = s; }
     void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
     void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
@@ -180,6 +191,10 @@ private:
     unsigned m_renderingMode : 1;  // Used to switch between CG and GDI text on Windows.
     unsigned m_kerning : 2; // Kerning
 
+    unsigned m_commonLigaturesState : 2;
+    unsigned m_discretionaryLigaturesState : 2;
+    unsigned m_historicalLigaturesState : 2;
+
     unsigned m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium).  If so,
                            // then we can accurately translate across different generic families to adjust for different preference settings
                            // (e.g., 13px monospace vs. 16px everything else).  Sizes are 1-8 (like the HTML size values for <font>).
@@ -203,6 +218,9 @@ inline bool FontDescription::operator==(const FontDescription& other) const
         && m_usePrinterFont == other.m_usePrinterFont
         && m_renderingMode == other.m_renderingMode
         && m_kerning == other.m_kerning
+        && m_commonLigaturesState == other.m_commonLigaturesState
+        && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState
+        && m_historicalLigaturesState == other.m_historicalLigaturesState
         && m_keywordSize == other.m_keywordSize
         && m_fontSmoothing == other.m_fontSmoothing
         && m_textRendering == other.m_textRendering