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

Unified Diff: sky/engine/core/css/resolver/StyleResolver.cpp

Issue 838313002: Move StyleResolver code out of ScopedStyleResolver. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/resolver/StyleResolver.cpp
diff --git a/sky/engine/core/css/resolver/StyleResolver.cpp b/sky/engine/core/css/resolver/StyleResolver.cpp
index d78bb38fed1c5b639ca9cf0b86db1cd71f867d39..0f9de00cae31d44fc83fe3d7d36c803cc00e0591 100644
--- a/sky/engine/core/css/resolver/StyleResolver.cpp
+++ b/sky/engine/core/css/resolver/StyleResolver.cpp
@@ -88,13 +88,6 @@ void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element)
namespace blink {
-static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector, const StyleRuleFontFace* fontFaceRule)
-{
- RefPtr<FontFace> fontFace = FontFace::create(document, fontFaceRule);
- if (fontFace)
- cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fontFace);
-}
-
static RuleSet& defaultStyles()
{
DEFINE_STATIC_LOCAL(RefPtr<StyleSheetContents>, styleSheet, ());
@@ -164,7 +157,25 @@ void StyleResolver::appendCSSStyleSheet(CSSStyleSheet* cssSheet)
TreeScope& treeScope = ownerNode->treeScope();
ScopedStyleResolver& resolver = treeScope.scopedStyleResolver();
- resolver.addRulesFromSheet(cssSheet, this);
+ resolver.addRulesFromSheet(cssSheet);
+
+ RuleSet& ruleSet = cssSheet->contents()->ruleSet();
+
+ const MediaQueryResultList& list = ruleSet.viewportDependentMediaQueryResults();
+ for (size_t i = 0; i < list.size(); ++i)
+ m_viewportDependentMediaQueryResults.append(list[i]);
+
+ // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment.
+ if (ownerNode->isDocumentNode()) {
+ CSSFontSelector* fontSelector = document().styleEngine()->fontSelector();
+ const Vector<RawPtr<StyleRuleFontFace> > fontFaceRules = ruleSet.fontFaceRules();
+ for (unsigned i = 0; i < fontFaceRules.size(); ++i) {
+ if (RefPtr<FontFace> fontFace = FontFace::create(&document(), fontFaceRules[i]))
+ fontSelector->fontFaceCache()->add(fontSelector, fontFaceRules[i], fontFace);
+ }
+ if (fontFaceRules.size())
+ invalidateMatchedPropertiesCache();
+ }
}
void StyleResolver::appendPendingAuthorStyleSheets()
@@ -191,18 +202,6 @@ void StyleResolver::finishAppendAuthorStyleSheets()
document().renderView()->style()->font().update(document().styleEngine()->fontSelector());
}
-void StyleResolver::processScopedRules(const RuleSet& authorRules, CSSStyleSheet* parentStyleSheet, unsigned parentIndex, ContainerNode& scope)
-{
- // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment.
- if (scope.isDocumentNode()) {
- const Vector<RawPtr<StyleRuleFontFace> > fontFaceRules = authorRules.fontFaceRules();
- for (unsigned i = 0; i < fontFaceRules.size(); ++i)
- addFontFaceRule(m_document, document().styleEngine()->fontSelector(), fontFaceRules[i]);
- if (fontFaceRules.size())
- invalidateMatchedPropertiesCache();
- }
-}
-
void StyleResolver::addToStyleSharingList(Element& element)
{
// Never add elements to the style sharing list if we're not in a recalcStyle,
@@ -800,12 +799,6 @@ void StyleResolver::applyPropertiesToStyle(const CSSPropertyValue* properties, s
}
}
-void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list)
-{
- for (size_t i = 0; i < list.size(); ++i)
- m_viewportDependentMediaQueryResults.append(list[i]);
-}
-
bool StyleResolver::mediaQueryAffectedByViewportChange() const
{
for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698