Exemplo n.º 1
0
LocalFrame* LinkResource::loadingFrame() const
{
    HTMLImportsController* import = m_owner->document().importsController();
    if (!import)
        return m_owner->document().frame();
    return import->frame();
}
Exemplo n.º 2
0
void LinkImport::process()
{
    if (m_child)
        return;
    if (!m_owner)
        return;
    if (!shouldLoadResource())
        return;

    if (!m_owner->document().import()) {
        ASSERT(m_owner->document().frame()); // The document should be the master.
        HTMLImportsController::provideTo(m_owner->document());
    }

    LinkRequestBuilder builder(m_owner);
    if (!builder.isValid()) {
        didFinish();
        return;
    }

    HTMLImport* parent = m_owner->document().import();
    HTMLImportsController* controller = parent->controller();
    m_child = controller->load(parent, this, builder.build(true));
    if (!m_child) {
        didFinish();
        return;
    }
}
void LinkImport::process()
{
    if (m_loader)
        return;
    if (!m_owner)
        return;
    if (!m_owner->document()->frame() && !m_owner->document()->import())
        return;

    if (!m_owner->document()->import()) {
        ASSERT(m_owner->document()->frame()); // The document should be the master.
        HTMLImportsController::provideTo(m_owner->document());
    }

    LinkRequestBuilder builder(m_owner);
    if (!builder.isValid()) {
        didFinish();
        return;
    }

    HTMLImport* parent = m_owner->document()->import();
    HTMLImportsController* controller = parent->controller();
    m_loader = controller->createLoader(parent, builder.build(true));
    if (!m_loader) {
        didFinish();
        return;
    }

    m_loader->addClient(this);
}
Exemplo n.º 4
0
inline Document* StyleEngine::master()
{
    if (isMaster())
        return m_document;
    HTMLImportsController* import = document().importsController();
    if (!import) // Document::import() can return null while executing its destructor.
        return 0;
    return import->master();
}
Exemplo n.º 5
0
    bool traverseTree(Node* rootNode, WillBeHeapVector<RawPtrWillBeMember<Node>, initialNodeVectorSize>* partiallyDependentNodes)
    {
        // To make each minor GC time bounded, we might need to give up
        // traversing at some point for a large DOM tree. That being said,
        // I could not observe the need even in pathological test cases.
        for (Node& node : NodeTraversal::startsAt(rootNode)) {
            if (node.containsWrapper()) {
                if (!node.isV8CollectableDuringMinorGC()) {
                    // This node is not in the new space of V8. This indicates that
                    // the minor GC cannot anyway judge reachability of this DOM tree.
                    // Thus we give up traversing the DOM tree.
                    return false;
                }
                node.clearV8CollectableDuringMinorGC();
                partiallyDependentNodes->append(&node);
            }
            if (ShadowRoot* shadowRoot = node.youngestShadowRoot()) {
                if (!traverseTree(shadowRoot, partiallyDependentNodes))
                    return false;
            } else if (node.isShadowRoot()) {
                if (ShadowRoot* shadowRoot = toShadowRoot(node).olderShadowRoot()) {
                    if (!traverseTree(shadowRoot, partiallyDependentNodes))
                        return false;
                }
            }
            // <template> has a |content| property holding a DOM fragment which we must traverse,
            // just like we do for the shadow trees above.
            if (isHTMLTemplateElement(node)) {
                if (!traverseTree(toHTMLTemplateElement(node).content(), partiallyDependentNodes))
                    return false;
            }

            // Document maintains the list of imported documents through HTMLImportsController.
            if (node.isDocumentNode()) {
                Document& document = toDocument(node);
                HTMLImportsController* controller = document.importsController();
                if (controller && document == controller->master()) {
                    for (unsigned i = 0; i < controller->loaderCount(); ++i) {
                        if (!traverseTree(controller->loaderDocumentAt(i), partiallyDependentNodes))
                            return false;
                    }
                }
            }
        }
        return true;
    }