void HTMLImport::showTree(HTMLImport* highlight, unsigned depth)
{
    for (unsigned i = 0; i < depth*4; ++i)
        fprintf(stderr, " ");

    fprintf(stderr, "%s", this == highlight ? "*" : " ");
    showThis();
    fprintf(stderr, "\n");
    for (HTMLImport* child = firstChild(); child; child = child->next())
        child->showTree(highlight, depth + 1);
}
Beispiel #2
0
// Ensuring following invariants against the import tree:
// - HTMLImportChild::firstImport() is the "first import" of the DFS order of the import tree.
// - The "first import" manages all the children that is loaded by the document.
void HTMLImportChild::normalize()
{
    if (!loader()->isFirstImport(this) && this->precedes(loader()->firstImport())) {
        HTMLImportChild* oldFirst = loader()->firstImport();
        loader()->moveToFirst(this);
        takeChildrenFrom(oldFirst);
    }

    for (HTMLImport* child = firstChild(); child; child = child->next())
        toHTMLImportChild(child)->normalize();
}
inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const
{
    // FIXME: Memoize to make this faster.
    for (HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->parent()) {
        for (HTMLImport* predecessor = ancestor->previous(); predecessor; predecessor = predecessor->previous()) {
            if (isBlockingFollowers(predecessor))
                return true;
        }
    }

    for (HTMLImport* child = m_import->firstChild(); child; child = child->next()) {
        if (isBlockingFollowers(child))
            return true;
    }

    return false;
}