| Index: Source/core/css/StylePropertySet.cpp
|
| diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
|
| index 81467555886c2c1843a5b55395a29910d6d99ea4..e5f28cfe5284ae6f6cb856fb81f8fa28913ed45e 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,11 @@ PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded()
|
| return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(), mutableThis->m_propertyVector.size(), cssParserMode());
|
| }
|
|
|
| +MutableStylePropertySet::MutableStylePropertySet(CSSParserMode cssParserMode)
|
| + : StylePropertySet(cssParserMode)
|
| +{
|
| +}
|
| +
|
| MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, unsigned length)
|
| : StylePropertySet(CSSStrictMode)
|
| {
|
| @@ -107,13 +105,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);
|
| @@ -328,6 +319,11 @@ String StylePropertySet::asText() const
|
| return StylePropertySerializer(*this).asText();
|
| }
|
|
|
| +bool StylePropertySet::hasCSSOMWrapper() const
|
| +{
|
| + return m_isMutable && static_cast<const MutableStylePropertySet*>(this)->m_cssomWrapper;
|
| +}
|
| +
|
| void MutableStylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet* other)
|
| {
|
| ASSERT(isMutable());
|
| @@ -515,34 +511,28 @@ 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) {
|
| - ASSERT(!static_cast<CSSStyleDeclaration*>(propertySetCSSOMWrapperMap().get(this))->parentRule());
|
| - ASSERT(!propertySetCSSOMWrapperMap().get(this)->parentElement());
|
| - return propertySetCSSOMWrapperMap().get(this);
|
| + if (m_cssomWrapper) {
|
| + 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);
|
| + if (m_cssomWrapper) {
|
| + 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()
|
|
|