diff options
Diffstat (limited to 'Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp')
-rw-r--r-- | Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp index 93d4e4538..824d90fb2 100644 --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp @@ -30,7 +30,6 @@ #include "MutationRecord.h" #include "StylePropertySet.h" #include "StyledElement.h" -#include "UndoManager.h" #include "WebCoreMemoryInstrumentation.h" #include <wtf/MemoryInstrumentationHashMap.h> @@ -55,39 +54,25 @@ public: ASSERT(!s_currentDecl); s_currentDecl = decl; -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) if (!s_currentDecl->parentElement()) return; bool shouldReadOldValue = false; -#if ENABLE(MUTATION_OBSERVERS) m_mutationRecipients = MutationObserverInterestGroup::createForAttributesMutation(s_currentDecl->parentElement(), HTMLNames::styleAttr); if (m_mutationRecipients && m_mutationRecipients->isOldValueRequested()) shouldReadOldValue = true; -#endif -#if ENABLE(UNDO_MANAGER) - m_isRecordingAutomaticTransaction = UndoManager::isRecordingAutomaticTransaction(s_currentDecl->parentElement()); - if (m_isRecordingAutomaticTransaction) - shouldReadOldValue = true; -#endif AtomicString oldValue; if (shouldReadOldValue) oldValue = s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr); -#if ENABLE(MUTATION_OBSERVERS) if (m_mutationRecipients) { AtomicString requestedOldValue = m_mutationRecipients->isOldValueRequested() ? oldValue : nullAtom; m_mutation = MutationRecord::createAttributes(s_currentDecl->parentElement(), HTMLNames::styleAttr, requestedOldValue); } #endif -#if ENABLE(UNDO_MANAGER) - if (m_isRecordingAutomaticTransaction) - m_oldValue = oldValue; -#endif - -#endif } ~StyleAttributeMutationScope() @@ -99,14 +84,7 @@ public: #if ENABLE(MUTATION_OBSERVERS) if (m_mutation && s_shouldDeliver) m_mutationRecipients->enqueueMutationRecord(m_mutation); -#endif -#if ENABLE(UNDO_MANAGER) - if (m_isRecordingAutomaticTransaction && s_shouldDeliver) { - UndoManager::addTransactionStep(AttrChangingDOMTransactionStep::create( - s_currentDecl->parentElement(), HTMLNames::styleAttr, m_oldValue, s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr))); - } -#endif -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) + s_shouldDeliver = false; #endif if (!s_shouldNotifyInspector) { @@ -121,7 +99,7 @@ public: InspectorInstrumentation::didInvalidateStyleAttr(localCopyStyleDecl->parentElement()->document(), localCopyStyleDecl->parentElement()); } -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) void enqueueMutationRecord() { s_shouldDeliver = true; @@ -137,7 +115,7 @@ private: static unsigned s_scopeCount; static PropertySetCSSStyleDeclaration* s_currentDecl; static bool s_shouldNotifyInspector; -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) static bool s_shouldDeliver; #endif @@ -145,16 +123,12 @@ private: OwnPtr<MutationObserverInterestGroup> m_mutationRecipients; RefPtr<MutationRecord> m_mutation; #endif -#if ENABLE(UNDO_MANAGER) - bool m_isRecordingAutomaticTransaction; - AtomicString m_oldValue; -#endif }; unsigned StyleAttributeMutationScope::s_scopeCount = 0; PropertySetCSSStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0; bool StyleAttributeMutationScope::s_shouldNotifyInspector = false; -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) bool StyleAttributeMutationScope::s_shouldDeliver = false; #endif @@ -196,7 +170,7 @@ String PropertySetCSSStyleDeclaration::cssText() const void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec) { -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); #endif willMutate(); @@ -207,7 +181,7 @@ void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCod didMutate(PropertyChanged); -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) mutationScope.enqueueMutationRecord(); #endif } @@ -257,7 +231,7 @@ bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyNa void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) { -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); #endif CSSPropertyID propertyID = cssPropertyID(propertyName); @@ -276,7 +250,7 @@ void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con if (changed) { // CSS DOM requires raising SYNTAX_ERR of parsing failed, but this is too dangerous for compatibility, // see <http://bugs.webkit.org/show_bug.cgi?id=7296>. -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) mutationScope.enqueueMutationRecord(); #endif } @@ -284,7 +258,7 @@ void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec) { -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); #endif CSSPropertyID propertyID = cssPropertyID(propertyName); @@ -300,7 +274,7 @@ String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName didMutate(changed ? PropertyChanged : NoChanges); if (changed) { -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) mutationScope.enqueueMutationRecord(); #endif } @@ -319,7 +293,7 @@ String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID pr void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) { -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); #endif willMutate(); @@ -330,7 +304,7 @@ void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyI didMutate(changed ? PropertyChanged : NoChanges); if (changed) { -#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER) +#if ENABLE(MUTATION_OBSERVERS) mutationScope.enqueueMutationRecord(); #endif } @@ -369,7 +343,7 @@ PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable() return m_propertySet; } -bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const +bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const StylePropertySet::PropertyReference& property) const { return m_propertySet->propertyMatches(property); } |