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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 ASSERT(result->length() <= 3); | 458 ASSERT(result->length() <= 3); |
459 return result.release(); | 459 return result.release(); |
460 } | 460 } |
461 | 461 |
462 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Comput
edStyle& style) | 462 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Comput
edStyle& style) |
463 { | 463 { |
464 Length length = style.lineHeight(); | 464 Length length = style.lineHeight(); |
465 if (length.isNegative()) | 465 if (length.isNegative()) |
466 return cssValuePool().createIdentifierValue(CSSValueNormal); | 466 return cssValuePool().createIdentifierValue(CSSValueNormal); |
467 | 467 |
468 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript
ion().computedSize()), style); | 468 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr
iption().computedSize()), style); |
469 } | 469 } |
470 | 470 |
471 static CSSValueID identifierForFamily(const AtomicString& family) | 471 static CSSValueID identifierForFamily(const AtomicString& family) |
472 { | 472 { |
473 if (family == FontFamilyNames::webkit_cursive) | 473 if (family == FontFamilyNames::webkit_cursive) |
474 return CSSValueCursive; | 474 return CSSValueCursive; |
475 if (family == FontFamilyNames::webkit_fantasy) | 475 if (family == FontFamilyNames::webkit_fantasy) |
476 return CSSValueFantasy; | 476 return CSSValueFantasy; |
477 if (family == FontFamilyNames::webkit_monospace) | 477 if (family == FontFamilyNames::webkit_monospace) |
478 return CSSValueMonospace; | 478 return CSSValueMonospace; |
479 if (family == FontFamilyNames::webkit_pictograph) | 479 if (family == FontFamilyNames::webkit_pictograph) |
480 return CSSValueWebkitPictograph; | 480 return CSSValueWebkitPictograph; |
481 if (family == FontFamilyNames::webkit_sans_serif) | 481 if (family == FontFamilyNames::webkit_sans_serif) |
482 return CSSValueSansSerif; | 482 return CSSValueSansSerif; |
483 if (family == FontFamilyNames::webkit_serif) | 483 if (family == FontFamilyNames::webkit_serif) |
484 return CSSValueSerif; | 484 return CSSValueSerif; |
485 return CSSValueInvalid; | 485 return CSSValueInvalid; |
486 } | 486 } |
487 | 487 |
488 static PassRefPtrWillBeRawPtr<CSSValue> valueForFamily(const AtomicString& famil
y) | 488 static PassRefPtrWillBeRawPtr<CSSValue> valueForFamily(const AtomicString& famil
y) |
489 { | 489 { |
490 if (CSSValueID familyIdentifier = identifierForFamily(family)) | 490 if (CSSValueID familyIdentifier = identifierForFamily(family)) |
491 return cssValuePool().createIdentifierValue(familyIdentifier); | 491 return cssValuePool().createIdentifierValue(familyIdentifier); |
492 return CSSCustomIdentValue::create(family.string()); | 492 return CSSCustomIdentValue::create(family.string()); |
493 } | 493 } |
494 | 494 |
495 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const ComputedSty
le& style) | 495 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const ComputedSty
le& style) |
496 { | 496 { |
497 const FontFamily& firstFamily = style.fontDescription().family(); | 497 const FontFamily& firstFamily = style.getFontDescription().family(); |
498 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 498 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
499 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) | 499 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) |
500 list->append(valueForFamily(family->family())); | 500 list->append(valueForFamily(family->family())); |
501 return list.release(); | 501 return list.release(); |
502 } | 502 } |
503 | 503 |
504 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const Computed
Style& style) | 504 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const Computed
Style& style) |
505 { | 505 { |
506 return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style)
; | 506 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty
le); |
507 } | 507 } |
508 | 508 |
509 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Compu
tedStyle& style) | 509 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Compu
tedStyle& style) |
510 { | 510 { |
511 return cssValuePool().createValue(style.fontDescription().stretch()); | 511 return cssValuePool().createValue(style.getFontDescription().stretch()); |
512 } | 512 } |
513 | 513 |
514 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const Compute
dStyle& style) | 514 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const Compute
dStyle& style) |
515 { | 515 { |
516 return cssValuePool().createValue(style.fontDescription().style()); | 516 return cssValuePool().createValue(style.getFontDescription().style()); |
517 } | 517 } |
518 | 518 |
519 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu
tedStyle& style) | 519 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu
tedStyle& style) |
520 { | 520 { |
521 return cssValuePool().createValue(style.fontDescription().variant()); | 521 return cssValuePool().createValue(style.getFontDescription().variant()); |
522 } | 522 } |
523 | 523 |
524 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
edStyle& style) | 524 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
edStyle& style) |
525 { | 525 { |
526 return cssValuePool().createValue(style.fontDescription().weight()); | 526 return cssValuePool().createValue(style.getFontDescription().weight()); |
527 } | 527 } |
528 | 528 |
529 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
GridLength& trackBreadth, const ComputedStyle& style) | 529 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
GridLength& trackBreadth, const ComputedStyle& style) |
530 { | 530 { |
531 if (!trackBreadth.isLength()) | 531 if (!trackBreadth.isLength()) |
532 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); | 532 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); |
533 | 533 |
534 const Length& trackBreadthLength = trackBreadth.length(); | 534 const Length& trackBreadthLength = trackBreadth.length(); |
535 if (trackBreadthLength.isAuto()) | 535 if (trackBreadthLength.isAuto()) |
536 return cssValuePool().createIdentifierValue(CSSValueAuto); | 536 return cssValuePool().createIdentifierValue(CSSValueAuto); |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 return cssValuePool().createIdentifierValue(CSSValueNone); | 1654 return cssValuePool().createIdentifierValue(CSSValueNone); |
1655 case CSSPropertyFontStretch: | 1655 case CSSPropertyFontStretch: |
1656 return valueForFontStretch(style); | 1656 return valueForFontStretch(style); |
1657 case CSSPropertyFontStyle: | 1657 case CSSPropertyFontStyle: |
1658 return valueForFontStyle(style); | 1658 return valueForFontStyle(style); |
1659 case CSSPropertyFontVariant: | 1659 case CSSPropertyFontVariant: |
1660 return valueForFontVariant(style); | 1660 return valueForFontVariant(style); |
1661 case CSSPropertyFontWeight: | 1661 case CSSPropertyFontWeight: |
1662 return valueForFontWeight(style); | 1662 return valueForFontWeight(style); |
1663 case CSSPropertyFontFeatureSettings: { | 1663 case CSSPropertyFontFeatureSettings: { |
1664 const FontFeatureSettings* featureSettings = style.fontDescription().fea
tureSettings(); | 1664 const FontFeatureSettings* featureSettings = style.getFontDescription().
featureSettings(); |
1665 if (!featureSettings || !featureSettings->size()) | 1665 if (!featureSettings || !featureSettings->size()) |
1666 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1666 return cssValuePool().createIdentifierValue(CSSValueNormal); |
1667 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1667 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); |
1668 for (unsigned i = 0; i < featureSettings->size(); ++i) { | 1668 for (unsigned i = 0; i < featureSettings->size(); ++i) { |
1669 const FontFeature& feature = featureSettings->at(i); | 1669 const FontFeature& feature = featureSettings->at(i); |
1670 RefPtrWillBeRawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatur
eValue::create(feature.tag(), feature.value()); | 1670 RefPtrWillBeRawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatur
eValue::create(feature.tag(), feature.value()); |
1671 list->append(featureValue.release()); | 1671 list->append(featureValue.release()); |
1672 } | 1672 } |
1673 return list.release(); | 1673 return list.release(); |
1674 } | 1674 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 if (style.getTextIndentLine() == TextIndentEachLine) | 2008 if (style.getTextIndentLine() == TextIndentEachLine) |
2009 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi
ne)); | 2009 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi
ne)); |
2010 if (style.getTextIndentType() == TextIndentHanging) | 2010 if (style.getTextIndentType() == TextIndentHanging) |
2011 list->append(cssValuePool().createIdentifierValue(CSSValueHangin
g)); | 2011 list->append(cssValuePool().createIdentifierValue(CSSValueHangin
g)); |
2012 } | 2012 } |
2013 return list.release(); | 2013 return list.release(); |
2014 } | 2014 } |
2015 case CSSPropertyTextShadow: | 2015 case CSSPropertyTextShadow: |
2016 return valueForShadowList(style.textShadow(), style, false); | 2016 return valueForShadowList(style.textShadow(), style, false); |
2017 case CSSPropertyTextRendering: | 2017 case CSSPropertyTextRendering: |
2018 return cssValuePool().createValue(style.fontDescription().textRendering(
)); | 2018 return cssValuePool().createValue(style.getFontDescription().textRenderi
ng()); |
2019 case CSSPropertyTextOverflow: | 2019 case CSSPropertyTextOverflow: |
2020 if (style.getTextOverflow()) | 2020 if (style.getTextOverflow()) |
2021 return cssValuePool().createIdentifierValue(CSSValueEllipsis); | 2021 return cssValuePool().createIdentifierValue(CSSValueEllipsis); |
2022 return cssValuePool().createIdentifierValue(CSSValueClip); | 2022 return cssValuePool().createIdentifierValue(CSSValueClip); |
2023 case CSSPropertyWebkitTextSecurity: | 2023 case CSSPropertyWebkitTextSecurity: |
2024 return cssValuePool().createValue(style.textSecurity()); | 2024 return cssValuePool().createValue(style.textSecurity()); |
2025 case CSSPropertyWebkitTextStrokeColor: | 2025 case CSSPropertyWebkitTextStrokeColor: |
2026 return currentColorOrValidColor(style, style.textStrokeColor()); | 2026 return currentColorOrValidColor(style, style.textStrokeColor()); |
2027 case CSSPropertyWebkitTextStrokeWidth: | 2027 case CSSPropertyWebkitTextStrokeWidth: |
2028 return zoomAdjustedPixelValue(style.textStrokeWidth(), style); | 2028 return zoomAdjustedPixelValue(style.textStrokeWidth(), style); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 return cssValuePool().createValue(style.wordBreak()); | 2080 return cssValuePool().createValue(style.wordBreak()); |
2081 case CSSPropertyWordSpacing: | 2081 case CSSPropertyWordSpacing: |
2082 return zoomAdjustedPixelValue(style.wordSpacing(), style); | 2082 return zoomAdjustedPixelValue(style.wordSpacing(), style); |
2083 case CSSPropertyWordWrap: | 2083 case CSSPropertyWordWrap: |
2084 return cssValuePool().createValue(style.overflowWrap()); | 2084 return cssValuePool().createValue(style.overflowWrap()); |
2085 case CSSPropertyWebkitLineBreak: | 2085 case CSSPropertyWebkitLineBreak: |
2086 return cssValuePool().createValue(style.getLineBreak()); | 2086 return cssValuePool().createValue(style.getLineBreak()); |
2087 case CSSPropertyResize: | 2087 case CSSPropertyResize: |
2088 return cssValuePool().createValue(style.resize()); | 2088 return cssValuePool().createValue(style.resize()); |
2089 case CSSPropertyFontKerning: | 2089 case CSSPropertyFontKerning: |
2090 return cssValuePool().createValue(style.fontDescription().getKerning()); | 2090 return cssValuePool().createValue(style.getFontDescription().getKerning(
)); |
2091 case CSSPropertyWebkitFontSmoothing: | 2091 case CSSPropertyWebkitFontSmoothing: |
2092 return cssValuePool().createValue(style.fontDescription().fontSmoothing(
)); | 2092 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); |
2093 case CSSPropertyFontVariantLigatures: { | 2093 case CSSPropertyFontVariantLigatures: { |
2094 FontDescription::LigaturesState commonLigaturesState = style.fontDescrip
tion().commonLigaturesState(); | 2094 FontDescription::LigaturesState commonLigaturesState = style.getFontDesc
ription().commonLigaturesState(); |
2095 FontDescription::LigaturesState discretionaryLigaturesState = style.font
Description().discretionaryLigaturesState(); | 2095 FontDescription::LigaturesState discretionaryLigaturesState = style.getF
ontDescription().discretionaryLigaturesState(); |
2096 FontDescription::LigaturesState historicalLigaturesState = style.fontDes
cription().historicalLigaturesState(); | 2096 FontDescription::LigaturesState historicalLigaturesState = style.getFont
Description().historicalLigaturesState(); |
2097 FontDescription::LigaturesState contextualLigaturesState = style.fontDes
cription().contextualLigaturesState(); | 2097 FontDescription::LigaturesState contextualLigaturesState = style.getFont
Description().contextualLigaturesState(); |
2098 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis
cretionaryLigaturesState == FontDescription::NormalLigaturesState | 2098 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis
cretionaryLigaturesState == FontDescription::NormalLigaturesState |
2099 && historicalLigaturesState == FontDescription::NormalLigaturesState
&& contextualLigaturesState == FontDescription::NormalLigaturesState) | 2099 && historicalLigaturesState == FontDescription::NormalLigaturesState
&& contextualLigaturesState == FontDescription::NormalLigaturesState) |
2100 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2100 return cssValuePool().createIdentifierValue(CSSValueNormal); |
2101 | 2101 |
2102 RefPtrWillBeRawPtr<CSSValueList> valueList = CSSValueList::createSpaceSe
parated(); | 2102 RefPtrWillBeRawPtr<CSSValueList> valueList = CSSValueList::createSpaceSe
parated(); |
2103 if (commonLigaturesState != FontDescription::NormalLigaturesState) | 2103 if (commonLigaturesState != FontDescription::NormalLigaturesState) |
2104 valueList->append(cssValuePool().createIdentifierValue(commonLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures :
CSSValueCommonLigatures)); | 2104 valueList->append(cssValuePool().createIdentifierValue(commonLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures :
CSSValueCommonLigatures)); |
2105 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState
) | 2105 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState
) |
2106 valueList->append(cssValuePool().createIdentifierValue(discretionary
LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion
aryLigatures : CSSValueDiscretionaryLigatures)); | 2106 valueList->append(cssValuePool().createIdentifierValue(discretionary
LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion
aryLigatures : CSSValueDiscretionaryLigatures)); |
2107 if (historicalLigaturesState != FontDescription::NormalLigaturesState) | 2107 if (historicalLigaturesState != FontDescription::NormalLigaturesState) |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 case CSSPropertyAll: | 2751 case CSSPropertyAll: |
2752 return nullptr; | 2752 return nullptr; |
2753 default: | 2753 default: |
2754 break; | 2754 break; |
2755 } | 2755 } |
2756 ASSERT_NOT_REACHED(); | 2756 ASSERT_NOT_REACHED(); |
2757 return nullptr; | 2757 return nullptr; |
2758 } | 2758 } |
2759 | 2759 |
2760 } // namespace blink | 2760 } // namespace blink |
OLD | NEW |