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

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: Fixed 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..6ec0a47c89a66122cd018fb0d53c162d0e24adff 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))
@@ -155,6 +165,12 @@ void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updat
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.
ojan 2013/11/21 00:57:48 I'm hoping that once this is done we can get rid o
tasak 2013/11/22 05:16:25 Yeah, I think, this patch is a temporary one.
+ // So we can remove "styleSheetContentsHasFontFaceRule(newSheets)".
+ if (cssStyleSheetHasFontFaceRule(newStyleSheets))
+ change.styleResolverUpdateType = ResetStyleResolverAndFontSelector;
change.styleResolverUpdateType = Reset;
ojan 2013/11/22 01:08:54 Hmmm...not lgtm actually. Now that I look more clo
tasak 2013/11/22 05:16:25 Yeah, It's my fault. I'm now trying to land the f
}
}
« 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