This source file includes following definitions.
- initialize
- shutdown
- image
- setContainerSizeForRenderer
#include "config.h"
#include "core/rendering/RenderImageResourceStyleImage.h"
#include "core/fetch/ImageResource.h"
#include "core/rendering/RenderObject.h"
#include "core/rendering/style/StyleFetchedImage.h"
namespace WebCore {
RenderImageResourceStyleImage::RenderImageResourceStyleImage(StyleImage* styleImage)
: m_styleImage(styleImage)
{
ASSERT(m_styleImage);
}
RenderImageResourceStyleImage::~RenderImageResourceStyleImage()
{
}
void RenderImageResourceStyleImage::initialize(RenderObject* renderer)
{
RenderImageResource::initialize(renderer);
if (m_styleImage->isImageResource())
m_cachedImage = toStyleFetchedImage(m_styleImage)->cachedImage();
m_styleImage->addClient(m_renderer);
}
void RenderImageResourceStyleImage::shutdown()
{
ASSERT(m_renderer);
m_styleImage->removeClient(m_renderer);
m_cachedImage = 0;
}
PassRefPtr<Image> RenderImageResourceStyleImage::image(int width, int height) const
{
if (m_styleImage->isPendingImage())
return nullptr;
return m_styleImage->image(m_renderer, IntSize(width, height));
}
void RenderImageResourceStyleImage::setContainerSizeForRenderer(const IntSize& size)
{
ASSERT(m_renderer);
m_styleImage->setContainerSizeForRenderer(m_renderer, size, m_renderer->style()->effectiveZoom());
}
}