summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/SVGCursorElement.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commit9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch)
treed49911209b132da58d838efa852daf28d516df21 /WebCore/svg/SVGCursorElement.cpp
parent87eb0cb35bad8784770ebc807e6c982432e47107 (diff)
downloadexternal_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip
external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz
external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2
Initial Contribution
Diffstat (limited to 'WebCore/svg/SVGCursorElement.cpp')
-rw-r--r--WebCore/svg/SVGCursorElement.cpp47
1 files changed, 17 insertions, 30 deletions
diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp
index 7a3e66c..52e2a7c 100644
--- a/WebCore/svg/SVGCursorElement.cpp
+++ b/WebCore/svg/SVGCursorElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -26,29 +26,36 @@
#include "SVGCursorElement.h"
#include "Attr.h"
+#include "CachedImage.h"
+#include "Document.h"
+#include "DocLoader.h"
#include "SVGNames.h"
#include "SVGLength.h"
namespace WebCore {
-SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document* doc)
+SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document *doc)
: SVGElement(tagName, doc)
, SVGTests()
, SVGExternalResourcesRequired()
, SVGURIReference()
+ , CachedResourceClient()
, m_x(0, LengthModeWidth)
, m_y(0, LengthModeHeight)
{
+ m_cachedImage = 0;
}
SVGCursorElement::~SVGCursorElement()
{
+ if (m_cachedImage)
+ m_cachedImage->deref(this);
}
ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
-void SVGCursorElement::parseMappedAttribute(MappedAttribute* attr)
+void SVGCursorElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(0, LengthModeWidth, attr->value()));
@@ -59,39 +66,19 @@ void SVGCursorElement::parseMappedAttribute(MappedAttribute* attr)
return;
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
- if (SVGURIReference::parseMappedAttribute(attr))
+ if (SVGURIReference::parseMappedAttribute(attr)) {
+ if (m_cachedImage)
+ m_cachedImage->deref(this);
+ m_cachedImage = ownerDocument()->docLoader()->requestImage(href());
+ if (m_cachedImage)
+ m_cachedImage->ref(this);
return;
+ }
SVGElement::parseMappedAttribute(attr);
}
}
-void SVGCursorElement::addClient(SVGElement* element)
-{
- m_clients.add(element);
-}
-
-void SVGCursorElement::removeClient(SVGElement* element)
-{
- m_clients.remove(element);
-}
-
-void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
-{
- SVGElement::svgAttributeChanged(attrName);
-
- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
- SVGTests::isKnownAttribute(attrName) ||
- SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
- SVGURIReference::isKnownAttribute(attrName)) {
- HashSet<SVGElement*>::const_iterator it = m_clients.begin();
- HashSet<SVGElement*>::const_iterator end = m_clients.end();
-
- for (; it != end; ++it)
- (*it)->setChanged();
- }
-}
-
}
#endif // ENABLE(SVG)