1/* 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@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 "SVGAnimatedBoolean.h" 25#include "SVGAnimatedLength.h" 26#include "SVGAnimatedPreserveAspectRatio.h" 27#include "SVGExternalResourcesRequired.h" 28#include "SVGGraphicsElement.h" 29#include "SVGImageLoader.h" 30#include "SVGURIReference.h" 31 32namespace WebCore { 33 34class SVGImageElement final : public SVGGraphicsElement, 35 public SVGExternalResourcesRequired, 36 public SVGURIReference { 37public: 38 static PassRefPtr<SVGImageElement> create(const QualifiedName&, Document&); 39 40private: 41 SVGImageElement(const QualifiedName&, Document&); 42 43 virtual bool isValid() const override { return SVGTests::isValid(); } 44 45 bool isSupportedAttribute(const QualifiedName&); 46 virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; 47 virtual bool isPresentationAttribute(const QualifiedName&) const override; 48 virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; 49 virtual void svgAttributeChanged(const QualifiedName&) override; 50 51 virtual void didAttachRenderers() override; 52 virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; 53 54 virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override; 55 56 virtual const AtomicString& imageSourceURL() const override; 57 virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; 58 59 virtual bool haveLoadedRequiredResources() override; 60 61 virtual bool selfHasRelativeLengths() const override; 62 virtual void didMoveToNewDocument(Document* oldDocument) override; 63 64 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement) 65 DECLARE_ANIMATED_LENGTH(X, x) 66 DECLARE_ANIMATED_LENGTH(Y, y) 67 DECLARE_ANIMATED_LENGTH(Width, width) 68 DECLARE_ANIMATED_LENGTH(Height, height) 69 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 70 DECLARE_ANIMATED_STRING(Href, href) 71 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) 72 END_DECLARE_ANIMATED_PROPERTIES 73 74 SVGImageLoader m_imageLoader; 75}; 76 77NODE_TYPE_CASTS(SVGImageElement) 78 79} // namespace WebCore 80 81#endif 82