Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 ASSERT_WITH_SECURITY_IMPLICATION(value.isValueList()); | |
|
Timothy Loh
2016/05/11 06:47:26
No need to write this, toCSSValueList has this ass
drott
2016/05/11 08:10:46
Assertion removed.
| |
| 349 FontVariantNumeric variantNumeric; | |
| 350 for (const CSSValue* feature : toCSSValueList(value)) { | |
| 351 switch (toCSSPrimitiveValue(feature)->getValueID()) { | |
| 352 case CSSValueLiningNums: | |
| 353 variantNumeric.setNumericFigure(FontVariantNumeric::LiningNums); | |
| 354 break; | |
| 355 case CSSValueOldstyleNums: | |
| 356 variantNumeric.setNumericFigure(FontVariantNumeric::OldstyleNums); | |
| 357 break; | |
| 358 case CSSValueProportionalNums: | |
| 359 variantNumeric.setNumericSpacing(FontVariantNumeric::ProportionalNum s); | |
| 360 break; | |
| 361 case CSSValueTabularNums: | |
| 362 variantNumeric.setNumericSpacing(FontVariantNumeric::TabularNums); | |
| 363 break; | |
| 364 case CSSValueDiagonalFractions: | |
| 365 variantNumeric.setNumericFraction(FontVariantNumeric::DiagonalFracti ons); | |
| 366 break; | |
| 367 case CSSValueStackedFractions: | |
| 368 variantNumeric.setNumericFraction(FontVariantNumeric::StackedFractio ns); | |
| 369 break; | |
| 370 case CSSValueOrdinal: | |
| 371 variantNumeric.setOrdinal(FontVariantNumeric::OrdinalOn); | |
| 372 break; | |
| 373 case CSSValueSlashedZero: | |
| 374 variantNumeric.setSlashedZero(FontVariantNumeric::SlashedZeroOn); | |
| 375 break; | |
| 376 default: | |
| 377 ASSERT_NOT_REACHED(); | |
| 378 break; | |
| 379 } | |
| 380 } | |
| 381 return variantNumeric; | |
| 382 } | |
| 383 | |
| 341 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, const CSSValue& value) | 384 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, const CSSValue& value) |
| 342 { | 385 { |
| 343 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ; | 386 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ; |
| 344 if (value.isValuePair()) { | 387 if (value.isValuePair()) { |
| 345 const CSSValuePair& pair = toCSSValuePair(value); | 388 const CSSValuePair& pair = toCSSValuePair(value); |
| 346 if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) { | 389 if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) { |
| 347 alignmentData.setPositionType(LegacyPosition); | 390 alignmentData.setPositionType(LegacyPosition); |
| 348 alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convert To<ItemPosition>()); | 391 alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convert To<ItemPosition>()); |
| 349 } else { | 392 } else { |
| 350 alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertT o<ItemPosition>()); | 393 alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertT o<ItemPosition>()); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1001 | 1044 |
| 1002 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) | 1045 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) |
| 1003 { | 1046 { |
| 1004 if (value.isPathValue()) | 1047 if (value.isPathValue()) |
| 1005 return toCSSPathValue(value).stylePath(); | 1048 return toCSSPathValue(value).stylePath(); |
| 1006 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); | 1049 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); |
| 1007 return nullptr; | 1050 return nullptr; |
| 1008 } | 1051 } |
| 1009 | 1052 |
| 1010 } // namespace blink | 1053 } // namespace blink |
| OLD | NEW |