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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2880303002: Update styleSheets list in import without active style update. (Closed)
Patch Set: Created 3 years, 7 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: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index bf671333e975d391cfe623922caf6ceff93347f2..6164c458ac8c8edd982872412c36bd472440d274 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -121,23 +121,40 @@ TreeScopeStyleSheetCollection* StyleEngine::StyleSheetCollectionFor(
const HeapVector<TraceWrapperMember<StyleSheet>>&
StyleEngine::StyleSheetsForStyleSheetList(TreeScope& tree_scope) {
- // TODO(rune@opera.com): we could split styleSheets and active stylesheet
- // update to have a lighter update while accessing the styleSheets list.
DCHECK(Master());
if (Master()->IsActive()) {
- if (IsMaster())
+ if (IsMaster()) {
+ // TODO(rune@opera.com): Replace with UpdateStyleSheetList().
UpdateActiveStyle();
- else
- Master()->GetStyleEngine().UpdateActiveStyle();
+ } else {
+ UpdateStyleSheetList(tree_scope);
+ }
}
if (tree_scope == document_)
return GetDocumentStyleSheetCollection().StyleSheetsForStyleSheetList();
+ DCHECK(IsMaster());
return EnsureStyleSheetCollectionFor(tree_scope)
->StyleSheetsForStyleSheetList();
}
+void StyleEngine::UpdateStyleSheetList(TreeScope& tree_scope) {
+ // TODO(rune@opera.com): currently only for import documents.
+ DCHECK(!IsMaster());
+ DCHECK(tree_scope.GetDocument() == GetDocument());
+
+ if (tree_scope != GetDocument())
+ return;
+ if (!ShouldUpdateDocumentStyleSheetCollection())
+ return;
+
+ GetDocumentStyleSheetCollection().CollectStyleSheetsForList();
+ // Avoid updating the styleSheets list repeatedly. Only safe for imports.
+ document_scope_dirty_ = false;
+ DCHECK(!all_tree_scopes_dirty_);
+}
+
void StyleEngine::InjectAuthorSheet(StyleSheetContents* author_sheet) {
injected_author_style_sheets_.push_back(TraceWrapperMember<CSSStyleSheet>(
this, CSSStyleSheet::Create(author_sheet, *document_)));
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698