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

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

Issue 66483002: fontSelector should be reset when removing stylesheets which has @font-face rule. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years, 1 month 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
« no previous file with comments | « Source/core/dom/StyleSheetCollection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StyleSheetCollection.cpp
diff --git a/Source/core/dom/StyleSheetCollection.cpp b/Source/core/dom/StyleSheetCollection.cpp
index 64858cb6d618e547986c9019c3a4e25c7cb656f8..d12b34955fbc867a403a42809c4ea16d9e896b1e 100644
--- a/Source/core/dom/StyleSheetCollection.cpp
+++ b/Source/core/dom/StyleSheetCollection.cpp
@@ -29,6 +29,7 @@
#include "core/css/CSSStyleSheet.h"
#include "core/css/StyleInvalidationAnalysis.h"
+#include "core/css/StyleRuleImport.h"
#include "core/css/StyleSheetContents.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
@@ -120,11 +121,18 @@ bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSS
return false;
}
-void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc)
+static bool styleSheetContentsHasFontFaceRule(Vector<StyleSheetContents*> sheets)
{
- styleResolverUpdateType = Reconstruct;
- requiresFullStyleRecalc = true;
+ for (unsigned i = 0; i < sheets.size(); ++i) {
+ ASSERT(sheets[i]);
+ if (sheets[i]->hasFontFaceRule())
+ return true;
+ }
+ return false;
+}
+void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleSheetChange& change)
+{
if (activeLoadingStyleSheetLoaded(newStyleSheets))
return;
@@ -136,10 +144,18 @@ void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updat
// Find out which stylesheets are new.
Vector<StyleSheetContents*> addedSheets;
if (oldStyleSheets.size() <= newStyleSheets.size()) {
- styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets);
+ change.styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets);
} else {
StyleResolverUpdateType updateType = compareStyleSheets(newStyleSheets, oldStyleSheets, addedSheets);
- styleResolverUpdateType = updateType != Additive ? updateType : Reset;
+ if (updateType != Additive) {
+ change.styleResolverUpdateType = updateType;
+ } else {
+ if (styleSheetContentsHasFontFaceRule(addedSheets)) {
+ change.styleResolverUpdateType = ResetStyleResolverAndFontSelector;
+ return;
+ }
+ change.styleResolverUpdateType = Reset;
+ }
}
// FIXME: If styleResolverUpdateType is still Reconstruct, we could return early here
@@ -152,7 +168,8 @@ void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updat
if (invalidationAnalysis.dirtiesAllStyle())
return;
invalidationAnalysis.invalidateStyle(*document());
- requiresFullStyleRecalc = false;
+ change.requiresFullStyleRecalc = false;
+ return;
}
void StyleSheetCollection::resetAllRuleSetsInTreeScope(StyleResolver* styleResolver)
« no previous file with comments | « Source/core/dom/StyleSheetCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698