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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 , m_descendantInsertionPointsIsValid(false) | 61 , m_descendantInsertionPointsIsValid(false) |
62 { | 62 { |
63 ScriptWrappable::init(this); | 63 ScriptWrappable::init(this); |
64 } | 64 } |
65 | 65 |
66 ShadowRoot::~ShadowRoot() | 66 ShadowRoot::~ShadowRoot() |
67 { | 67 { |
68 ASSERT(!m_prev); | 68 ASSERT(!m_prev); |
69 ASSERT(!m_next); | 69 ASSERT(!m_next); |
70 | 70 |
| 71 #if !ENABLE(OILPAN) |
71 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) | 72 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) |
72 m_shadowRootRareData->styleSheets()->detachFromDocument(); | 73 m_shadowRootRareData->styleSheets()->detachFromDocument(); |
73 | 74 |
74 document().styleEngine()->didRemoveShadowRoot(this); | 75 document().styleEngine()->didRemoveShadowRoot(this); |
| 76 #endif |
75 | 77 |
| 78 #if !ENABLE(OILPAN) |
76 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() | 79 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() |
77 // for this ShadowRoot instance because TreeScope destructor | 80 // for this ShadowRoot instance because TreeScope destructor |
78 // clears Node::m_treeScope thus ContainerNode is no longer able | 81 // clears Node::m_treeScope thus ContainerNode is no longer able |
79 // to access it Document reference after that. | 82 // to access it Document reference after that. |
80 willBeDeletedFromDocument(); | 83 willBeDeletedFromDocument(); |
| 84 #endif |
81 | 85 |
82 // We must remove all of our children first before the TreeScope destructor | 86 // We must remove all of our children first before the TreeScope destructor |
83 // runs so we don't go through TreeScopeAdopter for each child with a | 87 // runs so we don't go through TreeScopeAdopter for each child with a |
84 // destructed tree scope in each descendant. | 88 // destructed tree scope in each descendant. |
85 removeDetachedChildren(); | 89 removeDetachedChildren(); |
86 | 90 |
87 // We must call clearRareData() here since a ShadowRoot class inherits TreeS
cope | 91 // We must call clearRareData() here since a ShadowRoot class inherits TreeS
cope |
88 // as well as Node. See a comment on TreeScope.h for the reason. | 92 // as well as Node. See a comment on TreeScope.h for the reason. |
89 if (hasRareData()) | 93 if (hasRareData()) |
90 clearRareData(); | 94 clearRareData(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 ASSERT(hasScopedHTMLStyleChild() && m_numberOfStyles > 0); | 227 ASSERT(hasScopedHTMLStyleChild() && m_numberOfStyles > 0); |
224 --m_numberOfStyles; | 228 --m_numberOfStyles; |
225 setHasScopedHTMLStyleChild(m_numberOfStyles > 0); | 229 setHasScopedHTMLStyleChild(m_numberOfStyles > 0); |
226 } | 230 } |
227 | 231 |
228 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData() | 232 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData() |
229 { | 233 { |
230 if (m_shadowRootRareData) | 234 if (m_shadowRootRareData) |
231 return m_shadowRootRareData.get(); | 235 return m_shadowRootRareData.get(); |
232 | 236 |
233 m_shadowRootRareData = adoptPtr(new ShadowRootRareData); | 237 m_shadowRootRareData = adoptPtrWillBeNoop(new ShadowRootRareData); |
234 return m_shadowRootRareData.get(); | 238 return m_shadowRootRareData.get(); |
235 } | 239 } |
236 | 240 |
237 bool ShadowRoot::containsShadowElements() const | 241 bool ShadowRoot::containsShadowElements() const |
238 { | 242 { |
239 return m_shadowRootRareData ? m_shadowRootRareData->containsShadowElements()
: 0; | 243 return m_shadowRootRareData ? m_shadowRootRareData->containsShadowElements()
: 0; |
240 } | 244 } |
241 | 245 |
242 bool ShadowRoot::containsContentElements() const | 246 bool ShadowRoot::containsContentElements() const |
243 { | 247 { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 330 } |
327 | 331 |
328 StyleSheetList* ShadowRoot::styleSheets() | 332 StyleSheetList* ShadowRoot::styleSheets() |
329 { | 333 { |
330 if (!ensureShadowRootRareData()->styleSheets()) | 334 if (!ensureShadowRootRareData()->styleSheets()) |
331 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 335 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
332 | 336 |
333 return m_shadowRootRareData->styleSheets(); | 337 return m_shadowRootRareData->styleSheets(); |
334 } | 338 } |
335 | 339 |
| 340 void ShadowRoot::trace(Visitor* visitor) |
| 341 { |
| 342 visitor->trace(m_shadowRootRareData); |
| 343 TreeScope::trace(visitor); |
| 344 DocumentFragment::trace(visitor); |
336 } | 345 } |
| 346 |
| 347 } |
OLD | NEW |