Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1955723004: Implement font-variant-numeric (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
index cb45d8548462b7d904aacde6f033ecbc969cdb8b..6f6d9465840e73bf9bd1165904ccfc566da9bce8 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -678,6 +678,28 @@ static CSSValue* valueForFontVariantLigatures(const ComputedStyle& style)
return valueList;
}
+static CSSValue* valueForFontVariantNumeric(const ComputedStyle& style)
+{
+ FontVariantNumeric variantNumeric = style.getFontDescription().variantNumeric();
+ if (variantNumeric.isAllNormal())
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
+
+ CSSValueList* valueList = CSSValueList::createSpaceSeparated();
+ if (variantNumeric.numericFigureValue() != FontVariantNumeric::NormalFigure)
+ valueList->append(cssValuePool().createIdentifierValue(variantNumeric.numericFigureValue() == FontVariantNumeric::LiningNums ? CSSValueLiningNums : CSSValueOldstyleNums));
+ if (variantNumeric.numericSpacingValue() != FontVariantNumeric::NormalSpacing)
+ valueList->append(cssValuePool().createIdentifierValue(variantNumeric.numericSpacingValue() == FontVariantNumeric::ProportionalNums ? CSSValueProportionalNums : CSSValueTabularNums));
+ if (variantNumeric.numericFractionValue() != FontVariantNumeric::NormalFraction)
+ valueList->append(cssValuePool().createIdentifierValue(variantNumeric.numericFractionValue() == FontVariantNumeric::DiagonalFractions ? CSSValueDiagonalFractions : CSSValueStackedFractions));
+ if (variantNumeric.ordinalValue() == FontVariantNumeric::OrdinalOn)
+ valueList->append(cssValuePool().createIdentifierValue(CSSValueOrdinal));
+ if (variantNumeric.slashedZeroValue() == FontVariantNumeric::SlashedZeroOn)
+ valueList->append(cssValuePool().createIdentifierValue(CSSValueSlashedZero));
+
+ return valueList;
+}
+
+
static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const ComputedStyle& style)
{
if (!trackBreadth.isLength())
@@ -1502,7 +1524,9 @@ CSSValue* ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle& style)
// Check that non-initial font-variant subproperties are not conflicting with this serialization.
CSSValue* ligaturesValue = valueForFontVariantLigatures(style);
- if (!ligaturesValue->equals(*cssValuePool().createIdentifierValue(CSSValueNormal)))
+ CSSValue* numericValue = valueForFontVariantNumeric(style);
+ if (!ligaturesValue->equals(*cssValuePool().createIdentifierValue(CSSValueNormal))
+ || !numericValue->equals(*cssValuePool().createIdentifierValue(CSSValueNormal)))
return nullptr;
CSSPrimitiveValue* capsValue = valueForFontVariantCaps(style);
@@ -2325,6 +2349,8 @@ CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const Comp
return valueForFontVariantLigatures(style);
case CSSPropertyFontVariantCaps:
return valueForFontVariantCaps(style);
+ case CSSPropertyFontVariantNumeric:
+ return valueForFontVariantNumeric(style);
case CSSPropertyZIndex:
if (style.hasAutoZIndex())
return cssValuePool().createIdentifierValue(CSSValueAuto);
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSValueKeywords.in ('k') | third_party/WebKit/Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698