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

Side by Side Diff: Source/core/css/CSSValuePool.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 | « Source/core/css/CSSValuePool.h ('k') | Source/core/css/StylePropertySet.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) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 CSSValuePool::CSSValuePool() 41 CSSValuePool::CSSValuePool()
42 : m_inheritedValue(CSSInheritedValue::create()) 42 : m_inheritedValue(CSSInheritedValue::create())
43 , m_implicitInitialValue(CSSInitialValue::createImplicit()) 43 , m_implicitInitialValue(CSSInitialValue::createImplicit())
44 , m_explicitInitialValue(CSSInitialValue::createExplicit()) 44 , m_explicitInitialValue(CSSInitialValue::createExplicit())
45 , m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent)) 45 , m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent))
46 , m_colorWhite(CSSPrimitiveValue::createColor(Color::white)) 46 , m_colorWhite(CSSPrimitiveValue::createColor(Color::white))
47 , m_colorBlack(CSSPrimitiveValue::createColor(Color::black)) 47 , m_colorBlack(CSSPrimitiveValue::createColor(Color::black))
48 { 48 {
49 } 49 }
50 50
51 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(int ident) 51 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(CSSValueID ide nt)
52 { 52 {
53 if (ident <= 0 || ident >= numCSSValueKeywords) 53 if (ident <= 0)
54 return CSSPrimitiveValue::createIdentifier(ident); 54 return CSSPrimitiveValue::createIdentifier(ident);
55 55
56 if (!m_identifierValueCache[ident]) 56 if (!m_identifierValueCache[ident])
57 m_identifierValueCache[ident] = CSSPrimitiveValue::createIdentifier(iden t); 57 m_identifierValueCache[ident] = CSSPrimitiveValue::createIdentifier(iden t);
58 return m_identifierValueCache[ident]; 58 return m_identifierValueCache[ident];
59 } 59 }
60 60
61 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(CSSPropertyID ident)
62 {
63 return CSSPrimitiveValue::createIdentifier(ident);
64 }
65
61 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createColorValue(unsigned rgbValue) 66 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createColorValue(unsigned rgbValue)
62 { 67 {
63 // These are the empty and deleted values of the hash table. 68 // These are the empty and deleted values of the hash table.
64 if (rgbValue == Color::transparent) 69 if (rgbValue == Color::transparent)
65 return m_colorTransparent; 70 return m_colorTransparent;
66 if (rgbValue == Color::white) 71 if (rgbValue == Color::white)
67 return m_colorWhite; 72 return m_colorWhite;
68 // Just because it is common. 73 // Just because it is common.
69 if (rgbValue == Color::black) 74 if (rgbValue == Color::black)
70 return m_colorBlack; 75 return m_colorBlack;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 m_identifierValueCache[i] = 0; 146 m_identifierValueCache[i] = 0;
142 147
143 for (int i = 0; i < maximumCacheableIntegerValue; ++i) { 148 for (int i = 0; i < maximumCacheableIntegerValue; ++i) {
144 m_pixelValueCache[i] = 0; 149 m_pixelValueCache[i] = 0;
145 m_percentValueCache[i] = 0; 150 m_percentValueCache[i] = 0;
146 m_numberValueCache[i] = 0; 151 m_numberValueCache[i] = 0;
147 } 152 }
148 } 153 }
149 154
150 } 155 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValuePool.h ('k') | Source/core/css/StylePropertySet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698