コード例 #1
0
void ImageTokenizer::finish()
{
    if (!m_parserStopped && m_doc->imageElement()) {
        CachedImage* cachedImage = m_doc->cachedImage();
        RefPtr<SharedBuffer> data = m_doc->frame()->loader()->documentLoader()->mainResourceData();

        // If this is a multipart image, make a copy of the current part, since the resource data
        // will be overwritten by the next part.
        if (m_doc->frame()->loader()->documentLoader()->isLoadingMultipartContent())
            data = data->copy();

        cachedImage->data(data.release(), true);
        cachedImage->finish();

        cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());

        IntSize size = cachedImage->imageSize(pageZoomFactor(m_doc));
        if (size.width()) {
            // Compute the title, we use the decoded filename of the resource, falling
            // back on the (decoded) hostname if there is no path.
            String fileName = decodeURLEscapeSequences(m_doc->url().lastPathComponent());
            if (fileName.isEmpty())
                fileName = m_doc->url().host();
            m_doc->setTitle(imageTitle(fileName, size));
        }

        m_doc->imageChanged();
    }

    m_doc->finishedParsing();
}
コード例 #2
0
ファイル: ImageDocument.cpp プロジェクト: Gin-Rye/duibrowser
void ImageTokenizer::finish()
{
    if (!m_parserStopped && m_doc->imageElement()) {
        CachedImage* cachedImage = m_doc->cachedImage();
        RefPtr<SharedBuffer> data = m_doc->frame()->loader()->documentLoader()->mainResourceData();

        // If this is a multipart image, make a copy of the current part, since the resource data
        // will be overwritten by the next part.
        if (m_doc->frame()->loader()->documentLoader()->isLoadingMultipartContent())
            data = data->copy();

        cachedImage->data(data.release(), true);
        cachedImage->finish();

        cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());

        IntSize size = cachedImage->imageSize(m_doc->frame()->pageZoomFactor());
        if (size.width())
            m_doc->setTitle(imageTitle(cachedImage->response().suggestedFilename(), size));

        m_doc->imageChanged();
    }

    m_doc->finishedParsing();
}
コード例 #3
0
ファイル: ImageDocument.cpp プロジェクト: Gin-Rye/duibrowser
bool ImageTokenizer::writeRawData(const char* data, int len)
{
    CachedImage* cachedImage = m_doc->cachedImage();
    cachedImage->data(m_doc->frame()->loader()->documentLoader()->mainResourceData(), false);

    m_doc->imageChanged();
    
    return false;
}
コード例 #4
0
bool ImageTokenizer::writeRawData(const char*, int)
{
    Frame* frame = m_doc->frame();
    Settings* settings = frame->settings();
    if (!frame->loader()->client()->allowImages(!settings || settings->areImagesEnabled()))
        return false;

    CachedImage* cachedImage = m_doc->cachedImage();
    cachedImage->data(frame->loader()->documentLoader()->mainResourceData(), false);

    m_doc->imageChanged();

    return false;
}