Changeset 104786 in webkit


Ignore:
Timestamp:
Jan 11, 2012, 8:10:01 PM (14 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
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:
Location:
trunk
Files:
3 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r104785 r104786  
     12012-01-11  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
     4        https://bugs.webkit.org/show_bug.cgi?id=76103
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/css/getComputedStyle/computed-style-expected.txt:
     9        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     10        * fast/css/parsing-font-variant-ligatures.html: Added.
     11        * fast/text/font-variant-ligatures-expected.html: Added.
     12        * fast/text/font-variant-ligatures.html: Added.
     13        * platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt:
     14        * platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt:
     15        * platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     16        * platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
     17        * platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     18        * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     19        * platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     20        * svg/css/getComputedStyle-basic-expected.txt:
     21
    1222012-01-11  Tony Chang  <tony@chromium.org>
    223
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r104678 r104786  
    151151-webkit-font-kerning: auto;
    152152-webkit-font-smoothing: auto;
     153-webkit-font-variant-ligatures: normal;
    153154-webkit-highlight: none;
    154155-webkit-hyphenate-character: auto;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r102870 r104786  
    147147    -webkit-flex-flow: row nowrap
    148148    -webkit-font-smoothing: auto
     149    -webkit-font-variant-ligatures: normal
    149150    -webkit-highlight: none
    150151    -webkit-hyphenate-character: auto
  • trunk/LayoutTests/platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt

    r104689 r104786  
    299299rect: style.getPropertyValue(-webkit-font-smoothing) : auto
    300300rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
     301rect: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
     302rect: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
    301303rect: style.getPropertyValue(-webkit-highlight) : none
    302304rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
     
    809811g: style.getPropertyValue(-webkit-font-smoothing) : auto
    810812g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
     813g: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
     814g: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
    811815g: style.getPropertyValue(-webkit-highlight) : none
    812816g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
  • trunk/LayoutTests/platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt

    r104685 r104786  
    151151-webkit-font-kerning: auto;
    152152-webkit-font-smoothing: auto;
     153-webkit-font-variant-ligatures: normal;
    153154-webkit-highlight: none;
    154155-webkit-hyphenate-character: auto;
  • trunk/LayoutTests/platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r104678 r104786  
    150150    -webkit-font-kerning: auto
    151151    -webkit-font-smoothing: auto
     152    -webkit-font-variant-ligatures: normal
    152153    -webkit-highlight: none
    153154    -webkit-hyphenate-character: auto
  • trunk/LayoutTests/platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt

    r104678 r104786  
    299299rect: style.getPropertyValue(-webkit-font-smoothing) : auto
    300300rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
     301rect: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
     302rect: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
    301303rect: style.getPropertyValue(-webkit-highlight) : none
    302304rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
     
    809811g: style.getPropertyValue(-webkit-font-smoothing) : auto
    810812g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
     813g: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
     814g: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
    811815g: style.getPropertyValue(-webkit-highlight) : none
    812816g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
  • trunk/LayoutTests/platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r104697 r104786  
    150150    -webkit-font-kerning: auto
    151151    -webkit-font-smoothing: auto
     152    -webkit-font-variant-ligatures: normal
    152153    -webkit-highlight: none
    153154    -webkit-hyphenate-character: auto
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r104678 r104786  
    150150    -webkit-font-kerning: auto
    151151    -webkit-font-smoothing: auto
     152    -webkit-font-variant-ligatures: normal
    152153    -webkit-highlight: none
    153154    -webkit-hyphenate-character: auto
  • trunk/LayoutTests/platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r104678 r104786  
    150150    -webkit-font-kerning: auto
    151151    -webkit-font-smoothing: auto
     152    -webkit-font-variant-ligatures: normal
    152153    -webkit-highlight: none
    153154    -webkit-hyphenate-character: auto
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r104696 r104786  
    299299rect: style.getPropertyValue(-webkit-font-smoothing) : auto
    300300rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
     301rect: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
     302rect: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
    301303rect: style.getPropertyValue(-webkit-highlight) : none
    302304rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
     
    809811g: style.getPropertyValue(-webkit-font-smoothing) : auto
    810812g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue]
     813g: style.getPropertyValue(-webkit-font-variant-ligatures) : normal
     814g: style.getPropertyCSSValue(-webkit-font-variant-ligatures) : [object CSSPrimitiveValue]
    811815g: style.getPropertyValue(-webkit-highlight) : none
    812816g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue]
  • trunk/Source/WebCore/ChangeLog

    r104782 r104786  
     12012-01-11  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
     4        https://bugs.webkit.org/show_bug.cgi?id=76103
     5
     6        Reviewed by Sam Weinig.
     7
     8        Tests: fast/css/parsing-font-variant-ligatures.html
     9               fast/text/font-variant-ligatures-expected.html
     10               fast/text/font-variant-ligatures.html
     11
     12        Added support for all font-variant-ligatures values in the style system and in
     13        FontDescription, and made the {no-}common-ligatures value keywords control basic ligatures.
     14        The {no-}{discretionary,historical}-ligatures keywords have no effect on rendering at this
     15        time.
     16
     17        font-variant-ligatures was not made part of the font shorthand property.
     18
     19        * css/CSSComputedStyleDeclaration.cpp:
     20        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added code to handle
     21        font-variant-ligatures.
     22        * css/CSSParser.cpp:
     23        (WebCore::CSSParser::parseValue): Added code to handle font-variant-ligatures.
     24        (WebCore::CSSParser::parseFontVariantLigatures): Added. Parses font-variant-ligatures.
     25        * css/CSSParser.h:
     26        * css/CSSProperty.cpp:
     27        (WebCore::CSSProperty::isInheritedProperty): Added font-variant-ligatures to the set of
     28        inherited properties.
     29        * css/CSSPropertyNames.in: Added -webkit-font-variant-ligatures.
     30        * css/CSSStyleApplyProperty.cpp:
     31        (WebCore::ApplyPropertyFontVariantLigatures::applyInheritValue): Added. Copies
     32        {common,discretionary,historical}LigaturesState from the parent style font description.
     33        (WebCore::ApplyPropertyFontVariantLigatures::applyInitialValue): Added. Sets
     34        {common,discretionary,historical}LigaturesState to normal.
     35        (WebCore::ApplyPropertyFontVariantLigatures::applyValue): Added.
     36        (WebCore::ApplyPropertyFontVariantLigatures::createHandler): Added.
     37        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): Added a handler for
     38        font-variant-ligatures.
     39        * css/CSSStyleSelector.cpp:
     40        (WebCore::CSSStyleSelector::applyDeclaration): Updated for the number of properties that
     41        affect the font.
     42        (WebCore::CSSStyleSelector::applyProperty): Added CSSPropertyWebkitFontVariantLigatures to
     43        the switch statement, which needs to list all values in SVG-disabled builds.
     44        * css/CSSValueKeywords.in: Added the value keywords
     45        {no-}{common,discretionary,historical}-ligatures.
     46        * platform/graphics/Font.h:
     47        (WebCore::Font::typesettingFeatures): Changed to enable ligatures if common ligatures are
     48        enabled in the font description, disable them if they are disabled, and leave them to the
     49        default (determined by the text-rendering property) if they are in the normal state.
     50        * platform/graphics/FontDescription.h:
     51        (WebCore::FontDescription::FontDescription): Added initializers.
     52        (WebCore::FontDescription::commonLigaturesState): Added this accessor.
     53        (WebCore::FontDescription::discretionaryLigaturesState): Ditto.
     54        (WebCore::FontDescription::historicalLigaturesState): Ditto.
     55        (WebCore::FontDescription::setCommonLigaturesState): Ditto.
     56        (WebCore::FontDescription::setDiscretionaryLigaturesState): Ditto.
     57        (WebCore::FontDescription::setHistoricalLigaturesState): Ditto.
     58        (WebCore::FontDescription::operator==): Updated to compare the ligatures state members.
     59
    1602012-01-11  Adrienne Walker  <enne@google.com>
    261
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r104702 r104786  
    225225    CSSPropertyWebkitFontKerning,
    226226    CSSPropertyWebkitFontSmoothing,
     227    CSSPropertyWebkitFontVariantLigatures,
    227228#if ENABLE(CSS_GRID_LAYOUT)
    228229    CSSPropertyWebkitGridColumns,
     
    18761877        case CSSPropertyWebkitFontSmoothing:
    18771878            return cssValuePool->createValue(style->fontDescription().fontSmoothing());
     1879        case CSSPropertyWebkitFontVariantLigatures: {
     1880            FontDescription::LigaturesState commonLigaturesState = style->fontDescription().commonLigaturesState();
     1881            FontDescription::LigaturesState discretionaryLigaturesState = style->fontDescription().discretionaryLigaturesState();
     1882            FontDescription::LigaturesState historicalLigaturesState = style->fontDescription().historicalLigaturesState();
     1883            if (commonLigaturesState == FontDescription::NormalLigaturesState && discretionaryLigaturesState == FontDescription::NormalLigaturesState
     1884                && historicalLigaturesState == FontDescription::NormalLigaturesState)
     1885                return cssValuePool->createIdentifierValue(CSSValueNormal);
     1886
     1887            RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
     1888            if (commonLigaturesState != FontDescription::NormalLigaturesState)
     1889                valueList->append(cssValuePool->createIdentifierValue(commonLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
     1890            if (discretionaryLigaturesState != FontDescription::NormalLigaturesState)
     1891                valueList->append(cssValuePool->createIdentifierValue(discretionaryLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryLigatures : CSSValueDiscretionaryLigatures));
     1892            if (historicalLigaturesState != FontDescription::NormalLigaturesState)
     1893                valueList->append(cssValuePool->createIdentifierValue(historicalLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatures : CSSValueHistoricalLigatures));
     1894            return valueList;
     1895        }
    18781896        case CSSPropertyZIndex:
    18791897            if (style->hasAutoZIndex())
  • trunk/Source/WebCore/css/CSSParser.cpp

    r104688 r104786  
    22322232        if (id == CSSValueAuto || id == CSSValueNormal || id == CSSValueNone)
    22332233            validPrimitive = true;
     2234        break;
     2235
     2236    case CSSPropertyWebkitFontVariantLigatures:
     2237        if (id == CSSValueNormal)
     2238            validPrimitive = true;
     2239        else
     2240            return parseFontVariantLigatures(important);
    22342241        break;
    22352242
     
    72287235}
    72297236
     7237bool CSSParser::parseFontVariantLigatures(bool important)
     7238{
     7239    RefPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceSeparated();
     7240    bool sawCommonLigaturesValue = false;
     7241    bool sawDiscretionaryLigaturesValue = false;
     7242    bool sawHistoricalLigaturesValue = false;
     7243
     7244    for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
     7245        if (value->unit != CSSPrimitiveValue::CSS_IDENT)
     7246            return false;
     7247
     7248        switch (value->id) {
     7249        case CSSValueNoCommonLigatures:
     7250        case CSSValueCommonLigatures:
     7251            if (sawCommonLigaturesValue)
     7252                return false;
     7253            sawCommonLigaturesValue = true;
     7254            ligatureValues->append(cssValuePool()->createIdentifierValue(value->id));
     7255            break;
     7256        case CSSValueNoDiscretionaryLigatures:
     7257        case CSSValueDiscretionaryLigatures:
     7258            if (sawDiscretionaryLigaturesValue)
     7259                return false;
     7260            sawDiscretionaryLigaturesValue = true;
     7261            ligatureValues->append(cssValuePool()->createIdentifierValue(value->id));
     7262            break;
     7263        case CSSValueNoHistoricalLigatures:
     7264        case CSSValueHistoricalLigatures:
     7265            if (sawHistoricalLigaturesValue)
     7266                return false;
     7267            sawHistoricalLigaturesValue = true;
     7268            ligatureValues->append(cssValuePool()->createIdentifierValue(value->id));
     7269            break;
     7270        default:
     7271            return false;
     7272        }
     7273    }
     7274
     7275    if (!ligatureValues->length())
     7276        return false;
     7277
     7278    addProperty(CSSPropertyWebkitFontVariantLigatures, ligatureValues.release(), important);
     7279    return true;
     7280}
     7281
    72307282static inline int yyerror(const char*) { return 1; }
    72317283
  • trunk/Source/WebCore/css/CSSParser.h

    r103692 r104786  
    219219    bool parseRegionThread(int propId, bool important);
    220220
     221    bool parseFontVariantLigatures(bool important);
     222
    221223    int yyparse();
    222224
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r104678 r104786  
    321321    case CSSPropertyWebkitFontKerning:
    322322    case CSSPropertyWebkitFontSmoothing:
     323    case CSSPropertyWebkitFontVariantLigatures:
    323324    case CSSPropertyWebkitLocale:
    324325    case CSSPropertyWebkitHighlight:
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r104678 r104786  
    2424-webkit-font-kerning
    2525-webkit-font-smoothing
     26-webkit-font-variant-ligatures
    2627-webkit-locale
    2728-webkit-text-orientation
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r104678 r104786  
    722722        PropertyHandler handler = ApplyPropertyFont<FontWeight, &FontDescription::weight, &FontDescription::setWeight, FontWeightNormal>::createHandler();
    723723        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     724    }
     725};
     726
     727class ApplyPropertyFontVariantLigatures {
     728public:
     729    static void applyInheritValue(CSSStyleSelector* selector)
     730    {
     731        const FontDescription& parentFontDescription = selector->parentFontDescription();
     732        FontDescription fontDescription = selector->fontDescription();
     733
     734        fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
     735        fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
     736        fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
     737
     738        selector->setFontDescription(fontDescription);
     739    }
     740
     741    static void applyInitialValue(CSSStyleSelector* selector)
     742    {
     743        FontDescription fontDescription = selector->fontDescription();
     744
     745        fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
     746        fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
     747        fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
     748
     749        selector->setFontDescription(fontDescription);
     750    }
     751
     752    static void applyValue(CSSStyleSelector* selector, CSSValue* value)
     753    {
     754        FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
     755        FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
     756        FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
     757
     758        if (value->isValueList()) {
     759            CSSValueList* valueList = static_cast<CSSValueList*>(value);
     760            for (size_t i = 0; i < valueList->length(); ++i) {
     761                CSSValue* item = valueList->itemWithoutBoundsCheck(i);
     762                ASSERT(item->isPrimitiveValue());
     763                if (item->isPrimitiveValue()) {
     764                    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
     765                    switch (primitiveValue->getIdent()) {
     766                    case CSSValueNoCommonLigatures:
     767                        commonLigaturesState = FontDescription::DisabledLigaturesState;
     768                        break;
     769                    case CSSValueCommonLigatures:
     770                        commonLigaturesState = FontDescription::EnabledLigaturesState;
     771                        break;
     772                    case CSSValueNoDiscretionaryLigatures:
     773                        discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
     774                        break;
     775                    case CSSValueDiscretionaryLigatures:
     776                        discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
     777                        break;
     778                    case CSSValueNoHistoricalLigatures:
     779                        historicalLigaturesState = FontDescription::DisabledLigaturesState;
     780                        break;
     781                    case CSSValueHistoricalLigatures:
     782                        historicalLigaturesState = FontDescription::EnabledLigaturesState;
     783                        break;
     784                    default:
     785                        ASSERT_NOT_REACHED();
     786                        break;
     787                    }
     788                }
     789            }
     790        }
     791#if !ASSERT_DISABLED
     792        else {
     793            ASSERT(value->isPrimitiveValue());
     794            ASSERT(static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNormal);
     795        }
     796#endif
     797
     798        FontDescription fontDescription = selector->fontDescription();
     799        fontDescription.setCommonLigaturesState(commonLigaturesState);
     800        fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
     801        fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
     802        selector->setFontDescription(fontDescription);
     803    }
     804
     805    static PropertyHandler createHandler()
     806    {
     807        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
    724808    }
    725809};
     
    16851769    setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
    16861770    setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont<TextOrientation, &FontDescription::textOrientation, &FontDescription::setTextOrientation, TextOrientationVerticalRight>::createHandler());
     1771    setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
    16871772    setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
    16881773
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r104726 r104786  
    22292229        if (applyFirst) {
    22302230            COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
    2231             COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 17, CSS_zoom_is_end_of_first_prop_range);
     2231            COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 18, CSS_zoom_is_end_of_first_prop_range);
    22322232            COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
    22332233            // give special priority to font-xxx, color properties, etc
     
    38153815    case CSSPropertyWebkitFlowFrom:
    38163816    case CSSPropertyWebkitFontKerning:
     3817    case CSSPropertyWebkitFontVariantLigatures:
    38173818    case CSSPropertyWebkitHighlight:
    38183819    case CSSPropertyWebkitHyphenateCharacter:
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r102486 r104786  
    5353//normal
    5454small-caps
     55
     56// -webkit-font-variant-ligatures:
     57//
     58// normal
     59common-ligatures
     60no-common-ligatures
     61discretionary-ligatures
     62no-discretionary-ligatures
     63historical-ligatures
     64no-historical-ligatures
     65
    5566//
    5667// CSS_PROP_FONT_WEIGHT:
  • trunk/Source/WebCore/platform/graphics/Font.h

    r104683 r104786  
    130130        }
    131131
     132        switch (m_fontDescription.commonLigaturesState()) {
     133        case FontDescription::DisabledLigaturesState:
     134            features &= ~Ligatures;
     135            break;
     136        case FontDescription::EnabledLigaturesState:
     137            features |= Ligatures;
     138            break;
     139        case FontDescription::NormalLigaturesState:
     140            break;
     141        }
     142
    132143        return features;
    133144    }
  • trunk/Source/WebCore/platform/graphics/FontDescription.h

    r104678 r104786  
    7474
    7575    enum Kerning { AutoKerning, NormalKerning, NoneKerning };
     76
     77    enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledLigaturesState };
    7678
    7779    FontDescription()
     
    8991        , m_renderingMode(NormalRenderingMode)
    9092        , m_kerning(AutoKerning)
     93        , m_commonLigaturesState(NormalLigaturesState)
     94        , m_discretionaryLigaturesState(NormalLigaturesState)
     95        , m_historicalLigaturesState(NormalLigaturesState)
    9196        , m_keywordSize(0)
    9297        , m_fontSmoothing(AutoSmoothing)
     
    117122    FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
    118123    Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
     124    LigaturesState commonLigaturesState() const { return static_cast<LigaturesState>(m_commonLigaturesState); }
     125    LigaturesState discretionaryLigaturesState() const { return static_cast<LigaturesState>(m_discretionaryLigaturesState); }
     126    LigaturesState historicalLigaturesState() const { return static_cast<LigaturesState>(m_historicalLigaturesState); }
    119127    unsigned keywordSize() const { return m_keywordSize; }
    120128    FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); }
     
    147155    void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
    148156    void setKerning(Kerning kerning) { m_kerning = kerning; }
     157    void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; }
     158    void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesState) { m_discretionaryLigaturesState = discretionaryLigaturesState; }
     159    void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; }
    149160    void setKeywordSize(unsigned s) { m_keywordSize = s; }
    150161    void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
     
    180191    unsigned m_renderingMode : 1;  // Used to switch between CG and GDI text on Windows.
    181192    unsigned m_kerning : 2; // Kerning
     193
     194    unsigned m_commonLigaturesState : 2;
     195    unsigned m_discretionaryLigaturesState : 2;
     196    unsigned m_historicalLigaturesState : 2;
    182197
    183198    unsigned m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium).  If so,
     
    204219        && m_renderingMode == other.m_renderingMode
    205220        && m_kerning == other.m_kerning
     221        && m_commonLigaturesState == other.m_commonLigaturesState
     222        && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState
     223        && m_historicalLigaturesState == other.m_historicalLigaturesState
    206224        && m_keywordSize == other.m_keywordSize
    207225        && m_fontSmoothing == other.m_fontSmoothing
Note: See TracChangeset for help on using the changeset viewer.