| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 RefPtrWillBeRawPtr<CSSPrimitiveValue> dummyValue = nullptr; | 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 (std::isinf(value)) |
| 101 value = 0; |
| 102 |
| 100 if (value < 0 || value > maximumCacheableIntegerValue) | 103 if (value < 0 || value > maximumCacheableIntegerValue) |
| 101 return CSSPrimitiveValue::create(value, type); | 104 return CSSPrimitiveValue::create(value, type); |
| 102 | 105 |
| 103 int intValue = static_cast<int>(value); | 106 int intValue = static_cast<int>(value); |
| 104 if (value != intValue) | 107 if (value != intValue) |
| 105 return CSSPrimitiveValue::create(value, type); | 108 return CSSPrimitiveValue::create(value, type); |
| 106 | 109 |
| 107 switch (type) { | 110 switch (type) { |
| 108 case CSSPrimitiveValue::CSS_PX: | 111 case CSSPrimitiveValue::CSS_PX: |
| 109 if (!m_pixelValueCache[intValue]) | 112 if (!m_pixelValueCache[intValue]) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 visitor->trace(m_colorWhite); | 162 visitor->trace(m_colorWhite); |
| 160 visitor->trace(m_colorBlack); | 163 visitor->trace(m_colorBlack); |
| 161 visitor->trace(m_pixelValueCache); | 164 visitor->trace(m_pixelValueCache); |
| 162 visitor->trace(m_percentValueCache); | 165 visitor->trace(m_percentValueCache); |
| 163 visitor->trace(m_numberValueCache); | 166 visitor->trace(m_numberValueCache); |
| 164 visitor->trace(m_fontFaceValueCache); | 167 visitor->trace(m_fontFaceValueCache); |
| 165 visitor->trace(m_fontFamilyValueCache); | 168 visitor->trace(m_fontFamilyValueCache); |
| 166 } | 169 } |
| 167 | 170 |
| 168 } | 171 } |
| OLD | NEW |