#ifndef CSSSegmentedFontFace_h
#define CSSSegmentedFontFace_h
#include "platform/fonts/FontTraits.h"
#include "wtf/HashMap.h"
#include "wtf/ListHashSet.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class CSSFontFace;
class CSSFontSelector;
class FontData;
class FontDescription;
class FontFace;
class SegmentedFontData;
class CSSSegmentedFontFace : public RefCounted<CSSSegmentedFontFace> {
public:
static PassRefPtr<CSSSegmentedFontFace> create(CSSFontSelector* selector, FontTraits traits)
{
return adoptRef(new CSSSegmentedFontFace(selector, traits));
}
~CSSSegmentedFontFace();
CSSFontSelector* fontSelector() const { return m_fontSelector; }
FontTraits traits() const { return m_traits; }
void fontLoaded(CSSFontFace*);
void fontLoadWaitLimitExceeded(CSSFontFace*);
void addFontFace(PassRefPtr<FontFace>, bool cssConnected);
void removeFontFace(PassRefPtr<FontFace>);
bool isEmpty() const { return m_fontFaces.isEmpty(); }
PassRefPtr<FontData> getFontData(const FontDescription&);
bool checkFont(const String&) const;
void match(const String&, Vector<RefPtr<FontFace> >&) const;
void willUseFontData(const FontDescription&);
private:
CSSSegmentedFontFace(CSSFontSelector*, FontTraits);
void pruneTable();
bool isValid() const;
bool isLoading() const;
bool isLoaded() const;
typedef ListHashSet<RefPtr<FontFace> > FontFaceList;
CSSFontSelector* m_fontSelector;
FontTraits m_traits;
HashMap<unsigned, RefPtr<SegmentedFontData> > m_fontDataTable;
FontFaceList m_fontFaces;
FontFaceList::iterator m_firstNonCssConnectedFace;
};
}
#endif