Beispiel #1
0
void InsertionPoint::attach()
{
    if (isShadowBoundary()) {
        ShadowRoot* root = toShadowRoot(treeScope()->rootNode());
        if (doesSelectFromHostChildren()) {
            distributeHostChildren(root->tree());
            attachDistributedNode();
        } else if (!root->olderShadowRoot()->assignedTo()) {
            ASSERT(!root->olderShadowRoot()->attached());
            assignShadowRoot(root->olderShadowRoot());
            root->olderShadowRoot()->attach();
        }
    }

    HTMLElement::attach();
}
Beispiel #2
0
void InsertionPoint::detach()
{
    if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {
        ShadowTree* tree = root->tree();

        if (doesSelectFromHostChildren())
            clearDistribution(tree);
        else if (ShadowRoot* assignedShadowRoot = assignedFrom())
            clearAssignment(assignedShadowRoot);

        // When shadow element is detached, shadow tree should be recreated to re-calculate selector for
        // other insertion points.
        tree->setNeedsReattachHostChildrenAndShadow();
    }

    ASSERT(m_selections.isEmpty());
    HTMLElement::detach();
}
Beispiel #3
0
void InsertionPoint::detach()
{
    ShadowRoot* root = shadowRoot();
    if (root && isActive()) {
        ElementShadow* shadow = root->owner();

        if (doesSelectFromHostChildren())
            clearDistribution(shadow);
        else if (ShadowRoot* assignedShadowRoot = assignedFrom())
            clearAssignment(assignedShadowRoot);

        // When shadow element is detached, shadow tree should be recreated to re-calculate selector for
        // other insertion points.
        shadow->setNeedsRedistributing();
    }

    ASSERT(m_distribution.isEmpty());
    HTMLElement::detach();
}