OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef FontBuilder_h | 23 #ifndef FontBuilder_h |
24 #define FontBuilder_h | 24 #define FontBuilder_h |
25 | 25 |
26 #include "core/CSSValueKeywords.h" | 26 #include "core/CSSValueKeywords.h" |
27 | 27 #include "core/css/FontSize.h" |
28 #include "platform/fonts/FontDescription.h" | 28 #include "platform/fonts/FontDescription.h" |
29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
30 #include "wtf/PassRefPtr.h" | 30 #include "wtf/PassRefPtr.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class CSSValue; | 34 class CSSValue; |
35 class FontSelector; | 35 class FontSelector; |
36 class RenderStyle; | 36 class RenderStyle; |
37 | 37 |
(...skipping 12 matching lines...) Expand all Loading... |
50 | 50 |
51 void didChangeFontParameters(bool); | 51 void didChangeFontParameters(bool); |
52 | 52 |
53 void inheritFrom(const FontDescription&); | 53 void inheritFrom(const FontDescription&); |
54 void fromSystemFont(CSSValueID, float effectiveZoom); | 54 void fromSystemFont(CSSValueID, float effectiveZoom); |
55 | 55 |
56 void setFontFamilyInitial(); | 56 void setFontFamilyInitial(); |
57 void setFontFamilyInherit(const FontDescription&); | 57 void setFontFamilyInherit(const FontDescription&); |
58 void setFontFamilyValue(CSSValue*); | 58 void setFontFamilyValue(CSSValue*); |
59 | 59 |
60 void setFontSizeInitial(); | |
61 void setFontSizeInherit(const FontDescription&); | |
62 void setFontSizeValue(CSSValue*, RenderStyle* parentStyle, const RenderStyle
* rootElementStyle); | |
63 | |
64 void setWeight(FontWeight); | 60 void setWeight(FontWeight); |
| 61 void setSize(const FontDescription::Size&); |
65 void setStretch(FontStretch); | 62 void setStretch(FontStretch); |
66 void setFeatureSettings(PassRefPtr<FontFeatureSettings>); | 63 void setFeatureSettings(PassRefPtr<FontFeatureSettings>); |
67 void setScript(const String& locale); | 64 void setScript(const String& locale); |
68 void setStyle(FontStyle); | 65 void setStyle(FontStyle); |
69 void setVariant(FontVariant); | 66 void setVariant(FontVariant); |
70 void setVariantLigatures(const FontDescription::VariantLigatures&); | 67 void setVariantLigatures(const FontDescription::VariantLigatures&); |
71 void setTextRendering(TextRenderingMode); | 68 void setTextRendering(TextRenderingMode); |
72 void setKerning(FontDescription::Kerning); | 69 void setKerning(FontDescription::Kerning); |
73 void setFontSmoothing(FontSmoothingMode); | 70 void setFontSmoothing(FontSmoothingMode); |
74 | 71 |
75 // FIXME: These need to just vend a Font object eventually. | 72 // FIXME: These need to just vend a Font object eventually. |
76 void createFont(PassRefPtrWillBeRawPtr<FontSelector>, const RenderStyle* par
entStyle, RenderStyle*); | 73 void createFont(PassRefPtrWillBeRawPtr<FontSelector>, const RenderStyle* par
entStyle, RenderStyle*); |
77 // FIXME: This is nearly static, should either made fully static or decompos
ed into | 74 |
78 // FontBuilder calls at the callsite. | |
79 void createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle
*); | 75 void createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle
*); |
80 | 76 |
81 bool fontSizeHasViewportUnits() { return m_fontSizehasViewportUnits; } | |
82 | |
83 // FIXME: These should not be necessary eventually. | 77 // FIXME: These should not be necessary eventually. |
84 void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; } | 78 void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; } |
85 // FIXME: This is only used by an ASSERT in StyleResolver. Remove? | 79 // FIXME: This is only used by an ASSERT in StyleResolver. Remove? |
86 bool fontDirty() const { return m_fontDirty; } | 80 bool fontDirty() const { return m_fontDirty; } |
87 | 81 |
88 static FontFeatureSettings* initialFeatureSettings() { return nullptr; } | 82 static FontFeatureSettings* initialFeatureSettings() { return nullptr; } |
89 static FontDescription::GenericFamilyType initialGenericFamily() { return Fo
ntDescription::NoFamily; } | 83 static FontDescription::GenericFamilyType initialGenericFamily() { return Fo
ntDescription::NoFamily; } |
| 84 static FontDescription::Size initialSize() { return FontDescription::Size(Fo
ntSize::initialKeywordSize(), 0.0f, false); } |
90 static TextRenderingMode initialTextRendering() { return AutoTextRendering;
} | 85 static TextRenderingMode initialTextRendering() { return AutoTextRendering;
} |
91 static FontVariant initialVariant() { return FontVariantNormal; } | 86 static FontVariant initialVariant() { return FontVariantNormal; } |
92 static FontDescription::VariantLigatures initialVariantLigatures() { return
FontDescription::VariantLigatures(); } | 87 static FontDescription::VariantLigatures initialVariantLigatures() { return
FontDescription::VariantLigatures(); } |
93 static FontStyle initialStyle() { return FontStyleNormal; } | 88 static FontStyle initialStyle() { return FontStyleNormal; } |
94 static FontDescription::Kerning initialKerning() { return FontDescription::A
utoKerning; } | 89 static FontDescription::Kerning initialKerning() { return FontDescription::A
utoKerning; } |
95 static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; } | 90 static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; } |
96 static FontStretch initialStretch() { return FontStretchNormal; } | 91 static FontStretch initialStretch() { return FontStretchNormal; } |
97 static FontWeight initialWeight() { return FontWeightNormal; } | 92 static FontWeight initialWeight() { return FontWeightNormal; } |
98 | 93 |
99 friend class FontDescriptionChangeScope; | 94 friend class FontDescriptionChangeScope; |
100 | 95 |
101 private: | 96 private: |
102 | 97 |
103 // FIXME: "size" arg should be first for consistency with other similar func
tions. | 98 // FIXME: "size" arg should be first for consistency with other similar func
tions. |
104 void setSize(FontDescription&, float effectiveZoom, float size); | 99 void setSize(FontDescription&, const FontDescription::Size&); |
105 void checkForOrientationChange(RenderStyle*); | 100 void checkForOrientationChange(RenderStyle*); |
106 // This function fixes up the default font size if it detects that the curre
nt generic font family has changed. -dwh | 101 // This function fixes up the default font size if it detects that the curre
nt generic font family has changed. -dwh |
107 void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyl
e); | 102 void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyl
e); |
108 void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle); | 103 void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle); |
| 104 void updateComputedSize(FontDescription&, float effectiveZoom); |
109 | 105 |
110 float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom
, float specifiedSize); | 106 float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom
, float specifiedSize); |
111 | 107 |
112 RawPtrWillBeMember<const Document> m_document; | 108 RawPtrWillBeMember<const Document> m_document; |
113 bool m_fontSizehasViewportUnits; | |
114 // FIXME: This member is here on a short-term lease. The plan is to remove | 109 // FIXME: This member is here on a short-term lease. The plan is to remove |
115 // any notion of RenderStyle from here, allowing FontBuilder to build Font o
bjects | 110 // any notion of RenderStyle from here, allowing FontBuilder to build Font o
bjects |
116 // directly, rather than as a byproduct of calling RenderStyle::setFontDescr
iption. | 111 // directly, rather than as a byproduct of calling RenderStyle::setFontDescr
iption. |
117 // FontDescriptionChangeScope should be the only consumer of this member. | 112 // FontDescriptionChangeScope should be the only consumer of this member. |
118 // If you're using it, U R DOIN IT WRONG. | 113 // If you're using it, U R DOIN IT WRONG. |
119 RenderStyle* m_style; | 114 RenderStyle* m_style; |
120 | 115 |
121 // Fontbuilder is responsbile for creating the Font() | 116 // Fontbuilder is responsbile for creating the Font() |
122 // object on RenderStyle from various other font-related | 117 // object on RenderStyle from various other font-related |
123 // properties on RenderStyle. Whenever one of those | 118 // properties on RenderStyle. Whenever one of those |
124 // is changed, FontBuilder tracks the need to update | 119 // is changed, FontBuilder tracks the need to update |
125 // style->font() with this bool. | 120 // style->font() with this bool. |
126 bool m_fontDirty; | 121 bool m_fontDirty; |
127 | 122 |
128 friend class FontBuilderTest; | 123 friend class FontBuilderTest; |
129 }; | 124 }; |
130 | 125 |
131 } | 126 } |
132 | 127 |
133 #endif | 128 #endif |
OLD | NEW |