Changeset 207717 in webkit


Ignore:
Timestamp:
Oct 22, 2016 2:27:53 PM (7 years ago)
Author:
Antti Koivisto
Message:

REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20%
https://bugs.webkit.org/show_bug.cgi?id=163851

Reviewed by Darin Adler.

The test calls Scope::flushPendingUpdate a lot and nothing ever happens there.

Add a separate invalidity bit for descendant scopes and inline the fast path.

  • style/StyleScope.cpp:

(WebCore::Style::Scope::flushPendingSelfUpdate):
(WebCore::Style::Scope::flushPendingDescendantUpdates):
(WebCore::Style::Scope::scheduleUpdate):
(WebCore::Style::Scope::flushPendingUpdate): Deleted.

  • style/StyleScope.h:

(WebCore::Style::Scope::hasPendingUpdate):
(WebCore::Style::Scope::flushPendingUpdate):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207716 r207717  
     12016-10-22  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20%
     4        https://bugs.webkit.org/show_bug.cgi?id=163851
     5
     6        Reviewed by Darin Adler.
     7
     8        The test calls Scope::flushPendingUpdate a lot and nothing ever happens there.
     9
     10        Add a separate invalidity bit for descendant scopes and inline the fast path.
     11
     12        * style/StyleScope.cpp:
     13        (WebCore::Style::Scope::flushPendingSelfUpdate):
     14        (WebCore::Style::Scope::flushPendingDescendantUpdates):
     15        (WebCore::Style::Scope::scheduleUpdate):
     16        (WebCore::Style::Scope::flushPendingUpdate): Deleted.
     17        * style/StyleScope.h:
     18        (WebCore::Style::Scope::hasPendingUpdate):
     19        (WebCore::Style::Scope::flushPendingUpdate):
     20
    1212016-10-22  Darin Adler  <darin@apple.com>
    222
  • trunk/Source/WebCore/style/StyleScope.cpp

    r207669 r207717  
    468468}
    469469
    470 void Scope::flushPendingUpdate()
    471 {
    472     if (!m_shadowRoot) {
    473         for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots())
    474             descendantShadowRoot->styleScope().flushPendingUpdate();
    475     }
    476     if (!m_pendingUpdate)
    477         return;
     470void Scope::flushPendingSelfUpdate()
     471{
     472    ASSERT(m_pendingUpdate);
     473
    478474    auto updateType = *m_pendingUpdate;
    479475
    480476    clearPendingUpdate();
    481 
    482477    updateActiveStyleSheets(updateType);
     478}
     479
     480void Scope::flushPendingDescendantUpdates()
     481{
     482    ASSERT(m_hasDescendantWithPendingUpdate);
     483    ASSERT(!m_shadowRoot);
     484    for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots())
     485        descendantShadowRoot->styleScope().flushPendingUpdate();
     486    m_hasDescendantWithPendingUpdate = false;
    483487}
    484488
     
    491495void Scope::scheduleUpdate(UpdateType update)
    492496{
    493     if (!m_pendingUpdate || *m_pendingUpdate < update)
     497    if (!m_pendingUpdate || *m_pendingUpdate < update) {
    494498        m_pendingUpdate = update;
     499        if (m_shadowRoot)
     500            m_document.styleScope().m_hasDescendantWithPendingUpdate = true;
     501    }
    495502
    496503    if (m_pendingUpdateTimer.isActive())
  • trunk/Source/WebCore/style/StyleScope.h

    r207669 r207717  
    9393    WEBCORE_EXPORT void didChangeStyleSheetEnvironment();
    9494
    95     bool hasPendingUpdate() const { return !!m_pendingUpdate; }
    96     WEBCORE_EXPORT void flushPendingUpdate();
     95    bool hasPendingUpdate() const { return m_pendingUpdate || m_hasDescendantWithPendingUpdate; }
     96    void flushPendingUpdate();
    9797
    9898    StyleResolver& resolver();
     
    108108    void updateActiveStyleSheets(UpdateType);
    109109    void scheduleUpdate(UpdateType);
     110
     111    WEBCORE_EXPORT void flushPendingSelfUpdate();
     112    WEBCORE_EXPORT void flushPendingDescendantUpdates();
    110113
    111114    void collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>&);
     
    142145
    143146    Optional<UpdateType> m_pendingUpdate;
     147    bool m_hasDescendantWithPendingUpdate { false };
    144148
    145149    ListHashSet<Node*> m_styleSheetCandidateNodes;
     
    151155};
    152156
     157inline void Scope::flushPendingUpdate()
     158{
     159    if (m_hasDescendantWithPendingUpdate)
     160        flushPendingDescendantUpdates();
     161    if (m_pendingUpdate)
     162        flushPendingSelfUpdate();
     163}
     164
    153165}
    154166}
Note: See TracChangeset for help on using the changeset viewer.