2 Copyright (C) 2005, 2005 Alexander Kellett <lypanov@kde.org>
4 This file is part of the WebKit project
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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
25 #include <kdom/core/AttrImpl.h>
26 #include <kdom/cache/KDOMLoader.h>
27 #include "DocLoader.h"
28 #include "DocumentImpl.h"
31 #include "SVGImageElementImpl.h"
32 #include "SVGAnimatedLengthImpl.h"
33 #include "SVGAnimatedStringImpl.h"
34 #include "SVGMatrixImpl.h"
35 #include "KCanvasRenderingStyle.h"
37 #include "render_image.h"
39 using namespace WebCore;
41 SVGImageLoader::SVGImageLoader(SVGImageElementImpl *node) : DOM::HTMLImageLoader(node)
45 SVGImageLoader::~SVGImageLoader()
49 // FIXME - Refactor most of this code into DOM::HTMLImageLoader or a shared DOM::ImageLoader base class
50 void SVGImageLoader::updateFromElement()
52 SVGImageElementImpl *imageElement = static_cast<SVGImageElementImpl *>(element());
53 DOM::DocumentImpl* doc = imageElement->ownerDocument();
55 CachedImage *newImage = 0;
56 if (imageElement->href()->baseVal())
57 newImage = doc->docLoader()->requestImage(imageElement->href()->baseVal());
59 CachedImage *oldImage = image();
60 if (newImage != oldImage) {
61 setLoadingImage(newImage);
65 oldImage->deref(this);
68 if (RenderImage* renderer = static_cast<RenderImage*>(imageElement->renderer()))
69 renderer->resetAnimation();