| 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/CSSFontFamilyValue.h" | 5 #include "core/css/CSSFontFamilyValue.h" |
| 6 | 6 |
| 7 #include "core/css/CSSMarkup.h" | 7 #include "core/css/CSSMarkup.h" |
| 8 #include "core/css/CSSValuePool.h" | 8 #include "core/css/CSSValuePool.h" |
| 9 #include "wtf/text/WTFString.h" | 9 #include "platform/wtf/text/WTFString.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 CSSFontFamilyValue* CSSFontFamilyValue::Create(const String& family_name) { | 13 CSSFontFamilyValue* CSSFontFamilyValue::Create(const String& family_name) { |
| 14 if (family_name.IsNull()) | 14 if (family_name.IsNull()) |
| 15 return new CSSFontFamilyValue(family_name); | 15 return new CSSFontFamilyValue(family_name); |
| 16 CSSValuePool::FontFamilyValueCache::AddResult entry = | 16 CSSValuePool::FontFamilyValueCache::AddResult entry = |
| 17 CssValuePool().GetFontFamilyCacheEntry(family_name); | 17 CssValuePool().GetFontFamilyCacheEntry(family_name); |
| 18 if (!entry.stored_value->value) | 18 if (!entry.stored_value->value) |
| 19 entry.stored_value->value = new CSSFontFamilyValue(family_name); | 19 entry.stored_value->value = new CSSFontFamilyValue(family_name); |
| 20 return entry.stored_value->value; | 20 return entry.stored_value->value; |
| 21 } | 21 } |
| 22 | 22 |
| 23 CSSFontFamilyValue::CSSFontFamilyValue(const String& str) | 23 CSSFontFamilyValue::CSSFontFamilyValue(const String& str) |
| 24 : CSSValue(kFontFamilyClass), string_(str) {} | 24 : CSSValue(kFontFamilyClass), string_(str) {} |
| 25 | 25 |
| 26 String CSSFontFamilyValue::CustomCSSText() const { | 26 String CSSFontFamilyValue::CustomCSSText() const { |
| 27 return SerializeFontFamily(string_); | 27 return SerializeFontFamily(string_); |
| 28 } | 28 } |
| 29 | 29 |
| 30 DEFINE_TRACE_AFTER_DISPATCH(CSSFontFamilyValue) { | 30 DEFINE_TRACE_AFTER_DISPATCH(CSSFontFamilyValue) { |
| 31 CSSValue::TraceAfterDispatch(visitor); | 31 CSSValue::TraceAfterDispatch(visitor); |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace blink | 34 } // namespace blink |
| OLD | NEW |