Changeset 101736 in webkit


Ignore:
Timestamp:
Dec 1, 2011 7:39:11 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[MutationObservers] StyleAttributeMutationScope shouldn't be implemented with static classes
https://bugs.webkit.org/show_bug.cgi?id=73596

Patch by Rafael Weinstein <rafaelw@chromium.org> on 2011-12-01
Reviewed by Ojan Vafai.

No tests needed. This patch is a minor refactor.

  • css/CSSMutableStyleDeclaration.cpp:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r101734 r101736  
     12011-12-01  Rafael Weinstein  <rafaelw@chromium.org>
     2
     3        [MutationObservers] StyleAttributeMutationScope shouldn't be implemented with static classes
     4        https://bugs.webkit.org/show_bug.cgi?id=73596
     5
     6        Reviewed by Ojan Vafai.
     7
     8        No tests needed. This patch is a minor refactor.
     9
     10        * css/CSSMutableStyleDeclaration.cpp:
     11
    1122011-12-01  Andreas Kling  <kling@webkit.org>
    213
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp

    r101734 r101736  
    6868
    6969        CSSInlineStyleDeclaration* inlineDecl = toCSSInlineStyleDeclaration(s_currentDecl);
    70         s_mutationRecipients = MutationObserverInterestGroup::createForAttributesMutation(inlineDecl->element(), HTMLNames::styleAttr);
    71         if (s_mutationRecipients->isEmpty()) {
    72             s_mutationRecipients.clear();
     70        m_mutationRecipients = MutationObserverInterestGroup::createForAttributesMutation(inlineDecl->element(), HTMLNames::styleAttr);
     71        if (m_mutationRecipients->isEmpty()) {
     72            m_mutationRecipients.clear();
    7373            return;
    7474        }
    7575
    76         AtomicString oldValue = s_mutationRecipients->isOldValueRequested() ? inlineDecl->element()->getAttribute(HTMLNames::styleAttr) : nullAtom;
    77         s_mutation = MutationRecord::createAttributes(inlineDecl->element(), HTMLNames::styleAttr, oldValue);
     76        AtomicString oldValue = m_mutationRecipients->isOldValueRequested() ? inlineDecl->element()->getAttribute(HTMLNames::styleAttr) : nullAtom;
     77        m_mutation = MutationRecord::createAttributes(inlineDecl->element(), HTMLNames::styleAttr, oldValue);
    7878    }
    7979
     
    8181    {
    8282        --s_scopeCount;
    83         if (!s_scopeCount)
    84             s_currentDecl = 0;
     83        if (s_scopeCount)
     84            return;
     85
     86        s_currentDecl = 0;
     87        if (m_mutation && s_shouldDeliver)
     88            m_mutationRecipients->enqueueMutationRecord(m_mutation);
    8589    }
    8690
    8791    void enqueueMutationRecord()
    8892    {
    89         if (!s_mutation)
    90             return;
    91         s_mutationRecipients->enqueueMutationRecord(s_mutation);
    92         s_mutation.clear();
    93         s_mutationRecipients.clear();
     93        s_shouldDeliver = true;
    9494    }
    9595
    9696private:
    9797    static unsigned s_scopeCount;
    98     static OwnPtr<MutationObserverInterestGroup> s_mutationRecipients;
    99     static RefPtr<MutationRecord> s_mutation;
    10098    static CSSMutableStyleDeclaration* s_currentDecl;
     99    static bool s_shouldDeliver;
     100
     101    OwnPtr<MutationObserverInterestGroup> m_mutationRecipients;
     102    RefPtr<MutationRecord> m_mutation;
    101103};
    102104
    103105unsigned StyleAttributeMutationScope::s_scopeCount = 0;
    104 OwnPtr<MutationObserverInterestGroup> StyleAttributeMutationScope::s_mutationRecipients;
    105 RefPtr<MutationRecord> StyleAttributeMutationScope::s_mutation;
    106106CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0;
     107bool StyleAttributeMutationScope::s_shouldDeliver = false;
    107108
    108109} // namespace
Note: See TracChangeset for help on using the changeset viewer.