LayoutObject* HTMLImageElement::createLayoutObject(const ComputedStyle& style)
{
    if (m_useFallbackContent)
        return new LayoutBlockFlow(this);

    if (style.hasContent())
        return LayoutObject::createObject(this, style);

    LayoutImage* image = new LayoutImage(this);
    image->setImageResource(LayoutImageResource::create());
    image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
    return image;
}
Ejemplo n.º 2
0
LayoutObject* HTMLImageElement::createLayoutObject(const ComputedStyle& style)
{
    const ContentData* contentData = style.contentData();
    if (contentData && contentData->isImage()) {
        const StyleImage* contentImage = toImageContentData(contentData)->image();
        bool errorOccurred = contentImage && contentImage->cachedImage() && contentImage->cachedImage()->errorOccurred();
        if (!errorOccurred)
            return LayoutObject::createObject(this, style);
    }

    if (m_useFallbackContent)
        return new LayoutBlockFlow(this);

    LayoutImage* image = new LayoutImage(this);
    image->setImageResource(LayoutImageResource::create());
    image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
    return image;
}