Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: Source/core/dom/shadow/ShadowRoot.cpp

Issue 721103002: Fix lfiespan of ScopedStyleResolver (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix for hayato's review comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698