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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); 331 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue());
332 332
333 if (toCSSPrimitiveValue(value).getValueID() == CSSValueNone) { 333 if (toCSSPrimitiveValue(value).getValueID() == CSSValueNone) {
334 return FontDescription::VariantLigatures(FontDescription::DisabledLigatu resState); 334 return FontDescription::VariantLigatures(FontDescription::DisabledLigatu resState);
335 } 335 }
336 336
337 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal); 337 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal);
338 return FontDescription::VariantLigatures(); 338 return FontDescription::VariantLigatures();
339 } 339 }
340 340
341 FontVariantNumeric StyleBuilderConverter::convertFontVariantNumeric(StyleResolve rState&, const CSSValue& value)
342 {
343 if (value.isPrimitiveValue()) {
344 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal);
345 return FontVariantNumeric();
346 }
347
348 FontVariantNumeric variantNumeric;
349 for (const CSSValue* feature : toCSSValueList(value)) {
350 switch (toCSSPrimitiveValue(feature)->getValueID()) {
351 case CSSValueLiningNums:
352 variantNumeric.setNumericFigure(FontVariantNumeric::LiningNums);
353 break;
354 case CSSValueOldstyleNums:
355 variantNumeric.setNumericFigure(FontVariantNumeric::OldstyleNums);
356 break;
357 case CSSValueProportionalNums:
358 variantNumeric.setNumericSpacing(FontVariantNumeric::ProportionalNum s);
359 break;
360 case CSSValueTabularNums:
361 variantNumeric.setNumericSpacing(FontVariantNumeric::TabularNums);
362 break;
363 case CSSValueDiagonalFractions:
364 variantNumeric.setNumericFraction(FontVariantNumeric::DiagonalFracti ons);
365 break;
366 case CSSValueStackedFractions:
367 variantNumeric.setNumericFraction(FontVariantNumeric::StackedFractio ns);
368 break;
369 case CSSValueOrdinal:
370 variantNumeric.setOrdinal(FontVariantNumeric::OrdinalOn);
371 break;
372 case CSSValueSlashedZero:
373 variantNumeric.setSlashedZero(FontVariantNumeric::SlashedZeroOn);
374 break;
375 default:
376 ASSERT_NOT_REACHED();
377 break;
378 }
379 }
380 return variantNumeric;
381 }
382
341 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, const CSSValue& value) 383 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, const CSSValue& value)
342 { 384 {
343 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ; 385 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ;
344 if (value.isValuePair()) { 386 if (value.isValuePair()) {
345 const CSSValuePair& pair = toCSSValuePair(value); 387 const CSSValuePair& pair = toCSSValuePair(value);
346 if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) { 388 if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) {
347 alignmentData.setPositionType(LegacyPosition); 389 alignmentData.setPositionType(LegacyPosition);
348 alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convert To<ItemPosition>()); 390 alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convert To<ItemPosition>());
349 } else { 391 } else {
350 alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertT o<ItemPosition>()); 392 alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertT o<ItemPosition>());
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 1043
1002 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 1044 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
1003 { 1045 {
1004 if (value.isPathValue()) 1046 if (value.isPathValue())
1005 return toCSSPathValue(value).stylePath(); 1047 return toCSSPathValue(value).stylePath();
1006 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 1048 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
1007 return nullptr; 1049 return nullptr;
1008 } 1050 }
1009 1051
1010 } // namespace blink 1052 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698