1 /* 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann (at) kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis (at) kde.org> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef SVGImageElement_h 22 #define SVGImageElement_h 23 24 #include "SVGNames.h" 25 #include "core/svg/SVGAnimatedBoolean.h" 26 #include "core/svg/SVGAnimatedLength.h" 27 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" 28 #include "core/svg/SVGExternalResourcesRequired.h" 29 #include "core/svg/SVGGraphicsElement.h" 30 #include "core/svg/SVGImageLoader.h" 31 #include "core/svg/SVGURIReference.h" 32 33 namespace WebCore { 34 35 class SVGImageElement FINAL : public SVGGraphicsElement, 36 public SVGExternalResourcesRequired, 37 public SVGURIReference { 38 public: 39 static PassRefPtr<SVGImageElement> create(const QualifiedName&, Document*); 40 41 private: 42 SVGImageElement(const QualifiedName&, Document*); 43 44 virtual bool isValid() const { return SVGTests::isValid(); } 45 virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } 46 47 bool isSupportedAttribute(const QualifiedName&); 48 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; 49 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 50 virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE; 51 virtual void svgAttributeChanged(const QualifiedName&); 52 53 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 54 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 55 56 virtual RenderObject* createRenderer(RenderStyle*); 57 58 virtual const AtomicString& imageSourceURL() const OVERRIDE; 59 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; 60 61 virtual bool haveLoadedRequiredResources(); 62 63 virtual bool selfHasRelativeLengths() const; 64 virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; 65 66 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement) 67 DECLARE_ANIMATED_LENGTH(X, x) 68 DECLARE_ANIMATED_LENGTH(Y, y) 69 DECLARE_ANIMATED_LENGTH(Width, width) 70 DECLARE_ANIMATED_LENGTH(Height, height) 71 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 72 DECLARE_ANIMATED_STRING(Href, href) 73 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) 74 END_DECLARE_ANIMATED_PROPERTIES 75 76 SVGImageLoader m_imageLoader; 77 }; 78 79 inline SVGImageElement* toSVGImageElement(Node* node) 80 { 81 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::imageTag)); 82 return static_cast<SVGImageElement*>(node); 83 } 84 85 } // namespace WebCore 86 87 #endif 88