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

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: Remove whitespace and clarified TODOs 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 8574c6fcade57f7893c4a8d09b6f22ae9a85248a..4d7f9b295f97bdcbab0e8de7c8dc7ad3af20fe54 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.numericFigure() != FontVariantNumeric::NormalFigure)
+ valueList->append(cssValuePool().createIdentifierValue(variantNumeric.numericFigure() == FontVariantNumeric::LiningNums ? CSSValueLiningNums : CSSValueOldstyleNums));
+ if (variantNumeric.numericSpacing() != FontVariantNumeric::NormalSpacing)
+ valueList->append(cssValuePool().createIdentifierValue(variantNumeric.numericSpacing() == FontVariantNumeric::ProportionalNums ? CSSValueProportionalNums : CSSValueTabularNums));
+ if (variantNumeric.numericFraction() != FontVariantNumeric::NormalFraction)
+ valueList->append(cssValuePool().createIdentifierValue(variantNumeric.numericFraction() == FontVariantNumeric::DiagonalFractions ? CSSValueDiagonalFractions : CSSValueStackedFractions));
+ if (variantNumeric.ordinal() == FontVariantNumeric::OrdinalOn)
+ valueList->append(cssValuePool().createIdentifierValue(CSSValueOrdinal));
+ if (variantNumeric.slashedZero() == FontVariantNumeric::SlashedZeroOn)
+ valueList->append(cssValuePool().createIdentifierValue(CSSValueSlashedZero));
+
+ return valueList;
+}
+
+
static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const ComputedStyle& style)
{
if (!trackBreadth.isLength())
@@ -1438,7 +1460,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);
@@ -2262,6 +2286,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);

Powered by Google App Engine
This is Rietveld 408576698