OLD | NEW |
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length
& value, const RenderStyle& style) | 127 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length
& value, const RenderStyle& style) |
128 { | 128 { |
129 return CSSPrimitiveValue::create(value, style.effectiveZoom()); | 129 return CSSPrimitiveValue::create(value, style.effectiveZoom()); |
130 } | 130 } |
131 | 131 |
132 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(co
nst String& familyName) | 132 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(co
nst String& familyName) |
133 { | 133 { |
134 RefPtrWillBeMember<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(fa
milyName, 0).storedValue->value; | 134 RefPtrWillBeMember<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(fa
milyName, nullptr).storedValue->value; |
135 if (!value) | 135 if (!value) |
136 value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STR
ING); | 136 value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STR
ING); |
137 return value; | 137 return value; |
138 } | 138 } |
139 | 139 |
140 PassRefPtrWillBeRawPtr<CSSValueList> CSSValuePool::createFontFaceValue(const Ato
micString& string) | 140 PassRefPtrWillBeRawPtr<CSSValueList> CSSValuePool::createFontFaceValue(const Ato
micString& string) |
141 { | 141 { |
142 // Just wipe out the cache and start rebuilding if it gets too big. | 142 // Just wipe out the cache and start rebuilding if it gets too big. |
143 const unsigned maximumFontFaceCacheSize = 128; | 143 const unsigned maximumFontFaceCacheSize = 128; |
144 if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize) | 144 if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize) |
145 m_fontFaceValueCache.clear(); | 145 m_fontFaceValueCache.clear(); |
146 | 146 |
147 RefPtrWillBeMember<CSSValueList>& value = m_fontFaceValueCache.add(string, 0
).storedValue->value; | 147 RefPtrWillBeMember<CSSValueList>& value = m_fontFaceValueCache.add(string, n
ullptr).storedValue->value; |
148 if (!value) | 148 if (!value) |
149 value = BisonCSSParser::parseFontFaceValue(string); | 149 value = BisonCSSParser::parseFontFaceValue(string); |
150 return value; | 150 return value; |
151 } | 151 } |
152 | 152 |
153 void CSSValuePool::trace(Visitor* visitor) | 153 void CSSValuePool::trace(Visitor* visitor) |
154 { | 154 { |
155 visitor->trace(m_inheritedValue); | 155 visitor->trace(m_inheritedValue); |
156 visitor->trace(m_implicitInitialValue); | 156 visitor->trace(m_implicitInitialValue); |
157 visitor->trace(m_explicitInitialValue); | 157 visitor->trace(m_explicitInitialValue); |
158 visitor->trace(m_identifierValueCache); | 158 visitor->trace(m_identifierValueCache); |
159 visitor->trace(m_colorValueCache); | 159 visitor->trace(m_colorValueCache); |
160 visitor->trace(m_colorTransparent); | 160 visitor->trace(m_colorTransparent); |
161 visitor->trace(m_colorWhite); | 161 visitor->trace(m_colorWhite); |
162 visitor->trace(m_colorBlack); | 162 visitor->trace(m_colorBlack); |
163 visitor->trace(m_pixelValueCache); | 163 visitor->trace(m_pixelValueCache); |
164 visitor->trace(m_percentValueCache); | 164 visitor->trace(m_percentValueCache); |
165 visitor->trace(m_numberValueCache); | 165 visitor->trace(m_numberValueCache); |
166 visitor->trace(m_fontFaceValueCache); | 166 visitor->trace(m_fontFaceValueCache); |
167 visitor->trace(m_fontFamilyValueCache); | 167 visitor->trace(m_fontFamilyValueCache); |
168 } | 168 } |
169 | 169 |
170 } | 170 } |
OLD | NEW |