| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_registeredWithParentShadowRoot(false) | 52 , m_registeredWithParentShadowRoot(false) |
| 53 , m_descendantInsertionPointsIsValid(false) | 53 , m_descendantInsertionPointsIsValid(false) |
| 54 { | 54 { |
| 55 } | 55 } |
| 56 | 56 |
| 57 ShadowRoot::~ShadowRoot() | 57 ShadowRoot::~ShadowRoot() |
| 58 { | 58 { |
| 59 document().styleEngine()->didRemoveShadowRoot(this); | 59 if (StyleEngine* styleEngine = document().styleEngine()) |
| 60 styleEngine->didRemoveShadowRoot(this); |
| 60 | 61 |
| 61 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() | 62 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
| 62 // for this ShadowRoot instance because TreeScope destructor | 63 // for this ShadowRoot instance because TreeScope destructor |
| 63 // clears Node::m_treeScope thus ContainerNode is no longer able | 64 // clears Node::m_treeScope thus ContainerNode is no longer able |
| 64 // to access it Document reference after that. | 65 // to access it Document reference after that. |
| 65 willBeDeletedFromDocument(); | 66 willBeDeletedFromDocument(); |
| 66 | 67 |
| 67 // We must remove all of our children first before the TreeScope destructor | 68 // 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 | 69 // runs so we don't go through TreeScopeAdopter for each child with a |
| 69 // destructed tree scope in each descendant. | 70 // destructed tree scope in each descendant. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 Vector<RefPtr<InsertionPoint> > insertionPoints; | 214 Vector<RefPtr<InsertionPoint> > insertionPoints; |
| 214 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) | 215 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) |
| 215 insertionPoints.append(insertionPoint); | 216 insertionPoints.append(insertionPoint); |
| 216 | 217 |
| 217 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); | 218 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); |
| 218 | 219 |
| 219 return m_shadowRootRareData->descendantInsertionPoints(); | 220 return m_shadowRootRareData->descendantInsertionPoints(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 } | 223 } |
| OLD | NEW |