OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
7 * Copyright (C) 2015 Google Inc. All rights reserved. | 7 * Copyright (C) 2015 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 valueList->append(cssValuePool().createIdentifierValue(commonLigaturesSt
ate == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSS
ValueCommonLigatures)); | 671 valueList->append(cssValuePool().createIdentifierValue(commonLigaturesSt
ate == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSS
ValueCommonLigatures)); |
672 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState) | 672 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState) |
673 valueList->append(cssValuePool().createIdentifierValue(discretionaryLiga
turesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryL
igatures : CSSValueDiscretionaryLigatures)); | 673 valueList->append(cssValuePool().createIdentifierValue(discretionaryLiga
turesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryL
igatures : CSSValueDiscretionaryLigatures)); |
674 if (historicalLigaturesState != FontDescription::NormalLigaturesState) | 674 if (historicalLigaturesState != FontDescription::NormalLigaturesState) |
675 valueList->append(cssValuePool().createIdentifierValue(historicalLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatur
es : CSSValueHistoricalLigatures)); | 675 valueList->append(cssValuePool().createIdentifierValue(historicalLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatur
es : CSSValueHistoricalLigatures)); |
676 if (contextualLigaturesState != FontDescription::NormalLigaturesState) | 676 if (contextualLigaturesState != FontDescription::NormalLigaturesState) |
677 valueList->append(cssValuePool().createIdentifierValue(contextualLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSV
alueContextual)); | 677 valueList->append(cssValuePool().createIdentifierValue(contextualLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSV
alueContextual)); |
678 return valueList; | 678 return valueList; |
679 } | 679 } |
680 | 680 |
| 681 static CSSValue* valueForFontVariantNumeric(const ComputedStyle& style) |
| 682 { |
| 683 FontVariantNumeric variantNumeric = style.getFontDescription().variantNumeri
c(); |
| 684 if (variantNumeric.isAllNormal()) |
| 685 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 686 |
| 687 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); |
| 688 if (variantNumeric.numericFigureValue() != FontVariantNumeric::NormalFigure) |
| 689 valueList->append(cssValuePool().createIdentifierValue(variantNumeric.nu
mericFigureValue() == FontVariantNumeric::LiningNums ? CSSValueLiningNums : CSSV
alueOldstyleNums)); |
| 690 if (variantNumeric.numericSpacingValue() != FontVariantNumeric::NormalSpacin
g) |
| 691 valueList->append(cssValuePool().createIdentifierValue(variantNumeric.nu
mericSpacingValue() == FontVariantNumeric::ProportionalNums ? CSSValueProportion
alNums : CSSValueTabularNums)); |
| 692 if (variantNumeric.numericFractionValue() != FontVariantNumeric::NormalFract
ion) |
| 693 valueList->append(cssValuePool().createIdentifierValue(variantNumeric.nu
mericFractionValue() == FontVariantNumeric::DiagonalFractions ? CSSValueDiagonal
Fractions : CSSValueStackedFractions)); |
| 694 if (variantNumeric.ordinalValue() == FontVariantNumeric::OrdinalOn) |
| 695 valueList->append(cssValuePool().createIdentifierValue(CSSValueOrdinal))
; |
| 696 if (variantNumeric.slashedZeroValue() == FontVariantNumeric::SlashedZeroOn) |
| 697 valueList->append(cssValuePool().createIdentifierValue(CSSValueSlashedZe
ro)); |
| 698 |
| 699 return valueList; |
| 700 } |
| 701 |
| 702 |
681 static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadt
h, const ComputedStyle& style) | 703 static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadt
h, const ComputedStyle& style) |
682 { | 704 { |
683 if (!trackBreadth.isLength()) | 705 if (!trackBreadth.isLength()) |
684 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); | 706 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); |
685 | 707 |
686 const Length& trackBreadthLength = trackBreadth.length(); | 708 const Length& trackBreadthLength = trackBreadth.length(); |
687 if (trackBreadthLength.isAuto()) | 709 if (trackBreadthLength.isAuto()) |
688 return cssValuePool().createIdentifierValue(CSSValueAuto); | 710 return cssValuePool().createIdentifierValue(CSSValueAuto); |
689 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); | 711 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); |
690 } | 712 } |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 // Add a slash between size and line-height. | 1517 // Add a slash between size and line-height. |
1496 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated(); | 1518 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated(); |
1497 sizeAndLineHeight->append(valueForFontSize(style)); | 1519 sizeAndLineHeight->append(valueForFontSize(style)); |
1498 sizeAndLineHeight->append(valueForLineHeight(style)); | 1520 sizeAndLineHeight->append(valueForLineHeight(style)); |
1499 | 1521 |
1500 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1522 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1501 list->append(valueForFontStyle(style)); | 1523 list->append(valueForFontStyle(style)); |
1502 | 1524 |
1503 // Check that non-initial font-variant subproperties are not conflicting wit
h this serialization. | 1525 // Check that non-initial font-variant subproperties are not conflicting wit
h this serialization. |
1504 CSSValue* ligaturesValue = valueForFontVariantLigatures(style); | 1526 CSSValue* ligaturesValue = valueForFontVariantLigatures(style); |
1505 if (!ligaturesValue->equals(*cssValuePool().createIdentifierValue(CSSValueNo
rmal))) | 1527 CSSValue* numericValue = valueForFontVariantNumeric(style); |
| 1528 if (!ligaturesValue->equals(*cssValuePool().createIdentifierValue(CSSValueNo
rmal)) |
| 1529 || !numericValue->equals(*cssValuePool().createIdentifierValue(CSSValueN
ormal))) |
1506 return nullptr; | 1530 return nullptr; |
1507 | 1531 |
1508 CSSPrimitiveValue* capsValue = valueForFontVariantCaps(style); | 1532 CSSPrimitiveValue* capsValue = valueForFontVariantCaps(style); |
1509 if (!capsValue->equals(*cssValuePool().createIdentifierValue(CSSValueNormal)
) | 1533 if (!capsValue->equals(*cssValuePool().createIdentifierValue(CSSValueNormal)
) |
1510 && !capsValue->equals(*cssValuePool().createIdentifierValue(CSSValueSmal
lCaps))) | 1534 && !capsValue->equals(*cssValuePool().createIdentifierValue(CSSValueSmal
lCaps))) |
1511 return nullptr; | 1535 return nullptr; |
1512 list->append(capsValue); | 1536 list->append(capsValue); |
1513 | 1537 |
1514 list->append(valueForFontWeight(style)); | 1538 list->append(valueForFontWeight(style)); |
1515 list->append(valueForFontStretch(style)); | 1539 list->append(valueForFontStretch(style)); |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 case CSSPropertyResize: | 2342 case CSSPropertyResize: |
2319 return cssValuePool().createValue(style.resize()); | 2343 return cssValuePool().createValue(style.resize()); |
2320 case CSSPropertyFontKerning: | 2344 case CSSPropertyFontKerning: |
2321 return cssValuePool().createValue(style.getFontDescription().getKerning(
)); | 2345 return cssValuePool().createValue(style.getFontDescription().getKerning(
)); |
2322 case CSSPropertyWebkitFontSmoothing: | 2346 case CSSPropertyWebkitFontSmoothing: |
2323 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); | 2347 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); |
2324 case CSSPropertyFontVariantLigatures: | 2348 case CSSPropertyFontVariantLigatures: |
2325 return valueForFontVariantLigatures(style); | 2349 return valueForFontVariantLigatures(style); |
2326 case CSSPropertyFontVariantCaps: | 2350 case CSSPropertyFontVariantCaps: |
2327 return valueForFontVariantCaps(style); | 2351 return valueForFontVariantCaps(style); |
| 2352 case CSSPropertyFontVariantNumeric: |
| 2353 return valueForFontVariantNumeric(style); |
2328 case CSSPropertyZIndex: | 2354 case CSSPropertyZIndex: |
2329 if (style.hasAutoZIndex()) | 2355 if (style.hasAutoZIndex()) |
2330 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2356 return cssValuePool().createIdentifierValue(CSSValueAuto); |
2331 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni
tType::Integer); | 2357 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni
tType::Integer); |
2332 case CSSPropertyZoom: | 2358 case CSSPropertyZoom: |
2333 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT
ype::Number); | 2359 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT
ype::Number); |
2334 case CSSPropertyBoxSizing: | 2360 case CSSPropertyBoxSizing: |
2335 if (style.boxSizing() == BoxSizingContentBox) | 2361 if (style.boxSizing() == BoxSizingContentBox) |
2336 return cssValuePool().createIdentifierValue(CSSValueContentBox); | 2362 return cssValuePool().createIdentifierValue(CSSValueContentBox); |
2337 return cssValuePool().createIdentifierValue(CSSValueBorderBox); | 2363 return cssValuePool().createIdentifierValue(CSSValueBorderBox); |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 case CSSPropertyAll: | 3000 case CSSPropertyAll: |
2975 return nullptr; | 3001 return nullptr; |
2976 default: | 3002 default: |
2977 break; | 3003 break; |
2978 } | 3004 } |
2979 ASSERT_NOT_REACHED(); | 3005 ASSERT_NOT_REACHED(); |
2980 return nullptr; | 3006 return nullptr; |
2981 } | 3007 } |
2982 | 3008 |
2983 } // namespace blink | 3009 } // namespace blink |
OLD | NEW |