Title: [134986] trunk
Revision
134986
Author
an...@apple.com
Date
2012-11-16 12:36:03 -0800 (Fri, 16 Nov 2012)

Log Message

REGRESSION(r129644): User StyleSheet not applying
https://bugs.webkit.org/show_bug.cgi?id=102110

Reviewed by Andreas Kling.

Source/WebCore: 

Injected stylesheets added as UserStyleAuthorLevel fail to apply. r129644 implicitly assumed that
such things don't exists but on Chromium addUserStyleSheet() confusingly uses them.
        
The patch adds injected author stylesheets to DocumentStyleSheetCollection::activeStyleSheets().
It also generally cleans up the code around injected and user stylesheets.

Tests: userscripts/user-script-and-stylesheet.html
       userscripts/user-stylesheet-invalidate.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::collectRulesFromUserStyleSheets):
(WebCore::collectCSSOMWrappers):
* css/StyleResolver.h:
(StyleResolver):
* dom/Document.cpp:
(WebCore::Document::setCompatibilityMode):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::injectedUserStyleSheets):
(WebCore):
(WebCore::DocumentStyleSheetCollection::injectedAuthorStyleSheets):
(WebCore::DocumentStyleSheetCollection::updateInjectedStyleSheetCache):
(WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache):
(WebCore::DocumentStyleSheetCollection::addUserSheet):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::documentUserStyleSheets):
(DocumentStyleSheetCollection):
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserStyleSheetToWorld):
(WebCore::PageGroup::removeUserStyleSheetFromWorld):
(WebCore::PageGroup::removeUserStyleSheetsFromWorld):
(WebCore::PageGroup::removeAllUserContent):
(WebCore::PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames):
* page/PageGroup.h:
(PageGroup):

LayoutTests: 

* userscripts/user-stylesheet-invalidate-expected.txt: Added.
* userscripts/user-stylesheet-invalidate.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134985 => 134986)


--- trunk/LayoutTests/ChangeLog	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/LayoutTests/ChangeLog	2012-11-16 20:36:03 UTC (rev 134986)
@@ -1,3 +1,13 @@
+2012-11-16  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION(r129644): User StyleSheet not applying
+        https://bugs.webkit.org/show_bug.cgi?id=102110
+
+        Reviewed by Andreas Kling.
+
+        * userscripts/user-stylesheet-invalidate-expected.txt: Added.
+        * userscripts/user-stylesheet-invalidate.html: Added.
+
 2012-11-15  Brent Fulgham  <bfulg...@webkit.org>
 
         [WinCairo] Sync with Windows test expectations.

Added: trunk/LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt (0 => 134986)


--- trunk/LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt	2012-11-16 20:36:03 UTC (rev 134986)
@@ -0,0 +1,2 @@
+This test requires layout test runner.
+PASS

Added: trunk/LayoutTests/userscripts/user-stylesheet-invalidate.html (0 => 134986)


--- trunk/LayoutTests/userscripts/user-stylesheet-invalidate.html	                        (rev 0)
+++ trunk/LayoutTests/userscripts/user-stylesheet-invalidate.html	2012-11-16 20:36:03 UTC (rev 134986)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+* { color: red; }
+</style>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.addUserStyleSheet("div { width:0; }", true);
+}
+</script>
+</head>
+<body>
+This test requires layout test runner.
+<div id="target">FAIL</div>
+<script>
+var style = document.createElement("style");
+style.innerText = "* { color: blue; }";
+document.head.insertBefore(style, document.getElementsByTagName("style")[0]);
+if (document.getElementById('target').offsetWidth == 0)
+    document.getElementById('target').innerHTML = 'PASS';
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (134985 => 134986)


--- trunk/Source/WebCore/ChangeLog	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/ChangeLog	2012-11-16 20:36:03 UTC (rev 134986)
@@ -1,3 +1,50 @@
+2012-11-16  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION(r129644): User StyleSheet not applying
+        https://bugs.webkit.org/show_bug.cgi?id=102110
+
+        Reviewed by Andreas Kling.
+
+        Injected stylesheets added as UserStyleAuthorLevel fail to apply. r129644 implicitly assumed that
+        such things don't exists but on Chromium addUserStyleSheet() confusingly uses them.
+        
+        The patch adds injected author stylesheets to DocumentStyleSheetCollection::activeStyleSheets().
+        It also generally cleans up the code around injected and user stylesheets.
+
+        Tests: userscripts/user-script-and-stylesheet.html
+               userscripts/user-stylesheet-invalidate.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::StyleResolver):
+        (WebCore::StyleResolver::collectRulesFromUserStyleSheets):
+        (WebCore::collectCSSOMWrappers):
+        * css/StyleResolver.h:
+        (StyleResolver):
+        * dom/Document.cpp:
+        (WebCore::Document::setCompatibilityMode):
+        * dom/DocumentStyleSheetCollection.cpp:
+        (WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
+        (WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
+        (WebCore::DocumentStyleSheetCollection::injectedUserStyleSheets):
+        (WebCore):
+        (WebCore::DocumentStyleSheetCollection::injectedAuthorStyleSheets):
+        (WebCore::DocumentStyleSheetCollection::updateInjectedStyleSheetCache):
+        (WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache):
+        (WebCore::DocumentStyleSheetCollection::addUserSheet):
+        (WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
+        (WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
+        * dom/DocumentStyleSheetCollection.h:
+        (WebCore::DocumentStyleSheetCollection::documentUserStyleSheets):
+        (DocumentStyleSheetCollection):
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::addUserStyleSheetToWorld):
+        (WebCore::PageGroup::removeUserStyleSheetFromWorld):
+        (WebCore::PageGroup::removeUserStyleSheetsFromWorld):
+        (WebCore::PageGroup::removeAllUserContent):
+        (WebCore::PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames):
+        * page/PageGroup.h:
+        (PageGroup):
+
 2012-11-16  Andreas Kling  <akl...@apple.com>
 
         StyleResolver: Only input elements need equal "readonly" attribute for style sharing.

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (134985 => 134986)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-16 20:36:03 UTC (rev 134986)
@@ -314,12 +314,11 @@
     resetAuthorStyle();
 
     DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCollection();
-    // FIXME: This sucks! The user sheet is reparsed every time!
     OwnPtr<RuleSet> tempUserStyle = RuleSet::create();
     if (CSSStyleSheet* pageUserSheet = styleSheetCollection->pageUserSheet())
         tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), *m_medium, this);
-    addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->pageGroupUserSheets(), *tempUserStyle);
-    addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->documentUserSheets(), *tempUserStyle);
+    collectRulesFromUserStyleSheets(styleSheetCollection->injectedUserStyleSheets(), *tempUserStyle);
+    collectRulesFromUserStyleSheets(styleSheetCollection->documentUserStyleSheets(), *tempUserStyle);
     if (tempUserStyle->m_ruleCount > 0 || tempUserStyle->m_pageRules.size() > 0)
         m_userStyle = tempUserStyle.release();
 
@@ -335,18 +334,11 @@
     appendAuthorStyleSheets(0, styleSheetCollection->activeAuthorStyleSheets());
 }
 
-void StyleResolver::addAuthorRulesAndCollectUserRulesFromSheets(const Vector<RefPtr<CSSStyleSheet> >* userSheets, RuleSet& userStyle)
+void StyleResolver::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& userSheets, RuleSet& userStyle)
 {
-    if (!userSheets)
-        return;
-
-    unsigned length = userSheets->size();
-    for (unsigned i = 0; i < length; i++) {
-        StyleSheetContents* sheet = userSheets->at(i)->contents();
-        if (sheet->isUserStyleSheet())
-            userStyle.addRulesFromSheet(sheet, *m_medium, this);
-        else
-            m_authorStyle->addRulesFromSheet(sheet, *m_medium, this);
+    for (unsigned i = 0; i < userSheets.size(); ++i) {
+        ASSERT(userSheets[i]->contents()->isUserStyleSheet());
+        userStyle.addRulesFromSheet(userSheets[i]->contents(), *m_medium, this);
     }
 }
 
@@ -2590,27 +2582,18 @@
     collectCSSOMWrappers(wrapperMap, styleSheetWrapper.get());
 }
 
-static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, DocumentStyleSheetCollection* styleSheetCollection)
+static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, const Vector<RefPtr<CSSStyleSheet> >& sheets)
 {
-    const Vector<RefPtr<CSSStyleSheet> >& styleSheets = styleSheetCollection->activeAuthorStyleSheets();
-    for (unsigned i = 0; i < styleSheets.size(); ++i)
-        collectCSSOMWrappers(wrapperMap, styleSheets[i].get());
+    for (unsigned i = 0; i < sheets.size(); ++i)
+        collectCSSOMWrappers(wrapperMap, sheets[i].get());
+}
 
+static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, DocumentStyleSheetCollection* styleSheetCollection)
+{
+    collectCSSOMWrappers(wrapperMap, styleSheetCollection->activeAuthorStyleSheets());
     collectCSSOMWrappers(wrapperMap, styleSheetCollection->pageUserSheet());
-    {
-        const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets = styleSheetCollection->pageGroupUserSheets();
-        if (pageGroupUserSheets) {
-            for (size_t i = 0, size = pageGroupUserSheets->size(); i < size; ++i)
-                collectCSSOMWrappers(wrapperMap, pageGroupUserSheets->at(i).get());
-        }
-    }
-    {
-        const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets = styleSheetCollection->documentUserSheets();
-        if (documentUserSheets) {
-            for (size_t i = 0, size = documentUserSheets->size(); i < size; ++i)
-                collectCSSOMWrappers(wrapperMap, documentUserSheets->at(i).get());
-        }
-    }
+    collectCSSOMWrappers(wrapperMap, styleSheetCollection->injectedUserStyleSheets());
+    collectCSSOMWrappers(wrapperMap, styleSheetCollection->documentUserStyleSheets());
 }
 
 CSSStyleRule* StyleResolver::ensureFullCSSOMWrapperForInspector(StyleRule* rule)

Modified: trunk/Source/WebCore/css/StyleResolver.h (134985 => 134986)


--- trunk/Source/WebCore/css/StyleResolver.h	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/css/StyleResolver.h	2012-11-16 20:36:03 UTC (rev 134986)
@@ -421,7 +421,7 @@
 private:
     static RenderStyle* s_styleNotYetAvailable;
 
-    void addAuthorRulesAndCollectUserRulesFromSheets(const Vector<RefPtr<CSSStyleSheet> >*, RuleSet& userStyle);
+    void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&, RuleSet& userStyle);
 
     void cacheBorderAndBackground();
 

Modified: trunk/Source/WebCore/dom/Document.cpp (134985 => 134986)


--- trunk/Source/WebCore/dom/Document.cpp	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-11-16 20:36:03 UTC (rev 134986)
@@ -799,7 +799,7 @@
     if (inQuirksMode() != wasInQuirksMode) {
         // All user stylesheets have to reparse using the different mode.
         m_styleSheetCollection->clearPageUserSheet();
-        m_styleSheetCollection->clearPageGroupUserSheets();
+        m_styleSheetCollection->invalidateInjectedStyleSheetCache();
     }
 }
 

Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp (134985 => 134986)


--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp	2012-11-16 20:36:03 UTC (rev 134986)
@@ -58,7 +58,7 @@
 DocumentStyleSheetCollection::DocumentStyleSheetCollection(Document* document)
     : m_document(document)
     , m_pendingStylesheets(0)
-    , m_pageGroupUserSheetCacheValid(false)
+    , m_injectedStyleSheetCacheValid(false)
     , m_hadActiveLoadingStylesheet(false)
     , m_needsUpdateActiveStylesheetsOnStyleRecalc(false)
     , m_usesSiblingRules(false)
@@ -75,14 +75,12 @@
 {
     if (m_pageUserSheet)
         m_pageUserSheet->clearOwnerNode();
-    if (m_pageGroupUserSheets) {
-        for (size_t i = 0; i < m_pageGroupUserSheets->size(); ++i)
-            (*m_pageGroupUserSheets)[i]->clearOwnerNode();
-    }
-    if (m_userSheets) {
-        for (size_t i = 0; i < m_userSheets->size(); ++i)
-            (*m_userSheets)[i]->clearOwnerNode();
-    }
+    for (unsigned i = 0; i < m_injectedUserStyleSheets.size(); ++i)
+        m_injectedUserStyleSheets[i]->clearOwnerNode();
+    for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i)
+        m_injectedAuthorStyleSheets[i]->clearOwnerNode();
+    for (unsigned i = 0; i < m_userStyleSheets.size(); ++i)
+        m_userStyleSheets[i]->clearOwnerNode();
 }
 
 void DocumentStyleSheetCollection::combineCSSFeatureFlags()
@@ -137,21 +135,34 @@
         m_document->styleResolverChanged(RecalcStyleImmediately);
 }
 
-const Vector<RefPtr<CSSStyleSheet> >* DocumentStyleSheetCollection::pageGroupUserSheets() const
+const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::injectedUserStyleSheets() const
 {
-    if (m_pageGroupUserSheetCacheValid)
-        return m_pageGroupUserSheets.get();
-    
-    m_pageGroupUserSheetCacheValid = true;
-    
+    updateInjectedStyleSheetCache();
+    return m_injectedUserStyleSheets;
+}
+
+const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::injectedAuthorStyleSheets() const
+{
+    updateInjectedStyleSheetCache();
+    return m_injectedAuthorStyleSheets;
+}
+
+void DocumentStyleSheetCollection::updateInjectedStyleSheetCache() const
+{
+    if (m_injectedStyleSheetCacheValid)
+        return;
+    m_injectedStyleSheetCacheValid = true;
+    m_injectedUserStyleSheets.clear();
+    m_injectedAuthorStyleSheets.clear();
+
     Page* owningPage = m_document->page();
     if (!owningPage)
-        return 0;
+        return;
         
     const PageGroup& pageGroup = owningPage->group();
     const UserStyleSheetMap* sheetsMap = pageGroup.userStyleSheets();
     if (!sheetsMap)
-        return 0;
+        return;
 
     UserStyleSheetMap::const_iterator end = sheetsMap->end();
     for (UserStyleSheetMap::const_iterator it = sheetsMap->begin(); it != end; ++it) {
@@ -163,38 +174,26 @@
             if (!UserContentURLPattern::matchesPatterns(m_document->url(), sheet->whitelist(), sheet->blacklist()))
                 continue;
             RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(m_document), sheet->url());
-            if (!m_pageGroupUserSheets)
-                m_pageGroupUserSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
-            m_pageGroupUserSheets->append(groupSheet);
-            groupSheet->contents()->setIsUserStyleSheet(sheet->level() == UserStyleUserLevel);
+            bool isUserStyleSheet = sheet->level() == UserStyleUserLevel;
+            if (isUserStyleSheet)
+                m_injectedUserStyleSheets.append(groupSheet);
+            else
+                m_injectedAuthorStyleSheets.append(groupSheet);
+            groupSheet->contents()->setIsUserStyleSheet(isUserStyleSheet);
             groupSheet->contents()->parseString(sheet->source());
         }
     }
-
-    return m_pageGroupUserSheets.get();
 }
 
-void DocumentStyleSheetCollection::clearPageGroupUserSheets()
+void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
 {
-    m_pageGroupUserSheetCacheValid = false;
-    if (m_pageGroupUserSheets && m_pageGroupUserSheets->size()) {
-        m_pageGroupUserSheets->clear();
-        m_document->styleResolverChanged(DeferRecalcStyle);
-    }
+    m_injectedStyleSheetCacheValid = false;
+    m_document->styleResolverChanged(DeferRecalcStyle);
 }
 
-void DocumentStyleSheetCollection::updatePageGroupUserSheets()
-{
-    clearPageGroupUserSheets();
-    if (pageGroupUserSheets() && pageGroupUserSheets()->size())
-        m_document->styleResolverChanged(RecalcStyleImmediately);
-}
-
 void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
 {
-    if (!m_userSheets)
-        m_userSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
-    m_userSheets->append(CSSStyleSheet::create(userSheet, m_document));
+    m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document));
     m_document->styleResolverChanged(RecalcStyleImmediately);
 }
 
@@ -455,6 +454,7 @@
     collectActiveStyleSheets(activeStyleSheets);
 
     Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
+    activeCSSStyleSheets.append(injectedAuthorStyleSheets());
     collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_document);
     filterEnabledCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets);
 
@@ -490,8 +490,9 @@
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
     info.addMember(m_pageUserSheet);
-    info.addMember(m_pageGroupUserSheets);
-    info.addMember(m_userSheets);
+    info.addMember(m_injectedUserStyleSheets);
+    info.addMember(m_injectedAuthorStyleSheets);
+    info.addMember(m_userStyleSheets);
     info.addMember(m_activeAuthorStyleSheets);
     info.addMember(m_styleSheetsForStyleSheetList);
     info.addMember(m_styleSheetCandidateNodes);

Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h (134985 => 134986)


--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h	2012-11-16 20:36:03 UTC (rev 134986)
@@ -55,16 +55,17 @@
     const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { return m_activeAuthorStyleSheets; }
 
     CSSStyleSheet* pageUserSheet();
-    const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets() const;
-    const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets() const { return m_userSheets.get(); }
+    const Vector<RefPtr<CSSStyleSheet> >& documentUserStyleSheets() const { return m_userStyleSheets; }
+    const Vector<RefPtr<CSSStyleSheet> >& injectedUserStyleSheets() const;
+    const Vector<RefPtr<CSSStyleSheet> >& injectedAuthorStyleSheets() const;
 
     void addStyleSheetCandidateNode(Node*, bool createdByParser);
     void removeStyleSheetCandidateNode(Node*);
 
     void clearPageUserSheet();
     void updatePageUserSheet();
-    void clearPageGroupUserSheets();
-    void updatePageGroupUserSheets();
+    void invalidateInjectedStyleSheetCache();
+    void updateInjectedStyleSheetCache() const;
 
     void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
 
@@ -125,10 +126,13 @@
     int m_pendingStylesheets;
 
     RefPtr<CSSStyleSheet> m_pageUserSheet;
-    mutable OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_pageGroupUserSheets;
-    OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_userSheets;
-    mutable bool m_pageGroupUserSheetCacheValid;
 
+    mutable Vector<RefPtr<CSSStyleSheet> > m_injectedUserStyleSheets;
+    mutable Vector<RefPtr<CSSStyleSheet> > m_injectedAuthorStyleSheets;
+    mutable bool m_injectedStyleSheetCacheValid;
+
+    Vector<RefPtr<CSSStyleSheet> > m_userStyleSheets;
+
     bool m_hadActiveLoadingStylesheet;
     bool m_needsUpdateActiveStylesheetsOnStyleRecalc;
 

Modified: trunk/Source/WebCore/page/PageGroup.cpp (134985 => 134986)


--- trunk/Source/WebCore/page/PageGroup.cpp	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/page/PageGroup.cpp	2012-11-16 20:36:03 UTC (rev 134986)
@@ -301,7 +301,7 @@
     styleSheetsInWorld->append(userStyleSheet.release());
 
     if (injectionTime == InjectInExistingDocuments)
-        resetUserStyleCacheInAllFrames();
+        invalidatedInjectedStyleSheetCacheInAllFrames();
 }
 
 void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& url)
@@ -351,7 +351,7 @@
     if (stylesheets->isEmpty())
         m_userStyleSheets->remove(it);
 
-    resetUserStyleCacheInAllFrames();
+    invalidatedInjectedStyleSheetCacheInAllFrames();
 }
 
 void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld* world)
@@ -381,7 +381,7 @@
     
     m_userStyleSheets->remove(it);
 
-    resetUserStyleCacheInAllFrames();
+    invalidatedInjectedStyleSheetCacheInAllFrames();
 }
 
 void PageGroup::removeAllUserContent()
@@ -390,17 +390,17 @@
 
     if (m_userStyleSheets) {
         m_userStyleSheets.clear();
-        resetUserStyleCacheInAllFrames();
+        invalidatedInjectedStyleSheetCacheInAllFrames();
     }
 }
 
-void PageGroup::resetUserStyleCacheInAllFrames()
+void PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames()
 {
     // 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())
-            frame->document()->styleSheetCollection()->updatePageGroupUserSheets();
+            frame->document()->styleSheetCollection()->invalidateInjectedStyleSheetCache();
     }
 }
 

Modified: trunk/Source/WebCore/page/PageGroup.h (134985 => 134986)


--- trunk/Source/WebCore/page/PageGroup.h	2012-11-16 20:26:22 UTC (rev 134985)
+++ trunk/Source/WebCore/page/PageGroup.h	2012-11-16 20:36:03 UTC (rev 134986)
@@ -119,7 +119,7 @@
         PageGroup(Page*);
 
         void addVisitedLink(LinkHash stringHash);
-        void resetUserStyleCacheInAllFrames();
+        void invalidatedInjectedStyleSheetCacheInAllFrames();
   
 #if ENABLE(VIDEO_TRACK)
         CaptionUserPreferences* captionPreferences();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to