]>
git.saurik.com Git - iphone-api.git/blob - WebCore/RenderImage.h
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
28 #include "CachedImage.h"
29 #include "CachedResourceHandle.h"
30 #include "RenderReplaced.h"
36 class RenderImage
: public RenderReplaced
{
39 virtual ~RenderImage();
41 virtual const char* renderName() const { return "RenderImage"; }
43 virtual bool isImage() const { return true; }
44 virtual bool isRenderImage() const { return true; }
46 virtual void paintReplaced(PaintInfo
& paintInfo
, int tx
, int ty
);
48 virtual int minimumReplacedHeight() const;
50 virtual void imageChanged(WrappedImagePtr
, const IntRect
* = 0);
51 virtual void notifyFinished(CachedResource
*);
53 bool setImageSizeForAltText(CachedImage
* newImage
= 0);
57 void setCachedImage(CachedImage
*);
58 CachedImage
* cachedImage() const { return m_cachedImage
.get(); }
60 virtual bool nodeAtPoint(const HitTestRequest
&, HitTestResult
&, int x
, int y
, int tx
, int ty
, HitTestAction
);
62 virtual int calcReplacedWidth(bool includeMaxWidth
= true) const;
63 virtual int calcReplacedHeight() const;
65 virtual void calcPrefWidths();
67 HTMLMapElement
* imageMap();
69 void resetAnimation();
71 virtual bool hasImage() const { return m_cachedImage
; }
73 void highQualityRepaintTimerFired(Timer
<RenderImage
>*);
75 virtual void collectSelectionRects(Vector
<SelectionRect
>&, unsigned, unsigned);
78 virtual Image
* image(int /*w*/ = 0, int /*h*/ = 0) { return m_cachedImage
? m_cachedImage
->image() : nullImage(); }
79 virtual bool errorOccurred() const { return m_cachedImage
&& m_cachedImage
->errorOccurred(); }
80 virtual bool usesImageContainerSize() const { return m_cachedImage
? m_cachedImage
->usesImageContainerSize() : false; }
81 virtual void setImageContainerSize(const IntSize
& size
) const { if (m_cachedImage
) m_cachedImage
->setImageContainerSize(size
); }
82 virtual bool imageHasRelativeWidth() const { return m_cachedImage
? m_cachedImage
->imageHasRelativeWidth() : false; }
83 virtual bool imageHasRelativeHeight() const { return m_cachedImage
? m_cachedImage
->imageHasRelativeHeight() : false; }
84 virtual IntSize
imageSize(float multiplier
) const { return m_cachedImage
? m_cachedImage
->imageSize(multiplier
) : IntSize(); }
85 virtual WrappedImagePtr
imagePtr() const { return m_cachedImage
.get(); }
87 virtual void intrinsicSizeChanged() { imageChanged(imagePtr()); }
90 int calcAspectRatioWidth() const;
91 int calcAspectRatioHeight() const;
93 bool isWidthSpecified() const;
94 bool isHeightSpecified() const;
97 // The image we are rendering.
98 CachedResourceHandle
<CachedImage
> m_cachedImage
;
100 // Text to display as long as the image isn't available.
103 static Image
* nullImage();
105 friend class RenderImageScaleObserver
;
108 } // namespace WebCore
110 #endif // RenderImage_h