Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 203523002: Reland "Add plumbing for font-stretch" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: w/fix for ASSERT Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/css/CSSPropertyEquality.cpp ('k') | Source/core/css/CSSFontValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 CSSPropertyClip, 122 CSSPropertyClip,
123 CSSPropertyColor, 123 CSSPropertyColor,
124 CSSPropertyCursor, 124 CSSPropertyCursor,
125 CSSPropertyDirection, 125 CSSPropertyDirection,
126 CSSPropertyDisplay, 126 CSSPropertyDisplay,
127 CSSPropertyEmptyCells, 127 CSSPropertyEmptyCells,
128 CSSPropertyFloat, 128 CSSPropertyFloat,
129 CSSPropertyFontFamily, 129 CSSPropertyFontFamily,
130 CSSPropertyFontKerning, 130 CSSPropertyFontKerning,
131 CSSPropertyFontSize, 131 CSSPropertyFontSize,
132 CSSPropertyFontStretch,
132 CSSPropertyFontStyle, 133 CSSPropertyFontStyle,
133 CSSPropertyFontVariant, 134 CSSPropertyFontVariant,
134 CSSPropertyFontVariantLigatures, 135 CSSPropertyFontVariantLigatures,
135 CSSPropertyFontWeight, 136 CSSPropertyFontWeight,
136 CSSPropertyHeight, 137 CSSPropertyHeight,
137 CSSPropertyImageRendering, 138 CSSPropertyImageRendering,
138 CSSPropertyIsolation, 139 CSSPropertyIsolation,
139 CSSPropertyJustifyItems, 140 CSSPropertyJustifyItems,
140 CSSPropertyJustifySelf, 141 CSSPropertyJustifySelf,
141 CSSPropertyLeft, 142 CSSPropertyLeft,
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 return cssValuePool().createIdentifierValue(CSSValueNormal); 1401 return cssValuePool().createIdentifierValue(CSSValueNormal);
1401 1402
1402 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript ion().specifiedSize()), style); 1403 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript ion().specifiedSize()), style);
1403 } 1404 }
1404 1405
1405 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& s tyle) 1406 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& s tyle)
1406 { 1407 {
1407 return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), s tyle); 1408 return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), s tyle);
1408 } 1409 }
1409 1410
1411 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(RenderStyle & style)
1412 {
1413 switch (style.fontDescription().stretch()) {
1414 case FontStretchUltraCondensed:
1415 return cssValuePool().createIdentifierValue(CSSValueUltraCondensed);
1416 case FontStretchExtraCondensed:
1417 return cssValuePool().createIdentifierValue(CSSValueExtraCondensed);
1418 case FontStretchCondensed:
1419 return cssValuePool().createIdentifierValue(CSSValueCondensed);
1420 case FontStretchSemiCondensed:
1421 return cssValuePool().createIdentifierValue(CSSValueSemiCondensed);
1422 case FontStretchNormal:
1423 return cssValuePool().createIdentifierValue(CSSValueNormal);
1424 case FontStretchSemiExpanded:
1425 return cssValuePool().createIdentifierValue(CSSValueSemiExpanded);
1426 case FontStretchExpanded:
1427 return cssValuePool().createIdentifierValue(CSSValueExpanded);
1428 case FontStretchExtraExpanded:
1429 return cssValuePool().createIdentifierValue(CSSValueExtraExpanded);
1430 case FontStretchUltraExpanded:
1431 return cssValuePool().createIdentifierValue(CSSValueUltraExpanded);
1432 }
1433 ASSERT_NOT_REACHED();
1434 return cssValuePool().createIdentifierValue(CSSValueNormal);
1435 }
1436
1410 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle& style) 1437 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle& style)
1411 { 1438 {
1412 if (style.fontDescription().style() == FontStyleItalic) 1439 if (style.fontDescription().style() == FontStyleItalic)
1413 return cssValuePool().createIdentifierValue(CSSValueItalic); 1440 return cssValuePool().createIdentifierValue(CSSValueItalic);
1414 return cssValuePool().createIdentifierValue(CSSValueNormal); 1441 return cssValuePool().createIdentifierValue(CSSValueNormal);
1415 } 1442 }
1416 1443
1417 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle & style) 1444 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle & style)
1418 { 1445 {
1419 if (style.fontDescription().variant() == FontVariantSmallCaps) 1446 if (style.fontDescription().variant() == FontVariantSmallCaps)
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 return cssValuePool().createValue(style->order(), CSSPrimitiveValue: :CSS_NUMBER); 1945 return cssValuePool().createValue(style->order(), CSSPrimitiveValue: :CSS_NUMBER);
1919 case CSSPropertyFloat: 1946 case CSSPropertyFloat:
1920 if (style->display() != NONE && style->hasOutOfFlowPosition()) 1947 if (style->display() != NONE && style->hasOutOfFlowPosition())
1921 return cssValuePool().createIdentifierValue(CSSValueNone); 1948 return cssValuePool().createIdentifierValue(CSSValueNone);
1922 return cssValuePool().createValue(style->floating()); 1949 return cssValuePool().createValue(style->floating());
1923 case CSSPropertyFont: { 1950 case CSSPropertyFont: {
1924 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create (); 1951 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create ();
1925 computedFont->style = valueForFontStyle(*style); 1952 computedFont->style = valueForFontStyle(*style);
1926 computedFont->variant = valueForFontVariant(*style); 1953 computedFont->variant = valueForFontVariant(*style);
1927 computedFont->weight = valueForFontWeight(*style); 1954 computedFont->weight = valueForFontWeight(*style);
1955 computedFont->stretch = valueForFontStretch(*style);
1928 computedFont->size = valueForFontSize(*style); 1956 computedFont->size = valueForFontSize(*style);
1929 computedFont->lineHeight = valueForLineHeight(*style); 1957 computedFont->lineHeight = valueForLineHeight(*style);
1930 computedFont->family = valueForFontFamily(*style); 1958 computedFont->family = valueForFontFamily(*style);
1931 return computedFont.release(); 1959 return computedFont.release();
1932 } 1960 }
1933 case CSSPropertyFontFamily: { 1961 case CSSPropertyFontFamily: {
1934 RefPtrWillBeRawPtr<CSSValueList> fontFamilyList = valueForFontFamily (*style); 1962 RefPtrWillBeRawPtr<CSSValueList> fontFamilyList = valueForFontFamily (*style);
1935 // If there's only a single family, return that as a CSSPrimitiveVal ue. 1963 // If there's only a single family, return that as a CSSPrimitiveVal ue.
1936 // NOTE: Gecko always returns this as a comma-separated CSSPrimitive Value string. 1964 // NOTE: Gecko always returns this as a comma-separated CSSPrimitive Value string.
1937 if (fontFamilyList->length() == 1) 1965 if (fontFamilyList->length() == 1)
1938 return fontFamilyList->item(0); 1966 return fontFamilyList->item(0);
1939 return fontFamilyList.release(); 1967 return fontFamilyList.release();
1940 } 1968 }
1941 case CSSPropertyFontSize: 1969 case CSSPropertyFontSize:
1942 return valueForFontSize(*style); 1970 return valueForFontSize(*style);
1971 case CSSPropertyFontStretch:
1972 return valueForFontStretch(*style);
1943 case CSSPropertyFontStyle: 1973 case CSSPropertyFontStyle:
1944 return valueForFontStyle(*style); 1974 return valueForFontStyle(*style);
1945 case CSSPropertyFontVariant: 1975 case CSSPropertyFontVariant:
1946 return valueForFontVariant(*style); 1976 return valueForFontVariant(*style);
1947 case CSSPropertyFontWeight: 1977 case CSSPropertyFontWeight:
1948 return valueForFontWeight(*style); 1978 return valueForFontWeight(*style);
1949 case CSSPropertyWebkitFontFeatureSettings: { 1979 case CSSPropertyWebkitFontFeatureSettings: {
1950 const FontFeatureSettings* featureSettings = style->fontDescription( ).featureSettings(); 1980 const FontFeatureSettings* featureSettings = style->fontDescription( ).featureSettings();
1951 if (!featureSettings || !featureSettings->size()) 1981 if (!featureSettings || !featureSettings->size())
1952 return cssValuePool().createIdentifierValue(CSSValueNormal); 1982 return cssValuePool().createIdentifierValue(CSSValueNormal);
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 case CSSPropertyWebkitLogicalWidth: 2860 case CSSPropertyWebkitLogicalWidth:
2831 case CSSPropertyWebkitLogicalHeight: 2861 case CSSPropertyWebkitLogicalHeight:
2832 case CSSPropertyWebkitMinLogicalWidth: 2862 case CSSPropertyWebkitMinLogicalWidth:
2833 case CSSPropertyWebkitMinLogicalHeight: 2863 case CSSPropertyWebkitMinLogicalHeight:
2834 case CSSPropertyWebkitMaxLogicalWidth: 2864 case CSSPropertyWebkitMaxLogicalWidth:
2835 case CSSPropertyWebkitMaxLogicalHeight: 2865 case CSSPropertyWebkitMaxLogicalHeight:
2836 ASSERT_NOT_REACHED(); 2866 ASSERT_NOT_REACHED();
2837 break; 2867 break;
2838 2868
2839 /* Unimplemented @font-face properties */ 2869 /* Unimplemented @font-face properties */
2840 case CSSPropertyFontStretch:
2841 case CSSPropertySrc: 2870 case CSSPropertySrc:
2842 case CSSPropertyUnicodeRange: 2871 case CSSPropertyUnicodeRange:
2843 break; 2872 break;
2844 2873
2845 /* Other unimplemented properties */ 2874 /* Other unimplemented properties */
2846 case CSSPropertyPage: // for @page 2875 case CSSPropertyPage: // for @page
2847 case CSSPropertyQuotes: // FIXME: needs implementation 2876 case CSSPropertyQuotes: // FIXME: needs implementation
2848 case CSSPropertySize: // for @page 2877 case CSSPropertySize: // for @page
2849 break; 2878 break;
2850 2879
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
3117 return list.release(); 3146 return list.release();
3118 } 3147 }
3119 3148
3120 void CSSComputedStyleDeclaration::trace(Visitor* visitor) 3149 void CSSComputedStyleDeclaration::trace(Visitor* visitor)
3121 { 3150 {
3122 visitor->trace(m_node); 3151 visitor->trace(m_node);
3123 CSSStyleDeclaration::trace(visitor); 3152 CSSStyleDeclaration::trace(visitor);
3124 } 3153 }
3125 3154
3126 } // namespace blink 3155 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/css/CSSPropertyEquality.cpp ('k') | Source/core/css/CSSFontValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698