Index: Source/core/dom/shadow/ShadowRoot.cpp |
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp |
index 23674072ddfd184b8478d2c43e28ccc187f9b7d1..ab6dda319fb21d4ceabaae6e1641ef33151d5444 100644 |
--- a/Source/core/dom/shadow/ShadowRoot.cpp |
+++ b/Source/core/dom/shadow/ShadowRoot.cpp |
@@ -175,13 +175,16 @@ 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()) { |
+ clearScopedStyleResolver(); |
+ if (m_registeredWithParentShadowRoot) { |
+ ShadowRoot* root = host()->containingShadowRoot(); |
+ if (!root) |
+ root = insertionPoint->containingShadowRoot(); |
+ if (root) |
+ root->removeChildShadowRoot(); |
+ m_registeredWithParentShadowRoot = false; |
+ } |
} |
DocumentFragment::removedFrom(insertionPoint); |