コード例 #1
0
ファイル: SVGUseElement.cpp プロジェクト: cheekiatng/webkit
void SVGUseElement::updateExternalDocument()
{
    URL externalDocumentURL;
    if (inDocument() && isExternalURIReference(href(), document())) {
        externalDocumentURL = document().completeURL(href());
        if (!externalDocumentURL.hasFragmentIdentifier())
            externalDocumentURL = URL();
    }

    if (externalDocumentURL == (m_externalDocument ? m_externalDocument->url() : URL()))
        return;

    if (m_externalDocument)
        m_externalDocument->removeClient(this);

    if (externalDocumentURL.isNull())
        m_externalDocument = nullptr;
    else {
        ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
        options.setContentSecurityPolicyImposition(isInUserAgentShadowTree() ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck);

        CachedResourceRequest request { ResourceRequest { externalDocumentURL }, options };
        request.setInitiator(this);
        m_externalDocument = document().cachedResourceLoader().requestSVGDocument(request);
        if (m_externalDocument)
            m_externalDocument->addClient(this);
    }

    invalidateShadowTree();
}
コード例 #2
0
ファイル: SVGUseElement.cpp プロジェクト: houzhenggang/webkit
void SVGUseElement::updateExternalDocument()
{
    URL externalDocumentURL;
    if (inDocument() && isExternalURIReference(href(), document())) {
        externalDocumentURL = document().completeURL(href());
        if (!externalDocumentURL.hasFragmentIdentifier())
            externalDocumentURL = URL();
    }

    if (externalDocumentURL == (m_externalDocument ? m_externalDocument->url() : URL()))
        return;

    if (m_externalDocument)
        m_externalDocument->removeClient(this);

    if (externalDocumentURL.isNull())
        m_externalDocument = nullptr;
    else {
        CachedResourceRequest request { ResourceRequest { externalDocumentURL } };
        request.setInitiator(this);
        m_externalDocument = document().cachedResourceLoader().requestSVGDocument(request);
        if (m_externalDocument) {
            // FIXME: Is it really OK for us to set this to false for a document that might be shared by another client?
            m_externalDocument->setShouldCreateFrameForDocument(false); // No frame needed, we just want the elements.
            m_externalDocument->addClient(this);
        }
    }

    invalidateShadowTree();
}