Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Unified Diff: Source/core/dom/DocumentStyleSheetCollection.cpp

Issue 143463011: [import] support document.stylesheets in imported documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Landing Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/DocumentStyleSheetCollection.cpp
diff --git a/Source/core/dom/DocumentStyleSheetCollection.cpp b/Source/core/dom/DocumentStyleSheetCollection.cpp
index 07a8160e095c7570549dd92d5debd885e0900c25..9d69218ed3f925091d899bbe27178dec8b265aea 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.cpp
+++ b/Source/core/dom/DocumentStyleSheetCollection.cpp
@@ -81,10 +81,7 @@ void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine*
Document* document = candidate.importedDocument();
if (!document)
continue;
- if (collector.hasVisited(document))
- continue;
- collector.markVisited(document);
- document->styleEngine()->collectDocumentStyleSheets(collector);
+ document->styleEngine()->updateStyleSheetsInImport(collector);
continue;
}
@@ -101,19 +98,18 @@ void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine*
if (candidate.hasPreferrableName(engine->preferredStylesheetSetName()))
engine->selectStylesheetSetName(candidate.title());
- if (collector.isCollectingForList(m_treeScope))
- collector.appendSheetForList(sheet);
+ collector.appendSheetForList(sheet);
if (candidate.canBeActivated(engine->preferredStylesheetSetName()))
collector.appendActiveStyleSheet(toCSSStyleSheet(sheet));
}
}
-static void collectActiveCSSStyleSheetsFromSeamlessParents(StyleSheetCollectionBase& collection, Document* document)
+static void collectActiveCSSStyleSheetsFromSeamlessParents(DocumentStyleSheetCollector& collector, Document* document)
{
HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
if (!seamlessParentIFrame)
return;
- collection.appendActiveStyleSheets(seamlessParentIFrame->document().styleEngine()->activeAuthorStyleSheets());
+ collector.appendActiveStyleSheets(seamlessParentIFrame->document().styleEngine()->activeAuthorStyleSheets());
}
void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, DocumentStyleSheetCollector& collector)
@@ -121,17 +117,18 @@ void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Docum
ASSERT(document()->styleEngine() == engine);
collector.appendActiveStyleSheets(engine->injectedAuthorStyleSheets());
collector.appendActiveStyleSheets(engine->documentAuthorStyleSheets());
- collectActiveCSSStyleSheetsFromSeamlessParents(collector.collection(), document());
+ collectActiveCSSStyleSheetsFromSeamlessParents(collector, document());
collectStyleSheetsFromCandidates(engine, collector);
}
bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode)
{
- DocumentStyleSheetCollector collector(m_treeScope);
+ StyleSheetCollectionBase collection;
+ ActiveDocumentStyleSheetCollector collector(collection);
collectStyleSheets(engine, collector);
StyleSheetChange change;
- analyzeStyleSheetChange(updateMode, collector.collection(), change);
+ analyzeStyleSheetChange(updateMode, collection, change);
if (change.styleResolverUpdateType == Reconstruct) {
engine->clearMasterResolver();
@@ -146,15 +143,17 @@ bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine,
if (change.styleResolverUpdateType == ResetStyleResolverAndFontSelector)
engine->resetFontSelector();
styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets);
- styleResolver->lazyAppendAuthorStyleSheets(0, collector.collection().activeAuthorStyleSheets());
+ styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAuthorStyleSheets());
} else {
- styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collector.collection().activeAuthorStyleSheets());
+ styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection.activeAuthorStyleSheets());
}
} else if (change.styleResolverUpdateType == ResetStyleResolverAndFontSelector) {
engine->resetFontSelector();
}
m_scopingNodesForStyleScoped.didRemoveScopingNodes();
- collector.setCollectionTo(*this);
+
+ collection.swap(*this);
+
updateUsesRemUnits();
return change.requiresFullStyleRecalc;
« no previous file with comments | « LayoutTests/fast/html/imports/import-style-basic-expected.txt ('k') | Source/core/dom/DocumentStyleSheetCollector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698