Index: Source/core/dom/shadow/ShadowRoot.cpp |
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp |
index 896f38f731ff3cf87956e1545280f2657ba855fa..e5cd390d5ffeb54f196d852074f4ad32930a83d3 100644 |
--- a/Source/core/dom/shadow/ShadowRoot.cpp |
+++ b/Source/core/dom/shadow/ShadowRoot.cpp |
@@ -53,8 +53,8 @@ COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh |
ShadowRoot::ShadowRoot(Document& document, ShadowRootType type) |
: DocumentFragment(0, CreateShadowRoot) |
, TreeScope(*this, document) |
- , m_prev(0) |
- , m_next(0) |
+ , m_prev(nullptr) |
+ , m_next(nullptr) |
, m_numberOfStyles(0) |
, m_type(type) |
, m_registeredWithParentShadowRoot(false) |
@@ -65,28 +65,26 @@ ShadowRoot::ShadowRoot(Document& document, ShadowRootType type) |
ShadowRoot::~ShadowRoot() |
{ |
+#if !ENABLE(OILPAN) |
ASSERT(!m_prev); |
ASSERT(!m_next); |
-#if !ENABLE(OILPAN) |
if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) |
m_shadowRootRareData->styleSheets()->detachFromDocument(); |
document().styleEngine()->didRemoveShadowRoot(this); |
-#endif |
-#if !ENABLE(OILPAN) |
// We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
// for this ShadowRoot instance because TreeScope destructor |
// clears Node::m_treeScope thus ContainerNode is no longer able |
// to access it Document reference after that. |
willBeDeletedFromDocument(); |
-#endif |
// We must remove all of our children first before the TreeScope destructor |
// runs so we don't go through TreeScopeAdopter for each child with a |
// destructed tree scope in each descendant. |
removeDetachedChildren(); |
+#endif |
// We must call clearRareData() here since a ShadowRoot class inherits TreeScope |
// as well as Node. See a comment on TreeScope.h for the reason. |
@@ -96,7 +94,9 @@ ShadowRoot::~ShadowRoot() |
void ShadowRoot::dispose() |
{ |
+#if !ENABLE(OILPAN) |
removeDetachedChildren(); |
+#endif |
} |
ShadowRoot* ShadowRoot::olderShadowRootForBindings() const |
@@ -339,6 +339,8 @@ StyleSheetList* ShadowRoot::styleSheets() |
void ShadowRoot::trace(Visitor* visitor) |
{ |
+ visitor->trace(m_prev); |
+ visitor->trace(m_next); |
visitor->trace(m_shadowRootRareData); |
TreeScope::trace(visitor); |
DocumentFragment::trace(visitor); |