Esempio n. 1
0
void ShadowRoot::recalcStyle(StyleRecalcChange change)
{
    // ShadowRoot doesn't support custom callbacks.
    ASSERT(!hasCustomStyleCallbacks());

    StyleResolverParentScope parentScope(*this);

    if (styleChangeType() >= SubtreeStyleChange)
        change = Force;

    if (change < Force && hasRareData() && childNeedsStyleRecalc())
        checkForChildrenAdjacentRuleChanges();

    // There's no style to update so just calling recalcStyle means we're updated.
    clearNeedsStyleRecalc();

    // FIXME: This doesn't handle :hover + div properly like Element::recalcStyle does.
    Text* lastTextNode = 0;
    for (Node* child = lastChild(); child; child = child->previousSibling()) {
        if (child->isTextNode()) {
            toText(child)->recalcTextStyle(change, lastTextNode);
            lastTextNode = toText(child);
        } else if (child->isElementNode()) {
            if (child->shouldCallRecalcStyle(change))
                toElement(child)->recalcStyle(change, lastTextNode);
            if (child->renderer())
                lastTextNode = 0;
        }
    }

    clearChildNeedsStyleRecalc();
}
void ShadowRoot::recalcStyle(StyleChange change)
{
    if (hasContentElement())
        forceReattach(this);
    else {
        for (Node* n = firstChild(); n; n = n->nextSibling())
            n->recalcStyle(change);
    }

    clearNeedsStyleRecalc();
    clearChildNeedsStyleRecalc();
}
Esempio n. 3
0
void ShadowRoot::recalcShadowTreeStyle(StyleChange change)
{
    if (hasContentElement())
        reattach();
    else {
        for (Node* n = firstChild(); n; n = n->nextSibling()) {
            if (n->isElementNode())
                static_cast<Element*>(n)->recalcStyle(change);
            else if (n->isTextNode())
                static_cast<Text*>(n)->recalcTextStyle(change);
        }
    }

    clearNeedsStyleRecalc();
    clearChildNeedsStyleRecalc();
}
Esempio n. 4
0
void ShadowRoot::recalcStyle(StyleRecalcChange change)
{
    // ShadowRoot doesn't support custom callbacks.
    ASSERT(!hasCustomStyleCallbacks());

    StyleResolverParentScope parentScope(*this);

    if (styleChangeType() >= SubtreeStyleChange)
        change = Force;

    // There's no style to update so just calling recalcStyle means we're updated.
    clearNeedsStyleRecalc();

    recalcChildStyle(change);
    clearChildNeedsStyleRecalc();
}
Esempio n. 5
0
void ShadowRoot::recalcStyle(StyleRecalcChange change) {
  // ShadowRoot doesn't support custom callbacks.
  DCHECK(!hasCustomStyleCallbacks());

  StyleSharingDepthScope sharingScope(*this);

  if (getStyleChangeType() >= SubtreeStyleChange)
    change = Force;

  // There's no style to update so just calling recalcStyle means we're updated.
  clearNeedsStyleRecalc();
  clearNeedsReattachLayoutTree();

  recalcDescendantStyles(change);
  clearChildNeedsStyleRecalc();
  clearChildNeedsReattachLayoutTree();
}
Esempio n. 6
0
void ShadowRoot::recalcStyle(StyleChange change)
{
    // ShadowRoot doesn't support custom callbacks.
    ASSERT(!hasCustomCallbacks());

    StyleResolver* styleResolver = document()->styleResolver();
    styleResolver->pushParentShadowRoot(this);

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

    styleResolver->popParentShadowRoot(this);
    clearNeedsStyleRecalc();
    clearChildNeedsStyleRecalc();
}
Esempio n. 7
0
void ShadowRoot::recalcStyle(StyleRecalcChange change)
{
    if (styleChangeType() >= SubtreeStyleChange)
        change = Force;

    // There's no style to update so just calling recalcStyle means we're updated.
    clearNeedsStyleRecalc();

    for (Node* child = lastChild(); child; child = child->previousSibling()) {
        if (child->isTextNode()) {
            toText(child)->recalcTextStyle(change);
        } else if (child->isElementNode()) {
            if (child->shouldCallRecalcStyle(change))
                toElement(child)->recalcStyle(change);
        }
    }

    clearChildNeedsStyleRecalc();
}
Esempio n. 8
0
void Element::recalcStyle(StyleRecalcChange change)
{
    ASSERT(document().inStyleRecalc());
    ASSERT(!parentNode()->needsStyleRecalc());

    if (change >= Inherit || needsStyleRecalc()) {
        if (hasRareData()) {
            ElementRareData* data = elementRareData();
            data->clearComputedStyle();
        }
        if (parentRenderStyle())
            change = recalcOwnStyle(change);
        clearNeedsStyleRecalc();
    }

    // If we reattached we don't need to recalc the style of our descendants anymore.
    if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc()) {
        recalcChildStyle(change);
        clearChildNeedsStyleRecalc();
    }
}
Esempio n. 9
0
void ContainerNode::detach()
{
    detachChildren();
    clearChildNeedsStyleRecalc();
    Node::detach();
}