| Index: Source/core/dom/StyleSheetCollection.cpp
|
| diff --git a/Source/core/dom/StyleSheetCollection.cpp b/Source/core/dom/StyleSheetCollection.cpp
|
| index 1fcf88ae5d701c7258a685a3df8b85725e59f61d..08648d4665a38ea7968959977e941a2fed2c6f95 100644
|
| --- a/Source/core/dom/StyleSheetCollection.cpp
|
| +++ b/Source/core/dom/StyleSheetCollection.cpp
|
| @@ -152,19 +152,24 @@
|
| return false;
|
| }
|
|
|
| -static bool findFontFaceRulesFromStyleSheetContents(Vector<StyleSheetContents*> sheets, Vector<const StyleRuleFontFace*>& fontFaceRules)
|
| -{
|
| - bool hasFontFaceRule = false;
|
| -
|
| +static bool styleSheetContentsHasFontFaceRule(Vector<StyleSheetContents*> sheets)
|
| +{
|
| for (unsigned i = 0; i < sheets.size(); ++i) {
|
| ASSERT(sheets[i]);
|
| - if (sheets[i]->hasFontFaceRule()) {
|
| - // FIXME: We don't need this for styles in shadow tree.
|
| - sheets[i]->findFontFaceRules(fontFaceRules);
|
| - hasFontFaceRule = true;
|
| - }
|
| - }
|
| - return hasFontFaceRule;
|
| + if (sheets[i]->hasFontFaceRule())
|
| + return true;
|
| + }
|
| + 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 StyleSheetCollectionBase& newCollection, StyleSheetChange& change)
|
| @@ -184,10 +189,18 @@
|
| if (updateType != Additive) {
|
| change.styleResolverUpdateType = updateType;
|
| } else {
|
| - change.styleResolverUpdateType = Reset;
|
| - // If @font-face is removed, needs full style recalc.
|
| - if (findFontFaceRulesFromStyleSheetContents(addedSheets, change.fontFaceRulesToRemove))
|
| + if (styleSheetContentsHasFontFaceRule(addedSheets)) {
|
| + change.styleResolverUpdateType = ResetStyleResolverAndFontSelector;
|
| 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;
|
| }
|
| }
|
|
|
|
|