| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 break; | 109 break; |
| 110 default: | 110 default: |
| 111 return CSSPrimitiveValue::create(value, type); | 111 return CSSPrimitiveValue::create(value, type); |
| 112 } | 112 } |
| 113 | 113 |
| 114 if (!cache[intValue]) | 114 if (!cache[intValue]) |
| 115 cache[intValue] = CSSPrimitiveValue::create(value, type); | 115 cache[intValue] = CSSPrimitiveValue::create(value, type); |
| 116 return cache[intValue]; | 116 return cache[intValue]; |
| 117 } | 117 } |
| 118 | 118 |
| 119 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length& value, con
st RenderStyle* style) | 119 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length& value, con
st RenderStyle& style) |
| 120 { | 120 { |
| 121 return CSSPrimitiveValue::create(value, style->effectiveZoom()); | 121 return CSSPrimitiveValue::create(value, style.effectiveZoom()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String&
familyName) | 124 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String&
familyName) |
| 125 { | 125 { |
| 126 RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, 0)
.iterator->value; | 126 RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, 0)
.iterator->value; |
| 127 if (!value) | 127 if (!value) |
| 128 value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STR
ING); | 128 value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STR
ING); |
| 129 return value; | 129 return value; |
| 130 } | 130 } |
| 131 | 131 |
| 132 PassRefPtr<CSSValueList> CSSValuePool::createFontFaceValue(const AtomicString& s
tring) | 132 PassRefPtr<CSSValueList> CSSValuePool::createFontFaceValue(const AtomicString& s
tring) |
| 133 { | 133 { |
| 134 // Just wipe out the cache and start rebuilding if it gets too big. | 134 // Just wipe out the cache and start rebuilding if it gets too big. |
| 135 const int maximumFontFaceCacheSize = 128; | 135 const int maximumFontFaceCacheSize = 128; |
| 136 if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize) | 136 if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize) |
| 137 m_fontFaceValueCache.clear(); | 137 m_fontFaceValueCache.clear(); |
| 138 | 138 |
| 139 RefPtr<CSSValueList>& value = m_fontFaceValueCache.add(string, 0).iterator->
value; | 139 RefPtr<CSSValueList>& value = m_fontFaceValueCache.add(string, 0).iterator->
value; |
| 140 if (!value) | 140 if (!value) |
| 141 value = CSSParser::parseFontFaceValue(string); | 141 value = CSSParser::parseFontFaceValue(string); |
| 142 return value; | 142 return value; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } | 145 } |
| OLD | NEW |