Commit 968aabd4 authored by aa@chromium.org's avatar aa@chromium.org

2010-07-13 Aaron Boodman <aa@chromium.org>

        Reviewed by Timothy Hatcher.

        Don't reset per-document user style caches when user styles are updated in
        Chromium.

        https://bugs.webkit.org/show_bug.cgi?id=42003

        * page/PageGroup.cpp:
        (WebCore::PageGroup::addUserStyleSheetToWorld):
        (WebCore::PageGroup::removeUserStyleSheetFromWorld):
        (WebCore::PageGroup::removeUserStyleSheetsFromWorld):
        (WebCore::PageGroup::removeAllUserContent):
        (WebCore::PageGroup::resetUserStyleCacheInAllFrames):
        * page/PageGroup.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f88c1d42
2010-07-13 Aaron Boodman <aa@chromium.org>
Reviewed by Timothy Hatcher.
Don't reset per-document user style caches when user styles are updated in
Chromium.
https://bugs.webkit.org/show_bug.cgi?id=42003
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserStyleSheetToWorld):
(WebCore::PageGroup::removeUserStyleSheetFromWorld):
(WebCore::PageGroup::removeUserStyleSheetsFromWorld):
(WebCore::PageGroup::removeAllUserContent):
(WebCore::PageGroup::resetUserStyleCacheInAllFrames):
* page/PageGroup.h:
2010-07-13 Eric Carlson <eric.carlson@apple.com>
Reviewed by Dan Bernstein.
......@@ -242,12 +242,7 @@ void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& s
styleSheetsInWorld = new UserStyleSheetVector;
styleSheetsInWorld->append(userStyleSheet.release());
// 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()->clearPageGroupUserSheets();
}
resetUserStyleCacheInAllFrames();
}
void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& url)
......@@ -301,13 +296,8 @@ void PageGroup::removeUserStyleSheetFromWorld(DOMWrapperWorld* world, const KURL
delete it->second;
m_userStyleSheets->remove(it);
}
// 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()->clearPageGroupUserSheets();
}
resetUserStyleCacheInAllFrames();
}
void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld* world)
......@@ -339,12 +329,7 @@ void PageGroup::removeUserStyleSheetsFromWorld(DOMWrapperWorld* world)
delete it->second;
m_userStyleSheets->remove(it);
// 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()->clearPageGroupUserSheets();
}
resetUserStyleCacheInAllFrames();
}
void PageGroup::removeAllUserContent()
......@@ -353,12 +338,24 @@ void PageGroup::removeAllUserContent()
deleteAllValues(*m_userScripts);
m_userScripts.clear();
}
if (m_userStyleSheets) {
deleteAllValues(*m_userStyleSheets);
m_userStyleSheets.clear();
resetUserStyleCacheInAllFrames();
}
}
void PageGroup::resetUserStyleCacheInAllFrames()
{
#if !PLATFORM(CHROMIUM)
// 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()->clearPageGroupUserSheets();
}
#endif
}
} // namespace WebCore
......@@ -94,7 +94,8 @@ namespace WebCore {
private:
void addVisitedLink(LinkHash stringHash);
void resetUserStyleCacheInAllFrames();
String m_name;
HashSet<Page*> m_pages;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment