| 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 25 matching lines...) Expand all Loading... |
| 36 class RenderStyle; | 36 class RenderStyle; |
| 37 | 37 |
| 38 class FontDescriptionChangeScope; | 38 class FontDescriptionChangeScope; |
| 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(const Document&); | 44 FontBuilder(const Document&); |
| 45 | 45 |
| 46 void setStyle(RenderStyle* style) { m_style = style; } | 46 void setFontDescription(const FontDescription& fd) { m_fontDescription = fd;
} |
| 47 const FontDescription& fontDescription() const { return m_fontDescription; } |
| 48 |
| 47 void setInitial(float effectiveZoom); | 49 void setInitial(float effectiveZoom); |
| 48 | 50 |
| 49 void didChangeFontParameters(bool); | 51 void didChangeFontParameters(bool); |
| 50 | 52 |
| 51 void inheritFrom(const FontDescription&); | 53 void inheritFrom(const FontDescription&); |
| 52 | 54 |
| 53 FontFamily standardFontFamily() const; | 55 FontFamily standardFontFamily() const; |
| 54 AtomicString standardFontFamilyName() const; | 56 AtomicString standardFontFamilyName() const; |
| 55 AtomicString genericFontFamilyName(FontDescription::GenericFamilyType) const
; | 57 AtomicString genericFontFamilyName(FontDescription::GenericFamilyType) const
; |
| 56 | 58 |
| 57 void setWeight(FontWeight); | 59 void setWeight(FontWeight); |
| 58 void setSize(const FontDescription::Size&); | 60 void setSize(const FontDescription::Size&); |
| 59 void setStretch(FontStretch); | 61 void setStretch(FontStretch); |
| 60 void setFamilyDescription(const FontDescription::FamilyDescription&); | 62 void setFamilyDescription(const FontDescription::FamilyDescription&); |
| 61 void setFeatureSettings(PassRefPtr<FontFeatureSettings>); | 63 void setFeatureSettings(PassRefPtr<FontFeatureSettings>); |
| 62 void setScript(const String& locale); | 64 void setScript(const String& locale); |
| 63 void setStyle(FontStyle); | 65 void setStyle(FontStyle); |
| 64 void setVariant(FontVariant); | 66 void setVariant(FontVariant); |
| 65 void setVariantLigatures(const FontDescription::VariantLigatures&); | 67 void setVariantLigatures(const FontDescription::VariantLigatures&); |
| 66 void setTextRendering(TextRenderingMode); | 68 void setTextRendering(TextRenderingMode); |
| 67 void setKerning(FontDescription::Kerning); | 69 void setKerning(FontDescription::Kerning); |
| 68 void setFontSmoothing(FontSmoothingMode); | 70 void setFontSmoothing(FontSmoothingMode); |
| 69 | 71 |
| 70 // FIXME: These need to just vend a Font object eventually. | 72 // FIXME: These need to just vend a Font object eventually. |
| 71 void createFont(PassRefPtrWillBeRawPtr<FontSelector>, const RenderStyle* par
entStyle, RenderStyle*); | 73 void createFont(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle*, const Re
nderStyle* parentStyle); |
| 72 | 74 |
| 73 void createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle
*); | 75 void createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle
*); |
| 74 | 76 |
| 75 // FIXME: These should not be necessary eventually. | 77 // FIXME: These should not be necessary eventually. |
| 76 void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; } | 78 void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; } |
| 77 // FIXME: This is only used by an ASSERT in StyleResolver. Remove? | 79 // FIXME: This is only used by an ASSERT in StyleResolver. Remove? |
| 78 bool fontDirty() const { return m_fontDirty; } | 80 bool fontDirty() const { return m_fontDirty; } |
| 79 | 81 |
| 80 static FontDescription::FamilyDescription initialFamilyDescription() { retur
n FontDescription::FamilyDescription(initialGenericFamily()); } | 82 static FontDescription::FamilyDescription initialFamilyDescription() { retur
n FontDescription::FamilyDescription(initialGenericFamily()); } |
| 81 static FontFeatureSettings* initialFeatureSettings() { return nullptr; } | 83 static FontFeatureSettings* initialFeatureSettings() { return nullptr; } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 98 void setSize(FontDescription&, const FontDescription::Size&); | 100 void setSize(FontDescription&, const FontDescription::Size&); |
| 99 void checkForOrientationChange(RenderStyle*); | 101 void checkForOrientationChange(RenderStyle*); |
| 100 // This function fixes up the default font size if it detects that the curre
nt generic font family has changed. -dwh | 102 // This function fixes up the default font size if it detects that the curre
nt generic font family has changed. -dwh |
| 101 void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyl
e); | 103 void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyl
e); |
| 102 void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle); | 104 void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle); |
| 103 void updateComputedSize(FontDescription&, RenderStyle*); | 105 void updateComputedSize(FontDescription&, RenderStyle*); |
| 104 | 106 |
| 105 float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom
, float specifiedSize); | 107 float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom
, float specifiedSize); |
| 106 | 108 |
| 107 const Document& m_document; | 109 const Document& m_document; |
| 108 // FIXME: This member is here on a short-term lease. The plan is to remove | 110 FontDescription m_fontDescription; |
| 109 // any notion of RenderStyle from here, allowing FontBuilder to build Font o
bjects | |
| 110 // directly, rather than as a byproduct of calling RenderStyle::setFontDescr
iption. | |
| 111 // FontDescriptionChangeScope should be the only consumer of this member. | |
| 112 // If you're using it, U R DOIN IT WRONG. | |
| 113 RenderStyle* m_style; | |
| 114 | 111 |
| 115 // Fontbuilder is responsbile for creating the Font() | 112 // Fontbuilder is responsbile for creating the Font() |
| 116 // object on RenderStyle from various other font-related | 113 // object on RenderStyle from various other font-related |
| 117 // properties on RenderStyle. Whenever one of those | 114 // properties on RenderStyle. Whenever one of those |
| 118 // is changed, FontBuilder tracks the need to update | 115 // is changed, FontBuilder tracks the need to update |
| 119 // style->font() with this bool. | 116 // style->font() with this bool. |
| 120 bool m_fontDirty; | 117 bool m_fontDirty; |
| 121 | |
| 122 friend class FontBuilderTest; | |
| 123 }; | 118 }; |
| 124 | 119 |
| 125 } | 120 } |
| 126 | 121 |
| 127 #endif | 122 #endif |
| OLD | NEW |