| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return m_colorWhite; | 81 return m_colorWhite; |
| 82 // Just because it is common. | 82 // Just because it is common. |
| 83 if (rgbValue == Color::black) | 83 if (rgbValue == Color::black) |
| 84 return m_colorBlack; | 84 return m_colorBlack; |
| 85 | 85 |
| 86 // Just wipe out the cache and start rebuilding if it gets too big. | 86 // Just wipe out the cache and start rebuilding if it gets too big. |
| 87 const unsigned maximumColorCacheSize = 512; | 87 const unsigned maximumColorCacheSize = 512; |
| 88 if (m_colorValueCache.size() > maximumColorCacheSize) | 88 if (m_colorValueCache.size() > maximumColorCacheSize) |
| 89 m_colorValueCache.clear(); | 89 m_colorValueCache.clear(); |
| 90 | 90 |
| 91 RefPtrWillBeRawPtr<CSSPrimitiveValue> dummyValue; | 91 RefPtrWillBeRawPtr<CSSPrimitiveValue> dummyValue = nullptr; |
| 92 ColorValueCache::AddResult entry = m_colorValueCache.add(rgbValue, dummyValu
e); | 92 ColorValueCache::AddResult entry = m_colorValueCache.add(rgbValue, dummyValu
e); |
| 93 if (entry.isNewEntry) | 93 if (entry.isNewEntry) |
| 94 entry.storedValue->value = CSSPrimitiveValue::createColor(rgbValue); | 94 entry.storedValue->value = CSSPrimitiveValue::createColor(rgbValue); |
| 95 return entry.storedValue->value; | 95 return entry.storedValue->value; |
| 96 } | 96 } |
| 97 | 97 |
| 98 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(double value
, CSSPrimitiveValue::UnitTypes type) | 98 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(double value
, CSSPrimitiveValue::UnitTypes type) |
| 99 { | 99 { |
| 100 if (value < 0 || value > maximumCacheableIntegerValue) | 100 if (value < 0 || value > maximumCacheableIntegerValue) |
| 101 return CSSPrimitiveValue::create(value, type); | 101 return CSSPrimitiveValue::create(value, type); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 visitor->trace(m_colorWhite); | 159 visitor->trace(m_colorWhite); |
| 160 visitor->trace(m_colorBlack); | 160 visitor->trace(m_colorBlack); |
| 161 visitor->trace(m_pixelValueCache); | 161 visitor->trace(m_pixelValueCache); |
| 162 visitor->trace(m_percentValueCache); | 162 visitor->trace(m_percentValueCache); |
| 163 visitor->trace(m_numberValueCache); | 163 visitor->trace(m_numberValueCache); |
| 164 visitor->trace(m_fontFaceValueCache); | 164 visitor->trace(m_fontFaceValueCache); |
| 165 visitor->trace(m_fontFamilyValueCache); | 165 visitor->trace(m_fontFamilyValueCache); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } | 168 } |
| OLD | NEW |