Diff
Modified: trunk/LayoutTests/ChangeLog (134991 => 134992)
--- trunk/LayoutTests/ChangeLog 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/LayoutTests/ChangeLog 2012-11-16 21:31:16 UTC (rev 134992)
@@ -1,3 +1,15 @@
+2012-11-16 Dimitri Glazkov <dglaz...@chromium.org>
+
+ Unreviewed, rolling out r134986.
+ http://trac.webkit.org/changeset/134986
+ https://bugs.webkit.org/show_bug.cgi?id=102110
+
+ Triggered ASSERT in fast/frames/seamless/seamless-inherited-
+ origin.html.
+
+ * userscripts/user-stylesheet-invalidate-expected.txt: Removed.
+ * userscripts/user-stylesheet-invalidate.html: Removed.
+
2012-11-16 Antti Koivisto <an...@apple.com>
REGRESSION(r129644): User StyleSheet not applying
Deleted: trunk/LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt (134991 => 134992)
--- trunk/LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt 2012-11-16 21:31:16 UTC (rev 134992)
@@ -1,2 +0,0 @@
-This test requires layout test runner.
-PASS
Deleted: trunk/LayoutTests/userscripts/user-stylesheet-invalidate.html (134991 => 134992)
--- trunk/LayoutTests/userscripts/user-stylesheet-invalidate.html 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/LayoutTests/userscripts/user-stylesheet-invalidate.html 2012-11-16 21:31:16 UTC (rev 134992)
@@ -1,25 +0,0 @@
-<!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 (134991 => 134992)
--- trunk/Source/WebCore/ChangeLog 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/ChangeLog 2012-11-16 21:31:16 UTC (rev 134992)
@@ -1,3 +1,42 @@
+2012-11-16 Dimitri Glazkov <dglaz...@chromium.org>
+
+ Unreviewed, rolling out r134986.
+ http://trac.webkit.org/changeset/134986
+ https://bugs.webkit.org/show_bug.cgi?id=102110
+
+ Triggered ASSERT in fast/frames/seamless/seamless-inherited-
+ origin.html.
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::StyleResolver):
+ (WebCore::StyleResolver::addAuthorRulesAndCollectUserRulesFromSheets):
+ (WebCore::collectCSSOMWrappers):
+ * css/StyleResolver.h:
+ (StyleResolver):
+ * dom/Document.cpp:
+ (WebCore::Document::setCompatibilityMode):
+ * dom/DocumentStyleSheetCollection.cpp:
+ (WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::pageGroupUserSheets):
+ (WebCore):
+ (WebCore::DocumentStyleSheetCollection::clearPageGroupUserSheets):
+ (WebCore::DocumentStyleSheetCollection::updatePageGroupUserSheets):
+ (WebCore::DocumentStyleSheetCollection::addUserSheet):
+ (WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
+ (WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
+ * dom/DocumentStyleSheetCollection.h:
+ (DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::documentUserSheets):
+ * page/PageGroup.cpp:
+ (WebCore::PageGroup::addUserStyleSheetToWorld):
+ (WebCore::PageGroup::removeUserStyleSheetFromWorld):
+ (WebCore::PageGroup::removeUserStyleSheetsFromWorld):
+ (WebCore::PageGroup::removeAllUserContent):
+ (WebCore::PageGroup::resetUserStyleCacheInAllFrames):
+ * page/PageGroup.h:
+ (PageGroup):
+
2012-11-16 Michael Pruett <mich...@68k.org>
IndexedDB: Propagate DOMRequestState to IndexedDB binding utility functions
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (134991 => 134992)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2012-11-16 21:31:16 UTC (rev 134992)
@@ -314,11 +314,12 @@
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);
- collectRulesFromUserStyleSheets(styleSheetCollection->injectedUserStyleSheets(), *tempUserStyle);
- collectRulesFromUserStyleSheets(styleSheetCollection->documentUserStyleSheets(), *tempUserStyle);
+ addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->pageGroupUserSheets(), *tempUserStyle);
+ addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->documentUserSheets(), *tempUserStyle);
if (tempUserStyle->m_ruleCount > 0 || tempUserStyle->m_pageRules.size() > 0)
m_userStyle = tempUserStyle.release();
@@ -334,11 +335,18 @@
appendAuthorStyleSheets(0, styleSheetCollection->activeAuthorStyleSheets());
}
-void StyleResolver::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& userSheets, RuleSet& userStyle)
+void StyleResolver::addAuthorRulesAndCollectUserRulesFromSheets(const Vector<RefPtr<CSSStyleSheet> >* userSheets, RuleSet& userStyle)
{
- for (unsigned i = 0; i < userSheets.size(); ++i) {
- ASSERT(userSheets[i]->contents()->isUserStyleSheet());
- userStyle.addRulesFromSheet(userSheets[i]->contents(), *m_medium, this);
+ 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);
}
}
@@ -2582,18 +2590,27 @@
collectCSSOMWrappers(wrapperMap, styleSheetWrapper.get());
}
-static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, const Vector<RefPtr<CSSStyleSheet> >& sheets)
+static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, DocumentStyleSheetCollection* styleSheetCollection)
{
- for (unsigned i = 0; i < sheets.size(); ++i)
- collectCSSOMWrappers(wrapperMap, sheets[i].get());
-}
+ const Vector<RefPtr<CSSStyleSheet> >& styleSheets = styleSheetCollection->activeAuthorStyleSheets();
+ for (unsigned i = 0; i < styleSheets.size(); ++i)
+ collectCSSOMWrappers(wrapperMap, styleSheets[i].get());
-static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, DocumentStyleSheetCollection* styleSheetCollection)
-{
- collectCSSOMWrappers(wrapperMap, styleSheetCollection->activeAuthorStyleSheets());
collectCSSOMWrappers(wrapperMap, styleSheetCollection->pageUserSheet());
- collectCSSOMWrappers(wrapperMap, styleSheetCollection->injectedUserStyleSheets());
- collectCSSOMWrappers(wrapperMap, styleSheetCollection->documentUserStyleSheets());
+ {
+ 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());
+ }
+ }
}
CSSStyleRule* StyleResolver::ensureFullCSSOMWrapperForInspector(StyleRule* rule)
Modified: trunk/Source/WebCore/css/StyleResolver.h (134991 => 134992)
--- trunk/Source/WebCore/css/StyleResolver.h 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/css/StyleResolver.h 2012-11-16 21:31:16 UTC (rev 134992)
@@ -421,7 +421,7 @@
private:
static RenderStyle* s_styleNotYetAvailable;
- void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&, RuleSet& userStyle);
+ void addAuthorRulesAndCollectUserRulesFromSheets(const Vector<RefPtr<CSSStyleSheet> >*, RuleSet& userStyle);
void cacheBorderAndBackground();
Modified: trunk/Source/WebCore/dom/Document.cpp (134991 => 134992)
--- trunk/Source/WebCore/dom/Document.cpp 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-11-16 21:31:16 UTC (rev 134992)
@@ -799,7 +799,7 @@
if (inQuirksMode() != wasInQuirksMode) {
// All user stylesheets have to reparse using the different mode.
m_styleSheetCollection->clearPageUserSheet();
- m_styleSheetCollection->invalidateInjectedStyleSheetCache();
+ m_styleSheetCollection->clearPageGroupUserSheets();
}
}
Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp (134991 => 134992)
--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp 2012-11-16 21:31:16 UTC (rev 134992)
@@ -58,7 +58,7 @@
DocumentStyleSheetCollection::DocumentStyleSheetCollection(Document* document)
: m_document(document)
, m_pendingStylesheets(0)
- , m_injectedStyleSheetCacheValid(false)
+ , m_pageGroupUserSheetCacheValid(false)
, m_hadActiveLoadingStylesheet(false)
, m_needsUpdateActiveStylesheetsOnStyleRecalc(false)
, m_usesSiblingRules(false)
@@ -75,12 +75,14 @@
{
if (m_pageUserSheet)
m_pageUserSheet->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();
+ 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();
+ }
}
void DocumentStyleSheetCollection::combineCSSFeatureFlags()
@@ -135,34 +137,21 @@
m_document->styleResolverChanged(RecalcStyleImmediately);
}
-const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::injectedUserStyleSheets() const
+const Vector<RefPtr<CSSStyleSheet> >* DocumentStyleSheetCollection::pageGroupUserSheets() const
{
- 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();
-
+ if (m_pageGroupUserSheetCacheValid)
+ return m_pageGroupUserSheets.get();
+
+ m_pageGroupUserSheetCacheValid = true;
+
Page* owningPage = m_document->page();
if (!owningPage)
- return;
+ return 0;
const PageGroup& pageGroup = owningPage->group();
const UserStyleSheetMap* sheetsMap = pageGroup.userStyleSheets();
if (!sheetsMap)
- return;
+ return 0;
UserStyleSheetMap::const_iterator end = sheetsMap->end();
for (UserStyleSheetMap::const_iterator it = sheetsMap->begin(); it != end; ++it) {
@@ -174,26 +163,38 @@
if (!UserContentURLPattern::matchesPatterns(m_document->url(), sheet->whitelist(), sheet->blacklist()))
continue;
RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(m_document), sheet->url());
- bool isUserStyleSheet = sheet->level() == UserStyleUserLevel;
- if (isUserStyleSheet)
- m_injectedUserStyleSheets.append(groupSheet);
- else
- m_injectedAuthorStyleSheets.append(groupSheet);
- groupSheet->contents()->setIsUserStyleSheet(isUserStyleSheet);
+ if (!m_pageGroupUserSheets)
+ m_pageGroupUserSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
+ m_pageGroupUserSheets->append(groupSheet);
+ groupSheet->contents()->setIsUserStyleSheet(sheet->level() == UserStyleUserLevel);
groupSheet->contents()->parseString(sheet->source());
}
}
+
+ return m_pageGroupUserSheets.get();
}
-void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
+void DocumentStyleSheetCollection::clearPageGroupUserSheets()
{
- m_injectedStyleSheetCacheValid = false;
- m_document->styleResolverChanged(DeferRecalcStyle);
+ m_pageGroupUserSheetCacheValid = false;
+ if (m_pageGroupUserSheets && m_pageGroupUserSheets->size()) {
+ m_pageGroupUserSheets->clear();
+ m_document->styleResolverChanged(DeferRecalcStyle);
+ }
}
+void DocumentStyleSheetCollection::updatePageGroupUserSheets()
+{
+ clearPageGroupUserSheets();
+ if (pageGroupUserSheets() && pageGroupUserSheets()->size())
+ m_document->styleResolverChanged(RecalcStyleImmediately);
+}
+
void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
{
- m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document));
+ if (!m_userSheets)
+ m_userSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
+ m_userSheets->append(CSSStyleSheet::create(userSheet, m_document));
m_document->styleResolverChanged(RecalcStyleImmediately);
}
@@ -454,7 +455,6 @@
collectActiveStyleSheets(activeStyleSheets);
Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
- activeCSSStyleSheets.append(injectedAuthorStyleSheets());
collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_document);
filterEnabledCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets);
@@ -490,9 +490,8 @@
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
info.addMember(m_pageUserSheet);
- info.addMember(m_injectedUserStyleSheets);
- info.addMember(m_injectedAuthorStyleSheets);
- info.addMember(m_userStyleSheets);
+ info.addMember(m_pageGroupUserSheets);
+ info.addMember(m_userSheets);
info.addMember(m_activeAuthorStyleSheets);
info.addMember(m_styleSheetsForStyleSheetList);
info.addMember(m_styleSheetCandidateNodes);
Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h (134991 => 134992)
--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h 2012-11-16 21:31:16 UTC (rev 134992)
@@ -55,17 +55,16 @@
const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { return m_activeAuthorStyleSheets; }
CSSStyleSheet* pageUserSheet();
- const Vector<RefPtr<CSSStyleSheet> >& documentUserStyleSheets() const { return m_userStyleSheets; }
- const Vector<RefPtr<CSSStyleSheet> >& injectedUserStyleSheets() const;
- const Vector<RefPtr<CSSStyleSheet> >& injectedAuthorStyleSheets() const;
+ const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets() const;
+ const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets() const { return m_userSheets.get(); }
void addStyleSheetCandidateNode(Node*, bool createdByParser);
void removeStyleSheetCandidateNode(Node*);
void clearPageUserSheet();
void updatePageUserSheet();
- void invalidateInjectedStyleSheetCache();
- void updateInjectedStyleSheetCache() const;
+ void clearPageGroupUserSheets();
+ void updatePageGroupUserSheets();
void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
@@ -126,13 +125,10 @@
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 (134991 => 134992)
--- trunk/Source/WebCore/page/PageGroup.cpp 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/page/PageGroup.cpp 2012-11-16 21:31:16 UTC (rev 134992)
@@ -301,7 +301,7 @@
styleSheetsInWorld->append(userStyleSheet.release());
if (injectionTime == InjectInExistingDocuments)
- invalidatedInjectedStyleSheetCacheInAllFrames();
+ resetUserStyleCacheInAllFrames();
}
void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& url)
@@ -351,7 +351,7 @@
if (stylesheets->isEmpty())
m_userStyleSheets->remove(it);
- invalidatedInjectedStyleSheetCacheInAllFrames();
+ resetUserStyleCacheInAllFrames();
}
void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld* world)
@@ -381,7 +381,7 @@
m_userStyleSheets->remove(it);
- invalidatedInjectedStyleSheetCacheInAllFrames();
+ resetUserStyleCacheInAllFrames();
}
void PageGroup::removeAllUserContent()
@@ -390,17 +390,17 @@
if (m_userStyleSheets) {
m_userStyleSheets.clear();
- invalidatedInjectedStyleSheetCacheInAllFrames();
+ resetUserStyleCacheInAllFrames();
}
}
-void PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames()
+void PageGroup::resetUserStyleCacheInAllFrames()
{
// 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()->invalidateInjectedStyleSheetCache();
+ frame->document()->styleSheetCollection()->updatePageGroupUserSheets();
}
}
Modified: trunk/Source/WebCore/page/PageGroup.h (134991 => 134992)
--- trunk/Source/WebCore/page/PageGroup.h 2012-11-16 21:29:30 UTC (rev 134991)
+++ trunk/Source/WebCore/page/PageGroup.h 2012-11-16 21:31:16 UTC (rev 134992)
@@ -119,7 +119,7 @@
PageGroup(Page*);
void addVisitedLink(LinkHash stringHash);
- void invalidatedInjectedStyleSheetCacheInAllFrames();
+ void resetUserStyleCacheInAllFrames();
#if ENABLE(VIDEO_TRACK)
CaptionUserPreferences* captionPreferences();