diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp')
-rw-r--r-- | Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp index 86418d461..4e97f6915 100644 --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp @@ -22,7 +22,6 @@ #include "config.h" #include "PropertySetCSSStyleDeclaration.h" -#include "CSSCustomPropertyValue.h" #include "CSSParser.h" #include "CSSStyleSheet.h" #include "HTMLNames.h" @@ -89,7 +88,7 @@ public: s_currentDecl = 0; s_shouldNotifyInspector = false; if (localCopyStyleDecl->parentElement()) - InspectorInstrumentation::didInvalidateStyleAttr(localCopyStyleDecl->parentElement()->document(), *localCopyStyleDecl->parentElement()); + InspectorInstrumentation::didInvalidateStyleAttr(&localCopyStyleDecl->parentElement()->document(), localCopyStyleDecl->parentElement()); } void enqueueMutationRecord() @@ -108,7 +107,7 @@ private: static bool s_shouldNotifyInspector; static bool s_shouldDeliver; - std::unique_ptr<MutationObserverInterestGroup> m_mutationRecipients; + OwnPtr<MutationObserverInterestGroup> m_mutationRecipients; RefPtr<MutationRecord> m_mutation; }; @@ -145,40 +144,32 @@ String PropertySetCSSStyleDeclaration::cssText() const { return m_propertySet->asText(); } - -void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode&) + +void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec) { StyleAttributeMutationScope mutationScope(this); if (!willMutate()) return; - bool changed = m_propertySet->parseDeclaration(text, contextStyleSheet()); + ec = 0; + // FIXME: Detect syntax errors and set ec. + m_propertySet->parseDeclaration(text, contextStyleSheet()); - didMutate(changed ? PropertyChanged : NoChanges); + didMutate(PropertyChanged); mutationScope.enqueueMutationRecord(); } -RefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const String& propertyName) +PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const String& propertyName) { - if (isCustomPropertyName(propertyName)) { - RefPtr<CSSValue> value = m_propertySet->getCustomPropertyCSSValue(propertyName); - if (!value) - return nullptr; - return cloneAndCacheForCSSOM(value.get()); - } - CSSPropertyID propertyID = cssPropertyID(propertyName); if (!propertyID) - return nullptr; + return 0; return cloneAndCacheForCSSOM(m_propertySet->getPropertyCSSValue(propertyID).get()); } -String PropertySetCSSStyleDeclaration::getPropertyValue(const String& propertyName) +String PropertySetCSSStyleDeclaration::getPropertyValue(const String &propertyName) { - if (isCustomPropertyName(propertyName)) - return m_propertySet->getCustomPropertyValue(propertyName); - CSSPropertyID propertyID = cssPropertyID(propertyName); if (!propertyID) return String(); @@ -187,9 +178,6 @@ String PropertySetCSSStyleDeclaration::getPropertyValue(const String& propertyNa String PropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName) { - if (isCustomPropertyName(propertyName)) - return m_propertySet->customPropertyIsImportant(propertyName) ? "important" : ""; - CSSPropertyID propertyID = cssPropertyID(propertyName); if (!propertyID) return String(); @@ -215,10 +203,7 @@ bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyNa void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) { StyleAttributeMutationScope mutationScope(this); - CSSPropertyID propertyID = cssPropertyID(propertyName); - if (isCustomPropertyName(propertyName)) - propertyID = CSSPropertyCustom; if (!propertyID) return; @@ -228,7 +213,7 @@ void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con bool important = priority.find("important", 0, false) != notFound; ec = 0; - bool changed = propertyID != CSSPropertyCustom ? m_propertySet->setProperty(propertyID, value, important, contextStyleSheet()) : m_propertySet->setCustomProperty(propertyName, value, important, contextStyleSheet()); + bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet()); didMutate(changed ? PropertyChanged : NoChanges); @@ -243,8 +228,6 @@ String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName { StyleAttributeMutationScope mutationScope(this); CSSPropertyID propertyID = cssPropertyID(propertyName); - if (isCustomPropertyName(propertyName)) - propertyID = CSSPropertyCustom; if (!propertyID) return String(); @@ -253,7 +236,7 @@ String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName ec = 0; String result; - bool changed = propertyID != CSSPropertyCustom ? m_propertySet->removeProperty(propertyID, &result) : m_propertySet->removeCustomProperty(propertyName, &result); + bool changed = m_propertySet->removeProperty(propertyID, &result); didMutate(changed ? PropertyChanged : NoChanges); @@ -262,7 +245,7 @@ String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName return result; } -RefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) +PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) { return m_propertySet->getPropertyCSSValue(propertyID); } @@ -272,11 +255,11 @@ String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID pr return m_propertySet->getPropertyValue(propertyID); } -bool PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) +void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) { StyleAttributeMutationScope mutationScope(this); if (!willMutate()) - return false; + return; ec = 0; bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet()); @@ -285,7 +268,6 @@ bool PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyI if (changed) mutationScope.enqueueMutationRecord(); - return changed; } CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* internalValue) @@ -310,7 +292,7 @@ StyleSheetContents* PropertySetCSSStyleDeclaration::contextStyleSheet() const return cssStyleSheet ? &cssStyleSheet->contents() : 0; } -Ref<MutableStyleProperties> PropertySetCSSStyleDeclaration::copyProperties() const +PassRef<MutableStyleProperties> PropertySetCSSStyleDeclaration::copyProperties() const { return m_propertySet->mutableCopy(); } @@ -382,6 +364,7 @@ void InlineCSSStyleDeclaration::didMutate(MutationType type) if (!m_parentElement) return; + m_parentElement->setNeedsStyleRecalc(InlineStyleChange); m_parentElement->invalidateStyleAttribute(); StyleAttributeMutationScope(this).didInvalidateStyleAttr(); } |