Пример #1
0
void ShadowTree::recalcShadowTreeStyle(Node::StyleChange change)
{
    ShadowRoot* youngest = youngestShadowRoot();
    if (!youngest)
        return;

    if (needsReattachHostChildrenAndShadow())
        reattachHostChildrenAndShadow();
    else {
        StyleResolver* styleResolver = youngest->document()->styleResolver();

        styleResolver->pushParentShadowRoot(youngest);
        for (Node* n = youngest->firstChild(); n; n = n->nextSibling()) {
            if (n->isElementNode())
                static_cast<Element*>(n)->recalcStyle(change);
            else if (n->isTextNode())
                toText(n)->recalcTextStyle(change);
        }
        styleResolver->popParentShadowRoot(youngest);
    }

    clearNeedsReattachHostChildrenAndShadow();
    for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
        root->clearNeedsStyleRecalc();
        root->clearChildNeedsStyleRecalc();
    }
}
Пример #2
0
void ShadowRoot::recalcShadowTreeStyle(StyleChange change)
{
    if (needsReattachHostChildrenAndShadow())
        reattachHostChildrenAndShadow();
    else {
        for (Node* n = firstChild(); n; n = n->nextSibling()) {
            if (n->isElementNode())
                static_cast<Element*>(n)->recalcStyle(change);
            else if (n->isTextNode())
                toText(n)->recalcTextStyle(change);
        }
    }

    clearNeedsReattachHostChildrenAndShadow();
    clearNeedsStyleRecalc();
    clearChildNeedsStyleRecalc();
}