Title: [153788] trunk
Revision
153788
Author
[email protected]
Date
2013-08-07 08:02:39 -0700 (Wed, 07 Aug 2013)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153787 => 153788)


--- trunk/LayoutTests/ChangeLog	2013-08-07 15:00:42 UTC (rev 153787)
+++ trunk/LayoutTests/ChangeLog	2013-08-07 15:02:39 UTC (rev 153788)
@@ -1,3 +1,14 @@
+2013-08-07  Antti Koivisto  <[email protected]>
+
+        2.5% regression on page cycler moz
+        https://bugs.webkit.org/show_bug.cgi?id=102822
+
+        Reviewed by Andreas Kling.
+        
+        This is a progression.
+
+        * inspector/timeline/timeline-script-tag-1-expected.txt:
+
 2013-08-07  Mirela Budaes  <[email protected]>
 
         [CSS Blending] Add test suite to validate background blending with different properties

Modified: trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt (153787 => 153788)


--- trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt	2013-08-07 15:00:42 UTC (rev 153787)
+++ trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt	2013-08-07 15:02:39 UTC (rev 153788)
@@ -3,10 +3,8 @@
 
 
 ParseHTML
-----> ScheduleStyleRecalculation
 ----> InvalidateLayout
 ParseHTML
-----> ScheduleStyleRecalculation
 ----> EvaluateScript
 --------> TimeStamp : SCRIPT TAG
 ----> InvalidateLayout

Modified: trunk/Source/WebCore/ChangeLog (153787 => 153788)


--- trunk/Source/WebCore/ChangeLog	2013-08-07 15:00:42 UTC (rev 153787)
+++ trunk/Source/WebCore/ChangeLog	2013-08-07 15:02:39 UTC (rev 153788)
@@ -1,3 +1,35 @@
+2013-08-07  Antti Koivisto  <[email protected]>
+
+        2.5% regression on page cycler moz
+        https://bugs.webkit.org/show_bug.cgi?id=102822
+
+        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:
+
 2013-08-07  Andre Moreira Magalhaes   <[email protected]>
 
         Do no check seek offset against internal size on gstreamer source element

Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp (153787 => 153788)


--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp	2013-08-07 15:00:42 UTC (rev 153787)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp	2013-08-07 15:02:39 UTC (rev 153788)
@@ -187,7 +187,11 @@
 
 void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
 {
+    if (!m_injectedStyleSheetCacheValid)
+        return;
     m_injectedStyleSheetCacheValid = false;
+    if (m_injectedUserStyleSheets.isEmpty() && m_injectedAuthorStyleSheets.isEmpty())
+        return;
     m_document->styleResolverChanged(DeferRecalcStyle);
 }
 

Modified: trunk/Source/WebCore/page/PageGroup.cpp (153787 => 153788)


--- trunk/Source/WebCore/page/PageGroup.cpp	2013-08-07 15:00:42 UTC (rev 153787)
+++ trunk/Source/WebCore/page/PageGroup.cpp	2013-08-07 15:02:39 UTC (rev 153788)
@@ -305,7 +305,7 @@
     styleSheetsInWorld->append(userStyleSheet.release());
 
     if (injectionTime == InjectInExistingDocuments)
-        invalidatedInjectedStyleSheetCacheInAllFrames();
+        invalidateInjectedStyleSheetCacheInAllFrames();
 }
 
 void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& url)
@@ -355,7 +355,7 @@
     if (stylesheets->isEmpty())
         m_userStyleSheets->remove(it);
 
-    invalidatedInjectedStyleSheetCacheInAllFrames();
+    invalidateInjectedStyleSheetCacheInAllFrames();
 }
 
 void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld* world)
@@ -385,7 +385,7 @@
     
     m_userStyleSheets->remove(it);
 
-    invalidatedInjectedStyleSheetCacheInAllFrames();
+    invalidateInjectedStyleSheetCacheInAllFrames();
 }
 
 void PageGroup::removeAllUserContent()
@@ -394,17 +394,19 @@
 
     if (m_userStyleSheets) {
         m_userStyleSheets.clear();
-        invalidatedInjectedStyleSheetCacheInAllFrames();
+        invalidateInjectedStyleSheetCacheInAllFrames();
     }
 }
 
-void PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames()
+void PageGroup::invalidateInjectedStyleSheetCacheInAllFrames()
 {
     // Clear our cached sheets and have them just reparse.
     HashSet<Page*>::const_iterator end = m_pages.end();
     for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
+        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
             frame->document()->styleSheetCollection()->invalidateInjectedStyleSheetCache();
+            frame->document()->styleResolverChanged(DeferRecalcStyle);
+        }
     }
 }
 

Modified: trunk/Source/WebCore/page/PageGroup.h (153787 => 153788)


--- trunk/Source/WebCore/page/PageGroup.h	2013-08-07 15:00:42 UTC (rev 153787)
+++ trunk/Source/WebCore/page/PageGroup.h	2013-08-07 15:02:39 UTC (rev 153788)
@@ -119,7 +119,7 @@
         PageGroup(Page*);
 
         void addVisitedLink(LinkHash);
-        void invalidatedInjectedStyleSheetCacheInAllFrames();
+        void invalidateInjectedStyleSheetCacheInAllFrames();
 
         String m_name;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to