#ifndef CSSValuePool_h
#define CSSValuePool_h
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "core/css/CSSInheritedValue.h"
#include "core/css/CSSInitialValue.h"
#include "core/css/CSSPrimitiveValue.h"
#include "wtf/HashMap.h"
#include "wtf/RefPtr.h"
#include "wtf/text/AtomicStringHash.h"
namespace WebCore {
class CSSValueList;
class CSSValuePool : public NoBaseWillBeGarbageCollected<CSSValuePool> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&);
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createFontFamilyValue(const String&);
PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_inheritedValue; }
PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { return m_implicitInitialValue; }
PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { return m_explicitInitialValue; }
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle&);
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, float zoom) { return CSSPrimitiveValue::create(value, zoom); }
template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(T value) { return CSSPrimitiveValue::create(value); }
void trace(Visitor*);
private:
CSSValuePool();
RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue;
RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue;
RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue;
WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords> m_identifierValueCache;
typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPrimitiveValue> > ColorValueCache;
ColorValueCache m_colorValueCache;
RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent;
RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite;
RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack;
static const int maximumCacheableIntegerValue = 255;
WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pixelValueCache;
WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_percentValueCache;
WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_numberValueCache;
typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<CSSValueList> > FontFaceValueCache;
FontFaceValueCache m_fontFaceValueCache;
typedef WillBeHeapHashMap<String, RefPtrWillBeMember<CSSPrimitiveValue> > FontFamilyValueCache;
FontFamilyValueCache m_fontFamilyValueCache;
friend CSSValuePool& cssValuePool();
};
CSSValuePool& cssValuePool();
}
#endif