| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 | 291 |
| 292 void ShadowRoot::invalidateDescendantInsertionPoints() | 292 void ShadowRoot::invalidateDescendantInsertionPoints() |
| 293 { | 293 { |
| 294 m_descendantInsertionPointsIsValid = false; | 294 m_descendantInsertionPointsIsValid = false; |
| 295 m_shadowRootRareData->clearDescendantInsertionPoints(); | 295 m_shadowRootRareData->clearDescendantInsertionPoints(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 const HeapVector<Member<InsertionPoint>>& ShadowRoot::descendantInsertionPoints(
) | 298 const HeapVector<Member<InsertionPoint>>& ShadowRoot::descendantInsertionPoints(
) |
| 299 { | 299 { |
| 300 DEFINE_STATIC_LOCAL(HeapVector<Member<InsertionPoint>>, emptyList, (new Heap
Vector<Member<InsertionPoint>>)); | 300 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<InsertionPoint>>, emptyList,
()); |
| 301 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) | 301 if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) |
| 302 return m_shadowRootRareData->descendantInsertionPoints(); | 302 return m_shadowRootRareData->descendantInsertionPoints(); |
| 303 | 303 |
| 304 m_descendantInsertionPointsIsValid = true; | 304 m_descendantInsertionPointsIsValid = true; |
| 305 | 305 |
| 306 if (!containsInsertionPoints()) | 306 if (!containsInsertionPoints()) |
| 307 return emptyList; | 307 return emptyList; |
| 308 | 308 |
| 309 HeapVector<Member<InsertionPoint>> insertionPoints; | 309 HeapVector<Member<InsertionPoint>> insertionPoints; |
| 310 for (InsertionPoint& insertionPoint : Traversal<InsertionPoint>::descendants
Of(*this)) | 310 for (InsertionPoint& insertionPoint : Traversal<InsertionPoint>::descendants
Of(*this)) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 m_shadowRootRareData->clearDescendantSlots(); | 342 m_shadowRootRareData->clearDescendantSlots(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 unsigned ShadowRoot::descendantSlotCount() const | 345 unsigned ShadowRoot::descendantSlotCount() const |
| 346 { | 346 { |
| 347 return m_shadowRootRareData ? m_shadowRootRareData->descendantSlotCount() :
0; | 347 return m_shadowRootRareData ? m_shadowRootRareData->descendantSlotCount() :
0; |
| 348 } | 348 } |
| 349 | 349 |
| 350 const HeapVector<Member<HTMLSlotElement>>& ShadowRoot::descendantSlots() | 350 const HeapVector<Member<HTMLSlotElement>>& ShadowRoot::descendantSlots() |
| 351 { | 351 { |
| 352 DEFINE_STATIC_LOCAL(HeapVector<Member<HTMLSlotElement>>, emptyList, (new Hea
pVector<Member<HTMLSlotElement>>)); | 352 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<HTMLSlotElement>>, emptyList
, ()); |
| 353 if (m_descendantSlotsIsValid) { | 353 if (m_descendantSlotsIsValid) { |
| 354 ASSERT(m_shadowRootRareData); | 354 ASSERT(m_shadowRootRareData); |
| 355 return m_shadowRootRareData->descendantSlots(); | 355 return m_shadowRootRareData->descendantSlots(); |
| 356 } | 356 } |
| 357 if (descendantSlotCount() == 0) | 357 if (descendantSlotCount() == 0) |
| 358 return emptyList; | 358 return emptyList; |
| 359 | 359 |
| 360 ASSERT(m_shadowRootRareData); | 360 ASSERT(m_shadowRootRareData); |
| 361 HeapVector<Member<HTMLSlotElement>> slots; | 361 HeapVector<Member<HTMLSlotElement>> slots; |
| 362 slots.reserveCapacity(descendantSlotCount()); | 362 slots.reserveCapacity(descendantSlotCount()); |
| 363 for (HTMLSlotElement& slot : Traversal<HTMLSlotElement>::descendantsOf(rootN
ode())) | 363 for (HTMLSlotElement& slot : Traversal<HTMLSlotElement>::descendantsOf(rootN
ode())) |
| 364 slots.append(&slot); | 364 slots.append(&slot); |
| 365 m_shadowRootRareData->setDescendantSlots(slots); | 365 m_shadowRootRareData->setDescendantSlots(slots); |
| 366 m_descendantSlotsIsValid = true; | 366 m_descendantSlotsIsValid = true; |
| 367 return m_shadowRootRareData->descendantSlots(); | 367 return m_shadowRootRareData->descendantSlots(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 DEFINE_TRACE(ShadowRoot) | 370 DEFINE_TRACE(ShadowRoot) |
| 371 { | 371 { |
| 372 visitor->trace(m_prev); | 372 visitor->trace(m_prev); |
| 373 visitor->trace(m_next); | 373 visitor->trace(m_next); |
| 374 visitor->trace(m_shadowRootRareData); | 374 visitor->trace(m_shadowRootRareData); |
| 375 TreeScope::trace(visitor); | 375 TreeScope::trace(visitor); |
| 376 DocumentFragment::trace(visitor); | 376 DocumentFragment::trace(visitor); |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace blink | 379 } // namespace blink |
| OLD | NEW |