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
+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
-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;
-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
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
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
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
-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;
-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
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
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
-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
-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
-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
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
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
+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
CSSPropertyWebkitFlexWrap,
CSSPropertyWebkitFontKerning,
CSSPropertyWebkitFontSmoothing,
+ CSSPropertyWebkitFontVariantLigatures,
#if ENABLE(CSS_GRID_LAYOUT)
CSSPropertyWebkitGridColumns,
CSSPropertyWebkitGridRows,
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);
validPrimitive = true;
break;
+ case CSSPropertyWebkitFontVariantLigatures:
+ if (id == CSSValueNormal)
+ validPrimitive = true;
+ else
+ return parseFontVariantLigatures(important);
+ break;
+
case CSSPropertyWebkitWrapShapeInside:
case CSSPropertyWebkitWrapShapeOutside:
if (id == CSSValueAuto)
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
bool parseFlowThread(int propId, bool important);
bool parseRegionThread(int propId, bool important);
+ bool parseFontVariantLigatures(bool important);
+
int yyparse();
CSSParserSelector* createFloatingSelector();
case CSSPropertyWebkitFontFeatureSettings:
case CSSPropertyWebkitFontKerning:
case CSSPropertyWebkitFontSmoothing:
+ case CSSPropertyWebkitFontVariantLigatures:
case CSSPropertyWebkitLocale:
case CSSPropertyWebkitHighlight:
case CSSPropertyWebkitHyphenateCharacter:
-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
}
};
+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,
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());
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)
case CSSPropertyWebkitFlowInto:
case CSSPropertyWebkitFlowFrom:
case CSSPropertyWebkitFontKerning:
+ case CSSPropertyWebkitFontVariantLigatures:
case CSSPropertyWebkitHighlight:
case CSSPropertyWebkitHyphenateCharacter:
case CSSPropertyWebkitHyphenateLimitAfter:
//
//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:
//
break;
}
+ switch (m_fontDescription.commonLigaturesState()) {
+ case FontDescription::DisabledLigaturesState:
+ features &= ~Ligatures;
+ break;
+ case FontDescription::EnabledLigaturesState:
+ features |= Ligatures;
+ break;
+ case FontDescription::NormalLigaturesState:
+ break;
+ }
+
return features;
}
enum Kerning { AutoKerning, NormalKerning, NoneKerning };
+ enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledLigaturesState };
+
FontDescription()
: m_specifiedSize(0)
, m_computedSize(0)
, 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)
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); }
#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; }
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>).
&& 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