HTMLContentSelection* HTMLContentSelectionList::find(Node* node) const { for (HTMLContentSelection* item = first(); item; item = item->next()) { if (node == item->node()) return item; } return 0; }
HTMLContentElement* ShadowRoot::insertionPointFor(Node* node) const { if (!m_selector) return 0; HTMLContentSelection* found = m_selector->findFor(node); if (!found) return 0; return found->insertionPoint(); }
InsertionPoint* ShadowTree::insertionPointFor(const Node* node) const { ASSERT(node && node->parentNode()); if (node->parentNode()->isShadowRoot()) { if (InsertionPoint* insertionPoint = toShadowRoot(node->parentNode())->assignedTo()) return insertionPoint; return 0; } HTMLContentSelection* found = selector().findFor(node); if (!found) return 0; return found->insertionPoint(); }
void HTMLContentElement::attach() { ShadowRoot* root = toShadowRoot(shadowTreeRootNode()); // Before calling StyledElement::attach, selector must be calculated. if (root) { HTMLContentSelector* selector = root->ensureSelector(); selector->unselect(m_selections.get()); selector->select(this, m_selections.get()); } HTMLElement::attach(); if (root) { for (HTMLContentSelection* selection = m_selections->first(); selection; selection = selection->next()) selection->node()->attach(); } }
inline void InsertionPoint::attachDistributedNode() { for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next()) selection->node()->attach(); }
void HTMLContentSelector::unselect(HTMLContentSelectionList* list) { for (HTMLContentSelection* selection = list->first(); selection; selection = selection->next()) m_selectionSet.remove(selection); list->clear(); }