Index: Source/core/dom/StyleSheetCollection.cpp |
diff --git a/Source/core/dom/StyleSheetCollection.cpp b/Source/core/dom/StyleSheetCollection.cpp |
index 90f86fc64ad63135746b58fdb5b69201cebc79b0..96762b5f9ca41a97df4477c171c9d322f76512fc 100644 |
--- a/Source/core/dom/StyleSheetCollection.cpp |
+++ b/Source/core/dom/StyleSheetCollection.cpp |
@@ -124,7 +124,7 @@ bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSS |
static bool styleSheetContentsHasFontFaceRule(Vector<StyleSheetContents*> sheets) |
{ |
- for (unsigned i = 0; i < sheets.size(); ++i) { |
+ for (unsigned i = 0; i < sheets.size(); ++i) { |
ASSERT(sheets[i]); |
if (sheets[i]->hasFontFaceRule()) |
return true; |
@@ -132,6 +132,16 @@ static bool styleSheetContentsHasFontFaceRule(Vector<StyleSheetContents*> sheets |
return false; |
} |
+static bool cssStyleSheetHasFontFaceRule(const Vector<RefPtr<CSSStyleSheet> > sheets) |
+{ |
+ for (unsigned i = 0; i < sheets.size(); ++i) { |
+ ASSERT(sheets[i]); |
+ if (sheets[i]->contents()->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)) |
@@ -151,7 +161,11 @@ void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updat |
if (updateType != Additive) { |
change.styleResolverUpdateType = updateType; |
} else { |
- if (styleSheetContentsHasFontFaceRule(addedSheets)) { |
+ // FIXME: since currently all stylesheets are re-added after reseting styleresolver, |
+ // fontSelector should be always reset. After creating RuleSet for each StyleSheetContents, |
+ // we can avoid appending all stylesheetcontents in reset case. |
+ // So we can remove "styleSheetContentsHasFontFaceRule(newSheets)". |
+ if (styleSheetContentsHasFontFaceRule(addedSheets) || cssStyleSheetHasFontFaceRule(newStyleSheets)) { |
change.styleResolverUpdateType = ResetStyleResolverAndFontSelector; |
return; |
} |
tasak
2013/11/15 15:22:29
I found that the following code is better:
if (st
|