Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp |
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
index c34438007902b7978798d93f15501be8bc43cfc5..4f43661a933f6f53667016f3a3e4ce86300b14ef 100644 |
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
@@ -220,14 +220,17 @@ void StyleEngine::addStyleSheetCandidateNode(Node& node) { |
m_activeTreeScopes.add(&treeScope); |
} |
-void StyleEngine::removeStyleSheetCandidateNode(Node& node) { |
- removeStyleSheetCandidateNode(node, *m_document); |
-} |
- |
void StyleEngine::removeStyleSheetCandidateNode(Node& node, |
- TreeScope& treeScope) { |
+ ContainerNode& insertionPoint) { |
DCHECK(!isXSLStyleSheet(node)); |
+ DCHECK(insertionPoint.isConnected()); |
+ |
+ ShadowRoot* shadowRoot = node.containingShadowRoot(); |
+ if (!shadowRoot) |
+ shadowRoot = insertionPoint.containingShadowRoot(); |
+ TreeScope& treeScope = |
+ shadowRoot ? *toTreeScope(shadowRoot) : toTreeScope(document()); |
TreeScopeStyleSheetCollection* collection = |
styleSheetCollectionFor(treeScope); |
// After detaching document, collection could be null. In the case, |