Commit 44194bce authored by hyatt@apple.com's avatar hyatt@apple.com

Make sure the removal of user stylesheets results in all of the WebViews being updated to

reflect the changes.

Reviewed by Tim Hatcher.

* page/PageGroup.cpp:
(WebCore::PageGroup::removeUserContentWithURLForWorld):
(WebCore::PageGroup::removeUserContentForWorld):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a24eed18
2009-09-30 Dave Hyatt <hyatt@apple.com>
Reviewed by Tim Hatcher.
Make sure the removal of user stylesheets results in all of the WebViews being updated to
reflect the changes.
* page/PageGroup.cpp:
(WebCore::PageGroup::removeUserContentWithURLForWorld):
(WebCore::PageGroup::removeUserContentForWorld):
2009-09-30 Dan Bernstein <mitz@apple.com> 2009-09-30 Dan Bernstein <mitz@apple.com>
Reviewed by Sam Weinig. Reviewed by Sam Weinig.
...@@ -253,11 +253,14 @@ void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned world ...@@ -253,11 +253,14 @@ void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned world
if (m_userStyleSheets) { if (m_userStyleSheets) {
UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID); UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
bool sheetsChanged = false;
if (it != m_userStyleSheets->end()) { if (it != m_userStyleSheets->end()) {
UserStyleSheetVector* stylesheets = it->second; UserStyleSheetVector* stylesheets = it->second;
for (int i = stylesheets->size() - 1; i >= 0; --i) { for (int i = stylesheets->size() - 1; i >= 0; --i) {
if (stylesheets->at(i)->url() == url) if (stylesheets->at(i)->url() == url) {
stylesheets->remove(i); stylesheets->remove(i);
sheetsChanged = true;
}
} }
if (stylesheets->isEmpty()) { if (stylesheets->isEmpty()) {
...@@ -265,6 +268,15 @@ void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned world ...@@ -265,6 +268,15 @@ void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned world
delete it->second; delete it->second;
} }
} }
// Clear our cached sheets and have them just reparse.
if (sheetsChanged) {
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();
}
}
} }
} }
...@@ -279,11 +291,22 @@ void PageGroup::removeUserContentForWorld(unsigned worldID) ...@@ -279,11 +291,22 @@ void PageGroup::removeUserContentForWorld(unsigned worldID)
} }
if (m_userStyleSheets) { if (m_userStyleSheets) {
bool sheetsChanged = false;
UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID); UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
if (it != m_userStyleSheets->end()) { if (it != m_userStyleSheets->end()) {
m_userStyleSheets->remove(it); m_userStyleSheets->remove(it);
sheetsChanged = true;
delete it->second; delete it->second;
} }
if (sheetsChanged) {
// 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();
}
}
} }
} }
......
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