| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/CSSColorValue.h" | 5 #include "core/css/CSSColorValue.h" |
| 6 | 6 |
| 7 #include "core/css/CSSValuePool.h" | 7 #include "core/css/CSSValuePool.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 namespace cssvalue { |
| 10 | 11 |
| 11 CSSColorValue* CSSColorValue::create(RGBA32 color) { | 12 CSSColorValue* CSSColorValue::create(RGBA32 color) { |
| 12 // These are the empty and deleted values of the hash table. | 13 // These are the empty and deleted values of the hash table. |
| 13 if (color == Color::transparent) | 14 if (color == Color::transparent) |
| 14 return cssValuePool().transparentColor(); | 15 return cssValuePool().transparentColor(); |
| 15 if (color == Color::white) | 16 if (color == Color::white) |
| 16 return cssValuePool().whiteColor(); | 17 return cssValuePool().whiteColor(); |
| 17 // Just because it is common. | 18 // Just because it is common. |
| 18 if (color == Color::black) | 19 if (color == Color::black) |
| 19 return cssValuePool().blackColor(); | 20 return cssValuePool().blackColor(); |
| 20 | 21 |
| 21 CSSValuePool::ColorValueCache::AddResult entry = | 22 CSSValuePool::ColorValueCache::AddResult entry = |
| 22 cssValuePool().getColorCacheEntry(color); | 23 cssValuePool().getColorCacheEntry(color); |
| 23 if (entry.isNewEntry) | 24 if (entry.isNewEntry) |
| 24 entry.storedValue->value = new CSSColorValue(color); | 25 entry.storedValue->value = new CSSColorValue(color); |
| 25 return entry.storedValue->value; | 26 return entry.storedValue->value; |
| 26 } | 27 } |
| 27 | 28 |
| 29 } // namespace cssvalue |
| 28 } // namespace blink | 30 } // namespace blink |
| OLD | NEW |