1 /* 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. 5 * 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. 10 * 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. 15 * 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. 20 * 21 */ 22 23 #ifndef HTMLImageElement_h 24 #define HTMLImageElement_h 25 26 #include "GraphicsTypes.h" 27 #include "HTMLElement.h" 28 #include "HTMLImageLoader.h" 29 30 namespace WebCore { 31 32 class HTMLFormElement; 33 34 class HTMLImageElement : public HTMLElement { 35 friend class HTMLFormElement; 36 public: 37 HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0); 38 ~HTMLImageElement(); 39 endTagRequirement()40 virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; } tagPriority()41 virtual int tagPriority() const { return 0; } 42 43 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; 44 virtual void parseMappedAttribute(MappedAttribute*); 45 46 virtual void attach(); 47 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 48 virtual void insertedIntoDocument(); 49 virtual void removedFromDocument(); 50 canStartSelection()51 virtual bool canStartSelection() const { return false; } 52 53 int width(bool ignorePendingStylesheets = false) const; 54 int height(bool ignorePendingStylesheets = false) const; 55 56 int naturalWidth() const; 57 int naturalHeight() const; 58 isServerMap()59 bool isServerMap() const { return ismap && usemap.isEmpty(); } 60 61 String altText() const; 62 63 virtual bool isURLAttribute(Attribute*) const; 64 compositeOperator()65 CompositeOperator compositeOperator() const { return m_compositeOperator; } 66 cachedImage()67 CachedImage* cachedImage() const { return m_imageLoader.image(); } setCachedImage(CachedImage * i)68 void setCachedImage(CachedImage* i) { m_imageLoader.setImage(i); }; 69 setLoadManually(bool loadManually)70 void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); } 71 72 String name() const; 73 void setName(const String&); 74 75 String align() const; 76 void setAlign(const String&); 77 78 String alt() const; 79 void setAlt(const String&); 80 81 String border() const; 82 void setBorder(const String&); 83 84 virtual bool draggable() const; 85 86 void setHeight(int); 87 88 int hspace() const; 89 void setHspace(int); 90 91 bool isMap() const; 92 void setIsMap(bool); 93 94 KURL longDesc() const; 95 void setLongDesc(const String&); 96 97 KURL lowsrc() const; 98 void setLowsrc(const String&); 99 100 KURL src() const; 101 void setSrc(const String&); 102 103 String useMap() const; 104 void setUseMap(const String&); 105 106 int vspace() const; 107 void setVspace(int); 108 109 void setWidth(int); 110 111 int x() const; 112 int y() const; 113 114 bool complete() const; 115 haveFiredLoadEvent()116 bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); } 117 118 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; 119 120 private: 121 HTMLImageLoader m_imageLoader; 122 String usemap; 123 bool ismap; 124 HTMLFormElement* m_form; 125 AtomicString m_name; 126 AtomicString m_id; 127 CompositeOperator m_compositeOperator; 128 }; 129 130 } //namespace 131 132 #endif 133