Example #1
0
void HTMLObjectElement::attach()
{
    HTMLPlugInElement::attach();

    if (renderer() && !m_useFallbackContent) {
        if (isImageType()) {
            if (!m_imageLoader)
                m_imageLoader = new HTMLImageLoader(this);
            m_imageLoader->updateFromElement();
            if (renderer()) {
                RenderImage* imageObj = static_cast<RenderImage*>(renderer());
                imageObj->setCachedImage(m_imageLoader->image());
            }
        } else {
            if (m_needWidgetUpdate) {
                // Set m_needWidgetUpdate to false before calling updateWidget because updateWidget may cause
                // this method or recalcStyle (which also calls updateWidget) to be called.
                m_needWidgetUpdate = false;
                static_cast<RenderPartObject*>(renderer())->updateWidget(true);
            } else {
                m_needWidgetUpdate = true;
                setChanged();
            }
        }
    }
}
void HTMLImageElement::attach()
{
    HTMLElement::attach();

    if (renderer() && renderer()->isImage()) {
        RenderImage* imageObj = static_cast<RenderImage*>(renderer());
        imageObj->setCachedImage(m_imageLoader.image());
        
        // If we have no image at all because we have no src attribute, set
        // image height and width for the alt text instead.
        if (!m_imageLoader.image() && !imageObj->cachedImage())
            imageObj->setImageSizeForAltText();
    }
}
Example #3
0
void HTMLVideoElement::attach()
{
    HTMLMediaElement::attach();
    
    if (m_shouldShowPosterImage) {
        if (!m_imageLoader)
            m_imageLoader.set(new HTMLImageLoader(this));
        m_imageLoader->updateFromElement();
        if (renderer() && renderer()->isImage()) {
            RenderImage* imageRenderer = static_cast<RenderImage*>(renderer());
            imageRenderer->setCachedImage(m_imageLoader->image()); 
        }
    }

}
Example #4
0
void ImageLoader::updateRenderer()
{
    if (RenderObject* renderer = m_element->renderer()) {
        if (!renderer->isImage() && !renderer->isVideo())
            return;
        RenderImage* imageRenderer = toRenderImage(renderer);
        
        // Only update the renderer if it doesn't have an image or if what we have
        // is a complete image.  This prevents flickering in the case where a dynamic
        // change is happening between two images.
        CachedImage* cachedImage = imageRenderer->cachedImage();
        if (m_image != cachedImage && (m_imageComplete || !imageRenderer->cachedImage()))
            imageRenderer->setCachedImage(m_image.get());
    }
}
void WMLImageElement::attach()
{
    WMLElement::attach();

    if (renderer() && renderer()->isImage() && m_imageLoader.haveFiredBeforeLoadEvent()) {
        RenderImage* imageObj = toRenderImage(renderer());
        if (imageObj->hasImage())
            return;
        imageObj->setCachedImage(m_imageLoader.image());
        
        // If we have no image at all because we have no src attribute, set
        // image height and width for the alt text instead.
        if (!m_imageLoader.image() && !imageObj->cachedImage())
            imageObj->setImageSizeForAltText();
    }
}
void HTMLVideoElement::attach()
{
    HTMLMediaElement::attach();

#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    updatePosterImage();
    if (m_shouldDisplayPosterImage) {
        if (!m_imageLoader)
            m_imageLoader.set(new HTMLImageLoader(this));
        m_imageLoader->updateFromElement();
        if (renderer()) {
            RenderImage* imageRenderer = toRenderImage(renderer());
            imageRenderer->setCachedImage(m_imageLoader->image());
        }
    }
#endif
}
Example #7
0
void HTMLObjectElement::attach()
{
    bool isImage = isImageType();

    if (!isImage)
        queuePostAttachCallback(&HTMLPlugInElement::updateWidgetCallback, this);

    HTMLPlugInElement::attach();

    if (isImage && renderer() && !m_useFallbackContent) {
        if (!m_imageLoader)
            m_imageLoader.set(new HTMLImageLoader(this));
        m_imageLoader->updateFromElement();
        // updateForElement() may have changed us to use fallback content and called detach() and attach().
        if (m_useFallbackContent)
            return;

        if (renderer()) {
            RenderImage* imageObj = static_cast<RenderImage*>(renderer());
            imageObj->setCachedImage(m_imageLoader->image());
        }
    }
}