2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef HTMLImageElement_h
24 #define HTMLImageElement_h
26 #include "GraphicsTypes.h"
27 #include "HTMLElement.h"
28 #include "HTMLImageLoader.h"
32 class HTMLFormElement
;
34 class HTMLImageElement
: public HTMLElement
{
35 friend class HTMLFormElement
;
37 HTMLImageElement(const QualifiedName
&, Document
*, HTMLFormElement
* = 0);
40 virtual HTMLTagStatus
endTagRequirement() const { return TagStatusForbidden
; }
41 virtual int tagPriority() const { return 0; }
43 virtual bool mapToEntry(const QualifiedName
& attrName
, MappedAttributeEntry
& result
) const;
44 virtual void parseMappedAttribute(MappedAttribute
*);
46 virtual void attach();
47 virtual RenderObject
* createRenderer(RenderArena
*, RenderStyle
*);
48 virtual void insertedIntoDocument();
49 virtual void removedFromDocument();
51 virtual bool canStartSelection() const { return false; }
53 int width(bool ignorePendingStylesheets
= false) const;
54 int height(bool ignorePendingStylesheets
= false) const;
56 int naturalWidth() const;
57 int naturalHeight() const;
59 bool isServerMap() const { return ismap
&& usemap
.isEmpty(); }
61 String
altText() const;
63 virtual bool isURLAttribute(Attribute
*) const;
65 CompositeOperator
compositeOperator() const { return m_compositeOperator
; }
67 CachedImage
* cachedImage() const { return m_imageLoader
.image(); }
68 void setCachedImage(CachedImage
* i
) { m_imageLoader
.setImage(i
); };
70 void setLoadManually (bool loadManually
) { m_imageLoader
.setLoadManually(loadManually
); }
73 void setName(const String
&);
76 void setAlign(const String
&);
79 void setAlt(const String
&);
81 String
border() const;
82 void setBorder(const String
&);
92 KURL
longDesc() const;
93 void setLongDesc(const String
&);
96 void setLowsrc(const String
&);
99 void setSrc(const String
&);
101 String
useMap() const;
102 void setUseMap(const String
&);
112 bool complete() const;
114 bool haveFiredLoadEvent() const { return m_imageLoader
.haveFiredLoadEvent(); }
116 virtual bool willRespondToMouseClickEvents();
118 virtual void addSubresourceAttributeURLs(ListHashSet
<KURL
>&) const;
121 HTMLImageLoader m_imageLoader
;
124 HTMLFormElement
* m_form
;
127 CompositeOperator m_compositeOperator
;