| Index: third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp b/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
|
| index 31aabc718b704256c7345ed3e26bcc5624004a43..610460730c944a565d82a1502da69bb262409045 100644
|
| --- a/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
|
| @@ -28,6 +28,7 @@
|
|
|
| #include "core/HTMLNames.h"
|
| #include "core/css/CSSStyleSheet.h"
|
| +#include "core/css/StyleSheetContents.h"
|
| #include "core/css/resolver/StyleResolver.h"
|
| #include "core/dom/Element.h"
|
| #include "core/dom/StyleChangeReason.h"
|
| @@ -45,7 +46,7 @@ ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot& shado
|
| {
|
| }
|
|
|
| -void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine& engine, StyleSheetCollection& collection)
|
| +void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleSheetCollection& collection)
|
| {
|
| for (Node* n : m_styleSheetCandidateNodes) {
|
| StyleSheetCandidate candidate(*n);
|
| @@ -59,34 +60,18 @@ void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Sty
|
| continue;
|
|
|
| collection.appendSheetForList(sheet);
|
| - if (candidate.canBeActivated(nullAtom))
|
| - collection.appendActiveStyleSheet(toCSSStyleSheet(sheet));
|
| + if (candidate.canBeActivated(nullAtom)) {
|
| + CSSStyleSheet* cssSheet = toCSSStyleSheet(sheet);
|
| + collection.appendActiveStyleSheet(std::make_pair(cssSheet, &document().styleEngine().ensureRuleSetForSheet(*cssSheet)));
|
| + }
|
| }
|
| }
|
|
|
| -void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine, StyleResolverUpdateMode updateMode)
|
| +void ShadowTreeStyleSheetCollection::updateActiveStyleSheets()
|
| {
|
| 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);
|
| + collectStyleSheets(collection);
|
| + applyActiveStyleSheetChanges(collection);
|
| }
|
|
|
| } // namespace blink
|
|
|