Chromium Code Reviews| Index: Source/core/dom/StyleSheetCollection.cpp |
| diff --git a/Source/core/dom/StyleSheetCollection.cpp b/Source/core/dom/StyleSheetCollection.cpp |
| index 05d41a45e3911730002044f0e4d679e827665f17..7b916798becf605a650c6205a8120d9e5334421a 100644 |
| --- a/Source/core/dom/StyleSheetCollection.cpp |
| +++ b/Source/core/dom/StyleSheetCollection.cpp |
| @@ -153,24 +153,19 @@ bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSS |
| return false; |
| } |
| -static bool styleSheetContentsHasFontFaceRule(Vector<StyleSheetContents*> sheets) |
| +static bool styleSheetContentsHasFontFaceRule(Vector<StyleSheetContents*> sheets, Vector<const StyleRuleFontFace*>& removedRules) |
|
dglazkov
2013/11/25 16:27:29
This function now removes things, and the name sti
tasak
2013/11/26 07:49:06
I renamed the function to findFontFaceRulesFromSty
|
| { |
| - for (unsigned i = 0; i < sheets.size(); ++i) { |
| - ASSERT(sheets[i]); |
| - if (sheets[i]->hasFontFaceRule()) |
| - return true; |
| - } |
| - return false; |
| -} |
| + bool hasFontFaceRule = 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; |
| + if (sheets[i]->hasFontFaceRule()) { |
| + // FIXME: We don't need this for styles in shadow tree. |
| + sheets[i]->extractFontFaceRule(removedRules); |
| + hasFontFaceRule = true; |
| + } |
| } |
| - return false; |
| + return hasFontFaceRule; |
| } |
| void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const StyleSheetCollectionBase& newCollection, StyleSheetChange& change) |
| @@ -192,18 +187,10 @@ void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updat |
| if (updateType != Additive) { |
| change.styleResolverUpdateType = updateType; |
| } else { |
| - if (styleSheetContentsHasFontFaceRule(addedSheets)) { |
| - change.styleResolverUpdateType = ResetStyleResolverAndFontSelector; |
| + change.styleResolverUpdateType = Reset; |
| + // If @font-face is removed, needs full style recalc. |
| + if (styleSheetContentsHasFontFaceRule(addedSheets, change.removedFontFace)) |
| return; |
| - } |
| - // 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 (cssStyleSheetHasFontFaceRule(newCollection.activeAuthorStyleSheets())) |
| - change.styleResolverUpdateType = ResetStyleResolverAndFontSelector; |
| - else |
| - change.styleResolverUpdateType = Reset; |
| } |
| } |