const HeapVector<Member<InsertionPoint>>& ShadowRoot::descendantInsertionPoints() { DEFINE_STATIC_LOCAL(HeapVector<Member<InsertionPoint>>, emptyList, (new HeapVector<Member<InsertionPoint>>)); if (m_shadowRootRareDataV0 && m_descendantInsertionPointsIsValid) return m_shadowRootRareDataV0->descendantInsertionPoints(); m_descendantInsertionPointsIsValid = true; if (!containsInsertionPoints()) return emptyList; HeapVector<Member<InsertionPoint>> insertionPoints; for (InsertionPoint& insertionPoint : Traversal<InsertionPoint>::descendantsOf(*this)) insertionPoints.append(&insertionPoint); ensureShadowRootRareDataV0().setDescendantInsertionPoints(insertionPoints); return m_shadowRootRareDataV0->descendantInsertionPoints(); }
const Vector<RefPtr<InsertionPoint> >& ShadowRoot::descendantInsertionPoints() { DEFINE_STATIC_LOCAL(const Vector<RefPtr<InsertionPoint> >, emptyList, ()); if (m_shadowRootRareData && m_descendantInsertionPointsIsValid) return m_shadowRootRareData->descendantInsertionPoints(); m_descendantInsertionPointsIsValid = true; if (!containsInsertionPoints()) return emptyList; Vector<RefPtr<InsertionPoint> > insertionPoints; for (Element* element = ElementTraversal::firstWithin(*this); element; element = ElementTraversal::next(*element, this)) { if (element->isInsertionPoint()) insertionPoints.append(toInsertionPoint(element)); } ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); return m_shadowRootRareData->descendantInsertionPoints(); }