#ifndef RENDER_IMAGE_H
#define RENDER_IMAGE_H
#include "CachedImage.h"
#include "HTMLElement.h"
#include "RenderReplaced.h"
namespace WebCore {
class DocLoader;
class HTMLMapElement;
class RenderImage : public RenderReplaced
{
public:
RenderImage(Node*);
virtual ~RenderImage();
virtual const char* renderName() const { return "RenderImage"; }
virtual bool isImage() const { return true; }
virtual bool isImageButton() const { return false; }
virtual void paint(PaintInfo&, int tx, int ty);
virtual void layout();
virtual void imageChanged(CachedImage*);
HTMLElement* element() const
{ return static_cast<HTMLElement*>(RenderReplaced::element()); }
virtual void setStyle(RenderStyle *style);
void updateAltText();
void setIsAnonymousImage(bool anon) { m_isAnonymousImage = anon; }
bool isAnonymousImage() { return m_isAnonymousImage; }
void setCachedImage(CachedImage*);
CachedImage* cachedImage() const { return m_cachedImage; }
Image* image() { return m_cachedImage ? m_cachedImage->image() : nullImage(); }
virtual bool nodeAtPoint(NodeInfo&, int x, int y, int tx, int ty, HitTestAction);
virtual int calcReplacedWidth() const;
virtual int calcReplacedHeight() const;
int calcAspectRatioWidth() const;
int calcAspectRatioHeight() const;
virtual void calcMinMaxWidth();
void setContentObject(CachedResource*);
bool errorOccurred() const { return m_cachedImage && m_cachedImage->isErrorImage(); }
HTMLMapElement* imageMap();
void resetAnimation();
private:
bool isWidthSpecified() const;
bool isHeightSpecified() const;
CachedImage* m_cachedImage;
bool m_isAnonymousImage;
String m_altText;
static Image* nullImage();
};
}
#endif