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

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

Issue 157853002: Revert of Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months 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/TreeScopeStyleSheetCollection.h ('k') | Source/core/frame/Settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TreeScopeStyleSheetCollection.cpp
diff --git a/Source/core/dom/TreeScopeStyleSheetCollection.cpp b/Source/core/dom/TreeScopeStyleSheetCollection.cpp
index ea7eef7709c80b88fa40a953614228201983e27e..e53f441b87272714a1a8b1bfeb950b8e7d651263 100644
--- a/Source/core/dom/TreeScopeStyleSheetCollection.cpp
+++ b/Source/core/dom/TreeScopeStyleSheetCollection.cpp
@@ -121,19 +121,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 TreeScopeStyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const StyleSheetCollection& newCollection, StyleSheetChange& change)
@@ -153,10 +158,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;
}
}
« no previous file with comments | « Source/core/dom/TreeScopeStyleSheetCollection.h ('k') | Source/core/frame/Settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698