void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode) { StyleSheetCollection collection; collectStyleSheets(engine, collection); StyleSheetChange change; analyzeStyleSheetChange(updateMode, collection, change); if (StyleResolver* styleResolver = engine->resolver()) { if (change.styleResolverUpdateType != Additive) { // We should not destroy StyleResolver when we find any stylesheet update in a shadow tree. // In this case, we will reset rulesets created from style elements in the shadow tree. styleResolver->resetAuthorStyle(treeScope()); styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets); styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAuthorStyleSheets()); } else { styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection.activeAuthorStyleSheets()); } } if (change.requiresFullStyleRecalc) toShadowRoot(treeScope().rootNode()).host()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ActiveStylesheetsUpdate)); collection.swap(*this); updateUsesRemUnits(); }
void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode) { StyleSheetCollection collection; ActiveDocumentStyleSheetCollector collector(collection); collectStyleSheets(engine, collector); StyleSheetChange change; analyzeStyleSheetChange(updateMode, collection, change); if (change.styleResolverUpdateType == Reconstruct) { engine->clearMasterResolver(); // FIMXE: The following depends on whether StyleRuleFontFace was modified or not. // No need to always-clear font cache. engine->clearFontCache(); } else if (StyleResolver* styleResolver = engine->resolver()) { if (change.styleResolverUpdateType != Additive) { ASSERT(change.styleResolverUpdateType == Reset); styleResolver->resetAuthorStyle(treeScope()); engine->removeFontFaceRules(change.fontFaceRulesToRemove); styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets); styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAuthorStyleSheets()); } else { styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection.activeAuthorStyleSheets()); } } if (change.requiresFullStyleRecalc) document().setNeedsStyleRecalc(SubtreeStyleChange); collection.swap(*this); updateUsesRemUnits(); }
void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode) { StyleSheetCollection collection; ActiveDocumentStyleSheetCollector collector(collection); collectStyleSheets(engine, collector); StyleSheetChange change; analyzeStyleSheetChange(updateMode, collection, change); if (change.styleResolverUpdateType == Reconstruct) { engine->clearMasterResolver(); // FIMXE: The following depends on whether StyleRuleFontFace was modified or not. // No need to always-clear font cache. engine->clearFontCache(); } else if (StyleResolver* styleResolver = engine->resolver()) { // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder. // Need to change "false" to some valid condition. styleResolver->setBuildScopedStyleTreeInDocumentOrder(false); if (change.styleResolverUpdateType != Additive) { ASSERT(change.styleResolverUpdateType == Reset); resetAllRuleSetsInTreeScope(styleResolver); engine->removeFontFaceRules(change.fontFaceRulesToRemove); styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets); styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAuthorStyleSheets()); } else { styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection.activeAuthorStyleSheets()); } } if (change.requiresFullStyleRecalc) document().setNeedsStyleRecalc(SubtreeStyleChange); m_scopingNodesForStyleScoped.didRemoveScopingNodes(); collection.swap(*this); updateUsesRemUnits(); }