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.isValueList()) { | |
|
Timothy Loh
2016/05/10 05:26:26
I would put the 'none' check up first, i.e.
if (v
drott
2016/05/10 10:59:06
I assume you meant the "normal" check? Done.
| |
| 344 FontVariantNumeric variantNumeric; | |
| 345 const CSSValueList& valueList = toCSSValueList(value); | |
| 346 for (size_t i = 0; i < valueList.length(); ++i) { | |
|
Timothy Loh
2016/05/10 05:26:26
for (const CSSValue* feature : toCSSValueList(valu
drott
2016/05/10 10:59:06
Changed accordingly.
| |
| 347 const CSSValue& item = *valueList.item(i); | |
| 348 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(item); | |
| 349 switch (primitiveValue.getValueID()) { | |
| 350 case CSSValueLiningNums: | |
| 351 variantNumeric.setNumericFigure(FontVariantNumeric::LiningNums); | |
| 352 break; | |
| 353 case CSSValueOldstyleNums: | |
| 354 variantNumeric.setNumericFigure(FontVariantNumeric::OldstyleNums ); | |
| 355 break; | |
| 356 case CSSValueProportionalNums: | |
| 357 variantNumeric.setNumericSpacing(FontVariantNumeric::Proportiona lNums); | |
| 358 break; | |
| 359 case CSSValueTabularNums: | |
| 360 variantNumeric.setNumericSpacing(FontVariantNumeric::TabularNums ); | |
| 361 break; | |
| 362 case CSSValueDiagonalFractions: | |
| 363 variantNumeric.setNumericFraction(FontVariantNumeric::DiagonalFr actions); | |
| 364 break; | |
| 365 case CSSValueStackedFractions: | |
| 366 variantNumeric.setNumericFraction(FontVariantNumeric::StackedFra ctions); | |
| 367 break; | |
| 368 case CSSValueOrdinal: | |
| 369 variantNumeric.setOrdinal(FontVariantNumeric::OrdinalOn); | |
| 370 break; | |
| 371 case CSSValueSlashedZero: | |
| 372 variantNumeric.setSlashedZero(FontVariantNumeric::SlashedZeroOn) ; | |
| 373 break; | |
| 374 default: | |
| 375 ASSERT_NOT_REACHED(); | |
| 376 break; | |
| 377 } | |
| 378 } | |
| 379 return variantNumeric; | |
| 380 } | |
| 381 | |
| 382 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); | |
|
Timothy Loh
2016/05/10 05:26:26
btw this line is redundant because toCSSPrimitiveV
drott
2016/05/10 10:59:06
Not needed anymore due to the inversed order of ch
| |
| 383 ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal); | |
| 384 return FontVariantNumeric(); | |
| 385 } | |
| 386 | |
| 341 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, const CSSValue& value) | 387 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, const CSSValue& value) |
| 342 { | 388 { |
| 343 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ; | 389 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ; |
| 344 if (value.isValuePair()) { | 390 if (value.isValuePair()) { |
| 345 const CSSValuePair& pair = toCSSValuePair(value); | 391 const CSSValuePair& pair = toCSSValuePair(value); |
| 346 if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) { | 392 if (toCSSPrimitiveValue(pair.first()).getValueID() == CSSValueLegacy) { |
| 347 alignmentData.setPositionType(LegacyPosition); | 393 alignmentData.setPositionType(LegacyPosition); |
| 348 alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convert To<ItemPosition>()); | 394 alignmentData.setPosition(toCSSPrimitiveValue(pair.second()).convert To<ItemPosition>()); |
| 349 } else { | 395 } else { |
| 350 alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertT o<ItemPosition>()); | 396 alignmentData.setPosition(toCSSPrimitiveValue(pair.first()).convertT o<ItemPosition>()); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1001 | 1047 |
| 1002 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) | 1048 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) |
| 1003 { | 1049 { |
| 1004 if (value.isPathValue()) | 1050 if (value.isPathValue()) |
| 1005 return toCSSPathValue(value).stylePath(); | 1051 return toCSSPathValue(value).stylePath(); |
| 1006 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); | 1052 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); |
| 1007 return nullptr; | 1053 return nullptr; |
| 1008 } | 1054 } |
| 1009 | 1055 |
| 1010 } // namespace blink | 1056 } // namespace blink |
| OLD | NEW |