#ifndef FontBuilder_h
#define FontBuilder_h
#include "CSSValueKeywords.h"
#include "platform/fonts/FontDescription.h"
#include "wtf/PassRefPtr.h"
namespace WebCore {
class CSSValue;
class FontSelector;
class RenderStyle;
class FontDescriptionChangeScope;
class FontBuilder {
WTF_MAKE_NONCOPYABLE(FontBuilder); WTF_MAKE_FAST_ALLOCATED;
public:
FontBuilder();
void initForStyleResolve(const Document&, RenderStyle*, bool useSVGZoomRules);
void setInitial(float effectiveZoom);
void didChangeFontParameters(bool);
void inheritFrom(const FontDescription&);
void fromSystemFont(CSSValueID, float effectiveZoom);
void setFontFamilyInitial();
void setFontFamilyInherit(const FontDescription&);
void setFontFamilyValue(CSSValue*);
void setFontSizeInitial();
void setFontSizeInherit(const FontDescription&);
void setFontSizeValue(CSSValue*, RenderStyle* parentStyle, const RenderStyle* rootElementStyle);
void setWeight(FontWeight);
void setWeightBolder();
void setWeightLighter();
void setFontVariantLigaturesInitial();
void setFontVariantLigaturesInherit(const FontDescription&);
void setFontVariantLigaturesValue(CSSValue*);
void setFeatureSettingsNormal();
void setFeatureSettingsValue(CSSValue*);
void setScript(const String& locale);
void setStyle(FontStyle);
void setVariant(FontVariant);
void setTextRendering(TextRenderingMode);
void setKerning(FontDescription::Kerning);
void setFontSmoothing(FontSmoothingMode);
void createFont(PassRefPtr<FontSelector>, const RenderStyle* parentStyle, RenderStyle*);
void createFontForDocument(PassRefPtr<FontSelector>, RenderStyle*);
bool fontSizeHasViewportUnits() { return m_fontSizehasViewportUnits; }
void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; }
bool fontDirty() const { return m_fontDirty; }
static FontDescription::GenericFamilyType initialGenericFamily() { return FontDescription::NoFamily; }
static TextRenderingMode initialTextRendering() { return AutoTextRendering; }
static FontVariant initialVariant() { return FontVariantNormal; }
static FontStyle initialStyle() { return FontStyleNormal; }
static FontDescription::Kerning initialKerning() { return FontDescription::AutoKerning; }
static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; }
friend class FontDescriptionChangeScope;
private:
void setSize(FontDescription&, float effectiveZoom, float size);
void checkForOrientationChange(RenderStyle*);
void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyle);
void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle);
float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom, float specifiedSize);
const Document* m_document;
bool m_useSVGZoomRules;
bool m_fontSizehasViewportUnits;
RenderStyle* m_style;
bool m_fontDirty;
friend class FontBuilderTest;
};
}
#endif