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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 ShadowRoot::~ShadowRoot() | 80 ShadowRoot::~ShadowRoot() |
81 { | 81 { |
82 ASSERT(!m_prev); | 82 ASSERT(!m_prev); |
83 ASSERT(!m_next); | 83 ASSERT(!m_next); |
84 | 84 |
85 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) | 85 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) |
86 m_shadowRootRareData->styleSheets()->detachFromDocument(); | 86 m_shadowRootRareData->styleSheets()->detachFromDocument(); |
87 | 87 |
88 documentInternal()->styleEngine()->didRemoveShadowRoot(this); | 88 documentInternal()->styleEngine()->didRemoveShadowRoot(this); |
89 | 89 |
90 // We cannot let ContainerNode destructor call willBeDeletedFrom() | 90 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
91 // for this ShadowRoot instance because TreeScope destructor | 91 // for this ShadowRoot instance because TreeScope destructor |
92 // clears Node::m_treeScope thus ContainerNode is no longer able | 92 // clears Node::m_treeScope thus ContainerNode is no longer able |
93 // to access it Document reference after that. | 93 // to access it Document reference after that. |
94 willBeDeletedFrom(documentInternal()); | 94 willBeDeletedFromDocument(); |
95 | 95 |
96 // We must remove all of our children first before the TreeScope destructor | 96 // We must remove all of our children first before the TreeScope destructor |
97 // runs so we don't go through TreeScopeAdopter for each child with a | 97 // runs so we don't go through TreeScopeAdopter for each child with a |
98 // destructed tree scope in each descendant. | 98 // destructed tree scope in each descendant. |
99 removeDetachedChildren(); | 99 removeDetachedChildren(); |
100 | 100 |
101 // We must call clearRareData() here since a ShadowRoot class inherits TreeS
cope | 101 // We must call clearRareData() here since a ShadowRoot class inherits TreeS
cope |
102 // as well as Node. See a comment on TreeScope.h for the reason. | 102 // as well as Node. See a comment on TreeScope.h for the reason. |
103 if (hasRareData()) | 103 if (hasRareData()) |
104 clearRareData(); | 104 clearRareData(); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 StyleSheetList* ShadowRoot::styleSheets() | 415 StyleSheetList* ShadowRoot::styleSheets() |
416 { | 416 { |
417 if (!ensureShadowRootRareData()->styleSheets()) | 417 if (!ensureShadowRootRareData()->styleSheets()) |
418 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 418 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
419 | 419 |
420 return m_shadowRootRareData->styleSheets(); | 420 return m_shadowRootRareData->styleSheets(); |
421 } | 421 } |
422 | 422 |
423 } | 423 } |
OLD | NEW |