Chromium Code Reviews| Index: Source/core/css/StylePropertySet.cpp |
| diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp |
| index 81467555886c2c1843a5b55395a29910d6d99ea4..8061f217835cd63b7ed455d6e0cef1a8342b4e49 100644 |
| --- a/Source/core/css/StylePropertySet.cpp |
| +++ b/Source/core/css/StylePropertySet.cpp |
| @@ -42,13 +42,6 @@ using namespace std; |
| namespace WebCore { |
| -typedef HashMap<MutableStylePropertySet*, OwnPtr<PropertySetCSSStyleDeclaration> > PropertySetCSSOMWrapperMap; |
| -static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap() |
| -{ |
| - DEFINE_STATIC_LOCAL(PropertySetCSSOMWrapperMap, propertySetCSSOMWrapperMapInstance, ()); |
| - return propertySetCSSOMWrapperMapInstance; |
| -} |
| - |
| static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count) |
| { |
| return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count; |
| @@ -68,6 +61,10 @@ PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded() |
| return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(), mutableThis->m_propertyVector.size(), cssParserMode()); |
| } |
| +MutableStylePropertySet::MutableStylePropertySet(CSSParserMode cssParserMode) |
| + : StylePropertySet(cssParserMode) |
| +{ } |
|
abarth-chromium
2013/07/03 18:25:42
Please put each brace on it's own line.
Mads Ager (chromium)
2013/07/04 06:05:47
Done.
|
| + |
| MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, unsigned length) |
| : StylePropertySet(CSSStrictMode) |
| { |
| @@ -107,13 +104,6 @@ MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) |
| } |
| } |
| -MutableStylePropertySet::~MutableStylePropertySet() |
| -{ |
| - ASSERT(!m_ownsCSSOMWrapper || propertySetCSSOMWrapperMap().contains(this)); |
| - if (m_ownsCSSOMWrapper) |
| - propertySetCSSOMWrapperMap().remove(this); |
| -} |
| - |
| String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const |
| { |
| RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); |
| @@ -515,34 +505,30 @@ PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const |
| PropertySetCSSStyleDeclaration* MutableStylePropertySet::cssStyleDeclaration() |
| { |
| - if (!m_ownsCSSOMWrapper) |
| - return 0; |
| - return propertySetCSSOMWrapperMap().get(this); |
| + return m_cssomWrapper.get(); |
| } |
| CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() |
| { |
| if (m_ownsCSSOMWrapper) { |
|
abarth-chromium
2013/07/03 18:25:42
It seems like we can just check whether m_cssomWra
Mads Ager (chromium)
2013/07/04 06:05:47
We can do that. The only complication is that Styl
|
| - ASSERT(!static_cast<CSSStyleDeclaration*>(propertySetCSSOMWrapperMap().get(this))->parentRule()); |
| - ASSERT(!propertySetCSSOMWrapperMap().get(this)->parentElement()); |
| - return propertySetCSSOMWrapperMap().get(this); |
| + ASSERT(!static_cast<CSSStyleDeclaration*>(m_cssomWrapper.get())->parentRule()); |
| + ASSERT(!m_cssomWrapper->parentElement()); |
| + return m_cssomWrapper.get(); |
| } |
| m_ownsCSSOMWrapper = true; |
| - PropertySetCSSStyleDeclaration* cssomWrapper = new PropertySetCSSStyleDeclaration(this); |
| - propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); |
| - return cssomWrapper; |
| + m_cssomWrapper = adoptPtr(new PropertySetCSSStyleDeclaration(this)); |
| + return m_cssomWrapper.get(); |
| } |
| CSSStyleDeclaration* MutableStylePropertySet::ensureInlineCSSStyleDeclaration(Element* parentElement) |
| { |
| if (m_ownsCSSOMWrapper) { |
| - ASSERT(propertySetCSSOMWrapperMap().get(this)->parentElement() == parentElement); |
| - return propertySetCSSOMWrapperMap().get(this); |
| + ASSERT(m_cssomWrapper->parentElement() == parentElement); |
| + return m_cssomWrapper.get(); |
| } |
| m_ownsCSSOMWrapper = true; |
| - PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(this, parentElement); |
| - propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); |
| - return cssomWrapper; |
| + m_cssomWrapper = adoptPtr(new InlineCSSStyleDeclaration(this, parentElement)); |
| + return m_cssomWrapper.get(); |
| } |
| unsigned StylePropertySet::averageSizeInBytes() |