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

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

Issue 16339006: Make sure to use CSSValueID and CSSPropertyID rather than integers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | « no previous file | Source/core/css/CSSGrammar.y.in » ('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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 }; 383 };
384 384
385 static const Vector<CSSPropertyID>& computableProperties() 385 static const Vector<CSSPropertyID>& computableProperties()
386 { 386 {
387 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); 387 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
388 if (properties.isEmpty()) 388 if (properties.isEmpty())
389 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticComputable Properties, WTF_ARRAY_LENGTH(staticComputableProperties), properties); 389 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticComputable Properties, WTF_ARRAY_LENGTH(staticComputableProperties), properties);
390 return properties; 390 return properties;
391 } 391 }
392 392
393 static int valueForRepeatRule(int rule) 393 static CSSValueID valueForRepeatRule(int rule)
394 { 394 {
395 switch (rule) { 395 switch (rule) {
396 case RepeatImageRule: 396 case RepeatImageRule:
397 return CSSValueRepeat; 397 return CSSValueRepeat;
398 case RoundImageRule: 398 case RoundImageRule:
399 return CSSValueRound; 399 return CSSValueRound;
400 case SpaceImageRule: 400 case SpaceImageRule:
401 return CSSValueSpace; 401 return CSSValueSpace;
402 default: 402 default:
403 return CSSValueStretch; 403 return CSSValueStretch;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1216 }
1217 1217
1218 return result.toString(); 1218 return result.toString();
1219 } 1219 }
1220 1220
1221 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec) 1221 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
1222 { 1222 {
1223 ec = NO_MODIFICATION_ALLOWED_ERR; 1223 ec = NO_MODIFICATION_ALLOWED_ERR;
1224 } 1224 }
1225 1225
1226 static int cssIdentifierForFontSizeKeyword(int keywordSize) 1226 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
1227 { 1227 {
1228 ASSERT_ARG(keywordSize, keywordSize); 1228 ASSERT_ARG(keywordSize, keywordSize);
1229 ASSERT_ARG(keywordSize, keywordSize <= 8); 1229 ASSERT_ARG(keywordSize, keywordSize <= 8);
1230 return CSSValueXxSmall + keywordSize - 1; 1230 return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1);
1231 } 1231 }
1232 1232
1233 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK eyword() const 1233 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK eyword() const
1234 { 1234 {
1235 if (!m_node) 1235 if (!m_node)
1236 return 0; 1236 return 0;
1237 1237
1238 m_node->document()->updateLayoutIgnorePendingStylesheets(); 1238 m_node->document()->updateLayoutIgnorePendingStylesheets();
1239 1239
1240 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); 1240 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 list->prepend(ShadowValue::create(x.release(), y.release(), blur.release (), spread.release(), style.release(), color.release())); 1276 list->prepend(ShadowValue::create(x.release(), y.release(), blur.release (), spread.release(), style.release(), color.release()));
1277 } 1277 }
1278 return list.release(); 1278 return list.release();
1279 } 1279 }
1280 1280
1281 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert yID propertyID) const 1281 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert yID propertyID) const
1282 { 1282 {
1283 return getPropertyCSSValue(propertyID, UpdateLayout); 1283 return getPropertyCSSValue(propertyID, UpdateLayout);
1284 } 1284 }
1285 1285
1286 static int identifierForFamily(const AtomicString& family) 1286 static CSSValueID identifierForFamily(const AtomicString& family)
1287 { 1287 {
1288 if (family == cursiveFamily) 1288 if (family == cursiveFamily)
1289 return CSSValueCursive; 1289 return CSSValueCursive;
1290 if (family == fantasyFamily) 1290 if (family == fantasyFamily)
1291 return CSSValueFantasy; 1291 return CSSValueFantasy;
1292 if (family == monospaceFamily) 1292 if (family == monospaceFamily)
1293 return CSSValueMonospace; 1293 return CSSValueMonospace;
1294 if (family == pictographFamily) 1294 if (family == pictographFamily)
1295 return CSSValueWebkitPictograph; 1295 return CSSValueWebkitPictograph;
1296 if (family == sansSerifFamily) 1296 if (family == sansSerifFamily)
1297 return CSSValueSansSerif; 1297 return CSSValueSansSerif;
1298 if (family == serifFamily) 1298 if (family == serifFamily)
1299 return CSSValueSerif; 1299 return CSSValueSerif;
1300 return 0; 1300 return CSSValueInvalid;
1301 } 1301 }
1302 1302
1303 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family) 1303 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
1304 { 1304 {
1305 if (int familyIdentifier = identifierForFamily(family)) 1305 if (CSSValueID familyIdentifier = identifierForFamily(family))
1306 return cssValuePool().createIdentifierValue(familyIdentifier); 1306 return cssValuePool().createIdentifierValue(familyIdentifier);
1307 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_ST RING); 1307 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_ST RING);
1308 } 1308 }
1309 1309
1310 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecorati on) 1310 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecorati on)
1311 { 1311 {
1312 // Blink value is ignored. 1312 // Blink value is ignored.
1313 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1313 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1314 if (textDecoration & TextDecorationUnderline) 1314 if (textDecoration & TextDecorationUnderline)
1315 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); 1315 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3000 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3001 CSSPropertyB ackgroundClip }; 3001 CSSPropertyB ackgroundClip };
3002 3002
3003 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3003 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3004 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperat or)))); 3004 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperat or))));
3005 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator )))); 3005 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator ))));
3006 return list.release(); 3006 return list.release();
3007 } 3007 }
3008 3008
3009 } // namespace WebCore 3009 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSGrammar.y.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698