void ContentDistributor::ensureDistribution(ShadowRoot* shadowRoot) { ASSERT(shadowRoot); Vector<ShadowRoot*, 8> shadowRoots; for (Element* current = shadowRoot->host(); current; current = current->shadowHost()) { ShadowRoot* currentRoot = current->shadowRoot(); if (!currentRoot->distributor() || !currentRoot->distributor()->needsDistribution()) break; shadowRoots.append(currentRoot); } for (size_t i = shadowRoots.size(); i > 0; --i) shadowRoots[i - 1]->distributor()->distribute(shadowRoots[i - 1]->host()); }
void InsertionPoint::removedFrom(ContainerNode* insertionPoint) { ShadowRoot* root = containingShadowRoot(); if (!root) root = insertionPoint->containingShadowRoot(); if (root && root->hostElement()) { root->invalidateDistribution(); root->distributor().invalidateInsertionPointList(); } // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. clearDistribution(); HTMLElement::removedFrom(insertionPoint); }