| Index: sky/engine/core/dom/StyleEngine.cpp
|
| diff --git a/sky/engine/core/dom/StyleEngine.cpp b/sky/engine/core/dom/StyleEngine.cpp
|
| index fedaeb6e2566a1d6a35eeab188006306045a1bb2..895edc0d66779b58622d7309a1ed993949eb197e 100644
|
| --- a/sky/engine/core/dom/StyleEngine.cpp
|
| +++ b/sky/engine/core/dom/StyleEngine.cpp
|
| @@ -30,6 +30,7 @@
|
|
|
| #include "sky/engine/core/css/CSSFontSelector.h"
|
| #include "sky/engine/core/css/CSSStyleSheet.h"
|
| +#include "sky/engine/core/css/FontFace.h"
|
| #include "sky/engine/core/css/FontFaceCache.h"
|
| #include "sky/engine/core/css/StyleSheetContents.h"
|
| #include "sky/engine/core/dom/Document.h"
|
| @@ -81,7 +82,7 @@ void StyleEngine::updateActiveStyleSheets()
|
| for (TreeScope* treeScope : m_activeTreeScopes)
|
| treeScope->scopedStyleResolver().updateActiveStyleSheets();
|
|
|
| - m_document->renderView()->style()->font().update(fontSelector());
|
| + updateDocumentFonts();
|
| }
|
|
|
| void StyleEngine::resolverChanged()
|
| @@ -91,6 +92,25 @@ void StyleEngine::resolverChanged()
|
| updateActiveStyleSheets();
|
| }
|
|
|
| +void StyleEngine::updateDocumentFonts()
|
| +{
|
| + // TODO(esprehn): We should really support @font-face in ShadowRoot too.
|
| +
|
| + const auto& sheets = m_document->scopedStyleResolver().authorStyleSheets();
|
| +
|
| + for (const auto& sheet : sheets) {
|
| + RuleSet& ruleSet = sheet->contents()->ruleSet();
|
| + for (const auto& rule : ruleSet.fontFaceRules()) {
|
| + if (RefPtr<FontFace> fontFace = FontFace::create(m_document, rule))
|
| + m_fontSelector->fontFaceCache()->add(m_fontSelector.get(), rule, fontFace);
|
| + }
|
| + if (!ruleSet.fontFaceRules().isEmpty())
|
| + m_resolver->invalidateMatchedPropertiesCache();
|
| + }
|
| +
|
| + m_document->renderView()->style()->font().update(m_fontSelector.get());
|
| +}
|
| +
|
| void StyleEngine::clearFontCache()
|
| {
|
| m_fontSelector->fontFaceCache()->clearCSSConnected();
|
|
|