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

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

Issue 1843693002: Introduce setNeedsActiveStyleUpdate for adding/removing stylesheets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 6e10d0a669856f096c4619b06d57cf270511920e..db2d4fd5cef08142295424fd141c3f5aa4dd3682 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -177,19 +177,25 @@ void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode)
document().didRemoveAllPendingStylesheet();
}
-void StyleEngine::modifiedStyleSheet(StyleSheet* sheet)
+void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpdateMode updateMode)
{
- if (!sheet)
+ // resolverChanged() is called for inactive non-master documents because
+ // import documents are inactive documents. resolverChanged() for imports
+ // will call resolverChanged() for the master document and update the active
+ // stylesheets including the ones from the import.
+ if (!document().isActive() && isMaster())
return;
- Node* node = sheet->ownerNode();
- if (!node || !node->inDocument())
- return;
-
- TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_document;
- ASSERT(isStyleElement(*node) || treeScope == m_document);
+ if (sheet && document().isActive()) {
+ Node* node = sheet->ownerNode();
+ if (node && node->inDocument()) {
+ TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_document;
+ ASSERT(isStyleElement(*node) || node->treeScope() == m_document);
+ markTreeScopeDirty(treeScope);
+ }
+ }
- markTreeScopeDirty(treeScope);
+ resolverChanged(updateMode);
}
void StyleEngine::addStyleSheetCandidateNode(Node* node)
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698