Index: Source/core/dom/shadow/ShadowRoot.cpp |
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp |
index d346a20aa456d01395b2979695a07ddf88d4cb23..755c769d469a056bd75c90c94de6f09f2bd61ef5 100644 |
--- a/Source/core/dom/shadow/ShadowRoot.cpp |
+++ b/Source/core/dom/shadow/ShadowRoot.cpp |
@@ -175,13 +175,18 @@ Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser |
void ShadowRoot::removedFrom(ContainerNode* insertionPoint) |
{ |
- if (insertionPoint->inDocument() && m_registeredWithParentShadowRoot) { |
- ShadowRoot* root = host()->containingShadowRoot(); |
- if (!root) |
- root = insertionPoint->containingShadowRoot(); |
- if (root) |
- root->removeChildShadowRoot(); |
- m_registeredWithParentShadowRoot = false; |
+ if (insertionPoint->inDocument()) { |
+ if (ScopedStyleResolver* resolver = scopedStyleResolver()) |
+ insertionPoint->document().styleEngine()->removeScopedStyleResolver(resolver); |
+ |
+ if (m_registeredWithParentShadowRoot) { |
+ ShadowRoot* root = host()->containingShadowRoot(); |
+ if (!root) |
+ root = insertionPoint->containingShadowRoot(); |
+ if (root) |
+ root->removeChildShadowRoot(); |
+ m_registeredWithParentShadowRoot = false; |
+ } |
} |
DocumentFragment::removedFrom(insertionPoint); |