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

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

Issue 2551473002: Correctly re-collect active style for html imports. (Closed)
Patch Set: Created 4 years 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 fb1be1e4cc2949ffd99343fe1d90da385d0afb91..21d427e964e38999b46095891552cd34ff189bb4 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -1050,9 +1050,13 @@ void StyleEngine::viewportRulesChanged() {
m_viewportResolver->setNeedsCollectRules();
}
-void StyleEngine::importRemoved() {
+void StyleEngine::htmlImportAddedOrRemoved() {
if (document().importLoader()) {
- document().importsController()->master()->styleEngine().importRemoved();
+ document()
+ .importsController()
+ ->master()
+ ->styleEngine()
+ .htmlImportAddedOrRemoved();
return;
}
@@ -1061,11 +1065,14 @@ void StyleEngine::importRemoved() {
// comparison of active stylesheets is not able to figure out that the order
// of the stylesheets have changed after insertion.
//
+ // This is also the case when we import the same document twice where the
+ // last inserted document is inserted before the first one in dom order where
+ // the last would take precedence.
+ //
// Fall back to re-add all sheets to the scoped resolver and recalculate style
- // for the whole document if we remove an import in case it is re-inserted
- // into the document. The assumption is that removing html imports is very
- // rare.
+ // for the whole document when we remove or insert an import document.
if (ScopedStyleResolver* resolver = document().scopedStyleResolver()) {
+ markDocumentDirty();
resolver->setNeedsAppendAllSheets();
document().setNeedsStyleRecalc(
SubtreeStyleChange, StyleChangeReasonForTracing::create(
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/html/imports/HTMLImportChild.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698