| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef CSSValuePool_h | 26 #ifndef CSSValuePool_h |
| 27 #define CSSValuePool_h | 27 #define CSSValuePool_h |
| 28 | 28 |
| 29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
| 30 #include "core/CSSValueKeywords.h" | 30 #include "core/CSSValueKeywords.h" |
| 31 #include "core/css/CSSInheritedValue.h" | 31 #include "core/css/CSSInheritedValue.h" |
| 32 #include "core/css/CSSInitialValue.h" | 32 #include "core/css/CSSInitialValue.h" |
| 33 #include "core/css/CSSPrimitiveValue.h" | 33 #include "core/css/CSSPrimitiveValue.h" |
| 34 #include "core/css/CSSUnsetValue.h" |
| 34 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
| 35 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 36 #include "wtf/text/AtomicStringHash.h" | 37 #include "wtf/text/AtomicStringHash.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class CSSValueList; | 41 class CSSValueList; |
| 41 | 42 |
| 42 class CSSValuePool : public NoBaseWillBeGarbageCollected<CSSValuePool> { | 43 class CSSValuePool : public NoBaseWillBeGarbageCollected<CSSValuePool> { |
| 43 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 44 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 44 public: | 45 public: |
| 45 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); | 46 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); |
| 46 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createFontFamilyValue(const String
&); | 47 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createFontFamilyValue(const String
&); |
| 47 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } | 48 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } |
| 48 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } | 49 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } |
| 49 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } | 50 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } |
| 51 PassRefPtrWillBeRawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetVal
ue; } |
| 50 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); | 52 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); |
| 51 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyI
D identifier); | 53 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyI
D identifier); |
| 52 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue
); | 54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue
); |
| 53 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); | 55 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); |
| 54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const String& value, C
SSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type)
; } | 56 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const String& value, C
SSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type)
; } |
| 55 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst RenderStyle&); | 57 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst RenderStyle&); |
| 56 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } | 58 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } |
| 57 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } | 59 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } |
| 58 | 60 |
| 59 void trace(Visitor*); | 61 void trace(Visitor*); |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 CSSValuePool(); | 64 CSSValuePool(); |
| 63 | 65 |
| 64 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; | 66 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; |
| 65 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; | 67 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; |
| 66 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; | 68 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; |
| 69 RefPtrWillBeMember<CSSUnsetValue> m_unsetValue; |
| 67 | 70 |
| 68 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; | 71 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; |
| 69 | 72 |
| 70 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPrimitiveValue> >
ColorValueCache; | 73 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPrimitiveValue> >
ColorValueCache; |
| 71 ColorValueCache m_colorValueCache; | 74 ColorValueCache m_colorValueCache; |
| 72 RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent; | 75 RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent; |
| 73 RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite; | 76 RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite; |
| 74 RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack; | 77 RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack; |
| 75 | 78 |
| 76 static const int maximumCacheableIntegerValue = 255; | 79 static const int maximumCacheableIntegerValue = 255; |
| 77 | 80 |
| 78 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; | 81 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; |
| 79 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; | 82 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; |
| 80 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; | 83 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; |
| 81 | 84 |
| 82 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<CSSValueList> > F
ontFaceValueCache; | 85 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<CSSValueList> > F
ontFaceValueCache; |
| 83 FontFaceValueCache m_fontFaceValueCache; | 86 FontFaceValueCache m_fontFaceValueCache; |
| 84 | 87 |
| 85 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<CSSPrimitiveValue> > Fo
ntFamilyValueCache; | 88 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<CSSPrimitiveValue> > Fo
ntFamilyValueCache; |
| 86 FontFamilyValueCache m_fontFamilyValueCache; | 89 FontFamilyValueCache m_fontFamilyValueCache; |
| 87 | 90 |
| 88 friend CSSValuePool& cssValuePool(); | 91 friend CSSValuePool& cssValuePool(); |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 CSSValuePool& cssValuePool(); | 94 CSSValuePool& cssValuePool(); |
| 92 | 95 |
| 93 } | 96 } |
| 94 | 97 |
| 95 #endif | 98 #endif |
| OLD | NEW |