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