Reviewed by Eric.
Fixes: http://bugs.webkit.org/show_bug.cgi?id=15394
Dramatically improve dynamic update performance in DOM / SVG DOM.
The notifyAttributeChange() sledgehammer is gone now. It was implemented on quite a lot of
SVG*Element classes and blindly reacted on any property change caused by DOM / SVG DOM
by rebuilding style/renderer etc. without actually checking what changed. SVG used a hack
for years that attributeChanged() called notifyAttributeChange() - which results in poor
scripting performance and/or dynamic creation/modification of elements using SVG DOM.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@29951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp
index 16c5341..e425c4a 100644
--- a/WebCore/svg/SVGAElement.cpp
+++ b/WebCore/svg/SVGAElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
2007 Eric Seidel <eric@webkit.org>
@@ -65,7 +65,7 @@
return getAttribute(XLinkNames::titleAttr);
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGAElement, String, String, string, Target, target, SVGNames::targetAttr.localName(), m_target)
+ANIMATED_PROPERTY_DEFINITIONS(SVGAElement, String, String, string, Target, target, SVGNames::targetAttr, m_target)
void SVGAElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -124,11 +124,10 @@
}
String target = getAttribute(SVGNames::targetAttr);
- String xlinktarget = getAttribute(XLinkNames::showAttr);
if (e && e->button() == MiddleButton)
target = "_blank";
else if (target.isEmpty()) // if target is empty, default to "_self" or use xlink:target if set
- target = (xlinktarget == "new") ? "_blank" : "_self";
+ target = (getAttribute(XLinkNames::showAttr) == "new") ? "_blank" : "_self";
String url = parseURL(href());
if (!evt->defaultPrevented())
@@ -188,5 +187,4 @@
} // namespace WebCore
-// vim:ts=4:noet
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGAElement.h b/WebCore/svg/SVGAElement.h
index 0b00fbe..6494ea2 100644
--- a/WebCore/svg/SVGAElement.h
+++ b/WebCore/svg/SVGAElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
2007 Eric Seidel <eric@webkit.org>
@@ -23,8 +23,8 @@
#ifndef SVGAElement_h
#define SVGAElement_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
@@ -75,5 +75,3 @@
#endif // ENABLE(SVG)
#endif // SVGAElement_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGAngle.cpp b/WebCore/svg/SVGAngle.cpp
index cc0cc55..4b7efc2 100644
--- a/WebCore/svg/SVGAngle.cpp
+++ b/WebCore/svg/SVGAngle.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -173,5 +173,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGAngle.h b/WebCore/svg/SVGAngle.h
index 5abcb00..d281076 100644
--- a/WebCore/svg/SVGAngle.h
+++ b/WebCore/svg/SVGAngle.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,8 +24,8 @@
#define SVGAngle_h
#if ENABLE(SVG)
-
#include "PlatformString.h"
+#include "SVGNames.h"
namespace WebCore {
@@ -65,6 +65,9 @@
// Returns the angle that divides the shortest arc between the two angles.
static double shortestArcBisector(double angle1, double angle2);
+ // Throughout SVG 1.1 'SVGAngle' is only used for 'SVGMarkerElement' (orient-angle)
+ const QualifiedName& associatedAttributeName() const { return SVGNames::orientAttr; }
+
private:
SVGAngleType m_unitType;
float m_value;
@@ -78,5 +81,3 @@
#endif // ENABLE(SVG)
#endif // SVGAngle_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGAnimatedTemplate.h b/WebCore/svg/SVGAnimatedTemplate.h
index ca77d9f..340596d 100644
--- a/WebCore/svg/SVGAnimatedTemplate.h
+++ b/WebCore/svg/SVGAnimatedTemplate.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,11 +24,13 @@
#define SVGAnimatedTemplate_h
#if ENABLE(SVG)
-
#include <wtf/RefCounted.h>
#include "AtomicString.h"
+#include "Attribute.h"
namespace WebCore {
+
+ class FloatRect;
class SVGAngle;
class SVGElement;
class SVGLength;
@@ -37,7 +39,7 @@
class SVGPreserveAspectRatio;
class SVGTransformList;
class String;
- class FloatRect;
+ class QualifiedName;
struct SVGAnimatedTypeWrapperKey {
// Empty value
@@ -103,7 +105,12 @@
template<typename BareType>
class SVGAnimatedTemplate : public RefCounted<SVGAnimatedTemplate<BareType> >
{
- public:
+ public:
+ SVGAnimatedTemplate(const QualifiedName& attributeName)
+ : m_associatedAttributeName(attributeName)
+ {
+ }
+
virtual ~SVGAnimatedTemplate() { forgetWrapper(this); }
virtual BareType baseVal() const = 0;
@@ -111,13 +118,14 @@
virtual BareType animVal() const = 0;
virtual void setAnimVal(BareType newAnimVal) = 0;
-
+
typedef HashMap<SVGAnimatedTypeWrapperKey, SVGAnimatedTemplate<BareType>*, SVGAnimatedTypeWrapperKeyHash, SVGAnimatedTypeWrapperKeyHashTraits > ElementToWrapperMap;
typedef typename ElementToWrapperMap::const_iterator ElementToWrapperMapIterator;
-
- static ElementToWrapperMap* wrapperCache() {
- static ElementToWrapperMap* sWrapperCache = new ElementToWrapperMap;
- return sWrapperCache;
+
+ static ElementToWrapperMap* wrapperCache()
+ {
+ static ElementToWrapperMap* s_wrapperCache = new ElementToWrapperMap;
+ return s_wrapperCache;
}
static void forgetWrapper(SVGAnimatedTemplate<BareType>* wrapper)
@@ -132,14 +140,19 @@
}
}
}
+
+ const QualifiedName& associatedAttributeName() const { return m_associatedAttributeName; }
+
+ private:
+ const QualifiedName& m_associatedAttributeName;
};
-
+
template <class Type, class SVGElementSubClass>
- Type* lookupOrCreateWrapper(const SVGElementSubClass* element, const AtomicString& attrName) {
- SVGAnimatedTypeWrapperKey key(element, attrName);
+ Type* lookupOrCreateWrapper(const SVGElementSubClass* element, const QualifiedName& domAttrName, const AtomicString& attrIdentifier) {
+ SVGAnimatedTypeWrapperKey key(element, attrIdentifier);
Type* wrapper = static_cast<Type*>(Type::wrapperCache()->get(key));
if (!wrapper) {
- wrapper = new Type(element);
+ wrapper = new Type(element, domAttrName);
Type::wrapperCache()->set(key, wrapper);
}
return wrapper;
@@ -162,5 +175,3 @@
#endif // ENABLE(SVG)
#endif // SVGAnimatedTemplate_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGAnimationElement.cpp b/WebCore/svg/SVGAnimationElement.cpp
index e0e9ced..88a3d8d 100644
--- a/WebCore/svg/SVGAnimationElement.cpp
+++ b/WebCore/svg/SVGAnimationElement.cpp
@@ -169,7 +169,9 @@
void SVGAnimationElement::parseBeginOrEndValue(double& number, const String& value)
{
- RefPtr<SVGStringList> valueList = new SVGStringList();
+ // TODO: Don't use SVGStringList for parsing.
+ AtomicString dummy;
+ RefPtr<SVGStringList> valueList = new SVGStringList(QualifiedName(dummy, dummy, dummy));
valueList->parse(value, ';');
ExceptionCode ec = 0;
diff --git a/WebCore/svg/SVGCircleElement.cpp b/WebCore/svg/SVGCircleElement.cpp
index fe2a319..3bcbdc1 100644
--- a/WebCore/svg/SVGCircleElement.cpp
+++ b/WebCore/svg/SVGCircleElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -46,9 +46,9 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, Cx, cx, SVGNames::cxAttr.localName(), m_cx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, Cy, cy, SVGNames::cyAttr.localName(), m_cy)
-ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, R, r, SVGNames::rAttr.localName(), m_r)
+ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, Cx, cx, SVGNames::cxAttr, m_cx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, Cy, cy, SVGNames::cyAttr, m_cy)
+ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, R, r, SVGNames::rAttr, m_r)
void SVGCircleElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -71,12 +71,20 @@
}
}
-void SVGCircleElement::notifyAttributeChange() const
+void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!document()->parsing() && renderer())
- renderer()->setNeedsLayout(true);
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
- SVGStyledTransformableElement::notifyAttributeChange();
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
+ attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
}
Path SVGCircleElement::toPathData() const
@@ -92,5 +100,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGCircleElement.h b/WebCore/svg/SVGCircleElement.h
index c54d3d1..e968bc4 100644
--- a/WebCore/svg/SVGCircleElement.h
+++ b/WebCore/svg/SVGCircleElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,7 +24,6 @@
#define SVGCircleElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
@@ -40,12 +39,11 @@
public:
SVGCircleElement(const QualifiedName&, Document*);
virtual ~SVGCircleElement();
-
+
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGCircleElement' functions
- virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void notifyAttributeChange() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual Path toPathData() const;
@@ -65,5 +63,3 @@
#endif // ENABLE(SVG)
#endif // SVGCircleElement_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp
index a0058e7..9a12abf 100644
--- a/WebCore/svg/SVGClipPathElement.cpp
+++ b/WebCore/svg/SVGClipPathElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -46,7 +46,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGClipPathElement, int, Enumeration, enumeration, ClipPathUnits, clipPathUnits, SVGNames::clipPathUnitsAttr.localName(), m_clipPathUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGClipPathElement, int, Enumeration, enumeration, ClipPathUnits, clipPathUnits, SVGNames::clipPathUnitsAttr, m_clipPathUnits)
void SVGClipPathElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -66,6 +66,31 @@
}
}
+void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
+
+ if (!m_clipper)
+ return;
+
+ if (attrName == SVGNames::clipPathUnitsAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ m_clipper->invalidate();
+}
+
+void SVGClipPathElement::childrenChanged()
+{
+ SVGStyledTransformableElement::childrenChanged();
+
+ if (!m_clipper)
+ return;
+
+ m_clipper->invalidate();
+}
+
SVGResource* SVGClipPathElement::canvasResource()
{
if (!m_clipper)
@@ -88,7 +113,7 @@
pathStyle->deref(document()->renderArena());
}
}
- if (m_clipper->clipData().isEmpty() ) {
+ if (m_clipper->clipData().isEmpty()) {
Path pathData;
pathData.addRect(FloatRect());
m_clipper->addClipData(pathData, RULE_EVENODD, bbox);
@@ -97,17 +122,6 @@
return m_clipper.get();
}
-void SVGClipPathElement::notifyAttributeChange() const
-{
- if (!m_clipper || !attached() || document()->parsing())
- return;
-
- m_clipper->invalidate();
- m_clipper->repaintClients();
-}
-
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h
index 7286ad0..d167376 100644
--- a/WebCore/svg/SVGClipPathElement.h
+++ b/WebCore/svg/SVGClipPathElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,15 +24,14 @@
#define SVGClipPathElement_h
#if ENABLE(SVG)
-
#include "SVGResourceClipper.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGClipPathElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
@@ -41,17 +40,16 @@
public:
SVGClipPathElement(const QualifiedName&, Document*);
virtual ~SVGClipPathElement();
-
+
virtual bool isValid() const { return SVGTests::isValid(); }
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void childrenChanged();
virtual SVGResource* canvasResource();
- // 'SVGClipPathElement' functions
- virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
-
- virtual bool rendererIsNeeded(RenderStyle*) { return false; }
-
protected:
virtual const SVGElement* contextElement() const { return this; }
@@ -67,5 +65,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/WebCore/svg/SVGComponentTransferFunctionElement.cpp
index fc0529b..07b348d 100644
--- a/WebCore/svg/SVGComponentTransferFunctionElement.cpp
+++ b/WebCore/svg/SVGComponentTransferFunctionElement.cpp
@@ -47,13 +47,13 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr.localName(), m_type)
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, SVGNumberList*, NumberList, numberList, TableValues, tableValues, SVGNames::tableValuesAttr.localName(), m_tableValues.get())
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Slope, slope, SVGNames::slopeAttr.localName(), m_slope)
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Intercept, intercept, SVGNames::interceptAttr.localName(), m_intercept)
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Amplitude, amplitude, SVGNames::amplitudeAttr.localName(), m_amplitude)
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Exponent, exponent, SVGNames::exponentAttr.localName(), m_exponent)
-ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Offset, offset, SVGNames::offsetAttr.localName(), m_offset)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr, m_type)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, SVGNumberList*, NumberList, numberList, TableValues, tableValues, SVGNames::tableValuesAttr, m_tableValues.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Slope, slope, SVGNames::slopeAttr, m_slope)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Intercept, intercept, SVGNames::interceptAttr, m_intercept)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Amplitude, amplitude, SVGNames::amplitudeAttr, m_amplitude)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Exponent, exponent, SVGNames::exponentAttr, m_exponent)
+ANIMATED_PROPERTY_DEFINITIONS(SVGComponentTransferFunctionElement, float, Number, number, Offset, offset, SVGNames::offsetAttr, m_offset)
void SVGComponentTransferFunctionElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp
index 47b227a..52e2a7c 100644
--- a/WebCore/svg/SVGCursorElement.cpp
+++ b/WebCore/svg/SVGCursorElement.cpp
@@ -52,8 +52,8 @@
m_cachedImage->deref(this);
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
+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)
{
@@ -82,5 +82,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index 7fe70a4..8c82c02 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -205,7 +205,7 @@
for (; it != end; ++it)
(*it)->buildPendingResource();
- SVGResource::repaintClients(*clients);
+ SVGResource::invalidateClients(*clients);
}
}
@@ -244,8 +244,16 @@
return EventTargetNode::dispatchGenericEvent(this, e, ec, tempEvent);
}
+void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls)
+{
+ ASSERT(attr);
+ if (!attr)
+ return;
+
+ StyledElement::attributeChanged(attr, preserveDecls);
+ svgAttributeChanged(attr->name());
+}
+
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h
index 23b55b1..bf05e38 100644
--- a/WebCore/svg/SVGElement.h
+++ b/WebCore/svg/SVGElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,7 +24,6 @@
#define SVGElement_h
#if ENABLE(SVG)
-
#include "Document.h"
#include "FloatRect.h"
#include "StyledElement.h"
@@ -55,21 +54,21 @@
: public SVGAnimatedTemplate<BareType> \
{ \
public: \
- SVGAnimatedTemplate##UpperProperty(const ClassType* element); \
+ SVGAnimatedTemplate##UpperProperty(const ClassType*, const QualifiedName&); \
virtual ~SVGAnimatedTemplate##UpperProperty() { } \
virtual BareType baseVal() const; \
- virtual void setBaseVal(BareType newBaseVal); \
+ virtual void setBaseVal(BareType); \
virtual BareType animVal() const; \
- virtual void setAnimVal(BareType newAnimVal); \
+ virtual void setAnimVal(BareType); \
\
protected: \
ClassStorageType m_element; \
}; \
public: \
BareType LowerProperty() const; \
- void set##UpperProperty(BareType newValue); \
+ void set##UpperProperty(BareType); \
BareType LowerProperty##BaseValue() const; \
- void set##UpperProperty##BaseValue(BareType newValue); \
+ void set##UpperProperty##BaseValue(BareType); \
PassRefPtr<SVGAnimatedTemplate##UpperProperty> LowerProperty##Animated() const; \
void start##UpperProperty() const; \
void stop##UpperProperty(); \
@@ -78,8 +77,9 @@
StorageType m_##LowerProperty;
#define ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassType, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, ContextElement) \
-ClassName::SVGAnimatedTemplate##UpperProperty::SVGAnimatedTemplate##UpperProperty(const ClassType* element) \
-: m_element(const_cast<ClassType*>(element)) { } \
+ClassName::SVGAnimatedTemplate##UpperProperty::SVGAnimatedTemplate##UpperProperty(const ClassType* element, const QualifiedName& attributeName) \
+: SVGAnimatedTemplate<BareType>(attributeName), m_element(const_cast<ClassType*>(element)) { } \
+\
BareType ClassName::SVGAnimatedTemplate##UpperProperty::baseVal() const \
{ \
return m_element->LowerProperty##BaseValue(); \
@@ -157,26 +157,27 @@
ANIMATED_PROPERTY_DECLARATIONS_INTERNAL(ClassName, RefPtr<ClassName>, BareType, StorageType, UpperProperty, LowerProperty)
#define ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
-ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, SVGElement, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, contextElement()) \
+ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, SVGElement, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName.localName(), StorageGetter, contextElement()) \
PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
{ \
const SVGElement* context = contextElement(); \
ASSERT(context); \
- return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, SVGElement>(context, AttrName); \
+ return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, SVGElement>(context, AttrName, AttrName.localName()); \
+}
+
+#define ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrIdentifier, StorageGetter) \
+ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName.localName(), StorageGetter, this) \
+PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
+{ \
+ return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, ClassName>(this, AttrName, AttrIdentifier); \
}
#define ANIMATED_PROPERTY_DEFINITIONS(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
-ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, this) \
-PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
-{ \
- return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, ClassName>(this, AttrName); \
-}
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrName.localName(), StorageGetter)
namespace WebCore {
- class Ecma;
+
class SVGPreserveAspectRatio;
- class SVGMatrix;
- class SVGStyledElement;
class SVGSVGElement;
class SVGElement : public StyledElement {
@@ -194,9 +195,8 @@
SVGSVGElement* ownerSVGElement() const;
SVGElement* viewportElement() const;
- // Internal
virtual void parseMappedAttribute(MappedAttribute*);
-
+
virtual bool isStyled() const { return false; }
virtual bool isStyledTransformable() const { return false; }
virtual bool isStyledLocatable() const { return false; }
@@ -220,7 +220,9 @@
virtual void insertedIntoDocument();
virtual void buildPendingResource() { }
- virtual void notifyAttributeChange() const { }
+ virtual void svgAttributeChanged(const QualifiedName&) { }
+ virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+
void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false);
// Forwarded properties (declared/defined anywhere else in the inheritance structure)
@@ -248,5 +250,3 @@
#endif // ENABLE(SVG)
#endif // SVGElement_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGEllipseElement.cpp b/WebCore/svg/SVGEllipseElement.cpp
index 23fa1fb..0f32ed2 100644
--- a/WebCore/svg/SVGEllipseElement.cpp
+++ b/WebCore/svg/SVGEllipseElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -48,10 +48,10 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Cx, cx, SVGNames::cxAttr.localName(), m_cx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Cy, cy, SVGNames::cyAttr.localName(), m_cy)
-ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Rx, rx, SVGNames::rxAttr.localName(), m_rx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Ry, ry, SVGNames::ryAttr.localName(), m_ry)
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Cx, cx, SVGNames::cxAttr, m_cx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Cy, cy, SVGNames::cyAttr, m_cy)
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Rx, rx, SVGNames::rxAttr, m_rx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGEllipseElement, SVGLength, Length, length, Ry, ry, SVGNames::ryAttr, m_ry)
void SVGEllipseElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -78,12 +78,20 @@
}
}
-void SVGEllipseElement::notifyAttributeChange() const
+void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!document()->parsing() && renderer())
- renderer()->setNeedsLayout(true);
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
- SVGStyledTransformableElement::notifyAttributeChange();
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr ||
+ attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
}
Path SVGEllipseElement::toPathData() const
@@ -101,5 +109,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGEllipseElement.h b/WebCore/svg/SVGEllipseElement.h
index b625787..01e8ef5 100644
--- a/WebCore/svg/SVGEllipseElement.h
+++ b/WebCore/svg/SVGEllipseElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,28 +24,25 @@
#define SVGEllipseElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGEllipseElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGEllipseElement(const QualifiedName&, Document*);
virtual ~SVGEllipseElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGEllipseElement' functions
- virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void notifyAttributeChange() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual Path toPathData() const;
@@ -66,5 +63,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGExternalResourcesRequired.cpp b/WebCore/svg/SVGExternalResourcesRequired.cpp
index 43c2133..f6327e7 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.cpp
+++ b/WebCore/svg/SVGExternalResourcesRequired.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGExternalResourcesRequired.h"
@@ -39,7 +40,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGExternalResourcesRequired, bool, Boolean, boolean, ExternalResourcesRequired, externalResourcesRequired, SVGNames::externalResourcesRequiredAttr.localName(), m_externalResourcesRequired)
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGExternalResourcesRequired, bool, Boolean, boolean, ExternalResourcesRequired, externalResourcesRequired, SVGNames::externalResourcesRequiredAttr, m_externalResourcesRequired)
bool SVGExternalResourcesRequired::parseMappedAttribute(MappedAttribute* attr)
{
@@ -51,7 +52,11 @@
return false;
}
+bool SVGExternalResourcesRequired::isKnownAttribute(const QualifiedName& attrName)
+{
+ return attrName == SVGNames::externalResourcesRequiredAttr;
}
-// vim:ts=4:noet
+}
+
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGExternalResourcesRequired.h b/WebCore/svg/SVGExternalResourcesRequired.h
index a918726..4078794 100644
--- a/WebCore/svg/SVGExternalResourcesRequired.h
+++ b/WebCore/svg/SVGExternalResourcesRequired.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,12 +22,13 @@
#ifndef SVGExternalResourcesRequired_h
#define SVGExternalResourcesRequired_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include <wtf/RefPtr.h>
#include "SVGElement.h"
namespace WebCore {
+
class MappedAttribute;
// FIXME: This is wrong for several reasons:
@@ -45,8 +46,8 @@
SVGExternalResourcesRequired();
virtual ~SVGExternalResourcesRequired();
- // 'SVGExternalResourcesRequired' functions
bool parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
protected:
virtual const SVGElement* contextElement() const = 0;
@@ -59,5 +60,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp
index 72c0852..317b92b 100644
--- a/WebCore/svg/SVGFEBlendElement.cpp
+++ b/WebCore/svg/SVGFEBlendElement.cpp
@@ -41,9 +41,9 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, String, String, string, In2, in2, SVGNames::in2Attr.localName(), m_in2)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, int, Enumeration, enumeration, Mode, mode, SVGNames::modeAttr.localName(), m_mode)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, String, String, string, In2, in2, SVGNames::in2Attr, m_in2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEBlendElement, int, Enumeration, enumeration, Mode, mode, SVGNames::modeAttr, m_mode)
void SVGFEBlendElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp
index df7facc7..6a9474c 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.cpp
+++ b/WebCore/svg/SVGFEColorMatrixElement.cpp
@@ -34,7 +34,7 @@
SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document* doc)
: SVGFilterPrimitiveStandardAttributes(tagName, doc)
, m_type(SVG_FECOLORMATRIX_TYPE_UNKNOWN)
- , m_values(new SVGNumberList)
+ , m_values(new SVGNumberList(SVGNames::valuesAttr))
, m_filterEffect(0)
{
}
@@ -44,9 +44,9 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr.localName(), m_type)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, SVGNumberList*, NumberList, numberList, Values, values, SVGNames::valuesAttr.localName(), m_values.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr, m_type)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEColorMatrixElement, SVGNumberList*, NumberList, numberList, Values, values, SVGNames::valuesAttr, m_values.get())
void SVGFEColorMatrixElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp
index d0584e2..2e9ec2e 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.cpp
+++ b/WebCore/svg/SVGFEComponentTransferElement.cpp
@@ -47,7 +47,7 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEComponentTransferElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEComponentTransferElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
void SVGFEComponentTransferElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp
index 5b396c5..d21aeec 100644
--- a/WebCore/svg/SVGFECompositeElement.cpp
+++ b/WebCore/svg/SVGFECompositeElement.cpp
@@ -46,13 +46,13 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In2, in2, SVGNames::in2Attr.localName(), m_in2)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, int, Enumeration, enumeration, _operator, _operator, SVGNames::operatorAttr.localName(), m__operator)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K1, k1, SVGNames::k1Attr.localName(), m_k1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K2, k2, SVGNames::k2Attr.localName(), m_k2)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K3, k3, SVGNames::k3Attr.localName(), m_k3)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K4, k4, SVGNames::k4Attr.localName(), m_k4)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In2, in2, SVGNames::in2Attr, m_in2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, int, Enumeration, enumeration, _operator, _operator, SVGNames::operatorAttr, m__operator)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K1, k1, SVGNames::k1Attr, m_k1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K2, k2, SVGNames::k2Attr, m_k2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K3, k3, SVGNames::k3Attr, m_k3)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K4, k4, SVGNames::k4Attr, m_k4)
void SVGFECompositeElement::parseMappedAttribute(MappedAttribute *attr)
{
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index c785ef5..d1b3ebd 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -49,9 +49,9 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, float, Number, number, DiffuseConstant, diffuseConstant, SVGNames::diffuseConstantAttr.localName(), m_diffuseConstant)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, float, Number, number, SurfaceScale, surfaceScale, SVGNames::surfaceScaleAttr.localName(), m_surfaceScale)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, float, Number, number, DiffuseConstant, diffuseConstant, SVGNames::diffuseConstantAttr, m_diffuseConstant)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, float, Number, number, SurfaceScale, surfaceScale, SVGNames::surfaceScaleAttr, m_surfaceScale)
ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, float, Number, number, KernelUnitLengthX, kernelUnitLengthX, "kernelUnitLengthX", m_kernelUnitLengthX)
ANIMATED_PROPERTY_DEFINITIONS(SVGFEDiffuseLightingElement, float, Number, number, KernelUnitLengthY, kernelUnitLengthY, "kernelUnitLengthY", m_kernelUnitLengthY)
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp
index 448180d..8852a65 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.cpp
+++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp
@@ -41,11 +41,11 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, String, String, string, In2, in2, SVGNames::in2Attr.localName(), m_in2)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, int, Enumeration, enumeration, XChannelSelector, xChannelSelector, SVGNames::xChannelSelectorAttr.localName(), m_xChannelSelector)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, int, Enumeration, enumeration, YChannelSelector, yChannelSelector, SVGNames::yChannelSelectorAttr.localName(), m_yChannelSelector)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, float, Number, number, Scale, scale, SVGNames::scaleAttr.localName(), m_scale)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, String, String, string, In2, in2, SVGNames::in2Attr, m_in2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, int, Enumeration, enumeration, XChannelSelector, xChannelSelector, SVGNames::xChannelSelectorAttr, m_xChannelSelector)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, int, Enumeration, enumeration, YChannelSelector, yChannelSelector, SVGNames::yChannelSelectorAttr, m_yChannelSelector)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEDisplacementMapElement, float, Number, number, Scale, scale, SVGNames::scaleAttr, m_scale)
SVGChannelSelectorType SVGFEDisplacementMapElement::stringToChannel(const String& key)
{
diff --git a/WebCore/svg/SVGFEFloodElement.cpp b/WebCore/svg/SVGFEFloodElement.cpp
index e9c13a6..e9eff9d 100644
--- a/WebCore/svg/SVGFEFloodElement.cpp
+++ b/WebCore/svg/SVGFEFloodElement.cpp
@@ -44,7 +44,7 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEFloodElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEFloodElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
void SVGFEFloodElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp
index a92a88f..e6d0b39 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.cpp
+++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp
@@ -44,7 +44,7 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, float, Number, number, StdDeviationX, stdDeviationX, "stdDeviationX", m_stdDeviationX)
ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, float, Number, number, StdDeviationY, stdDeviationY, "stdDeviationY", m_stdDeviationY)
diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp
index e9f47f2..6ff83ee 100644
--- a/WebCore/svg/SVGFEImageElement.cpp
+++ b/WebCore/svg/SVGFEImageElement.cpp
@@ -54,7 +54,7 @@
m_cachedImage->deref(this);
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio.get())
void SVGFEImageElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFELightElement.cpp b/WebCore/svg/SVGFELightElement.cpp
index abe83e1..52c0287 100644
--- a/WebCore/svg/SVGFELightElement.cpp
+++ b/WebCore/svg/SVGFELightElement.cpp
@@ -47,17 +47,17 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Azimuth, azimuth, SVGNames::azimuthAttr.localName(), m_azimuth)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Elevation, elevation, SVGNames::elevationAttr.localName(), m_elevation)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Y, y, SVGNames::yAttr.localName(), m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Azimuth, azimuth, SVGNames::azimuthAttr, m_azimuth)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Elevation, elevation, SVGNames::elevationAttr, m_elevation)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Y, y, SVGNames::yAttr, m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Z, z, SVGNames::zAttr.localName(), m_z)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtX, pointsAtX, SVGNames::pointsAtXAttr.localName(), m_pointsAtX)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtY, pointsAtY, SVGNames::pointsAtYAttr.localName(), m_pointsAtY)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtZ, pointsAtZ, SVGNames::pointsAtZAttr.localName(), m_pointsAtZ)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr.localName(), m_specularExponent)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, LimitingConeAngle, limitingConeAngle, SVGNames::limitingConeAngleAttr.localName(), m_limitingConeAngle)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Z, z, SVGNames::zAttr, m_z)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtX, pointsAtX, SVGNames::pointsAtXAttr, m_pointsAtX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtY, pointsAtY, SVGNames::pointsAtYAttr, m_pointsAtY)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtZ, pointsAtZ, SVGNames::pointsAtZAttr, m_pointsAtZ)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr, m_specularExponent)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, LimitingConeAngle, limitingConeAngle, SVGNames::limitingConeAngleAttr, m_limitingConeAngle)
void SVGFELightElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFEMergeNodeElement.cpp b/WebCore/svg/SVGFEMergeNodeElement.cpp
index e37cba5..d46ee25 100644
--- a/WebCore/svg/SVGFEMergeNodeElement.cpp
+++ b/WebCore/svg/SVGFEMergeNodeElement.cpp
@@ -36,7 +36,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEMergeNodeElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEMergeNodeElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
void SVGFEMergeNodeElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp
index 1693f29..1442159 100644
--- a/WebCore/svg/SVGFEOffsetElement.cpp
+++ b/WebCore/svg/SVGFEOffsetElement.cpp
@@ -43,9 +43,9 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, float, Number, number, Dx, dx, SVGNames::dxAttr.localName(), m_dx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, float, Number, number, Dy, dy, SVGNames::dyAttr.localName(), m_dy)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, float, Number, number, Dx, dx, SVGNames::dxAttr, m_dx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFEOffsetElement, float, Number, number, Dy, dy, SVGNames::dyAttr, m_dy)
void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp
index 80f5056..509794a 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -49,10 +49,10 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, SpecularConstant, specularConstant, SVGNames::specularConstantAttr.localName(), m_specularConstant)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr.localName(), m_specularExponent)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, SurfaceScale, surfaceScale, SVGNames::surfaceScaleAttr.localName(), m_surfaceScale)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, SpecularConstant, specularConstant, SVGNames::specularConstantAttr, m_specularConstant)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr, m_specularExponent)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, SurfaceScale, surfaceScale, SVGNames::surfaceScaleAttr, m_surfaceScale)
ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, KernelUnitLengthX, kernelUnitLengthX, "kernelUnitLengthX", m_kernelUnitLengthX)
ANIMATED_PROPERTY_DEFINITIONS(SVGFESpecularLightingElement, float, Number, number, KernelUnitLengthY, kernelUnitLengthY, "kernelUnitLengthY", m_kernelUnitLengthY)
diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp
index cbadcec..62fc05b 100644
--- a/WebCore/svg/SVGFETileElement.cpp
+++ b/WebCore/svg/SVGFETileElement.cpp
@@ -42,7 +42,7 @@
delete m_filterEffect;
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFETileElement, String, String, string, In1, in1, SVGNames::inAttr.localName(), m_in1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETileElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
void SVGFETileElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp
index 3916840..0abc83c 100644
--- a/WebCore/svg/SVGFETurbulenceElement.cpp
+++ b/WebCore/svg/SVGFETurbulenceElement.cpp
@@ -49,10 +49,10 @@
ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, float, Number, number, BaseFrequencyX, baseFrequencyX, "baseFrequencyX", m_baseFrequencyX)
ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, float, Number, number, BaseFrequencyY, baseFrequencyY, "baseFrequencyY", m_baseFrequencyY)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, float, Number, number, Seed, seed, SVGNames::seedAttr.localName(), m_seed)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, long, Integer, integer, NumOctaves, numOctaves, SVGNames::numOctavesAttr.localName(), m_numOctaves)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Enumeration, enumeration, StitchTiles, stitchTiles, SVGNames::stitchTilesAttr.localName(), m_stitchTiles)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr.localName(), m_type)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, float, Number, number, Seed, seed, SVGNames::seedAttr, m_seed)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, long, Integer, integer, NumOctaves, numOctaves, SVGNames::numOctavesAttr, m_numOctaves)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Enumeration, enumeration, StitchTiles, stitchTiles, SVGNames::stitchTilesAttr, m_stitchTiles)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFETurbulenceElement, int, Enumeration, enumeration, Type, type, SVGNames::typeAttr, m_type)
void SVGFETurbulenceElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp
index 2605384..125d084 100644
--- a/WebCore/svg/SVGFilterElement.cpp
+++ b/WebCore/svg/SVGFilterElement.cpp
@@ -62,12 +62,12 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Enumeration, enumeration, FilterUnits, filterUnits, SVGNames::filterUnitsAttr.localName(), m_filterUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Enumeration, enumeration, PrimitiveUnits, primitiveUnits, SVGNames::primitiveUnitsAttr.localName(), m_primitiveUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Enumeration, enumeration, FilterUnits, filterUnits, SVGNames::filterUnitsAttr, m_filterUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, int, Enumeration, enumeration, PrimitiveUnits, primitiveUnits, SVGNames::primitiveUnitsAttr, m_primitiveUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, long, Integer, integer, FilterResX, filterResX, "filterResX", m_filterResX)
ANIMATED_PROPERTY_DEFINITIONS(SVGFilterElement, long, Integer, integer, FilterResY, filterResY, "filterResY", m_filterResY)
diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp
index 47a9188..aaaf003 100644
--- a/WebCore/svg/SVGFitToViewBox.cpp
+++ b/WebCore/svg/SVGFitToViewBox.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGFitToViewBox.h"
@@ -44,8 +45,8 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, FloatRect, Rect, rect, ViewBox, viewBox, SVGNames::viewBoxAttr.localName(), m_viewBox)
-ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get())
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, FloatRect, Rect, rect, ViewBox, viewBox, SVGNames::viewBoxAttr, m_viewBox)
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio.get())
bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate)
{
@@ -110,8 +111,12 @@
return false;
}
+bool SVGFitToViewBox::isKnownAttribute(const QualifiedName& attrName)
+{
+ return (attrName == SVGNames::viewBoxAttr ||
+ attrName == SVGNames::preserveAspectRatioAttr);
+}
+
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGFitToViewBox.h b/WebCore/svg/SVGFitToViewBox.h
index 91239ae..16ea1c2 100644
--- a/WebCore/svg/SVGFitToViewBox.h
+++ b/WebCore/svg/SVGFitToViewBox.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,11 +22,12 @@
#ifndef SVGFitToViewBox_h
#define SVGFitToViewBox_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGElement.h"
namespace WebCore {
+
class AffineTransform;
class SVGPreserveAspectRatio;
@@ -40,6 +41,7 @@
virtual AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
bool parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
protected:
virtual const SVGElement* contextElement() const = 0;
@@ -53,5 +55,3 @@
#endif // ENABLE(SVG)
#endif // SVGFitToViewBox_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGForeignObjectElement.cpp b/WebCore/svg/SVGForeignObjectElement.cpp
index 1987a33..1d6e2d2 100644
--- a/WebCore/svg/SVGForeignObjectElement.cpp
+++ b/WebCore/svg/SVGForeignObjectElement.cpp
@@ -49,10 +49,10 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
void SVGForeignObjectElement::parseMappedAttribute(MappedAttribute *attr)
{
diff --git a/WebCore/svg/SVGGElement.cpp b/WebCore/svg/SVGGElement.cpp
index b8347b6..c762e1e 100644
--- a/WebCore/svg/SVGGElement.cpp
+++ b/WebCore/svg/SVGGElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -52,6 +52,29 @@
SVGStyledTransformableElement::parseMappedAttribute(attr);
}
+void SVGGElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
+
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::clipPathUnitsAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
+}
+
+void SVGGElement::childrenChanged()
+{
+ SVGStyledTransformableElement::childrenChanged();
+
+ if (renderer())
+ renderer()->setNeedsLayout(true);
+}
+
RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
return new (arena) RenderSVGTransformableContainer(this);
@@ -60,5 +83,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h
index 6ebf5667..6e27aea 100644
--- a/WebCore/svg/SVGGElement.h
+++ b/WebCore/svg/SVGGElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,19 +24,17 @@
#define SVGGElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGGElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGGElement(const QualifiedName&, Document*);
virtual ~SVGGElement();
@@ -44,6 +42,8 @@
virtual bool isValid() const { return SVGTests::isValid(); }
virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void childrenChanged();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
@@ -62,5 +62,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp
index 5b7ef695..b77399a 100644
--- a/WebCore/svg/SVGGradientElement.cpp
+++ b/WebCore/svg/SVGGradientElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -44,7 +44,7 @@
, SVGExternalResourcesRequired()
, m_spreadMethod(0)
, m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
- , m_gradientTransform(new SVGTransformList())
+ , m_gradientTransform(new SVGTransformList(SVGNames::gradientTransformAttr))
{
}
@@ -52,9 +52,9 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, GradientUnits, gradientUnits, SVGNames::gradientUnitsAttr.localName(), m_gradientUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, SVGTransformList*, TransformList, transformList, GradientTransform, gradientTransform, SVGNames::gradientTransformAttr.localName(), m_gradientTransform.get())
-ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, SpreadMethod, spreadMethod, SVGNames::spreadMethodAttr.localName(), m_spreadMethod)
+ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, GradientUnits, gradientUnits, SVGNames::gradientUnitsAttr, m_gradientUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, SVGTransformList*, TransformList, transformList, GradientTransform, gradientTransform, SVGNames::gradientTransformAttr, m_gradientTransform.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, SpreadMethod, spreadMethod, SVGNames::spreadMethodAttr, m_spreadMethod)
void SVGGradientElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -86,13 +86,28 @@
}
}
-void SVGGradientElement::notifyAttributeChange() const
+void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!m_resource || !attached() || document()->parsing())
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (!m_resource)
return;
- m_resource->invalidate();
- m_resource->repaintClients();
+ if (attrName == SVGNames::gradientUnitsAttr ||
+ attrName == SVGNames::gradientTransformAttr ||
+ attrName == SVGNames::spreadMethodAttr ||
+ SVGURIReference::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledElement::isKnownAttribute(attrName))
+ m_resource->invalidate();
+}
+
+void SVGGradientElement::childrenChanged()
+{
+ SVGStyledElement::childrenChanged();
+
+ if (m_resource)
+ m_resource->invalidate();
}
RenderObject* SVGGradientElement::createRenderer(RenderArena* arena, RenderStyle*)
@@ -115,36 +130,47 @@
Vector<SVGGradientStop> SVGGradientElement::buildStops() const
{
Vector<SVGGradientStop> stops;
-
- // FIXME: Manual style resolution is a hack
RenderStyle* gradientStyle = 0;
+
for (Node* n = firstChild(); n; n = n->nextSibling()) {
- SVGElement* element = 0;
- if (n->isSVGElement())
- element = static_cast<SVGElement*>(n);
+ SVGElement* element = n->isSVGElement() ? static_cast<SVGElement*>(n) : 0;
+
if (element && element->isGradientStop()) {
SVGStopElement* stop = static_cast<SVGStopElement*>(element);
float stopOffset = stop->offset();
- if (!stop->renderer() && !gradientStyle)
- gradientStyle = const_cast<SVGGradientElement*>(this)->styleForRenderer(parent()->renderer());
+ Color color;
+ float opacity;
- RenderStyle* stopStyle = stop->resolveStyle(gradientStyle);
- Color c = stopStyle->svgStyle()->stopColor();
- float opacity = stopStyle->svgStyle()->stopOpacity();
-
- stops.append(makeGradientStop(stopOffset, makeRGBA(c.red(), c.green(), c.blue(), int(opacity * 255.))));
- stopStyle->deref(document()->renderArena());
+ if (stop->renderer()) {
+ RenderStyle* stopStyle = stop->renderer()->style();
+ color = stopStyle->svgStyle()->stopColor();
+ opacity = stopStyle->svgStyle()->stopOpacity();
+ } else {
+ // If there is no renderer for this stop element, then a parent element
+ // set display="none" - ie. <g display="none"><linearGradient><stop>..
+ // Unfortunately we have to manually rebuild the stop style. See pservers-grad-19-b.svg
+ if (!gradientStyle)
+ gradientStyle = const_cast<SVGGradientElement*>(this)->styleForRenderer(parent()->renderer());
+
+ RenderStyle* stopStyle = stop->resolveStyle(gradientStyle);
+
+ color = stopStyle->svgStyle()->stopColor();
+ opacity = stopStyle->svgStyle()->stopOpacity();
+
+ stopStyle->deref(document()->renderArena());
+ }
+
+ stops.append(makeGradientStop(stopOffset, makeRGBA(color.red(), color.green(), color.blue(), int(opacity * 255.))));
}
}
if (gradientStyle)
gradientStyle->deref(document()->renderArena());
+
return stops;
}
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h
index 86421ce..b38261d 100644
--- a/WebCore/svg/SVGGradientElement.h
+++ b/WebCore/svg/SVGGradientElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,19 +24,19 @@
#define SVGGradientElement_h
#if ENABLE(SVG)
-
#include "SVGPaintServerGradient.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGStyledElement.h"
#include "SVGURIReference.h"
namespace WebCore {
+
class SVGGradientElement;
class SVGTransformList;
+
class SVGGradientElement : public SVGStyledElement,
public SVGURIReference,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
enum SVGGradientType {
SVG_SPREADMETHOD_UNKNOWN = 0,
@@ -49,8 +49,9 @@
virtual ~SVGGradientElement();
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
-
+ virtual void svgAttributeChanged(const QualifiedName&);
+
+ virtual void childrenChanged();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual SVGResource* canvasResource();
@@ -79,5 +80,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGImageElement.cpp b/WebCore/svg/SVGImageElement.cpp
index 5ab5e0c..b640c5c 100644
--- a/WebCore/svg/SVGImageElement.cpp
+++ b/WebCore/svg/SVGImageElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
2006 Alexander Kellett <lypanov@kde.org>
@@ -56,11 +56,11 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
-ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio.get())
void SVGImageElement::parseMappedAttribute(MappedAttribute *attr)
{
@@ -89,21 +89,33 @@
return;
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
- if (SVGURIReference::parseMappedAttribute(attr)) {
- if (attr->name().matches(XLinkNames::hrefAttr) && attached())
- m_imageLoader.updateFromElement();
+ if (SVGURIReference::parseMappedAttribute(attr))
return;
- }
SVGStyledTransformableElement::parseMappedAttribute(attr);
}
}
-void SVGImageElement::notifyAttributeChange() const
+void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!document()->parsing() && renderer())
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
+
+ if (!renderer())
+ return;
+
+ bool isURIAttribute = SVGURIReference::isKnownAttribute(attrName);
+
+ if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr ||
+ attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ isURIAttribute ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName)) {
renderer()->setNeedsLayout(true);
- SVGStyledTransformableElement::notifyAttributeChange();
+ if (isURIAttribute)
+ m_imageLoader.updateFromElement();
+ }
}
bool SVGImageElement::hasRelativeValues() const
@@ -133,5 +145,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGImageElement.h b/WebCore/svg/SVGImageElement.h
index 73e4df7..c069f0f 100644
--- a/WebCore/svg/SVGImageElement.h
+++ b/WebCore/svg/SVGImageElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,7 +24,6 @@
#define SVGImageElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGImageLoader.h"
@@ -32,27 +31,24 @@
#include "SVGTests.h"
#include "SVGURIReference.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGPreserveAspectRatio;
class SVGLength;
- class SVGDocument;
class SVGImageElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
public SVGExternalResourcesRequired,
- public SVGURIReference
- {
+ public SVGURIReference {
public:
SVGImageElement(const QualifiedName&, Document*);
virtual ~SVGImageElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGImageElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual void attach();
@@ -83,5 +79,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLangSpace.cpp b/WebCore/svg/SVGLangSpace.cpp
index 00280e4..638f0c1 100644
--- a/WebCore/svg/SVGLangSpace.cpp
+++ b/WebCore/svg/SVGLangSpace.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -76,8 +76,12 @@
return false;
}
+bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName)
+{
+ return (attrName.matches(XMLNames::langAttr) ||
+ attrName.matches(XMLNames::spaceAttr));
+}
+
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLangSpace.h b/WebCore/svg/SVGLangSpace.h
index c3a3bb8..df8606e 100644
--- a/WebCore/svg/SVGLangSpace.h
+++ b/WebCore/svg/SVGLangSpace.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,19 +24,18 @@
#define SVGLangSpace_h
#if ENABLE(SVG)
-
#include "AtomicString.h"
namespace WebCore {
class MappedAttribute;
+ class QualifiedName;
class SVGLangSpace {
public:
SVGLangSpace();
virtual ~SVGLangSpace();
- // 'SVGLangSpace' functions
const AtomicString& xmllang() const;
void setXmllang(const AtomicString& xmlLang);
@@ -44,6 +43,7 @@
void setXmlspace(const AtomicString& xmlSpace);
bool parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
private:
AtomicString m_lang;
@@ -54,5 +54,3 @@
#endif // ENABLE(SVG)
#endif // SVGLangSpace_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLengthList.cpp b/WebCore/svg/SVGLengthList.cpp
index 9d673d98..c2d8160 100644
--- a/WebCore/svg/SVGLengthList.cpp
+++ b/WebCore/svg/SVGLengthList.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -29,8 +29,8 @@
namespace WebCore {
-SVGLengthList::SVGLengthList()
- : SVGPODList<SVGLength>()
+SVGLengthList::SVGLengthList(const QualifiedName& attributeName)
+ : SVGPODList<SVGLength>(attributeName)
{
}
@@ -62,5 +62,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLengthList.h b/WebCore/svg/SVGLengthList.h
index 290c036..af365a1 100644
--- a/WebCore/svg/SVGLengthList.h
+++ b/WebCore/svg/SVGLengthList.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,16 +24,14 @@
#define SVGLengthList_h
#if ENABLE(SVG)
-
#include "SVGLength.h"
#include "SVGList.h"
-namespace WebCore
-{
- class SVGLengthList : public SVGPODList<SVGLength>
- {
+namespace WebCore {
+
+ class SVGLengthList : public SVGPODList<SVGLength> {
public:
- SVGLengthList();
+ SVGLengthList(const QualifiedName&);
virtual ~SVGLengthList();
void parse(const String& value, const SVGStyledElement* context, SVGLengthMode mode);
@@ -43,5 +41,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLineElement.cpp b/WebCore/svg/SVGLineElement.cpp
index 9136b68..3b664d1 100644
--- a/WebCore/svg/SVGLineElement.cpp
+++ b/WebCore/svg/SVGLineElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -48,10 +48,10 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, X1, x1, SVGNames::x1Attr.localName(), m_x1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, Y1, y1, SVGNames::y1Attr.localName(), m_y1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, X2, x2, SVGNames::x2Attr.localName(), m_x2)
-ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, Y2, y2, SVGNames::y2Attr.localName(), m_y2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, X1, x1, SVGNames::x1Attr, m_x1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, Y1, y1, SVGNames::y1Attr, m_y1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, X2, x2, SVGNames::x2Attr, m_x2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLineElement, SVGLength, Length, length, Y2, y2, SVGNames::y2Attr, m_y2)
void SVGLineElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -75,12 +75,20 @@
}
}
-void SVGLineElement::notifyAttributeChange() const
+void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!document()->parsing() && renderer())
- renderer()->setNeedsLayout(true);
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
- SVGStyledTransformableElement::notifyAttributeChange();
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr ||
+ attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
}
Path SVGLineElement::toPathData() const
@@ -98,5 +106,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLineElement.h b/WebCore/svg/SVGLineElement.h
index b599bf7..c6dbc08 100644
--- a/WebCore/svg/SVGLineElement.h
+++ b/WebCore/svg/SVGLineElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,29 +24,27 @@
#define SVGLineElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGLength;
+
class SVGLineElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGLineElement(const QualifiedName&, Document*);
virtual ~SVGLineElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGLineElement' functions
- virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void notifyAttributeChange() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual Path toPathData() const;
@@ -69,5 +67,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp
index a0e2122..6cddf07 100644
--- a/WebCore/svg/SVGLinearGradientElement.cpp
+++ b/WebCore/svg/SVGLinearGradientElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -51,10 +51,10 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, X1, x1, SVGNames::x1Attr.localName(), m_x1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, Y1, y1, SVGNames::y1Attr.localName(), m_y1)
-ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, X2, x2, SVGNames::x2Attr.localName(), m_x2)
-ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, Y2, y2, SVGNames::y2Attr.localName(), m_y2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, X1, x1, SVGNames::x1Attr, m_x1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, Y1, y1, SVGNames::y1Attr, m_y1)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, X2, x2, SVGNames::x2Attr, m_x2)
+ANIMATED_PROPERTY_DEFINITIONS(SVGLinearGradientElement, SVGLength, Length, length, Y2, y2, SVGNames::y2Attr, m_y2)
void SVGLinearGradientElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -70,6 +70,18 @@
SVGGradientElement::parseMappedAttribute(attr);
}
+void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGGradientElement::svgAttributeChanged(attrName);
+
+ if (!m_resource)
+ return;
+
+ if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr ||
+ attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr)
+ m_resource->invalidate();
+}
+
void SVGLinearGradientElement::buildGradient() const
{
LinearGradientAttributes attributes = collectGradientProperties();
@@ -150,5 +162,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGLinearGradientElement.h b/WebCore/svg/SVGLinearGradientElement.h
index 1bd4a67..496585e 100644
--- a/WebCore/svg/SVGLinearGradientElement.h
+++ b/WebCore/svg/SVGLinearGradientElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,22 +24,20 @@
#define SVGLinearGradientElement_h
#if ENABLE(SVG)
-
#include "SVGGradientElement.h"
-namespace WebCore
-{
+namespace WebCore {
+
struct LinearGradientAttributes;
class SVGLength;
- class SVGLinearGradientElement : public SVGGradientElement
- {
+ class SVGLinearGradientElement : public SVGGradientElement {
public:
SVGLinearGradientElement(const QualifiedName&, Document*);
virtual ~SVGLinearGradientElement();
- // 'SVGLinearGradientElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
protected:
virtual void buildGradient() const;
@@ -61,5 +59,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGList.h b/WebCore/svg/SVGList.h
index f03b82e..92c7068 100644
--- a/WebCore/svg/SVGList.h
+++ b/WebCore/svg/SVGList.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,18 +24,18 @@
#define SVGList_h
#if ENABLE(SVG)
-
-#include <wtf/Vector.h>
+#include "ExceptionCode.h"
+#include "SVGListTraits.h"
#include <wtf/RefCounted.h>
-#include "SVGListTraits.h"
-#include "ExceptionCode.h"
+#include <wtf/Vector.h>
namespace WebCore {
+ class QualifiedName;
+
template<typename Item>
- struct SVGListTypeOperations
- {
+ struct SVGListTypeOperations {
static Item nullItem()
{
return SVGListTraits<UsesDefaultInitializer<Item>::value, Item>::nullItem();
@@ -43,15 +43,20 @@
};
template<typename Item>
- class SVGList : public RefCounted<SVGList<Item> >
- {
+ class SVGList : public RefCounted<SVGList<Item> > {
private:
typedef SVGListTypeOperations<Item> TypeOperations;
public:
- SVGList() { }
+ SVGList(const QualifiedName& attributeName)
+ : m_associatedAttributeName(attributeName)
+ {
+ }
+
virtual ~SVGList() { m_vector.clear(); }
+ const QualifiedName& associatedAttributeName() const { return m_associatedAttributeName; }
+
unsigned int numberOfItems() const { return m_vector.size(); }
void clear(ExceptionCode &) { m_vector.clear(); }
@@ -130,11 +135,11 @@
private:
Vector<Item> m_vector;
+ const QualifiedName& m_associatedAttributeName;
};
template<typename Item>
- class SVGPODListItem : public RefCounted<SVGPODListItem<Item> >
- {
+ class SVGPODListItem : public RefCounted<SVGPODListItem<Item> > {
public:
SVGPODListItem() : m_item() { }
SVGPODListItem(const Item& item) : m_item(item) { }
@@ -154,7 +159,7 @@
class SVGPODList : public SVGList<RefPtr<SVGPODListItem<Item> > >
{
public:
- SVGPODList() : SVGList<RefPtr<SVGPODListItem<Item> > >() { }
+ SVGPODList(const QualifiedName& attributeName) : SVGList<RefPtr<SVGPODListItem<Item> > >(attributeName) { }
Item initialize(Item newItem, ExceptionCode& ec)
{
@@ -242,5 +247,3 @@
#endif // ENABLE(SVG)
#endif // SVGList_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp
index ecbe162..41ca266 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -58,13 +58,13 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, RefX, refX, SVGNames::refXAttr.localName(), m_refX)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, RefY, refY, SVGNames::refYAttr.localName(), m_refY)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, int, Enumeration, enumeration, MarkerUnits, markerUnits, SVGNames::markerUnitsAttr.localName(), m_markerUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, MarkerWidth, markerWidth, SVGNames::markerWidthAttr.localName(), m_markerWidth)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, MarkerHeight, markerHeight, SVGNames::markerHeightAttr.localName(), m_markerHeight)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, int, Enumeration, enumeration, OrientType, orientType, "orientType", m_orientType)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGAngle*, Angle, angle, OrientAngle, orientAngle, "orientAngle", m_orientAngle.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, RefX, refX, SVGNames::refXAttr, m_refX)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, RefY, refY, SVGNames::refYAttr, m_refY)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, int, Enumeration, enumeration, MarkerUnits, markerUnits, SVGNames::markerUnitsAttr, m_markerUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, MarkerWidth, markerWidth, SVGNames::markerWidthAttr, m_markerWidth)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, SVGLength, Length, length, MarkerHeight, markerHeight, SVGNames::markerHeightAttr, m_markerHeight)
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(SVGMarkerElement, int, Enumeration, enumeration, OrientType, orientType, SVGNames::orientAttr, "orientType", m_orientType)
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(SVGMarkerElement, SVGAngle*, Angle, angle, OrientAngle, orientAngle, SVGNames::orientAttr, "orientAngle", m_orientAngle.get())
void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -99,6 +99,38 @@
}
}
+void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (!m_marker)
+ return;
+
+ if (attrName == SVGNames::markerUnitsAttr || attrName == SVGNames::refXAttr ||
+ attrName == SVGNames::refYAttr || attrName == SVGNames::markerWidthAttr ||
+ attrName == SVGNames::markerHeightAttr || attrName == SVGNames::orientAttr ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGFitToViewBox::isKnownAttribute(attrName) ||
+ SVGStyledElement::isKnownAttribute(attrName)) {
+ if (renderer())
+ renderer()->setNeedsLayout(true);
+
+ m_marker->invalidate();
+ }
+}
+
+void SVGMarkerElement::childrenChanged()
+{
+ SVGStyledElement::childrenChanged();
+
+ if (renderer())
+ renderer()->setNeedsLayout(true);
+
+ if (m_marker)
+ m_marker->invalidate();
+}
+
void SVGMarkerElement::setOrientToAuto()
{
setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO);
@@ -140,23 +172,6 @@
return markerContainer;
}
-void SVGMarkerElement::notifyAttributeChange() const
-{
- if (!m_marker || !attached() || document()->parsing())
- return;
-
- RenderSVGViewportContainer* markerContainer = static_cast<RenderSVGViewportContainer*>(renderer());
-
- // NOTE: This is a typical case, where proper "attributeChanged" usage would reduce the number of updates needed.
- if (markerContainer)
- markerContainer->setNeedsLayout(true);
-
- m_marker->invalidate();
- m_marker->repaintClients();
-}
-
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h
index 50aed60..b6ee4b2 100644
--- a/WebCore/svg/SVGMarkerElement.h
+++ b/WebCore/svg/SVGMarkerElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,23 +24,21 @@
#define SVGMarkerElement_h
#if ENABLE(SVG)
-
#include "SVGResourceMarker.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
#include "SVGLangSpace.h"
#include "SVGStyledElement.h"
-namespace WebCore
-{
+namespace WebCore {
+
class Document;
class SVGAngle;
class SVGMarkerElement : public SVGStyledElement,
public SVGLangSpace,
public SVGExternalResourcesRequired,
- public SVGFitToViewBox
- {
+ public SVGFitToViewBox {
public:
enum SVGMarkerUnitsType {
SVG_MARKERUNITS_UNKNOWN = 0,
@@ -57,12 +55,12 @@
SVGMarkerElement(const QualifiedName&, Document*);
virtual ~SVGMarkerElement();
- // 'SVGMarkerElement' functions
void setOrientToAuto();
void setOrientToAngle(SVGAngle*);
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void childrenChanged();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual SVGResource* canvasResource();
@@ -90,5 +88,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp
index 3a8b005..b41ca2f 100644
--- a/WebCore/svg/SVGMaskElement.cpp
+++ b/WebCore/svg/SVGMaskElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
2005 Alexander Kellett <lypanov@kde.org>
@@ -68,13 +68,12 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, int, Enumeration, enumeration, MaskUnits, maskUnits, SVGNames::maskUnitsAttr.localName(), m_maskUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, int, Enumeration, enumeration, MaskContentUnits, maskContentUnits, SVGNames::maskContentUnitsAttr.localName(), m_maskContentUnits)
-
-ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, int, Enumeration, enumeration, MaskUnits, maskUnits, SVGNames::maskUnitsAttr, m_maskUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, int, Enumeration, enumeration, MaskContentUnits, maskContentUnits, SVGNames::maskContentUnitsAttr, m_maskContentUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGMaskElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
void SVGMaskElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -109,6 +108,34 @@
}
}
+void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (!m_masker)
+ return;
+
+ if (attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr ||
+ attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
+ attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
+ SVGURIReference::isKnownAttribute(attrName) ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledElement::isKnownAttribute(attrName))
+ m_masker->invalidate();
+}
+
+void SVGMaskElement::childrenChanged()
+{
+ SVGStyledElement::childrenChanged();
+
+ if (!m_masker)
+ return;
+
+ m_masker->invalidate();
+}
+
auto_ptr<ImageBuffer> SVGMaskElement::drawMaskerContent(const FloatRect& targetRect, FloatRect& maskDestRect) const
{
// Determine specified mask size
@@ -194,19 +221,6 @@
return m_masker.get();
}
-void SVGMaskElement::notifyAttributeChange() const
-{
- if (!attached() || document()->parsing())
- return;
-
- if (m_masker) {
- m_masker->invalidate();
- m_masker->repaintClients();
- }
-}
-
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h
index aaed0a4..4b5507f 100644
--- a/WebCore/svg/SVGMaskElement.h
+++ b/WebCore/svg/SVGMaskElement.h
@@ -23,7 +23,6 @@
#define SVGMaskElement_h
#if ENABLE(SVG)
-
#include "SVGResourceMasker.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
@@ -31,28 +30,27 @@
#include "SVGTests.h"
#include "SVGURIReference.h"
-namespace WebCore
-{
- class Attribute;
+namespace WebCore {
+
class SVGLength;
+
class SVGMaskElement : public SVGStyledLocatableElement,
public SVGURIReference,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGMaskElement(const QualifiedName&, Document*);
virtual ~SVGMaskElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGMaskElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void childrenChanged();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual SVGResource* canvasResource();
-
+
std::auto_ptr<ImageBuffer> drawMaskerContent(const FloatRect& targetRect, FloatRect& maskRect) const;
protected:
@@ -77,5 +75,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGNumberList.cpp b/WebCore/svg/SVGNumberList.cpp
index 2ae87bf..7931eca 100644
--- a/WebCore/svg/SVGNumberList.cpp
+++ b/WebCore/svg/SVGNumberList.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -29,8 +29,8 @@
namespace WebCore {
-SVGNumberList::SVGNumberList()
- : SVGList<float>()
+SVGNumberList::SVGNumberList(const QualifiedName& attributeName)
+ : SVGList<float>(attributeName)
{
}
@@ -56,6 +56,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGNumberList.h b/WebCore/svg/SVGNumberList.h
index 244b157..1fae5fe 100644
--- a/WebCore/svg/SVGNumberList.h
+++ b/WebCore/svg/SVGNumberList.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,17 +24,15 @@
#define SVGNumberList_h
#if ENABLE(SVG)
-
#include "SVGList.h"
-namespace WebCore
-{
+namespace WebCore {
+
class String;
- class SVGNumberList : public SVGList<float>
- {
+ class SVGNumberList : public SVGList<float> {
public:
- SVGNumberList();
+ SVGNumberList(const QualifiedName&);
virtual ~SVGNumberList();
void parse(const String& value);
@@ -44,5 +42,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp
index 7dd94ab..2f36b40 100644
--- a/WebCore/svg/SVGPathElement.cpp
+++ b/WebCore/svg/SVGPathElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -56,7 +56,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGPathElement, float, Number, number, PathLength, pathLength, SVGNames::pathLengthAttr.localName(), m_pathLength)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPathElement, float, Number, number, PathLength, pathLength, SVGNames::pathLengthAttr, m_pathLength)
float SVGPathElement::getTotalLength()
{
@@ -193,18 +193,25 @@
}
}
-void SVGPathElement::notifyAttributeChange() const
+void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!document()->parsing() && renderer())
- renderer()->setNeedsLayout(true);
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
- SVGStyledTransformableElement::notifyAttributeChange();
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::dAttr || attrName == SVGNames::pathLengthAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
}
SVGPathSegList* SVGPathElement::pathSegList() const
{
if (!m_pathSegList)
- m_pathSegList = new SVGPathSegList();
+ m_pathSegList = new SVGPathSegList(SVGNames::dAttr);
return m_pathSegList.get();
}
@@ -235,5 +242,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathElement.h b/WebCore/svg/SVGPathElement.h
index 7645a02..76a8ec4 100644
--- a/WebCore/svg/SVGPathElement.h
+++ b/WebCore/svg/SVGPathElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,7 +24,6 @@
#define SVGPathElement_h
#if ENABLE(SVG)
-
#include "SVGAnimatedPathData.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
@@ -94,8 +93,8 @@
virtual SVGPathSegList* animatedPathSegList() const;
virtual SVGPathSegList* animatedNormalizedPathSegList() const;
- virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void notifyAttributeChange() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual Path toPathData() const;
@@ -116,5 +115,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathSeg.h b/WebCore/svg/SVGPathSeg.h
index 2f83bf2..11f714b 100644
--- a/WebCore/svg/SVGPathSeg.h
+++ b/WebCore/svg/SVGPathSeg.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,8 +24,9 @@
#define SVGPathSeg_h
#if ENABLE(SVG)
-
#include "PlatformString.h"
+#include "SVGNames.h"
+
#include <wtf/RefCounted.h>
namespace WebCore
@@ -65,11 +66,11 @@
virtual unsigned short pathSegType() const { return PATHSEG_UNKNOWN; }
virtual String pathSegTypeAsLetter() const { return ""; }
virtual String toString() const { return ""; }
+
+ const QualifiedName& associatedAttributeName() const { return SVGNames::dAttr; }
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathSegList.cpp b/WebCore/svg/SVGPathSegList.cpp
index e1e735f..9a4f21e 100644
--- a/WebCore/svg/SVGPathSegList.cpp
+++ b/WebCore/svg/SVGPathSegList.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
Copyright (C) 2007 Eric Seidel <eric@webkit.org>
@@ -35,8 +35,8 @@
namespace WebCore {
-SVGPathSegList::SVGPathSegList()
- : SVGList<RefPtr<SVGPathSeg> >()
+SVGPathSegList::SVGPathSegList(const QualifiedName& attributeName)
+ : SVGList<RefPtr<SVGPathSeg> >(attributeName)
{
}
@@ -138,5 +138,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPathSegList.h b/WebCore/svg/SVGPathSegList.h
index c20778b..47e0079 100644
--- a/WebCore/svg/SVGPathSegList.h
+++ b/WebCore/svg/SVGPathSegList.h
@@ -23,7 +23,6 @@
#define SVGPathSegList_h
#if ENABLE(SVG)
-
#include "SVGList.h"
#include "SVGPathSeg.h"
@@ -34,7 +33,7 @@
class SVGPathSegList : public SVGList<RefPtr<SVGPathSeg> > {
public:
- SVGPathSegList();
+ SVGPathSegList(const QualifiedName&);
virtual ~SVGPathSegList();
unsigned getPathSegAtLength(double);
@@ -45,5 +44,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp
index 819d53d..741b30c 100644
--- a/WebCore/svg/SVGPatternElement.cpp
+++ b/WebCore/svg/SVGPatternElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -63,7 +63,7 @@
, m_height(this, LengthModeHeight)
, m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
, m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
- , m_patternTransform(new SVGTransformList())
+ , m_patternTransform(new SVGTransformList(SVGNames::patternTransformAttr))
{
}
@@ -71,13 +71,13 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, int, Enumeration, enumeration, PatternUnits, patternUnits, SVGNames::patternUnitsAttr.localName(), m_patternUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, int, Enumeration, enumeration, PatternContentUnits, patternContentUnits, SVGNames::patternContentUnitsAttr.localName(), m_patternContentUnits)
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
-ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGTransformList*, TransformList, transformList, PatternTransform, patternTransform, SVGNames::patternTransformAttr.localName(), m_patternTransform.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, int, Enumeration, enumeration, PatternUnits, patternUnits, SVGNames::patternUnitsAttr, m_patternUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, int, Enumeration, enumeration, PatternContentUnits, patternContentUnits, SVGNames::patternContentUnitsAttr, m_patternContentUnits)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGTransformList*, TransformList, transformList, PatternTransform, patternTransform, SVGNames::patternTransformAttr, m_patternTransform.get())
void SVGPatternElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -125,6 +125,35 @@
}
}
+void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (!m_resource)
+ return;
+
+ if (attrName == SVGNames::patternUnitsAttr || attrName == SVGNames::patternContentUnitsAttr ||
+ attrName == SVGNames::patternTransformAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
+ attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
+ SVGURIReference::isKnownAttribute(attrName) ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGFitToViewBox::isKnownAttribute(attrName) ||
+ SVGStyledElement::isKnownAttribute(attrName))
+ m_resource->invalidate();
+}
+
+void SVGPatternElement::childrenChanged()
+{
+ SVGStyledElement::childrenChanged();
+
+ if (!m_resource)
+ return;
+
+ m_resource->invalidate();
+}
+
void SVGPatternElement::buildPattern(const FloatRect& targetRect) const
{
PatternAttributes attributes = collectPatternProperties();
@@ -233,15 +262,6 @@
m_resource->setTile(patternImage);
}
-void SVGPatternElement::notifyAttributeChange() const
-{
- if (!m_resource || !attached() || document()->parsing())
- return;
-
- m_resource->invalidate();
- m_resource->repaintClients();
-}
-
RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*)
{
RenderSVGContainer* patternContainer = new (arena) RenderSVGContainer(this);
@@ -308,5 +328,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h
index 983d1ee..21796f6 100644
--- a/WebCore/svg/SVGPatternElement.h
+++ b/WebCore/svg/SVGPatternElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,7 +24,6 @@
#define SVGPatternElement_h
#if ENABLE(SVG)
-
#include "SVGPaintServerPattern.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
@@ -34,12 +33,11 @@
#include "SVGURIReference.h"
-namespace WebCore
-{
+namespace WebCore {
+
struct PatternAttributes;
class SVGLength;
- class SVGPatternElement;
class SVGTransformList;
class SVGPatternElement : public SVGStyledElement,
@@ -47,17 +45,16 @@
public SVGTests,
public SVGLangSpace,
public SVGExternalResourcesRequired,
- public SVGFitToViewBox
- {
+ public SVGFitToViewBox {
public:
SVGPatternElement(const QualifiedName&, Document*);
virtual ~SVGPatternElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGPatternElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
+ virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void childrenChanged();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual SVGResource* canvasResource();
@@ -91,5 +88,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPointList.cpp b/WebCore/svg/SVGPointList.cpp
index c73cac5..25160bb 100644
--- a/WebCore/svg/SVGPointList.cpp
+++ b/WebCore/svg/SVGPointList.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -26,10 +26,10 @@
#include "SVGPointList.h"
-using namespace WebCore;
+namespace WebCore {
-SVGPointList::SVGPointList()
- : SVGPODList<FloatPoint>()
+SVGPointList::SVGPointList(const QualifiedName& attributeName)
+ : SVGPODList<FloatPoint>(attributeName)
{
}
@@ -37,6 +37,6 @@
{
}
-#endif // ENABLE(SVG)
+}
-// vim:ts=4:noet
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPointList.h b/WebCore/svg/SVGPointList.h
index 9debe40..1843ef0 100644
--- a/WebCore/svg/SVGPointList.h
+++ b/WebCore/svg/SVGPointList.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,18 +24,14 @@
#define SVGPointList_h
#if ENABLE(SVG)
-
#include "SVGList.h"
#include "FloatPoint.h"
-namespace WebCore
-{
- class SVGElement;
+namespace WebCore {
- class SVGPointList : public SVGPODList<FloatPoint>
- {
+ class SVGPointList : public SVGPODList<FloatPoint> {
public:
- SVGPointList();
+ SVGPointList(const QualifiedName&);
virtual ~SVGPointList();
};
@@ -43,5 +39,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPolyElement.cpp b/WebCore/svg/SVGPolyElement.cpp
index 649a2d0..3af9778 100644
--- a/WebCore/svg/SVGPolyElement.cpp
+++ b/WebCore/svg/SVGPolyElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -40,8 +40,8 @@
, SVGLangSpace()
, SVGExternalResourcesRequired()
, SVGAnimatedPoints()
+ , m_ignoreAttributeChanges(false)
{
- m_ignoreAttributeChanges = false;
}
SVGPolyElement::~SVGPolyElement()
@@ -51,7 +51,7 @@
SVGPointList* SVGPolyElement::points() const
{
if (!m_points)
- m_points = new SVGPointList();
+ m_points = new SVGPointList(SVGNames::pointsAttr);
return m_points.get();
}
@@ -68,7 +68,8 @@
if (attr->name() == SVGNames::pointsAttr) {
ExceptionCode ec = 0;
points()->clear(ec);
- if (!pointsListFromSVGData(points(), value) && !m_ignoreAttributeChanges) {
+
+ if (!pointsListFromSVGData(points(), value)) {
points()->clear(ec);
document()->accessSVGExtensions()->reportError("Problem parsing points=\"" + value + "\"");
}
@@ -83,40 +84,48 @@
}
}
-void SVGPolyElement::notifyAttributeChange() const
+void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (m_ignoreAttributeChanges || document()->parsing())
+ if (m_ignoreAttributeChanges)
return;
- m_ignoreAttributeChanges = true;
- if (renderer())
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
+
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::pointsAttr) {
+ m_ignoreAttributeChanges = true;
renderer()->setNeedsLayout(true);
-
- ExceptionCode ec = 0;
- // Spec: Additionally, the 'points' attribute on the original element
- // accessed via the XML DOM (e.g., using the getAttribute() method call)
- // will reflect any changes made to points.
- String _points;
- int len = points()->numberOfItems();
- for (int i = 0; i < len; ++i) {
- FloatPoint p = points()->getItem(i, ec);
- _points += String::format("%.6lg %.6lg ", p.x(), p.y());
- }
-
- RefPtr<Attr> attr = const_cast<SVGPolyElement*>(this)->getAttributeNode(SVGNames::pointsAttr.localName());
- if (attr) {
ExceptionCode ec = 0;
- attr->setValue(_points, ec);
+
+ // Spec: Additionally, the 'points' attribute on the original element
+ // accessed via the XML DOM (e.g., using the getAttribute() method call)
+ // will reflect any changes made to points.
+ String _points;
+ int len = points()->numberOfItems();
+ for (int i = 0; i < len; ++i) {
+ FloatPoint p = points()->getItem(i, ec);
+ _points += String::format("%.6lg %.6lg ", p.x(), p.y());
+ }
+
+ if (RefPtr<Attr> attr = const_cast<SVGPolyElement*>(this)->getAttributeNode(SVGNames::pointsAttr.localName())) {
+ ExceptionCode ec = 0;
+ attr->setValue(_points, ec);
+ }
+
+ m_ignoreAttributeChanges = false;
+ return;
}
- m_ignoreAttributeChanges = false;
-
- SVGStyledTransformableElement::notifyAttributeChange();
+ if (SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
}
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPolyElement.h b/WebCore/svg/SVGPolyElement.h
index 0fdc39a..09ce1df 100644
--- a/WebCore/svg/SVGPolyElement.h
+++ b/WebCore/svg/SVGPolyElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,33 +24,30 @@
#define SVGPolyElement_h
#if ENABLE(SVG)
-
#include "SVGAnimatedPoints.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGPolyElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
public SVGExternalResourcesRequired,
- public SVGAnimatedPoints
- {
+ public SVGAnimatedPoints {
public:
SVGPolyElement(const QualifiedName&, Document*);
virtual ~SVGPolyElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // Derived from: 'SVGAnimatedPoints'
virtual SVGPointList* points() const;
virtual SVGPointList* animatedPoints() const;
- virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void notifyAttributeChange() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual bool supportsMarkers() const { return true; }
@@ -59,7 +56,7 @@
virtual const SVGElement* contextElement() const { return this; }
private:
- mutable bool m_ignoreAttributeChanges;
+ bool m_ignoreAttributeChanges : 1;
mutable RefPtr<SVGPointList> m_points;
ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
@@ -69,5 +66,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPolygonElement.cpp b/WebCore/svg/SVGPolygonElement.cpp
index b6eb0c4..95513e4 100644
--- a/WebCore/svg/SVGPolygonElement.cpp
+++ b/WebCore/svg/SVGPolygonElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -59,5 +59,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPolygonElement.h b/WebCore/svg/SVGPolygonElement.h
index 14dab58..7afb553 100644
--- a/WebCore/svg/SVGPolygonElement.h
+++ b/WebCore/svg/SVGPolygonElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,13 +24,11 @@
#define SVGPolygonElement_h
#if ENABLE(SVG)
-
#include "SVGPolyElement.h"
-namespace WebCore
-{
- class SVGPolygonElement : public SVGPolyElement
- {
+namespace WebCore {
+
+ class SVGPolygonElement : public SVGPolyElement {
public:
SVGPolygonElement(const QualifiedName&, Document*);
virtual ~SVGPolygonElement();
@@ -42,5 +40,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPolylineElement.cpp b/WebCore/svg/SVGPolylineElement.cpp
index cc2220c..9ea136e 100644
--- a/WebCore/svg/SVGPolylineElement.cpp
+++ b/WebCore/svg/SVGPolylineElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -58,5 +58,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPolylineElement.h b/WebCore/svg/SVGPolylineElement.h
index bb7c49a..d43dbbe 100644
--- a/WebCore/svg/SVGPolylineElement.h
+++ b/WebCore/svg/SVGPolylineElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,13 +24,11 @@
#define SVGPolylineElement_h
#if ENABLE(SVG)
-
#include "SVGPolyElement.h"
-namespace WebCore
-{
- class SVGPolylineElement : public SVGPolyElement
- {
+namespace WebCore {
+
+ class SVGPolylineElement : public SVGPolyElement {
public:
SVGPolylineElement(const QualifiedName&, Document*);
virtual ~SVGPolylineElement();
@@ -42,5 +40,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGPreserveAspectRatio.cpp b/WebCore/svg/SVGPreserveAspectRatio.cpp
index cbeda80..e4223ea 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.cpp
+++ b/WebCore/svg/SVGPreserveAspectRatio.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGPreserveAspectRatio.h"
@@ -204,5 +205,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPreserveAspectRatio.h b/WebCore/svg/SVGPreserveAspectRatio.h
index e9d737c..1f56d5a 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.h
+++ b/WebCore/svg/SVGPreserveAspectRatio.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,9 +24,10 @@
#define SVGPreserveAspectRatio_h
#if ENABLE(SVG)
+#include "PlatformString.h"
+#include "SVGNames.h"
#include <wtf/RefCounted.h>
-#include <PlatformString.h>
namespace WebCore {
@@ -73,6 +74,8 @@
// Helper
bool parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate = true);
+ const QualifiedName& associatedAttributeName() const { return SVGNames::preserveAspectRatioAttr; }
+
protected:
unsigned short m_align;
unsigned short m_meetOrSlice;
@@ -83,4 +86,3 @@
#endif // ENABLE(SVG)
#endif // SVGPreserveAspectRatio_h
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp
index 5d9c6bd..9ec5eb8 100644
--- a/WebCore/svg/SVGRadialGradientElement.cpp
+++ b/WebCore/svg/SVGRadialGradientElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -28,6 +28,7 @@
#include "FloatConversion.h"
#include "FloatPoint.h"
#include "RadialGradientAttributes.h"
+#include "RenderObject.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "SVGPaintServerRadialGradient.h"
@@ -56,11 +57,11 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Cx, cx, SVGNames::cxAttr.localName(), m_cx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Cy, cy, SVGNames::cyAttr.localName(), m_cy)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Fx, fx, SVGNames::fxAttr.localName(), m_fx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Fy, fy, SVGNames::fyAttr.localName(), m_fy)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, R, r, SVGNames::rAttr.localName(), m_r)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Cx, cx, SVGNames::cxAttr, m_cx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Cy, cy, SVGNames::cyAttr, m_cy)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Fx, fx, SVGNames::fxAttr, m_fx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, Fy, fy, SVGNames::fyAttr, m_fy)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRadialGradientElement, SVGLength, Length, length, R, r, SVGNames::rAttr, m_r)
void SVGRadialGradientElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -80,6 +81,18 @@
SVGGradientElement::parseMappedAttribute(attr);
}
+void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGGradientElement::svgAttributeChanged(attrName);
+
+ if (!m_resource)
+ return;
+
+ if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr ||
+ attrName == SVGNames::fyAttr || attrName == SVGNames::fyAttr ||
+ attrName == SVGNames::rAttr)
+ m_resource->invalidate();
+}
void SVGRadialGradientElement::buildGradient() const
{
@@ -171,5 +184,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGRadialGradientElement.h b/WebCore/svg/SVGRadialGradientElement.h
index 4916433..7007ea5 100644
--- a/WebCore/svg/SVGRadialGradientElement.h
+++ b/WebCore/svg/SVGRadialGradientElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,22 +24,20 @@
#define SVGRadialGradientElement_h
#if ENABLE(SVG)
-
#include "SVGGradientElement.h"
-namespace WebCore
-{
+namespace WebCore {
+
struct RadialGradientAttributes;
class SVGLength;
- class SVGRadialGradientElement : public SVGGradientElement
- {
+ class SVGRadialGradientElement : public SVGGradientElement {
public:
SVGRadialGradientElement(const QualifiedName&, Document*);
virtual ~SVGRadialGradientElement();
- // 'SVGRadialGradientElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
protected:
virtual void buildGradient() const;
@@ -62,5 +60,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGRectElement.cpp b/WebCore/svg/SVGRectElement.cpp
index 0eb67d8..6820b9d 100644
--- a/WebCore/svg/SVGRectElement.cpp
+++ b/WebCore/svg/SVGRectElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGRectElement.h"
@@ -48,12 +49,12 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Rx, rx, SVGNames::rxAttr.localName(), m_rx)
-ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Ry, ry, SVGNames::ryAttr.localName(), m_ry)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Rx, rx, SVGNames::rxAttr, m_rx)
+ANIMATED_PROPERTY_DEFINITIONS(SVGRectElement, SVGLength, Length, length, Ry, ry, SVGNames::ryAttr, m_ry)
void SVGRectElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -88,12 +89,20 @@
}
}
-void SVGRectElement::notifyAttributeChange() const
+void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!document()->parsing() && renderer())
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
+
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
+ attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName))
renderer()->setNeedsLayout(true);
-
- SVGStyledTransformableElement::notifyAttributeChange();
}
Path SVGRectElement::toPathData() const
@@ -120,5 +129,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGRectElement.h b/WebCore/svg/SVGRectElement.h
index 52fa80f..244a6ef 100644
--- a/WebCore/svg/SVGRectElement.h
+++ b/WebCore/svg/SVGRectElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,28 +24,25 @@
#define SVGRectElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGRectElement : public SVGStyledTransformableElement,
public SVGTests,
public SVGLangSpace,
- public SVGExternalResourcesRequired
- {
+ public SVGExternalResourcesRequired {
public:
SVGRectElement(const QualifiedName&, Document*);
virtual ~SVGRectElement();
virtual bool isValid() const { return SVGTests::isValid(); }
- // 'SVGRectElement' functions
- virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void notifyAttributeChange() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual Path toPathData() const;
@@ -68,5 +65,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp
index ce47d8e..db0a209 100644
--- a/WebCore/svg/SVGSVGElement.cpp
+++ b/WebCore/svg/SVGSVGElement.cpp
@@ -88,10 +88,10 @@
document()->accessSVGExtensions()->removeTimeContainer(this);
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGSVGElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
const AtomicString& SVGSVGElement::contentScriptType() const
{
@@ -265,10 +265,8 @@
return;
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
- if (SVGFitToViewBox::parseMappedAttribute(attr) && renderer()) {
- renderer()->setNeedsLayout(true);
+ if (SVGFitToViewBox::parseMappedAttribute(attr))
return;
- }
if (SVGZoomAndPan::parseMappedAttribute(attr))
return;
@@ -276,6 +274,24 @@
}
}
+void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGStyledElement::svgAttributeChanged(attrName);
+
+ if (!renderer())
+ return;
+
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
+ attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGFitToViewBox::isKnownAttribute(attrName) ||
+ SVGZoomAndPan::isKnownAttribute(attrName) ||
+ SVGStyledLocatableElement::isKnownAttribute(attrName))
+ renderer()->setNeedsLayout(true);
+}
+
unsigned long SVGSVGElement::suspendRedraw(unsigned long /* max_wait_milliseconds */)
{
// FIXME: Implement me (see bug 11275)
@@ -476,18 +492,6 @@
return !parentNode()->isSVGElement();
}
-void SVGSVGElement::attributeChanged(Attribute* attr, bool preserveDecls)
-{
- if (attr->name() == SVGNames::xAttr ||
- attr->name() == SVGNames::yAttr ||
- attr->name() == SVGNames::widthAttr ||
- attr->name() == SVGNames::heightAttr)
- if (renderer())
- renderer()->setNeedsLayout(true);
-
- SVGStyledElement::attributeChanged(attr, preserveDecls);
-}
-
AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
{
FloatRect viewBoxRect;
diff --git a/WebCore/svg/SVGSVGElement.h b/WebCore/svg/SVGSVGElement.h
index 1c05898..4296938 100644
--- a/WebCore/svg/SVGSVGElement.h
+++ b/WebCore/svg/SVGSVGElement.h
@@ -128,7 +128,7 @@
virtual void insertedIntoDocument();
virtual void removedFromDocument();
- virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
diff --git a/WebCore/svg/SVGStopElement.cpp b/WebCore/svg/SVGStopElement.cpp
index 63d992d..eb1657f 100644
--- a/WebCore/svg/SVGStopElement.cpp
+++ b/WebCore/svg/SVGStopElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -27,6 +27,7 @@
#include "Document.h"
#include "RenderSVGGradientStop.h"
+#include "SVGGradientElement.h"
#include "SVGNames.h"
namespace WebCore {
@@ -41,7 +42,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGStopElement, float, Number, number, Offset, offset, SVGNames::offsetAttr.localName(), m_offset)
+ANIMATED_PROPERTY_DEFINITIONS(SVGStopElement, float, Number, number, Offset, offset, SVGNames::offsetAttr, m_offset)
void SVGStopElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -51,26 +52,17 @@
setOffsetBaseValue(value.left(value.length() - 1).toFloat() / 100.0f);
else
setOffsetBaseValue(value.toFloat());
+
+ setChanged();
} else
SVGStyledElement::parseMappedAttribute(attr);
}
-RenderObject* SVGStopElement::createRenderer(RenderArena* arena, RenderStyle* style)
+RenderObject* SVGStopElement::createRenderer(RenderArena* arena, RenderStyle*)
{
return new (arena) RenderSVGGradientStop(this);
}
-void SVGStopElement::notifyAttributeChange() const
-{
- if (!attached() || document()->parsing())
- return;
-
- const_cast<SVGStopElement*>(this)->recalcStyle(Force);
- SVGStyledElement::notifyAttributeChange();
-}
-
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStopElement.h b/WebCore/svg/SVGStopElement.h
index 36f2803..84ac4eb 100644
--- a/WebCore/svg/SVGStopElement.h
+++ b/WebCore/svg/SVGStopElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,24 +24,21 @@
#define SVGStopElement_h
#if ENABLE(SVG)
-
#include "SVGStyledElement.h"
-namespace WebCore
-{
- class SVGStopElement : public SVGStyledElement
- {
+namespace WebCore {
+
+ class SVGStopElement : public SVGStyledElement {
public:
SVGStopElement(const QualifiedName&, Document*);
virtual ~SVGStopElement();
-
+
virtual bool isGradientStop() const { return true; }
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-
+
private:
ANIMATED_PROPERTY_DECLARATIONS(SVGStopElement, float, float, Offset, offset)
};
@@ -50,5 +47,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStringList.cpp b/WebCore/svg/SVGStringList.cpp
index 00e1ac1..9a23a4a 100644
--- a/WebCore/svg/SVGStringList.cpp
+++ b/WebCore/svg/SVGStringList.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGStringList.h"
@@ -28,8 +29,8 @@
namespace WebCore {
-SVGStringList::SVGStringList()
- : SVGList<String>()
+SVGStringList::SVGStringList(const QualifiedName& attributeName)
+ : SVGList<String>(attributeName)
{
}
@@ -68,5 +69,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStringList.h b/WebCore/svg/SVGStringList.h
index 5869ed3..bf39bc6 100644
--- a/WebCore/svg/SVGStringList.h
+++ b/WebCore/svg/SVGStringList.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,21 +24,17 @@
#define SVGStringList_h
#if ENABLE(SVG)
-
#include "PlatformString.h"
#include "SVGList.h"
namespace WebCore {
- class SVGStringList : public SVGList<String>
- {
+ class SVGStringList : public SVGList<String> {
public:
- SVGStringList();
+ SVGStringList(const QualifiedName&);
virtual ~SVGStringList();
-
- // Internal
- void reset(const String& str);
+ void reset(const String& str);
void parse(const String& data, UChar delimiter = ',');
};
@@ -46,5 +42,3 @@
#endif // ENABLE(SVG)
#endif // SVGStringList_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStylable.cpp b/WebCore/svg/SVGStylable.cpp
index aa99038..5d063c3 100644
--- a/WebCore/svg/SVGStylable.cpp
+++ b/WebCore/svg/SVGStylable.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGStylable.h"
@@ -36,6 +37,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGStylable.h b/WebCore/svg/SVGStylable.h
index c81f22b..ade5c2f 100644
--- a/WebCore/svg/SVGStylable.h
+++ b/WebCore/svg/SVGStylable.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,8 +22,8 @@
#ifndef SVGStylable_h
#define SVGStylable_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include <wtf/PassRefPtr.h>
namespace WebCore {
@@ -31,20 +31,18 @@
class CSSValue;
class CSSStyleDeclaration;
class String;
+ class QualifiedName;
class SVGStylable {
public:
SVGStylable();
virtual ~SVGStylable();
- // 'SVGStylable' functions
virtual CSSStyleDeclaration* style() = 0;
- virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name) = 0;
+ virtual PassRefPtr<CSSValue> getPresentationAttribute(const String&) = 0;
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGStylable_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index 7141e8f..f64d019 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -54,7 +54,7 @@
SVGResource::removeClient(this);
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGStyledElement, String, String, string, ClassName, className, HTMLNames::classAttr.localName(), m_className)
+ANIMATED_PROPERTY_DEFINITIONS(SVGStyledElement, String, String, string, ClassName, className, HTMLNames::classAttr, m_className)
bool SVGStyledElement::rendererIsNeeded(RenderStyle* style)
{
@@ -178,20 +178,50 @@
SVGElement::parseMappedAttribute(attr);
}
-void SVGStyledElement::notifyAttributeChange() const
+bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName)
{
+ // Recognize all style related SVG CSS properties
+ int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
+ if (propId > 0)
+ return true;
+
+ return (attrName == HTMLNames::idAttr || attrName == HTMLNames::styleAttr);
+}
+
+void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGElement::svgAttributeChanged(attrName);
+
+ // If we're the child of a resource element, be sure to invalidate it.
+ invalidateResourcesInAncestorChain();
+
SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
if (!extensions)
return;
+ // TODO: Fix bug http://bugs.webkit.org/show_bug.cgi?id=15430 (SVGElementInstances should rebuild themselves lazily)
+
// In case we're referenced by a <use> element, we have element instances registered
// to us in the SVGDocumentExtensions. If notifyAttributeChange() is called, we need
// to recursively update all children including ourselves.
updateElementInstance(extensions);
+}
- // If we're a child of an element creating a "resource" (ie. <pattern> child)
- // then we have to notify our parent resource that we changed.
- notifyResourceParentIfExistant();
+void SVGStyledElement::invalidateResourcesInAncestorChain() const
+{
+ Node* node = parentNode();
+ while (node) {
+ if (!node->isSVGElement())
+ break;
+
+ SVGElement* element = static_cast<SVGElement*>(node);
+ if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) {
+ if (SVGResource* resource = styledElement->canvasResource())
+ resource->invalidate();
+ }
+
+ node = node->parentNode();
+ }
}
void SVGStyledElement::childrenChanged()
@@ -204,26 +234,14 @@
if (!extensions)
return;
+ // TODO: Fix bug http://bugs.webkit.org/show_bug.cgi?id=15430 (SVGElementInstances should rebuild themselves lazily)
+
// In case we're referenced by a <use> element, we have element instances registered
// to us in the SVGDocumentExtensions. If childrenChanged() is called, we need
// to recursively update all children including ourselves.
updateElementInstance(extensions);
}
-void SVGStyledElement::notifyResourceParentIfExistant() const
-{
- Node* node = parentNode();
- while (node) {
- if (node->hasTagName(SVGNames::linearGradientTag) || node->hasTagName(SVGNames::radialGradientTag) ||
- node->hasTagName(SVGNames::patternTag) || node->hasTagName(SVGNames::clipPathTag) ||
- node->hasTagName(SVGNames::markerTag) || node->hasTagName(SVGNames::maskTag)) {
- static_cast<SVGElement*>(node)->notifyAttributeChange();
- }
-
- node = node->parentNode();
- }
-}
-
void SVGStyledElement::updateElementInstance(SVGDocumentExtensions* extensions) const
{
SVGStyledElement* nonConstThis = const_cast<SVGStyledElement*>(this);
@@ -250,16 +268,6 @@
(*it2)->updateInstance(nonConstThis);
}
-void SVGStyledElement::attributeChanged(Attribute* attr, bool preserveDecls)
-{
- // FIXME: Eventually subclasses from SVGElement should implement
- // attributeChanged() instead of notifyAttributeChange()
- // This is a quick fix to allow dynamic updates of SVG elements
- // but will result in slower dynamic-update performance than necessary.
- SVGElement::attributeChanged(attr, preserveDecls);
- notifyAttributeChange();
-}
-
RenderStyle* SVGStyledElement::resolveStyle(RenderStyle* parentStyle)
{
if (renderer()) {
@@ -288,5 +296,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index acf86a4..1a9bc74 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,7 +24,6 @@
#define SVGStyledElement_h
#if ENABLE(SVG)
-
#include "AffineTransform.h"
#include "Path.h"
#include "SVGElement.h"
@@ -34,9 +33,8 @@
namespace WebCore {
- class RenderPath;
-
- class SVGStyledElement : public SVGElement, public SVGStylable {
+ class SVGStyledElement : public SVGElement,
+ public SVGStylable {
public:
SVGStyledElement(const QualifiedName&, Document*);
virtual ~SVGStyledElement();
@@ -44,25 +42,25 @@
virtual bool isStyled() const { return true; }
virtual bool supportsMarkers() const { return false; }
- // 'SVGStylable' functions
virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name);
virtual CSSStyleDeclaration* style() { return StyledElement::style(); }
+ bool isKnownAttribute(const QualifiedName&);
+
virtual bool rendererIsNeeded(RenderStyle*);
virtual SVGResource* canvasResource() { return 0; }
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
- virtual void childrenChanged();
- void notifyResourceParentIfExistant() const;
+ virtual void svgAttributeChanged(const QualifiedName&);
- virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+ virtual void childrenChanged();
// Centralized place to force a manual style resolution. Hacky but needed for now.
RenderStyle* resolveStyle(RenderStyle* parentStyle);
-
+
+ void invalidateResourcesInAncestorChain() const;
virtual void detach();
protected:
@@ -80,5 +78,3 @@
#endif // ENABLE(SVG)
#endif // SVGStyledElement
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStyledLocatableElement.cpp b/WebCore/svg/SVGStyledLocatableElement.cpp
index 684b9e2..eaed36d 100644
--- a/WebCore/svg/SVGStyledLocatableElement.cpp
+++ b/WebCore/svg/SVGStyledLocatableElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -23,7 +23,6 @@
#include "config.h"
#if ENABLE(SVG)
-
#include "SVGStyledLocatableElement.h"
#include "RenderPath.h"
@@ -70,6 +69,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGStyledLocatableElement.h b/WebCore/svg/SVGStyledLocatableElement.h
index cd9e731..9af3337 100644
--- a/WebCore/svg/SVGStyledLocatableElement.h
+++ b/WebCore/svg/SVGStyledLocatableElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,8 +22,8 @@
#ifndef SVGStyledLocatableElement_h
#define SVGStyledLocatableElement_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGLocatable.h"
#include "SVGStyledElement.h"
@@ -31,14 +31,14 @@
class SVGElement;
- class SVGStyledLocatableElement : public SVGStyledElement, virtual public SVGLocatable {
+ class SVGStyledLocatableElement : public SVGStyledElement,
+ virtual public SVGLocatable {
public:
SVGStyledLocatableElement(const QualifiedName&, Document*);
virtual ~SVGStyledLocatableElement();
virtual bool isStyledLocatable() const { return true; }
- // 'SVGStyledLocatableElement' functions
virtual SVGElement* nearestViewportElement() const;
virtual SVGElement* farthestViewportElement() const;
@@ -51,5 +51,3 @@
#endif // ENABLE(SVG)
#endif // SVGStyledLocatableElement_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp
index 76b6ad7..9893ab8 100644
--- a/WebCore/svg/SVGStyledTransformableElement.cpp
+++ b/WebCore/svg/SVGStyledTransformableElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -23,7 +23,6 @@
#include "config.h"
#if ENABLE(SVG)
-
#include "SVGStyledTransformableElement.h"
#include "Attr.h"
@@ -39,7 +38,7 @@
SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* doc)
: SVGStyledLocatableElement(tagName, doc)
, SVGTransformable()
- , m_transform(new SVGTransformList())
+ , m_transform(new SVGTransformList(SVGNames::transformAttr))
{
}
@@ -47,7 +46,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGStyledTransformableElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr.localName(), m_transform.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGStyledTransformableElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform.get())
AffineTransform SVGStyledTransformableElement::getCTM() const
{
@@ -74,15 +73,18 @@
if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value()))
localTransforms->clear(ec);
- else {
+ else
setTransformBaseValue(localTransforms);
- if (renderer())
- renderer()->setNeedsLayout(true); // should really be in setTransform
- }
} else
SVGStyledLocatableElement::parseMappedAttribute(attr);
}
+bool SVGStyledTransformableElement::isKnownAttribute(const QualifiedName& attrName)
+{
+ return SVGTransformable::isKnownAttribute(attrName) ||
+ SVGStyledLocatableElement::isKnownAttribute(attrName);
+}
+
SVGElement* SVGStyledTransformableElement::nearestViewportElement() const
{
return SVGTransformable::nearestViewportElement(this);
@@ -98,13 +100,6 @@
return SVGTransformable::getBBox(this);
}
-void SVGStyledTransformableElement::notifyAttributeChange() const
-{
- if (renderer())
- renderer()->setNeedsLayout(true);
- SVGStyledLocatableElement::notifyAttributeChange();
-}
-
RenderObject* SVGStyledTransformableElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
// By default, any subclass is expected to do path-based drawing
@@ -114,5 +109,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGStyledTransformableElement.h b/WebCore/svg/SVGStyledTransformableElement.h
index 1637cb2..8e23a514 100644
--- a/WebCore/svg/SVGStyledTransformableElement.h
+++ b/WebCore/svg/SVGStyledTransformableElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,27 +22,24 @@
#ifndef SVGStyledTransformableElement_h
#define SVGStyledTransformableElement_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGStyledLocatableElement.h"
#include "SVGTransformable.h"
namespace WebCore {
class AffineTransform;
- class Attribute;
- class Node;
- class StringImpl;
class SVGTransformList;
- class SVGStyledTransformableElement : public SVGStyledLocatableElement, public SVGTransformable {
+ class SVGStyledTransformableElement : public SVGStyledLocatableElement,
+ public SVGTransformable {
public:
SVGStyledTransformableElement(const QualifiedName&, Document*);
virtual ~SVGStyledTransformableElement();
virtual bool isStyledTransformable() const { return true; }
- // Derived from: 'SVGLocatable'
virtual AffineTransform getCTM() const;
virtual AffineTransform getScreenCTM() const;
virtual SVGElement* nearestViewportElement() const;
@@ -53,14 +50,13 @@
virtual FloatRect getBBox() const;
virtual void parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
// "base class" methods for all the elements which render as paths
virtual Path toPathData() const { return Path(); }
virtual Path toClipPath() const { return toPathData(); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void notifyAttributeChange() const;
-
protected:
ANIMATED_PROPERTY_DECLARATIONS(SVGStyledTransformableElement, SVGTransformList*, RefPtr<SVGTransformList>, Transform, transform)
};
@@ -69,5 +65,3 @@
#endif // ENABLE(SVG)
#endif // SVGStyledTransformableElement_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTests.cpp b/WebCore/svg/SVGTests.cpp
index 8c94317..d11e44d 100644
--- a/WebCore/svg/SVGTests.cpp
+++ b/WebCore/svg/SVGTests.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGTests.h"
@@ -43,7 +44,7 @@
SVGStringList* SVGTests::requiredFeatures() const
{
if (!m_features)
- m_features = new SVGStringList();
+ m_features = new SVGStringList(SVGNames::requiredFeaturesAttr);
return m_features.get();
}
@@ -51,7 +52,7 @@
SVGStringList* SVGTests::requiredExtensions() const
{
if (!m_extensions)
- m_extensions = new SVGStringList();
+ m_extensions = new SVGStringList(SVGNames::requiredExtensionsAttr);
return m_extensions.get();
}
@@ -59,7 +60,7 @@
SVGStringList* SVGTests::systemLanguage() const
{
if (!m_systemLanguage)
- m_systemLanguage = new SVGStringList();
+ m_systemLanguage = new SVGStringList(SVGNames::systemLanguageAttr);
return m_systemLanguage.get();
}
@@ -109,7 +110,13 @@
return false;
}
+bool SVGTests::isKnownAttribute(const QualifiedName& attrName)
+{
+ return (attrName == SVGNames::requiredFeaturesAttr ||
+ attrName == SVGNames::requiredExtensionsAttr ||
+ attrName == SVGNames::systemLanguageAttr);
}
-// vim:ts=4:noet
+}
+
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTests.h b/WebCore/svg/SVGTests.h
index 9e71806..2d82cb4 100644
--- a/WebCore/svg/SVGTests.h
+++ b/WebCore/svg/SVGTests.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,8 +22,8 @@
#ifndef SVGTests_h
#define SVGTests_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include <wtf/RefPtr.h>
namespace WebCore {
@@ -31,13 +31,13 @@
class MappedAttribute;
class String;
class SVGStringList;
+ class QualifiedName;
class SVGTests {
public:
SVGTests();
virtual ~SVGTests();
- // 'SVGTests' functions
SVGStringList* requiredFeatures() const;
SVGStringList* requiredExtensions() const;
SVGStringList* systemLanguage() const;
@@ -47,6 +47,7 @@
bool isValid() const;
bool parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
private:
mutable RefPtr<SVGStringList> m_features;
@@ -58,5 +59,3 @@
#endif // ENABLE(SVG)
#endif // SVGTests_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp
index 29e22f7..03ed592 100644
--- a/WebCore/svg/SVGTextContentElement.cpp
+++ b/WebCore/svg/SVGTextContentElement.cpp
@@ -57,8 +57,8 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextContentElement, SVGLength, Length, length, TextLength, textLength, SVGNames::textLengthAttr.localName(), m_textLength)
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextContentElement, int, Enumeration, enumeration, LengthAdjust, lengthAdjust, SVGNames::lengthAdjustAttr.localName(), m_lengthAdjust)
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextContentElement, SVGLength, Length, length, TextLength, textLength, SVGNames::textLengthAttr, m_textLength)
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextContentElement, int, Enumeration, enumeration, LengthAdjust, lengthAdjust, SVGNames::lengthAdjustAttr, m_lengthAdjust)
static inline float cummulatedCharacterRangeLength(const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end, SVGInlineTextBox* textBox,
int startOffset, long startPosition, long length, bool isVerticalText, long& atCharacter)
diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp
index a4e2415..d316dd0 100644
--- a/WebCore/svg/SVGTextElement.cpp
+++ b/WebCore/svg/SVGTextElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -38,7 +38,7 @@
SVGTextElement::SVGTextElement(const QualifiedName& tagName, Document* doc)
: SVGTextPositioningElement(tagName, doc)
, SVGTransformable()
- , m_transform(new SVGTransformList())
+ , m_transform(new SVGTransformList(SVGNames::transformAttr))
{
}
@@ -46,7 +46,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr.localName(), m_transform.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform.get())
void SVGTextElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -113,5 +113,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h
index 980c3c1..3e5c1e0 100644
--- a/WebCore/svg/SVGTextElement.h
+++ b/WebCore/svg/SVGTextElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,23 +22,21 @@
#ifndef SVGTextElement_h
#define SVGTextElement_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGTextPositioningElement.h"
#include "SVGTransformable.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGTextElement : public SVGTextPositioningElement,
- public SVGTransformable
- {
+ public SVGTransformable {
public:
SVGTextElement(const QualifiedName&, Document*);
virtual ~SVGTextElement();
virtual void parseMappedAttribute(MappedAttribute*);
- // 'SVGTextElement' functions
virtual SVGElement* nearestViewportElement() const;
virtual SVGElement* farthestViewportElement() const;
@@ -62,5 +60,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTextPathElement.cpp b/WebCore/svg/SVGTextPathElement.cpp
index 59646be..47c08f5 100644
--- a/WebCore/svg/SVGTextPathElement.cpp
+++ b/WebCore/svg/SVGTextPathElement.cpp
@@ -48,9 +48,9 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPathElement, SVGLength, Length, length, StartOffset, startOffset, SVGNames::startOffsetAttr.localName(), m_startOffset)
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPathElement, int, Enumeration, enumeration, Method, method, SVGNames::methodAttr.localName(), m_method)
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPathElement, int, Enumeration, enumeration, Spacing, spacing, SVGNames::spacingAttr.localName(), m_spacing)
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPathElement, SVGLength, Length, length, StartOffset, startOffset, SVGNames::startOffsetAttr, m_startOffset)
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPathElement, int, Enumeration, enumeration, Method, method, SVGNames::methodAttr, m_method)
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPathElement, int, Enumeration, enumeration, Spacing, spacing, SVGNames::spacingAttr, m_spacing)
void SVGTextPathElement::parseMappedAttribute(MappedAttribute* attr)
{
diff --git a/WebCore/svg/SVGTextPathElement.h b/WebCore/svg/SVGTextPathElement.h
index 6bafe92..4db7a94 100644
--- a/WebCore/svg/SVGTextPathElement.h
+++ b/WebCore/svg/SVGTextPathElement.h
@@ -60,7 +60,7 @@
virtual void insertedIntoDocument();
- virtual void parseMappedAttribute(MappedAttribute* attr);
+ virtual void parseMappedAttribute(MappedAttribute*);
virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp
index a35a89f0..346bd1e 100644
--- a/WebCore/svg/SVGTextPositioningElement.cpp
+++ b/WebCore/svg/SVGTextPositioningElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGTextPositioningElement.h"
@@ -32,11 +33,11 @@
SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document* doc)
: SVGTextContentElement(tagName, doc)
- , m_x(new SVGLengthList)
- , m_y(new SVGLengthList)
- , m_dx(new SVGLengthList)
- , m_dy(new SVGLengthList)
- , m_rotate(new SVGNumberList)
+ , m_x(new SVGLengthList(SVGNames::xAttr))
+ , m_y(new SVGLengthList(SVGNames::yAttr))
+ , m_dx(new SVGLengthList(SVGNames::dxAttr))
+ , m_dy(new SVGLengthList(SVGNames::dyAttr))
+ , m_rotate(new SVGNumberList(SVGNames::rotateAttr))
{
}
@@ -44,11 +45,11 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, X, x, SVGNames::xAttr.localName(), m_x.get())
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Y, y, SVGNames::yAttr.localName(), m_y.get())
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dx, dx, SVGNames::dxAttr.localName(), m_dx.get())
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dy, dy, SVGNames::dyAttr.localName(), m_dy.get())
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGNumberList*, NumberList, numberList, Rotate, rotate, SVGNames::rotateAttr.localName(), m_rotate.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, X, x, SVGNames::xAttr, m_x.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Y, y, SVGNames::yAttr, m_y.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dx, dx, SVGNames::dxAttr, m_dx.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dy, dy, SVGNames::dyAttr, m_dy.get())
+ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGNumberList*, NumberList, numberList, Rotate, rotate, SVGNames::rotateAttr, m_rotate.get())
void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
{
@@ -68,6 +69,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGTextPositioningElement.h b/WebCore/svg/SVGTextPositioningElement.h
index 26aae70..fc4251c 100644
--- a/WebCore/svg/SVGTextPositioningElement.h
+++ b/WebCore/svg/SVGTextPositioningElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,22 +22,20 @@
#ifndef SVGTextPositioningElement_h
#define SVGTextPositioningElement_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGTextContentElement.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGLengthList;
class SVGNumberList;
- class SVGTextPositioningElement : public SVGTextContentElement
- {
+ class SVGTextPositioningElement : public SVGTextContentElement {
public:
SVGTextPositioningElement(const QualifiedName&, Document*);
virtual ~SVGTextPositioningElement();
- // 'SVGTextPositioningElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
private:
@@ -52,5 +50,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTransformList.cpp b/WebCore/svg/SVGTransformList.cpp
index d9818d5..9b75848 100644
--- a/WebCore/svg/SVGTransformList.cpp
+++ b/WebCore/svg/SVGTransformList.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -23,7 +23,6 @@
#include "config.h"
#if ENABLE(SVG)
-
#include "AffineTransform.h"
#include "SVGTransform.h"
#include "SVGSVGElement.h"
@@ -32,8 +31,8 @@
using namespace WebCore;
-SVGTransformList::SVGTransformList()
- : SVGPODList<SVGTransform>()
+SVGTransformList::SVGTransformList(const QualifiedName& attributeName)
+ : SVGPODList<SVGTransform>(attributeName)
{
}
@@ -84,5 +83,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTransformList.h b/WebCore/svg/SVGTransformList.h
index 5928bb3..e41d393 100644
--- a/WebCore/svg/SVGTransformList.h
+++ b/WebCore/svg/SVGTransformList.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,16 +24,14 @@
#define SVGTransformList_h
#if ENABLE(SVG)
-
#include "SVGList.h"
#include "SVGTransform.h"
namespace WebCore {
- class SVGTransformList : public SVGPODList<SVGTransform>
- {
+ class SVGTransformList : public SVGPODList<SVGTransform> {
public:
- SVGTransformList();
+ SVGTransformList(const QualifiedName&);
virtual ~SVGTransformList();
SVGTransform createSVGTransformFromMatrix(const AffineTransform&) const;
@@ -48,5 +46,3 @@
#endif // ENABLE(SVG)
#endif // SVGTransformList_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGTransformable.cpp b/WebCore/svg/SVGTransformable.cpp
index 2acf8ec..8614d55 100644
--- a/WebCore/svg/SVGTransformable.cpp
+++ b/WebCore/svg/SVGTransformable.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
2007 Eric Seidel <eric@webkit.org>
@@ -22,6 +22,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGTransformable.h"
@@ -222,8 +223,11 @@
return !delimParsed;
}
+bool SVGTransformable::isKnownAttribute(const QualifiedName& attrName)
+{
+ return attrName == SVGNames::transformAttr;
}
-// vim:ts=4:noet
-#endif // ENABLE(SVG)
+}
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTransformable.h b/WebCore/svg/SVGTransformable.h
index 75573b7..1b1813f 100644
--- a/WebCore/svg/SVGTransformable.h
+++ b/WebCore/svg/SVGTransformable.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,17 +22,18 @@
#ifndef SVGTransformable_h
#define SVGTransformable_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
+#include "PlatformString.h"
#include "SVGLocatable.h"
-#include <PlatformString.h>
namespace WebCore {
- class AtomicString;
class AffineTransform;
+ class AtomicString;
class SVGTransform;
class SVGTransformList;
+ class QualifiedName;
class SVGTransformable : virtual public SVGLocatable {
public:
@@ -47,11 +48,11 @@
AffineTransform getScreenCTM(const SVGElement*) const;
virtual AffineTransform animatedLocalTransform() const = 0;
+
+ bool isKnownAttribute(const QualifiedName&);
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGTransformable_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGURIReference.cpp b/WebCore/svg/SVGURIReference.cpp
index 4211e45..5a2cabc 100644
--- a/WebCore/svg/SVGURIReference.cpp
+++ b/WebCore/svg/SVGURIReference.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006 Rob Buis <buis@kde.org>
This library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGURIReference.h"
@@ -36,7 +37,7 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGURIReference, String, String, string, Href, href, XLinkNames::hrefAttr.localName(), m_href)
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGURIReference, String, String, string, Href, href, XLinkNames::hrefAttr, m_href)
bool SVGURIReference::parseMappedAttribute(MappedAttribute* attr)
{
@@ -48,6 +49,11 @@
return false;
}
+bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName)
+{
+ return attrName.matches(XLinkNames::hrefAttr);
+}
+
String SVGURIReference::getTarget(const String& url)
{
if (url.startsWith("url(")) { // URI References, ie. fill:url(#target)
@@ -64,5 +70,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGURIReference.h b/WebCore/svg/SVGURIReference.h
index dcfa1ce..22f2f45 100644
--- a/WebCore/svg/SVGURIReference.h
+++ b/WebCore/svg/SVGURIReference.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,8 +22,8 @@
#ifndef SVGURIReference_h
#define SVGURIReference_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGElement.h"
namespace WebCore {
@@ -35,10 +35,9 @@
SVGURIReference();
virtual ~SVGURIReference();
- // 'SVGURIReference' functions
bool parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
- // Helpers
static String getTarget(const String& url);
protected:
@@ -52,5 +51,3 @@
#endif // ENABLE(SVG)
#endif // SVGURIReference_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp
index ae8fb74..6faa87e 100644
--- a/WebCore/svg/SVGUseElement.cpp
+++ b/WebCore/svg/SVGUseElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -68,10 +68,10 @@
{
}
-ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, X, x, SVGNames::xAttr.localName(), m_x)
-ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, Y, y, SVGNames::yAttr.localName(), m_y)
-ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr.localName(), m_width)
-ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr.localName(), m_height)
+ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
+ANIMATED_PROPERTY_DEFINITIONS(SVGUseElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
SVGElementInstance* SVGUseElement::instanceRoot() const
{
@@ -114,14 +114,6 @@
void SVGUseElement::insertedIntoDocument()
{
SVGElement::insertedIntoDocument();
-
- String id = SVGURIReference::getTarget(href());
- Element* targetElement = document()->getElementById(id);
- if (!targetElement) {
- document()->accessSVGExtensions()->addPendingResource(id, this);
- return;
- }
-
buildPendingResource();
}
@@ -133,31 +125,35 @@
m_shadowTreeRootElement = 0;
}
-void SVGUseElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
{
- // Avoid calling SVGStyledElement::attributeChanged(), as it always calls notifyAttributeChange.
- SVGElement::attributeChanged(attr, preserveDecls);
+ SVGStyledTransformableElement::svgAttributeChanged(attrName);
if (!attached())
- return;
+ return;
- // Only update the tree if x/y/width/height or xlink:href changed.
- if (attr->name() == SVGNames::xAttr || attr->name() == SVGNames::yAttr ||
- attr->name() == SVGNames::widthAttr || attr->name() == SVGNames::heightAttr ||
- attr->name().matches(XLinkNames::hrefAttr))
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
+ attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr ||
+ SVGTests::isKnownAttribute(attrName) ||
+ SVGLangSpace::isKnownAttribute(attrName) ||
+ SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
+ SVGURIReference::isKnownAttribute(attrName) ||
+ SVGStyledTransformableElement::isKnownAttribute(attrName)) {
+ // TODO: Now that we're aware of the attribute name, we can finally optimize
+ // updating <use> attributes - to not reclone every time.
buildPendingResource();
- else if (m_shadowTreeRootElement)
- m_shadowTreeRootElement->setChanged();
+
+ if (m_shadowTreeRootElement)
+ m_shadowTreeRootElement->setChanged();
+ }
}
-void SVGUseElement::notifyAttributeChange() const
+void SVGUseElement::childrenChanged()
{
if (!attached())
return;
- // NOTE: A lot of room for improvments here. This is too slow.
- // It has to be done correctly, by implementing attributeChanged().
- const_cast<SVGUseElement*>(this)->buildPendingResource();
+ buildPendingResource();
if (m_shadowTreeRootElement)
m_shadowTreeRootElement->setChanged();
@@ -249,6 +245,16 @@
void SVGUseElement::buildPendingResource()
{
+ String id = SVGURIReference::getTarget(href());
+ Element* targetElement = document()->getElementById(id);
+
+ if (!targetElement) {
+ // TODO: We want to deregister as pending resource, if our href() changed!
+ // TODO: Move to svgAttributeChanged, once we're fixing use & the new dynamic update concept.
+ document()->accessSVGExtensions()->addPendingResource(id, this);
+ return;
+ }
+
// Do not build the shadow/instance tree for <use> elements living in a shadow tree.
// The will be expanded soon anyway - see expandUseElementsInShadowTree().
Node* parent = parentNode();
@@ -258,9 +264,7 @@
parent = parent->parentNode();
}
-
- String id = SVGURIReference::getTarget(href());
- Element* targetElement = document()->getElementById(id);
+
SVGElement* target = 0;
if (targetElement && targetElement->isSVGElement())
target = static_cast<SVGElement*>(targetElement);
@@ -809,5 +813,3 @@
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGUseElement.h b/WebCore/svg/SVGUseElement.h
index f045d69..19f4737 100644
--- a/WebCore/svg/SVGUseElement.h
+++ b/WebCore/svg/SVGUseElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -24,15 +24,14 @@
#define SVGUseElement_h
#if ENABLE(SVG)
-
#include "SVGExternalResourcesRequired.h"
#include "SVGLangSpace.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTests.h"
#include "SVGURIReference.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGElementInstance;
class SVGLength;
@@ -40,8 +39,7 @@
public SVGTests,
public SVGLangSpace,
public SVGExternalResourcesRequired,
- public SVGURIReference
- {
+ public SVGURIReference {
public:
SVGUseElement(const QualifiedName&, Document*);
virtual ~SVGUseElement();
@@ -51,16 +49,14 @@
virtual bool isValid() const { return SVGTests::isValid(); }
- // Derived from: 'Element'
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void buildPendingResource();
- // 'SVGUseElement' functions
virtual void parseMappedAttribute(MappedAttribute*);
- virtual void notifyAttributeChange() const;
+ virtual void childrenChanged();
- virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual void recalcStyle(StyleChange = NoChange);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
@@ -96,10 +92,12 @@
void removeDisallowedElementsFromSubtree(Node* element);
void buildShadowTree(SVGElement* target, SVGElementInstance* targetInstance);
+
#if ENABLE(SVG) && ENABLE(SVG_USE)
void expandUseElementsInShadowTree(Node* element);
void expandSymbolElementsInShadowTree(Node* element);
#endif
+
void attachShadowTree();
// "Tree connector"
@@ -116,6 +114,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
-
diff --git a/WebCore/svg/SVGViewElement.cpp b/WebCore/svg/SVGViewElement.cpp
index 5949e29..24c08e6 100644
--- a/WebCore/svg/SVGViewElement.cpp
+++ b/WebCore/svg/SVGViewElement.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGViewElement.h"
@@ -33,7 +34,7 @@
namespace WebCore {
-SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document *doc)
+SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* doc)
: SVGStyledElement(tagName, doc)
, SVGExternalResourcesRequired()
, SVGFitToViewBox()
@@ -48,12 +49,12 @@
SVGStringList* SVGViewElement::viewTarget() const
{
if (!m_viewTarget)
- m_viewTarget = new SVGStringList();
+ m_viewTarget = new SVGStringList(SVGNames::viewTargetAttr);
return m_viewTarget.get();
}
-void SVGViewElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGViewElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == SVGNames::viewTargetAttr)
viewTarget()->reset(attr->value());
@@ -70,4 +71,3 @@
}
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGViewElement.h b/WebCore/svg/SVGViewElement.h
index 85157b5..17e0d1d 100644
--- a/WebCore/svg/SVGViewElement.h
+++ b/WebCore/svg/SVGViewElement.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,29 +22,27 @@
#ifndef SVGViewElement_h
#define SVGViewElement_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGStyledElement.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
#include "SVGZoomAndPan.h"
-namespace WebCore
-{
+namespace WebCore {
+
class SVGStringList;
class SVGViewElement : public SVGStyledElement,
public SVGExternalResourcesRequired,
public SVGFitToViewBox,
- public SVGZoomAndPan
- {
+ public SVGZoomAndPan {
public:
SVGViewElement(const QualifiedName&, Document*);
virtual ~SVGViewElement();
- virtual void parseMappedAttribute(MappedAttribute *attr);
+ virtual void parseMappedAttribute(MappedAttribute*);
- // 'SVGViewElement' functions
- SVGStringList *viewTarget() const;
+ SVGStringList* viewTarget() const;
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
@@ -63,5 +61,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp
index 30bd78c..f7a3600 100644
--- a/WebCore/svg/SVGViewSpec.cpp
+++ b/WebCore/svg/SVGViewSpec.cpp
@@ -35,7 +35,7 @@
SVGViewSpec::SVGViewSpec(const SVGSVGElement* contextElement)
: SVGFitToViewBox()
, SVGZoomAndPan()
- , m_transform(new SVGTransformList())
+ , m_transform(new SVGTransformList(SVGNames::transformAttr))
, m_contextElement(contextElement)
{
}
@@ -176,4 +176,3 @@
}
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGViewSpec.h b/WebCore/svg/SVGViewSpec.h
index baa02fd..b143634 100644
--- a/WebCore/svg/SVGViewSpec.h
+++ b/WebCore/svg/SVGViewSpec.h
@@ -21,29 +21,27 @@
#ifndef SVGViewSpec_h
#define SVGViewSpec_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "SVGFitToViewBox.h"
#include "SVGZoomAndPan.h"
#include <wtf/RefPtr.h>
-namespace WebCore
-{
+namespace WebCore {
+
class SVGElement;
class SVGSVGElement;
class SVGTransformList;
class SVGViewSpec : public SVGFitToViewBox,
- public SVGZoomAndPan
- {
+ public SVGZoomAndPan {
public:
SVGViewSpec(const SVGSVGElement*);
virtual ~SVGViewSpec();
bool parseViewSpec(const String&);
- // 'SVGViewSpec' functions
void setTransform(const String&);
SVGTransformList* transform() const { return m_transform.get(); }
@@ -68,5 +66,3 @@
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/SVGZoomAndPan.cpp b/WebCore/svg/SVGZoomAndPan.cpp
index c84c9c6..c5eafb2 100644
--- a/WebCore/svg/SVGZoomAndPan.cpp
+++ b/WebCore/svg/SVGZoomAndPan.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGZoomAndPan.h"
@@ -61,6 +62,11 @@
return false;
}
+bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& attrName)
+{
+ return attrName == SVGNames::zoomAndPanAttr;
+}
+
static const UChar disable[] = {'d', 'i', 's', 'a', 'b', 'l', 'e'};
static const UChar magnify[] = {'m', 'a', 'g', 'n', 'i', 'f', 'y'};
@@ -78,6 +84,4 @@
}
-// vim:ts=4:noet
#endif // ENABLE(SVG)
-
diff --git a/WebCore/svg/SVGZoomAndPan.h b/WebCore/svg/SVGZoomAndPan.h
index f7d2236..d7be342 100644
--- a/WebCore/svg/SVGZoomAndPan.h
+++ b/WebCore/svg/SVGZoomAndPan.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
+ Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
@@ -22,13 +22,14 @@
#ifndef SVGZoomAndPan_h
#define SVGZoomAndPan_h
-#if ENABLE(SVG)
+#if ENABLE(SVG)
#include "PlatformString.h"
namespace WebCore {
class MappedAttribute;
+ class QualifiedName;
class SVGZoomAndPan {
public:
@@ -41,11 +42,11 @@
SVGZoomAndPan();
virtual ~SVGZoomAndPan();
- // 'SVGZoomAndPan' functions
unsigned short zoomAndPan() const;
virtual void setZoomAndPan(unsigned short zoomAndPan);
bool parseMappedAttribute(MappedAttribute*);
+ bool isKnownAttribute(const QualifiedName&);
bool parseZoomAndPan(const UChar*& start, const UChar* end);
@@ -57,5 +58,3 @@
#endif // ENABLE(SVG)
#endif // SVGZoomAndPan_h
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/graphics/SVGResource.cpp b/WebCore/svg/graphics/SVGResource.cpp
index b150243..10d6648 100644
--- a/WebCore/svg/graphics/SVGResource.cpp
+++ b/WebCore/svg/graphics/SVGResource.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -86,6 +86,32 @@
void SVGResource::invalidate()
{
+ HashSet<SVGStyledElement*>::const_iterator it = m_clients.begin();
+ const HashSet<SVGStyledElement*>::const_iterator end = m_clients.end();
+
+ for (; it != end; ++it) {
+ SVGStyledElement* cur = *it;
+
+ if (cur->renderer())
+ cur->renderer()->setNeedsLayout(true);
+
+ cur->invalidateResourcesInAncestorChain();
+ }
+}
+
+void SVGResource::invalidateClients(HashSet<SVGStyledElement*> clients)
+{
+ HashSet<SVGStyledElement*>::const_iterator it = clients.begin();
+ const HashSet<SVGStyledElement*>::const_iterator end = clients.end();
+
+ for (; it != end; ++it) {
+ SVGStyledElement* cur = *it;
+
+ if (cur->renderer())
+ cur->renderer()->setNeedsLayout(true);
+
+ cur->invalidateResourcesInAncestorChain();
+ }
}
void SVGResource::removeClient(SVGStyledElement* item)
@@ -110,43 +136,21 @@
{
if (m_clients.contains(item))
return;
-
+
m_clients.add(item);
ResourceSet* target = clientMap().get(item);
if (!target)
target = new ResourceSet;
-
-
+
SVGResourceType type = resourceType();
if (SVGResource* oldResource = target->resources[type])
oldResource->m_clients.remove(item);
-
+
target->resources[type] = this;
clientMap().set(item, target);
}
-void SVGResource::repaintClients() const
-{
- SVGResource::repaintClients(m_clients);
-}
-
-void SVGResource::repaintClients(HashSet<SVGStyledElement*> clients)
-{
- HashSet<SVGStyledElement*>::const_iterator it = clients.begin();
- const HashSet<SVGStyledElement*>::const_iterator end = clients.end();
-
- for (; it != end; ++it) {
- SVGStyledElement* cur = *it;
- cur->setChanged();
-
- if (cur->renderer())
- cur->renderer()->repaint();
-
- cur->notifyResourceParentIfExistant();
- }
-}
-
TextStream& SVGResource::externalRepresentation(TextStream& ts) const
{
return ts;
@@ -173,6 +177,6 @@
return r.externalRepresentation(ts);
}
-} // namespace WebCore
+}
#endif
diff --git a/WebCore/svg/graphics/SVGResource.h b/WebCore/svg/graphics/SVGResource.h
index 4eca5ba..5272468 100644
--- a/WebCore/svg/graphics/SVGResource.h
+++ b/WebCore/svg/graphics/SVGResource.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,20 +27,17 @@
#define SVGResource_h
#if ENABLE(SVG)
-
#include "PlatformString.h"
-#include <wtf/RefCounted.h>
#include "StringHash.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
+#include <wtf/RefCounted.h>
namespace WebCore {
class AtomicString;
class Document;
- class RenderPath;
- class SVGDocumentExtensions;
class SVGStyledElement;
class TextStream;
@@ -75,10 +72,6 @@
virtual void invalidate();
void addClient(SVGStyledElement*);
-
- void repaintClients() const;
- static void repaintClients(HashSet<SVGStyledElement*>);
-
virtual SVGResourceType resourceType() const = 0;
bool isPaintServer() const { return resourceType() == PaintServerResourceType; }
@@ -89,7 +82,9 @@
virtual TextStream& externalRepresentation(TextStream&) const;
+ static void invalidateClients(HashSet<SVGStyledElement*>);
static void removeClient(SVGStyledElement*);
+
private:
HashSet<SVGStyledElement*> m_clients;
};
@@ -101,5 +96,4 @@
} // namespace WebCore
#endif
-
#endif // SVGResource_h
diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp
index 40fc636..842f04f 100644
--- a/WebCore/svg/graphics/SVGResourceMasker.cpp
+++ b/WebCore/svg/graphics/SVGResourceMasker.cpp
@@ -47,6 +47,7 @@
void SVGResourceMasker::invalidate()
{
+ SVGResource::invalidate();
m_mask.clear();
}
diff --git a/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp b/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp
index 4702d59..d1ab090 100644
--- a/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp
+++ b/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
This file is part of the KDE project
@@ -327,6 +327,8 @@
void SVGPaintServerGradient::invalidate()
{
+ SVGPaintServer::invalidate();
+
// Invalidate caches
CGShadingRelease(m_shadingCache);
@@ -337,5 +339,3 @@
} // namespace WebCore
#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp
index e4ac38d..0c9eaee 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -72,7 +72,7 @@
void SVGFEImage::imageChanged(CachedImage*)
{
if (SVGResourceFilter* filterResource = filter())
- filterResource->repaintClients();
+ filterResource->invalidate();
}
} // namespace WebCore