blob: 99e4f96e486e1b2e35c110e1cbbd3ac4f7e7b1bc [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/css/css_font_family_value.h"
#include "third_party/blink/renderer/core/css/css_markup.h"
#include "third_party/blink/renderer/core/css/css_value_pool.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
CSSFontFamilyValue* CSSFontFamilyValue::Create(const String& family_name) {
if (family_name.IsNull())
return MakeGarbageCollected<CSSFontFamilyValue>(family_name);
CSSValuePool::FontFamilyValueCache::AddResult entry =
CssValuePool().GetFontFamilyCacheEntry(family_name);
if (!entry.stored_value->value) {
entry.stored_value->value =
MakeGarbageCollected<CSSFontFamilyValue>(family_name);
}
return entry.stored_value->value;
}
CSSFontFamilyValue::CSSFontFamilyValue(const String& str)
: CSSValue(kFontFamilyClass), string_(str) {}
String CSSFontFamilyValue::CustomCSSText() const {
return SerializeFontFamily(string_);
}
void CSSFontFamilyValue::TraceAfterDispatch(blink::Visitor* visitor) {
CSSValue::TraceAfterDispatch(visitor);
}
} // namespace blink