#ifndef RenderImage_h
#define RenderImage_h
#include "CachedImage.h"
#include "RenderReplaced.h"
namespace WebCore {
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 void paint(PaintInfo&, int tx, int ty);
virtual void layout();
virtual void imageChanged(CachedImage*);
bool setImageSizeForAltText(CachedImage* newImage = 0);
void updateAltText();
void setIsAnonymousImage(bool anon) { m_isAnonymousImage = anon; }
bool isAnonymousImage() { return m_isAnonymousImage; }
void setCachedImage(CachedImage*);
CachedImage* cachedImage() const { return m_cachedImage; }
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
virtual int calcReplacedWidth() const;
virtual int calcReplacedHeight() const;
virtual void calcPrefWidths();
HTMLMapElement* imageMap();
void resetAnimation();
protected:
Image* image() { return m_cachedImage ? m_cachedImage->image() : nullImage(); }
private:
int calcAspectRatioWidth() const;
int calcAspectRatioHeight() const;
bool isWidthSpecified() const;
bool isHeightSpecified() const;
bool errorOccurred() const { return m_cachedImage && m_cachedImage->errorOccurred(); }
CachedImage* m_cachedImage;
bool m_isAnonymousImage;
String m_altText;
static Image* nullImage();
};
}
#endif // RenderImage_h