| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 : DocumentFragment(0, CreateShadowRoot) | 51 : DocumentFragment(0, CreateShadowRoot) |
| 52 , TreeScope(*this, document) | 52 , TreeScope(*this, document) |
| 53 , m_numberOfStyles(0) | 53 , m_numberOfStyles(0) |
| 54 , m_registeredWithParentShadowRoot(false) | 54 , m_registeredWithParentShadowRoot(false) |
| 55 , m_descendantInsertionPointsIsValid(false) | 55 , m_descendantInsertionPointsIsValid(false) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 ShadowRoot::~ShadowRoot() | 59 ShadowRoot::~ShadowRoot() |
| 60 { | 60 { |
| 61 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) | |
| 62 m_shadowRootRareData->styleSheets()->detachFromDocument(); | |
| 63 | |
| 64 document().styleEngine()->didRemoveShadowRoot(this); | 61 document().styleEngine()->didRemoveShadowRoot(this); |
| 65 | 62 |
| 66 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() | 63 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
| 67 // for this ShadowRoot instance because TreeScope destructor | 64 // for this ShadowRoot instance because TreeScope destructor |
| 68 // clears Node::m_treeScope thus ContainerNode is no longer able | 65 // clears Node::m_treeScope thus ContainerNode is no longer able |
| 69 // to access it Document reference after that. | 66 // to access it Document reference after that. |
| 70 willBeDeletedFromDocument(); | 67 willBeDeletedFromDocument(); |
| 71 | 68 |
| 72 // We must remove all of our children first before the TreeScope destructor | 69 // We must remove all of our children first before the TreeScope destructor |
| 73 // runs so we don't go through TreeScopeAdopter for each child with a | 70 // runs so we don't go through TreeScopeAdopter for each child with a |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 225 |
| 229 Vector<RefPtr<InsertionPoint> > insertionPoints; | 226 Vector<RefPtr<InsertionPoint> > insertionPoints; |
| 230 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) | 227 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin
(*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser
tionPoint, this)) |
| 231 insertionPoints.append(insertionPoint); | 228 insertionPoints.append(insertionPoint); |
| 232 | 229 |
| 233 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); | 230 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); |
| 234 | 231 |
| 235 return m_shadowRootRareData->descendantInsertionPoints(); | 232 return m_shadowRootRareData->descendantInsertionPoints(); |
| 236 } | 233 } |
| 237 | 234 |
| 238 StyleSheetList* ShadowRoot::styleSheets() | |
| 239 { | |
| 240 if (!ensureShadowRootRareData()->styleSheets()) | |
| 241 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | |
| 242 | |
| 243 return m_shadowRootRareData->styleSheets(); | |
| 244 } | 235 } |
| 245 | |
| 246 } | |
| OLD | NEW |