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 canStartSelection()49 virtual bool canStartSelection() const { return false; } 50 51 int width(bool ignorePendingStylesheets = false) const; 52 int height(bool ignorePendingStylesheets = false) const; 53 54 int naturalWidth() const; 55 int naturalHeight() const; 56 isServerMap()57 bool isServerMap() const { return ismap && usemap.isEmpty(); } 58 59 String altText() const; 60 61 virtual bool isURLAttribute(Attribute*) const; 62 compositeOperator()63 CompositeOperator compositeOperator() const { return m_compositeOperator; } 64 cachedImage()65 CachedImage* cachedImage() const { return m_imageLoader.image(); } setCachedImage(CachedImage * i)66 void setCachedImage(CachedImage* i) { m_imageLoader.setImage(i); }; 67 setLoadManually(bool loadManually)68 void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); } 69 70 const AtomicString& alt() const; 71 72 virtual bool draggable() const; 73 74 void setHeight(int); 75 76 int hspace() const; 77 void setHspace(int); 78 79 bool isMap() const; 80 void setIsMap(bool); 81 82 KURL longDesc() const; 83 void setLongDesc(const String&); 84 85 KURL lowsrc() const; 86 void setLowsrc(const String&); 87 88 KURL src() const; 89 void setSrc(const String&); 90 91 int vspace() const; 92 void setVspace(int); 93 94 void setWidth(int); 95 96 int x() const; 97 int y() const; 98 99 bool complete() const; 100 haveFiredLoadEvent()101 bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); } 102 103 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; 104 105 private: 106 virtual void insertedIntoDocument(); 107 virtual void removedFromDocument(); 108 virtual void insertedIntoTree(bool deep); 109 virtual void removedFromTree(bool deep); 110 111 HTMLImageLoader m_imageLoader; 112 String usemap; 113 bool ismap; 114 HTMLFormElement* m_form; 115 AtomicString m_name; 116 AtomicString m_id; 117 CompositeOperator m_compositeOperator; 118 }; 119 120 } //namespace 121 122 #endif 123