Changeset 153788 in webkit


Ignore:
Timestamp:
Aug 7, 2013 8:02:39 AM (11 years ago)
Author:
Antti Koivisto
Message:

2.5% regression on page cycler moz
https://bugs.webkit.org/show_bug.cgi?id=102822

Source/WebCore:

Reviewed by Andreas Kling.

DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache() triggers a style recalc for quirks mode
documents in the beginning of document parsing via Document::setCompatibilityMode. This often coalesces
with style recalc triggered by stylesheet loading. However on very simple documents it can generate genuinely
unnecessary work.

  • dom/DocumentStyleSheetCollection.cpp:

(WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache):

Check that we actually have cached injected stylesheets before triggering style recalc.


  • page/PageGroup.cpp:

(WebCore::PageGroup::addUserStyleSheetToWorld):
(WebCore::PageGroup::removeUserStyleSheetFromWorld):
(WebCore::PageGroup::removeUserStyleSheetsFromWorld):
(WebCore::PageGroup::removeAllUserContent):

Fix a misspelling.

(WebCore::PageGroup::invalidateInjectedStyleSheetCacheInAllFrames):

Always invalidate style when user sheets change since we don't do that in
DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache anymore.

  • page/PageGroup.h:

LayoutTests:

Reviewed by Andreas Kling.

This is a progression.

  • inspector/timeline/timeline-script-tag-1-expected.txt:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153784 r153788  
     12013-08-07  Antti Koivisto  <antti@apple.com>
     2
     3        2.5% regression on page cycler moz
     4        https://bugs.webkit.org/show_bug.cgi?id=102822
     5
     6        Reviewed by Andreas Kling.
     7       
     8        This is a progression.
     9
     10        * inspector/timeline/timeline-script-tag-1-expected.txt:
     11
    1122013-08-07  Mirela Budaes  <mbudaes@adobe.com>
    213
  • trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt

    r135082 r153788  
    44
    55ParseHTML
    6 ----> ScheduleStyleRecalculation
    76----> InvalidateLayout
    87ParseHTML
    9 ----> ScheduleStyleRecalculation
    108----> EvaluateScript
    119--------> TimeStamp : SCRIPT TAG
  • trunk/Source/WebCore/ChangeLog

    r153787 r153788  
     12013-08-07  Antti Koivisto  <antti@apple.com>
     2
     3        2.5% regression on page cycler moz
     4        https://bugs.webkit.org/show_bug.cgi?id=102822
     5
     6        Reviewed by Andreas Kling.
     7
     8        DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache() triggers a style recalc for quirks mode
     9        documents in the beginning of document parsing via Document::setCompatibilityMode. This often coalesces
     10        with style recalc triggered by stylesheet loading. However on very simple documents it can generate genuinely
     11        unnecessary work.
     12
     13        * dom/DocumentStyleSheetCollection.cpp:
     14        (WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache):
     15       
     16            Check that we actually have cached injected stylesheets before triggering style recalc.
     17           
     18        * page/PageGroup.cpp:
     19        (WebCore::PageGroup::addUserStyleSheetToWorld):
     20        (WebCore::PageGroup::removeUserStyleSheetFromWorld):
     21        (WebCore::PageGroup::removeUserStyleSheetsFromWorld):
     22        (WebCore::PageGroup::removeAllUserContent):
     23       
     24            Fix a misspelling.
     25
     26        (WebCore::PageGroup::invalidateInjectedStyleSheetCacheInAllFrames):
     27       
     28            Always invalidate style when user sheets change since we don't do that in
     29            DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache anymore.
     30
     31        * page/PageGroup.h:
     32
    1332013-08-07  Andre Moreira Magalhaes   <andre.magalhaes@collabora.co.uk>
    234
  • trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp

    r153641 r153788  
    188188void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
    189189{
     190    if (!m_injectedStyleSheetCacheValid)
     191        return;
    190192    m_injectedStyleSheetCacheValid = false;
     193    if (m_injectedUserStyleSheets.isEmpty() && m_injectedAuthorStyleSheets.isEmpty())
     194        return;
    191195    m_document->styleResolverChanged(DeferRecalcStyle);
    192196}
  • trunk/Source/WebCore/page/PageGroup.cpp

    r152004 r153788  
    306306
    307307    if (injectionTime == InjectInExistingDocuments)
    308         invalidatedInjectedStyleSheetCacheInAllFrames();
     308        invalidateInjectedStyleSheetCacheInAllFrames();
    309309}
    310310
     
    356356        m_userStyleSheets->remove(it);
    357357
    358     invalidatedInjectedStyleSheetCacheInAllFrames();
     358    invalidateInjectedStyleSheetCacheInAllFrames();
    359359}
    360360
     
    386386    m_userStyleSheets->remove(it);
    387387
    388     invalidatedInjectedStyleSheetCacheInAllFrames();
     388    invalidateInjectedStyleSheetCacheInAllFrames();
    389389}
    390390
     
    395395    if (m_userStyleSheets) {
    396396        m_userStyleSheets.clear();
    397         invalidatedInjectedStyleSheetCacheInAllFrames();
    398     }
    399 }
    400 
    401 void PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames()
     397        invalidateInjectedStyleSheetCacheInAllFrames();
     398    }
     399}
     400
     401void PageGroup::invalidateInjectedStyleSheetCacheInAllFrames()
    402402{
    403403    // Clear our cached sheets and have them just reparse.
    404404    HashSet<Page*>::const_iterator end = m_pages.end();
    405405    for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
    406         for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
     406        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    407407            frame->document()->styleSheetCollection()->invalidateInjectedStyleSheetCache();
     408            frame->document()->styleResolverChanged(DeferRecalcStyle);
     409        }
    408410    }
    409411}
  • trunk/Source/WebCore/page/PageGroup.h

    r149840 r153788  
    120120
    121121        void addVisitedLink(LinkHash);
    122         void invalidatedInjectedStyleSheetCacheInAllFrames();
     122        void invalidateInjectedStyleSheetCacheInAllFrames();
    123123
    124124        String m_name;
Note: See TracChangeset for help on using the changeset viewer.