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/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