1 /**
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20 #include "config.h"
21 #include "core/css/CSSFontValue.h"
22
23 #include "core/css/CSSPrimitiveValue.h"
24 #include "core/css/CSSValueList.h"
25 #include "wtf/text/StringBuilder.h"
26
27 namespace blink {
28
customCSSText() const29 String CSSFontValue::customCSSText() const
30 {
31 // font variant weight size / line-height family
32
33 StringBuilder result;
34
35 if (style)
36 result.append(style->cssText());
37 if (variant) {
38 if (!result.isEmpty())
39 result.append(' ');
40 result.append(variant->cssText());
41 }
42 if (weight) {
43 if (!result.isEmpty())
44 result.append(' ');
45 result.append(weight->cssText());
46 }
47 if (stretch) {
48 if (!result.isEmpty())
49 result.append(' ');
50 result.append(stretch->cssText());
51 }
52 if (size) {
53 if (!result.isEmpty())
54 result.append(' ');
55 result.append(size->cssText());
56 }
57 if (lineHeight) {
58 if (!size)
59 result.append(' ');
60 result.append('/');
61 result.append(lineHeight->cssText());
62 }
63 if (family) {
64 if (!result.isEmpty())
65 result.append(' ');
66 result.append(family->cssText());
67 }
68
69 return result.toString();
70 }
71
equals(const CSSFontValue & other) const72 bool CSSFontValue::equals(const CSSFontValue& other) const
73 {
74 return compareCSSValuePtr(style, other.style)
75 && compareCSSValuePtr(variant, other.variant)
76 && compareCSSValuePtr(weight, other.weight)
77 && compareCSSValuePtr(stretch, other.stretch)
78 && compareCSSValuePtr(size, other.size)
79 && compareCSSValuePtr(lineHeight, other.lineHeight)
80 && compareCSSValuePtr(family, other.family);
81 }
82
traceAfterDispatch(Visitor * visitor)83 void CSSFontValue::traceAfterDispatch(Visitor* visitor)
84 {
85 visitor->trace(style);
86 visitor->trace(variant);
87 visitor->trace(weight);
88 visitor->trace(stretch);
89 visitor->trace(size);
90 visitor->trace(lineHeight);
91 visitor->trace(family);
92 CSSValue::traceAfterDispatch(visitor);
93 }
94
95 }
96