Chromium Code Reviews| 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
|
| } |
| } |