| 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 10 matching lines...) Expand all Loading... |
| 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/css/CSSValuePool.h" | 27 #include "core/css/CSSValuePool.h" |
| 28 | 28 |
| 29 #include "core/css/CSSValueList.h" | 29 #include "core/css/CSSValueList.h" |
| 30 #include "core/css/parser/CSSParser.h" | 30 #include "core/css/parser/CSSParser.h" |
| 31 #include "core/layout/style/LayoutStyle.h" | 31 #include "core/layout/style/ComputedStyle.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 CSSValuePool& cssValuePool() | 35 CSSValuePool& cssValuePool() |
| 36 { | 36 { |
| 37 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<CSSValuePool>, pool, (adoptPtrWil
lBeNoop(new CSSValuePool()))); | 37 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<CSSValuePool>, pool, (adoptPtrWil
lBeNoop(new CSSValuePool()))); |
| 38 return *pool; | 38 return *pool; |
| 39 } | 39 } |
| 40 | 40 |
| 41 CSSValuePool::CSSValuePool() | 41 CSSValuePool::CSSValuePool() |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return m_percentValueCache[intValue]; | 114 return m_percentValueCache[intValue]; |
| 115 case CSSPrimitiveValue::CSS_NUMBER: | 115 case CSSPrimitiveValue::CSS_NUMBER: |
| 116 if (!m_numberValueCache[intValue]) | 116 if (!m_numberValueCache[intValue]) |
| 117 m_numberValueCache[intValue] = CSSPrimitiveValue::create(value, type
); | 117 m_numberValueCache[intValue] = CSSPrimitiveValue::create(value, type
); |
| 118 return m_numberValueCache[intValue]; | 118 return m_numberValueCache[intValue]; |
| 119 default: | 119 default: |
| 120 return CSSPrimitiveValue::create(value, type); | 120 return CSSPrimitiveValue::create(value, type); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length
& value, const LayoutStyle& style) | 124 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length
& value, const ComputedStyle& style) |
| 125 { | 125 { |
| 126 return CSSPrimitiveValue::create(value, style.effectiveZoom()); | 126 return CSSPrimitiveValue::create(value, style.effectiveZoom()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(co
nst String& familyName) | 129 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(co
nst String& familyName) |
| 130 { | 130 { |
| 131 RefPtrWillBeMember<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(fa
milyName, nullptr).storedValue->value; | 131 RefPtrWillBeMember<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(fa
milyName, nullptr).storedValue->value; |
| 132 if (!value) | 132 if (!value) |
| 133 value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_CUS
TOM_IDENT); | 133 value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_CUS
TOM_IDENT); |
| 134 return value; | 134 return value; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 164 visitor->trace(m_colorBlack); | 164 visitor->trace(m_colorBlack); |
| 165 visitor->trace(m_pixelValueCache); | 165 visitor->trace(m_pixelValueCache); |
| 166 visitor->trace(m_percentValueCache); | 166 visitor->trace(m_percentValueCache); |
| 167 visitor->trace(m_numberValueCache); | 167 visitor->trace(m_numberValueCache); |
| 168 visitor->trace(m_fontFaceValueCache); | 168 visitor->trace(m_fontFaceValueCache); |
| 169 visitor->trace(m_fontFamilyValueCache); | 169 visitor->trace(m_fontFamilyValueCache); |
| 170 #endif | 170 #endif |
| 171 } | 171 } |
| 172 | 172 |
| 173 } | 173 } |
| OLD | NEW |