Changeset 252785 in webkit
- Timestamp:
- Nov 22, 2019 11:00:32 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252784 r252785 1 2019-11-22 Chris Lord <clord@igalia.com> 2 3 Make CSSValuePool constructable 4 https://bugs.webkit.org/show_bug.cgi?id=204520 5 6 Reviewed by Antti Koivisto. 7 8 No new tests, no new functionality. 9 10 * css/CSSInheritedValue.h: 11 * css/CSSRevertValue.h: 12 * css/CSSUnsetValue.h: 13 * css/CSSValuePool.cpp: 14 (WebCore::CSSValuePool::singleton): 15 (WebCore::CSSValuePool::CSSValuePool): 16 * css/CSSValuePool.h: 17 1 18 2019-11-22 Antti Koivisto <antti@apple.com> 2 19 -
trunk/Source/WebCore/css/CSSInheritedValue.h
r235986 r252785 27 27 class CSSInheritedValue final : public CSSValue { 28 28 public: 29 static Ref<CSSInheritedValue> create() { return adoptRef(*new CSSInheritedValue()); } 30 29 31 String customCSSText() const; 30 32 … … 32 34 33 35 private: 34 friend LazyNeverDestroyed<CSSInheritedValue>;35 36 CSSInheritedValue() 36 37 : CSSValue(InheritedClass) -
trunk/Source/WebCore/css/CSSRevertValue.h
r235986 r252785 32 32 class CSSRevertValue final : public CSSValue { 33 33 public: 34 static Ref<CSSRevertValue> create() { return adoptRef(*new CSSRevertValue()); } 35 34 36 String customCSSText() const; 35 37 … … 37 39 38 40 private: 39 friend LazyNeverDestroyed<CSSRevertValue>;40 41 CSSRevertValue() 41 42 : CSSValue(RevertClass) -
trunk/Source/WebCore/css/CSSUnsetValue.h
r235986 r252785 32 32 class CSSUnsetValue final : public CSSValue { 33 33 public: 34 static Ref<CSSUnsetValue> create() { return adoptRef(*new CSSUnsetValue()); } 35 34 36 String customCSSText() const; 35 37 … … 37 39 38 40 private: 39 friend LazyNeverDestroyed<CSSUnsetValue>;40 41 CSSUnsetValue() 41 42 : CSSValue(UnsetClass) -
trunk/Source/WebCore/css/CSSValuePool.cpp
r252392 r252785 36 36 CSSValuePool& CSSValuePool::singleton() 37 37 { 38 ASSERT(isMainThread()); 38 39 static NeverDestroyed<CSSValuePool> pool; 39 40 return pool; … … 41 42 42 43 CSSValuePool::CSSValuePool() 44 : m_inheritedValue(CSSInheritedValue::create()) 45 , m_implicitInitialValue(CSSInitialValue::createImplicit()) 46 , m_explicitInitialValue(CSSInitialValue::createExplicit()) 47 , m_unsetValue(CSSUnsetValue::create()) 48 , m_revertValue(CSSRevertValue::create()) 49 , m_transparentColor(CSSPrimitiveValue::create(Color(Color::transparent))) 50 , m_whiteColor(CSSPrimitiveValue::create(Color(Color::white))) 51 , m_blackColor(CSSPrimitiveValue::create(Color(Color::black))) 43 52 { 44 m_inheritedValue.construct(); 45 m_implicitInitialValue.construct(true); 46 m_explicitInitialValue.construct(false); 47 m_unsetValue.construct(); 48 m_revertValue.construct(); 53 m_identifierValues.reserveInitialCapacity(numCSSValueKeywords); 54 for (unsigned i = 0; i < numCSSValueKeywords; ++i) 55 m_identifierValues.uncheckedAppend(CSSPrimitiveValue::create(static_cast<CSSValueID>(i))); 49 56 50 m_transparentColor.construct(Color(Color::transparent)); 51 m_whiteColor.construct(Color(Color::white)); 52 m_blackColor.construct(Color(Color::black)); 53 54 for (unsigned i = firstCSSValueKeyword; i <= lastCSSValueKeyword; ++i) 55 m_identifierValues[i].construct(static_cast<CSSValueID>(i)); 56 57 m_pixelValues.reserveInitialCapacity(maximumCacheableIntegerValue + 1); 58 m_percentValues.reserveInitialCapacity(maximumCacheableIntegerValue + 1); 59 m_numberValues.reserveInitialCapacity(maximumCacheableIntegerValue + 1); 57 60 for (unsigned i = 0; i < (maximumCacheableIntegerValue + 1); ++i) { 58 m_pixelValues [i].construct(i, CSSUnitType::CSS_PX);59 m_percentValues [i].construct(i, CSSUnitType::CSS_PERCENTAGE);60 m_numberValues [i].construct(i, CSSUnitType::CSS_NUMBER);61 m_pixelValues.uncheckedAppend(CSSPrimitiveValue::create(i, CSSUnitType::CSS_PX)); 62 m_percentValues.uncheckedAppend(CSSPrimitiveValue::create(i, CSSUnitType::CSS_PERCENTAGE)); 63 m_numberValues.uncheckedAppend(CSSPrimitiveValue::create(i, CSSUnitType::CSS_NUMBER)); 61 64 } 62 65 } -
trunk/Source/WebCore/css/CSSValuePool.h
r252392 r252785 38 38 #include <wtf/NeverDestroyed.h> 39 39 #include <wtf/RefPtr.h> 40 #include <wtf/Vector.h> 40 41 #include <wtf/text/AtomStringHash.h> 41 42 … … 49 50 WTF_MAKE_FAST_ALLOCATED; 50 51 public: 52 CSSValuePool(); 53 51 54 static CSSValuePool& singleton(); 52 55 … … 70 73 71 74 private: 72 CSSValuePool();73 74 75 typedef HashMap<Color, RefPtr<CSSPrimitiveValue>> ColorValueCache; 75 76 ColorValueCache m_colorValueCache; … … 83 84 friend class WTF::NeverDestroyed<CSSValuePool>; 84 85 85 LazyNeverDestroyed<CSSInheritedValue> m_inheritedValue;86 LazyNeverDestroyed<CSSInitialValue> m_implicitInitialValue;87 LazyNeverDestroyed<CSSInitialValue> m_explicitInitialValue;88 LazyNeverDestroyed<CSSUnsetValue> m_unsetValue;89 LazyNeverDestroyed<CSSRevertValue> m_revertValue;86 Ref<CSSInheritedValue> m_inheritedValue; 87 Ref<CSSInitialValue> m_implicitInitialValue; 88 Ref<CSSInitialValue> m_explicitInitialValue; 89 Ref<CSSUnsetValue> m_unsetValue; 90 Ref<CSSRevertValue> m_revertValue; 90 91 91 LazyNeverDestroyed<CSSPrimitiveValue> m_transparentColor;92 LazyNeverDestroyed<CSSPrimitiveValue> m_whiteColor;93 LazyNeverDestroyed<CSSPrimitiveValue> m_blackColor;92 Ref<CSSPrimitiveValue> m_transparentColor; 93 Ref<CSSPrimitiveValue> m_whiteColor; 94 Ref<CSSPrimitiveValue> m_blackColor; 94 95 95 96 static const int maximumCacheableIntegerValue = 255; 96 97 97 LazyNeverDestroyed<CSSPrimitiveValue> m_pixelValues[maximumCacheableIntegerValue + 1];98 LazyNeverDestroyed<CSSPrimitiveValue> m_percentValues[maximumCacheableIntegerValue + 1];99 LazyNeverDestroyed<CSSPrimitiveValue> m_numberValues[maximumCacheableIntegerValue + 1];100 LazyNeverDestroyed<CSSPrimitiveValue> m_identifierValues[numCSSValueKeywords];98 Vector<Ref<CSSPrimitiveValue>> m_pixelValues; 99 Vector<Ref<CSSPrimitiveValue>> m_percentValues; 100 Vector<Ref<CSSPrimitiveValue>> m_numberValues; 101 Vector<Ref<CSSPrimitiveValue>> m_identifierValues; 101 102 }; 102 103
Note: See TracChangeset
for help on using the changeset viewer.