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 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 CSSPropertyClip, | 123 CSSPropertyClip, |
124 CSSPropertyColor, | 124 CSSPropertyColor, |
125 CSSPropertyCursor, | 125 CSSPropertyCursor, |
126 CSSPropertyDirection, | 126 CSSPropertyDirection, |
127 CSSPropertyDisplay, | 127 CSSPropertyDisplay, |
128 CSSPropertyEmptyCells, | 128 CSSPropertyEmptyCells, |
129 CSSPropertyFloat, | 129 CSSPropertyFloat, |
130 CSSPropertyFontFamily, | 130 CSSPropertyFontFamily, |
131 CSSPropertyFontKerning, | 131 CSSPropertyFontKerning, |
132 CSSPropertyFontSize, | 132 CSSPropertyFontSize, |
| 133 CSSPropertyFontStretch, |
133 CSSPropertyFontStyle, | 134 CSSPropertyFontStyle, |
134 CSSPropertyFontVariant, | 135 CSSPropertyFontVariant, |
135 CSSPropertyFontVariantLigatures, | 136 CSSPropertyFontVariantLigatures, |
136 CSSPropertyFontWeight, | 137 CSSPropertyFontWeight, |
137 CSSPropertyHeight, | 138 CSSPropertyHeight, |
138 CSSPropertyImageRendering, | 139 CSSPropertyImageRendering, |
139 CSSPropertyIsolation, | 140 CSSPropertyIsolation, |
140 CSSPropertyJustifySelf, | 141 CSSPropertyJustifySelf, |
141 CSSPropertyLeft, | 142 CSSPropertyLeft, |
142 CSSPropertyLetterSpacing, | 143 CSSPropertyLetterSpacing, |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1385 return cssValuePool().createIdentifierValue(CSSValueNormal); |
1385 | 1386 |
1386 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript
ion().specifiedSize()), style); | 1387 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript
ion().specifiedSize()), style); |
1387 } | 1388 } |
1388 | 1389 |
1389 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& s
tyle) | 1390 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& s
tyle) |
1390 { | 1391 { |
1391 return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), s
tyle); | 1392 return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), s
tyle); |
1392 } | 1393 } |
1393 | 1394 |
| 1395 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(RenderStyle
& style) |
| 1396 { |
| 1397 switch (style.fontDescription().stretch()) { |
| 1398 case FontStretchUltraCondensed: |
| 1399 return cssValuePool().createIdentifierValue(CSSValueUltraCondensed); |
| 1400 case FontStretchExtraCondensed: |
| 1401 return cssValuePool().createIdentifierValue(CSSValueExtraCondensed); |
| 1402 case FontStretchCondensed: |
| 1403 return cssValuePool().createIdentifierValue(CSSValueCondensed); |
| 1404 case FontStretchSemiCondensed: |
| 1405 return cssValuePool().createIdentifierValue(CSSValueSemiCondensed); |
| 1406 case FontStretchNormal: |
| 1407 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1408 case FontStretchSemiExpanded: |
| 1409 return cssValuePool().createIdentifierValue(CSSValueSemiExpanded); |
| 1410 case FontStretchExpanded: |
| 1411 return cssValuePool().createIdentifierValue(CSSValueExpanded); |
| 1412 case FontStretchExtraExpanded: |
| 1413 return cssValuePool().createIdentifierValue(CSSValueExtraExpanded); |
| 1414 case FontStretchUltraExpanded: |
| 1415 return cssValuePool().createIdentifierValue(CSSValueUltraExpanded); |
| 1416 } |
| 1417 ASSERT_NOT_REACHED(); |
| 1418 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1419 } |
| 1420 |
1394 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle&
style) | 1421 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle&
style) |
1395 { | 1422 { |
1396 if (style.fontDescription().italic()) | 1423 if (style.fontDescription().italic()) |
1397 return cssValuePool().createIdentifierValue(CSSValueItalic); | 1424 return cssValuePool().createIdentifierValue(CSSValueItalic); |
1398 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1425 return cssValuePool().createIdentifierValue(CSSValueNormal); |
1399 } | 1426 } |
1400 | 1427 |
1401 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle
& style) | 1428 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle
& style) |
1402 { | 1429 { |
1403 if (style.fontDescription().smallCaps()) | 1430 if (style.fontDescription().smallCaps()) |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 return cssValuePool().createValue(style->order(), CSSPrimitiveValue:
:CSS_NUMBER); | 1935 return cssValuePool().createValue(style->order(), CSSPrimitiveValue:
:CSS_NUMBER); |
1909 case CSSPropertyFloat: | 1936 case CSSPropertyFloat: |
1910 if (style->display() != NONE && style->hasOutOfFlowPosition()) | 1937 if (style->display() != NONE && style->hasOutOfFlowPosition()) |
1911 return cssValuePool().createIdentifierValue(CSSValueNone); | 1938 return cssValuePool().createIdentifierValue(CSSValueNone); |
1912 return cssValuePool().createValue(style->floating()); | 1939 return cssValuePool().createValue(style->floating()); |
1913 case CSSPropertyFont: { | 1940 case CSSPropertyFont: { |
1914 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create
(); | 1941 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create
(); |
1915 computedFont->style = valueForFontStyle(*style); | 1942 computedFont->style = valueForFontStyle(*style); |
1916 computedFont->variant = valueForFontVariant(*style); | 1943 computedFont->variant = valueForFontVariant(*style); |
1917 computedFont->weight = valueForFontWeight(*style); | 1944 computedFont->weight = valueForFontWeight(*style); |
| 1945 computedFont->stretch = valueForFontStretch(*style); |
1918 computedFont->size = valueForFontSize(*style); | 1946 computedFont->size = valueForFontSize(*style); |
1919 computedFont->lineHeight = valueForLineHeight(*style); | 1947 computedFont->lineHeight = valueForLineHeight(*style); |
1920 computedFont->family = valueForFontFamily(*style); | 1948 computedFont->family = valueForFontFamily(*style); |
1921 return computedFont.release(); | 1949 return computedFont.release(); |
1922 } | 1950 } |
1923 case CSSPropertyFontFamily: { | 1951 case CSSPropertyFontFamily: { |
1924 RefPtrWillBeRawPtr<CSSValueList> fontFamilyList = valueForFontFamily
(*style); | 1952 RefPtrWillBeRawPtr<CSSValueList> fontFamilyList = valueForFontFamily
(*style); |
1925 // If there's only a single family, return that as a CSSPrimitiveVal
ue. | 1953 // If there's only a single family, return that as a CSSPrimitiveVal
ue. |
1926 // NOTE: Gecko always returns this as a comma-separated CSSPrimitive
Value string. | 1954 // NOTE: Gecko always returns this as a comma-separated CSSPrimitive
Value string. |
1927 if (fontFamilyList->length() == 1) | 1955 if (fontFamilyList->length() == 1) |
1928 return fontFamilyList->item(0); | 1956 return fontFamilyList->item(0); |
1929 return fontFamilyList.release(); | 1957 return fontFamilyList.release(); |
1930 } | 1958 } |
1931 case CSSPropertyFontSize: | 1959 case CSSPropertyFontSize: |
1932 return valueForFontSize(*style); | 1960 return valueForFontSize(*style); |
| 1961 case CSSPropertyFontStretch: |
| 1962 return valueForFontStretch(*style); |
1933 case CSSPropertyFontStyle: | 1963 case CSSPropertyFontStyle: |
1934 return valueForFontStyle(*style); | 1964 return valueForFontStyle(*style); |
1935 case CSSPropertyFontVariant: | 1965 case CSSPropertyFontVariant: |
1936 return valueForFontVariant(*style); | 1966 return valueForFontVariant(*style); |
1937 case CSSPropertyFontWeight: | 1967 case CSSPropertyFontWeight: |
1938 return valueForFontWeight(*style); | 1968 return valueForFontWeight(*style); |
1939 case CSSPropertyWebkitFontFeatureSettings: { | 1969 case CSSPropertyWebkitFontFeatureSettings: { |
1940 const FontFeatureSettings* featureSettings = style->fontDescription(
).featureSettings(); | 1970 const FontFeatureSettings* featureSettings = style->fontDescription(
).featureSettings(); |
1941 if (!featureSettings || !featureSettings->size()) | 1971 if (!featureSettings || !featureSettings->size()) |
1942 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1972 return cssValuePool().createIdentifierValue(CSSValueNormal); |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 case CSSPropertyWebkitLogicalWidth: | 2792 case CSSPropertyWebkitLogicalWidth: |
2763 case CSSPropertyWebkitLogicalHeight: | 2793 case CSSPropertyWebkitLogicalHeight: |
2764 case CSSPropertyWebkitMinLogicalWidth: | 2794 case CSSPropertyWebkitMinLogicalWidth: |
2765 case CSSPropertyWebkitMinLogicalHeight: | 2795 case CSSPropertyWebkitMinLogicalHeight: |
2766 case CSSPropertyWebkitMaxLogicalWidth: | 2796 case CSSPropertyWebkitMaxLogicalWidth: |
2767 case CSSPropertyWebkitMaxLogicalHeight: | 2797 case CSSPropertyWebkitMaxLogicalHeight: |
2768 ASSERT_NOT_REACHED(); | 2798 ASSERT_NOT_REACHED(); |
2769 break; | 2799 break; |
2770 | 2800 |
2771 /* Unimplemented @font-face properties */ | 2801 /* Unimplemented @font-face properties */ |
2772 case CSSPropertyFontStretch: | |
2773 case CSSPropertySrc: | 2802 case CSSPropertySrc: |
2774 case CSSPropertyUnicodeRange: | 2803 case CSSPropertyUnicodeRange: |
2775 break; | 2804 break; |
2776 | 2805 |
2777 /* Other unimplemented properties */ | 2806 /* Other unimplemented properties */ |
2778 case CSSPropertyPage: // for @page | 2807 case CSSPropertyPage: // for @page |
2779 case CSSPropertyQuotes: // FIXME: needs implementation | 2808 case CSSPropertyQuotes: // FIXME: needs implementation |
2780 case CSSPropertySize: // for @page | 2809 case CSSPropertySize: // for @page |
2781 break; | 2810 break; |
2782 | 2811 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, | 3071 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, |
3043 CSSPropertyB
ackgroundClip }; | 3072 CSSPropertyB
ackgroundClip }; |
3044 | 3073 |
3045 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 3074 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; |
3046 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); | 3075 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); |
3047 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); | 3076 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); |
3048 return list.release(); | 3077 return list.release(); |
3049 } | 3078 } |
3050 | 3079 |
3051 } // namespace WebCore | 3080 } // namespace WebCore |
OLD | NEW |