| 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 * |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 class FontBuilder { | 40 class FontBuilder { |
| 41 STACK_ALLOCATED(); | 41 STACK_ALLOCATED(); |
| 42 WTF_MAKE_NONCOPYABLE(FontBuilder); | 42 WTF_MAKE_NONCOPYABLE(FontBuilder); |
| 43 public: | 43 public: |
| 44 FontBuilder(); | 44 FontBuilder(); |
| 45 | 45 |
| 46 // FIXME: The name is probably wrong, but matches StyleResolverState callsit
e for consistency. | 46 // FIXME: The name is probably wrong, but matches StyleResolverState callsit
e for consistency. |
| 47 void initForStyleResolve(const Document&, RenderStyle*); | 47 void initForStyleResolve(const Document&, RenderStyle*); |
| 48 | 48 |
| 49 void setInitial(float effectiveZoom); | 49 void setInitial(); |
| 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); |
| 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(); | 60 void setFontSizeInitial(); |
| 61 void setFontSizeInherit(const FontDescription&); | 61 void setFontSizeInherit(const FontDescription&); |
| 62 void setFontSizeValue(CSSValue*, RenderStyle* parentStyle, const RenderStyle
* rootElementStyle); | 62 void setFontSizeValue(CSSValue*, RenderStyle* parentStyle, const RenderStyle
* rootElementStyle); |
| 63 | 63 |
| 64 void setWeight(FontWeight); | 64 void setWeight(FontWeight); |
| 65 void setStretch(FontStretch); | 65 void setStretch(FontStretch); |
| 66 void setFeatureSettings(PassRefPtr<FontFeatureSettings>); | 66 void setFeatureSettings(PassRefPtr<FontFeatureSettings>); |
| 67 void setScript(const String& locale); | 67 void setScript(const String& locale); |
| 68 void setStyle(FontStyle); | 68 void setStyle(FontStyle); |
| 69 void setVariant(FontVariant); | 69 void setVariant(FontVariant); |
| 70 void setVariantLigatures(const FontDescription::VariantLigatures&); | 70 void setVariantLigatures(const FontDescription::VariantLigatures&); |
| 71 void setTextRendering(TextRenderingMode); | 71 void setTextRendering(TextRenderingMode); |
| 72 void setKerning(FontDescription::Kerning); | 72 void setKerning(FontDescription::Kerning); |
| 73 void setFontSmoothing(FontSmoothingMode); | 73 void setFontSmoothing(FontSmoothingMode); |
| 74 | 74 |
| 75 // FIXME: These need to just vend a Font object eventually. | 75 // FIXME: These need to just vend a Font object eventually. |
| 76 void createFont(PassRefPtr<FontSelector>, const RenderStyle* parentStyle, Re
nderStyle*); | 76 void createFont(PassRefPtr<FontSelector>, const RenderStyle* parentStyle, Re
nderStyle*); |
| 77 // FIXME: This is nearly static, should either made fully static or decompos
ed into | 77 // FIXME: This is nearly static, should either made fully static or decompos
ed into |
| 78 // FontBuilder calls at the callsite. | 78 // FontBuilder calls at the callsite. |
| 79 void createFontForDocument(PassRefPtr<FontSelector>, RenderStyle*); | 79 void createFontForDocument(PassRefPtr<FontSelector>, RenderStyle*); |
| 80 | 80 |
| 81 bool fontSizeHasViewportUnits() { return m_fontSizehasViewportUnits; } | 81 bool fontSizeHasViewportUnits() { return m_fontSizehasViewportUnits; } |
| 82 | 82 |
| 83 // FIXME: These should not be necessary eventually. | |
| 84 void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; } | |
| 85 // FIXME: This is only used by an ASSERT in StyleResolver. Remove? | 83 // FIXME: This is only used by an ASSERT in StyleResolver. Remove? |
| 86 bool fontDirty() const { return m_fontDirty; } | 84 bool fontDirty() const { return m_fontDirty; } |
| 87 | 85 |
| 88 static FontFeatureSettings* initialFeatureSettings() { return nullptr; } | 86 static FontFeatureSettings* initialFeatureSettings() { return nullptr; } |
| 89 static FontDescription::GenericFamilyType initialGenericFamily() { return Fo
ntDescription::NoFamily; } | 87 static FontDescription::GenericFamilyType initialGenericFamily() { return Fo
ntDescription::NoFamily; } |
| 90 static TextRenderingMode initialTextRendering() { return AutoTextRendering;
} | 88 static TextRenderingMode initialTextRendering() { return AutoTextRendering;
} |
| 91 static FontVariant initialVariant() { return FontVariantNormal; } | 89 static FontVariant initialVariant() { return FontVariantNormal; } |
| 92 static FontDescription::VariantLigatures initialVariantLigatures() { return
FontDescription::VariantLigatures(); } | 90 static FontDescription::VariantLigatures initialVariantLigatures() { return
FontDescription::VariantLigatures(); } |
| 93 static FontStyle initialStyle() { return FontStyleNormal; } | 91 static FontStyle initialStyle() { return FontStyleNormal; } |
| 94 static FontDescription::Kerning initialKerning() { return FontDescription::A
utoKerning; } | 92 static FontDescription::Kerning initialKerning() { return FontDescription::A
utoKerning; } |
| 95 static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; } | 93 static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; } |
| 96 static FontStretch initialStretch() { return FontStretchNormal; } | 94 static FontStretch initialStretch() { return FontStretchNormal; } |
| 97 static FontWeight initialWeight() { return FontWeightNormal; } | 95 static FontWeight initialWeight() { return FontWeightNormal; } |
| 98 | 96 |
| 99 friend class FontDescriptionChangeScope; | 97 friend class FontDescriptionChangeScope; |
| 100 | 98 |
| 101 private: | 99 private: |
| 102 | 100 |
| 103 // FIXME: "size" arg should be first for consistency with other similar func
tions. | 101 // FIXME: "size" arg should be first for consistency with other similar func
tions. |
| 104 void setSize(FontDescription&, float effectiveZoom, float size); | 102 void setSize(FontDescription&, float size); |
| 105 void checkForOrientationChange(RenderStyle*); | 103 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 | 104 // 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); | 105 void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyl
e); |
| 108 void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle); | 106 void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle); |
| 109 | 107 |
| 110 float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom
, float specifiedSize); | 108 float getComputedSizeFromSpecifiedSize(FontDescription&, float specifiedSize
); |
| 111 | 109 |
| 112 RawPtr<const Document> m_document; | 110 RawPtr<const Document> m_document; |
| 113 bool m_fontSizehasViewportUnits; | 111 bool m_fontSizehasViewportUnits; |
| 114 // FIXME: This member is here on a short-term lease. The plan is to remove | 112 // 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 | 113 // 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. | 114 // directly, rather than as a byproduct of calling RenderStyle::setFontDescr
iption. |
| 117 // FontDescriptionChangeScope should be the only consumer of this member. | 115 // FontDescriptionChangeScope should be the only consumer of this member. |
| 118 // If you're using it, U R DOIN IT WRONG. | 116 // If you're using it, U R DOIN IT WRONG. |
| 119 RenderStyle* m_style; | 117 RenderStyle* m_style; |
| 120 | 118 |
| 121 // Fontbuilder is responsbile for creating the Font() | 119 // Fontbuilder is responsbile for creating the Font() |
| 122 // object on RenderStyle from various other font-related | 120 // object on RenderStyle from various other font-related |
| 123 // properties on RenderStyle. Whenever one of those | 121 // properties on RenderStyle. Whenever one of those |
| 124 // is changed, FontBuilder tracks the need to update | 122 // is changed, FontBuilder tracks the need to update |
| 125 // style->font() with this bool. | 123 // style->font() with this bool. |
| 126 bool m_fontDirty; | 124 bool m_fontDirty; |
| 127 | 125 |
| 128 friend class FontBuilderTest; | 126 friend class FontBuilderTest; |
| 129 }; | 127 }; |
| 130 | 128 |
| 131 } | 129 } |
| 132 | 130 |
| 133 #endif | 131 #endif |
| OLD | NEW |