| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 ShadowRoot::ShadowRoot(Document& document) | 49 ShadowRoot::ShadowRoot(Document& document) |
| 50 : DocumentFragment(0, CreateShadowRoot) | 50 : DocumentFragment(0, CreateShadowRoot) |
| 51 , TreeScope(*this, document) | 51 , TreeScope(*this, document) |
| 52 , m_descendantInsertionPointsIsValid(false) | 52 , m_descendantInsertionPointsIsValid(false) |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 ShadowRoot::~ShadowRoot() | 56 ShadowRoot::~ShadowRoot() |
| 57 { | 57 { |
| 58 if (StyleEngine* styleEngine = document().styleEngine()) | |
| 59 styleEngine->didRemoveShadowRoot(this); | |
| 60 | |
| 61 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() | 58 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
| 62 // for this ShadowRoot instance because TreeScope destructor | 59 // for this ShadowRoot instance because TreeScope destructor |
| 63 // clears Node::m_treeScope thus ContainerNode is no longer able | 60 // clears Node::m_treeScope thus ContainerNode is no longer able |
| 64 // to access it Document reference after that. | 61 // to access it Document reference after that. |
| 65 willBeDeletedFromDocument(); | 62 willBeDeletedFromDocument(); |
| 66 | 63 |
| 67 // We must remove all of our children first before the TreeScope destructor | 64 // We must remove all of our children first before the TreeScope destructor |
| 68 // runs so we don't go through TreeScopeAdopter for each child with a | 65 // runs so we don't go through TreeScopeAdopter for each child with a |
| 69 // destructed tree scope in each descendant. | 66 // destructed tree scope in each descendant. |
| 70 removeDetachedChildren(); | 67 removeDetachedChildren(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 Vector<RefPtr<InsertionPoint> > insertionPoints; | 196 Vector<RefPtr<InsertionPoint> > insertionPoints; |
| 200 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) | 197 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) |
| 201 insertionPoints.append(insertionPoint); | 198 insertionPoints.append(insertionPoint); |
| 202 | 199 |
| 203 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); | 200 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); |
| 204 | 201 |
| 205 return m_shadowRootRareData->descendantInsertionPoints(); | 202 return m_shadowRootRareData->descendantInsertionPoints(); |
| 206 } | 203 } |
| 207 | 204 |
| 208 } | 205 } |
| OLD | NEW |