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

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

Issue 73993002: Reset fontselector() when removing stylesheets and left stylesheets still have @font-face rules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | « no previous file | 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 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698