Reviewed by Antti & Eric.
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jul 2008 11:33:57 +0000 (11:33 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jul 2008 11:33:57 +0000 (11:33 +0000)
Fixes: http://bugs.webkit.org/show_bug.cgi?id=17779 (SVG 1.1 Errata demands "SVG JavaScript Liveness" support)

SVG Errata states: "All SVG DOM objects that directly correspond to an
attribute, e.g. the SVGAnimatedLength 'ry' in an SVGRectElement, are live. This
means that any changes made to the attribute are immediately reflected in the
corresponding SVG DOM object." (see linked URL on bug report)

Until now only XML -> SVG DOM changes took affect, aka. changing the 'rx' attribute of a <rect>
element resuted in changes when accessing 'rx' through SVG DOM (rx.baseVal.value).

Add a new synchronization layer to handle SVG DOM -> XML changes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34913 268f45cc-cd09-0410-ab3c-d52691b4dbfc

116 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.png [new file with mode: 0644]
LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.checksum [deleted file]
LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.png [deleted file]
LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/hixie/dynamic/005-expected.txt [moved from LayoutTests/platform/mac/svg/hixie/dynamic/005-broken-expected.txt with 88% similarity]
LayoutTests/svg/custom/resources/svg-xml-dom-sync.js [new file with mode: 0644]
LayoutTests/svg/custom/svg-xml-dom-sync-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/svg-xml-dom-sync.html [new file with mode: 0644]
LayoutTests/svg/hixie/dynamic/005.xml [moved from LayoutTests/svg/hixie/dynamic/005-broken.xml with 100% similarity]
WebCore/ChangeLog
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/NamedAttrMap.h
WebCore/svg/SVGAElement.h
WebCore/svg/SVGAltGlyphElement.h
WebCore/svg/SVGAnimateElement.h
WebCore/svg/SVGAnimateMotionElement.h
WebCore/svg/SVGAnimateTransformElement.h
WebCore/svg/SVGAnimatedTemplate.h
WebCore/svg/SVGAnimationElement.h
WebCore/svg/SVGCircleElement.h
WebCore/svg/SVGClipPathElement.h
WebCore/svg/SVGComponentTransferFunctionElement.cpp
WebCore/svg/SVGComponentTransferFunctionElement.h
WebCore/svg/SVGCursorElement.cpp
WebCore/svg/SVGCursorElement.h
WebCore/svg/SVGDefsElement.h
WebCore/svg/SVGElement.cpp
WebCore/svg/SVGElement.h
WebCore/svg/SVGEllipseElement.cpp
WebCore/svg/SVGEllipseElement.h
WebCore/svg/SVGExternalResourcesRequired.h
WebCore/svg/SVGFEBlendElement.h
WebCore/svg/SVGFEColorMatrixElement.cpp
WebCore/svg/SVGFEColorMatrixElement.h
WebCore/svg/SVGFEComponentTransferElement.h
WebCore/svg/SVGFECompositeElement.h
WebCore/svg/SVGFEDiffuseLightingElement.h
WebCore/svg/SVGFEDisplacementMapElement.h
WebCore/svg/SVGFEFloodElement.h
WebCore/svg/SVGFEGaussianBlurElement.h
WebCore/svg/SVGFEImageElement.cpp
WebCore/svg/SVGFEImageElement.h
WebCore/svg/SVGFELightElement.h
WebCore/svg/SVGFEMergeElement.h
WebCore/svg/SVGFEMergeNodeElement.h
WebCore/svg/SVGFEOffsetElement.h
WebCore/svg/SVGFESpecularLightingElement.h
WebCore/svg/SVGFETileElement.h
WebCore/svg/SVGFETurbulenceElement.h
WebCore/svg/SVGFilterElement.cpp
WebCore/svg/SVGFilterElement.h
WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
WebCore/svg/SVGFitToViewBox.cpp
WebCore/svg/SVGFitToViewBox.h
WebCore/svg/SVGFontElement.h
WebCore/svg/SVGForeignObjectElement.cpp
WebCore/svg/SVGForeignObjectElement.h
WebCore/svg/SVGGElement.h
WebCore/svg/SVGGradientElement.cpp
WebCore/svg/SVGGradientElement.h
WebCore/svg/SVGImageElement.cpp
WebCore/svg/SVGImageElement.h
WebCore/svg/SVGLengthList.cpp
WebCore/svg/SVGLengthList.h
WebCore/svg/SVGLineElement.cpp
WebCore/svg/SVGLineElement.h
WebCore/svg/SVGLinearGradientElement.cpp
WebCore/svg/SVGLinearGradientElement.h
WebCore/svg/SVGMPathElement.h
WebCore/svg/SVGMarkerElement.cpp
WebCore/svg/SVGMarkerElement.h
WebCore/svg/SVGMaskElement.cpp
WebCore/svg/SVGMaskElement.h
WebCore/svg/SVGNumberList.cpp
WebCore/svg/SVGNumberList.h
WebCore/svg/SVGPathElement.h
WebCore/svg/SVGPatternElement.cpp
WebCore/svg/SVGPatternElement.h
WebCore/svg/SVGPolyElement.h
WebCore/svg/SVGPreserveAspectRatio.cpp
WebCore/svg/SVGPreserveAspectRatio.h
WebCore/svg/SVGRadialGradientElement.cpp
WebCore/svg/SVGRadialGradientElement.h
WebCore/svg/SVGRectElement.cpp
WebCore/svg/SVGRectElement.h
WebCore/svg/SVGSVGElement.cpp
WebCore/svg/SVGSVGElement.h
WebCore/svg/SVGScriptElement.h
WebCore/svg/SVGStyledElement.h
WebCore/svg/SVGStyledTransformableElement.cpp
WebCore/svg/SVGStyledTransformableElement.h
WebCore/svg/SVGSwitchElement.h
WebCore/svg/SVGSymbolElement.h
WebCore/svg/SVGTRefElement.h
WebCore/svg/SVGTSpanElement.h
WebCore/svg/SVGTextContentElement.cpp
WebCore/svg/SVGTextContentElement.h
WebCore/svg/SVGTextElement.cpp
WebCore/svg/SVGTextElement.h
WebCore/svg/SVGTextPathElement.cpp
WebCore/svg/SVGTextPathElement.h
WebCore/svg/SVGTextPositioningElement.cpp
WebCore/svg/SVGTextPositioningElement.h
WebCore/svg/SVGTransformList.cpp
WebCore/svg/SVGTransformList.h
WebCore/svg/SVGURIReference.h
WebCore/svg/SVGUseElement.cpp
WebCore/svg/SVGUseElement.h
WebCore/svg/SVGViewElement.h
WebCore/svg/SVGViewSpec.cpp
WebCore/svg/SVGViewSpec.h

index 18cfc3f..f619e32 100644 (file)
@@ -1,3 +1,26 @@
+2008-07-01  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed by Antti.
+
+        Fixes: http://bugs.webkit.org/show_bug.cgi?id=17779 (SVG 1.1 Errata demands "SVG JavaScript Liveness" support)
+
+        Add new layout test covering SVG <-> XML synchronication (svg/custom/svg-xml-dom-sync.html).
+        Rename one hixie test that got fixed: 005-broken.xml -> 005.xml
+
+        * platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.checksum: Added.
+        * platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.png: Added.
+        * platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.checksum: Removed.
+        * platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.png: Removed.
+        * platform/mac-leopard/svg/hixie/dynamic/005-expected.checksum: Copied from platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.checksum.
+        * platform/mac-leopard/svg/hixie/dynamic/005-expected.png: Copied from platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.png.
+        * platform/mac/svg/hixie/dynamic/005-broken-expected.txt: Removed.
+        * platform/mac/svg/hixie/dynamic/005-expected.txt: Copied from platform/mac/svg/hixie/dynamic/005-broken-expected.txt.
+        * svg/custom/resources/svg-xml-dom-sync.js: Added.
+        * svg/custom/svg-xml-dom-sync-expected.txt: Added.
+        * svg/custom/svg-xml-dom-sync.html: Added.
+        * svg/hixie/dynamic/005-broken.xml: Removed.
+        * svg/hixie/dynamic/005.xml: Copied from svg/hixie/dynamic/005-broken.xml.
+
 2008-06-30  Adele Peterson  <adele@apple.com>
 
         Reviewed by Oliver.
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.checksum b/LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.checksum
new file mode 100644 (file)
index 0000000..073b5b2
--- /dev/null
@@ -0,0 +1 @@
+2618d16bf325ac468218c8ffec1fbdc2
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.png b/LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.png
new file mode 100644 (file)
index 0000000..1d83518
Binary files /dev/null and b/LayoutTests/platform/mac-leopard/svg/custom/svg-xml-dom-sync-expected.png differ
diff --git a/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.checksum b/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.checksum
deleted file mode 100644 (file)
index e006bf7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-13a4206547a4d569ab96cd2c60100e9b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.png b/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.png
deleted file mode 100644 (file)
index 371fe66..0000000
Binary files a/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-broken-expected.png and /dev/null differ
diff --git a/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.checksum b/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.checksum
new file mode 100644 (file)
index 0000000..59bdd60
--- /dev/null
@@ -0,0 +1 @@
+76bdc02f9e5c8554aebc20f37d11fae7
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.png b/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.png
new file mode 100644 (file)
index 0000000..830b0cd
Binary files /dev/null and b/LayoutTests/platform/mac-leopard/svg/hixie/dynamic/005-expected.png differ
@@ -4,4 +4,4 @@ layer at (0,0) size 300x300
   RenderSVGRoot {svg} at (0,0) size 300x300
     RenderPath {rect} at (0,0) size 150x300 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L150.00,0.00 L150.00,300.00 L0.00,300.00"]
     RenderPath {rect} at (0,0) size 300x150 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L300.00,0.00 L300.00,150.00 L0.00,150.00"]
-    RenderPath {rect} at (0,150) size 300x150 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,150.00 L300.00,150.00 L300.00,300.00 L0.00,300.00"]
+    RenderPath {rect} at (0,150) size 300x150 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,150.00 L300.00,150.00 L300.00,300.00 L0.00,300.00"]
diff --git a/LayoutTests/svg/custom/resources/svg-xml-dom-sync.js b/LayoutTests/svg/custom/resources/svg-xml-dom-sync.js
new file mode 100644 (file)
index 0000000..6c17b35
--- /dev/null
@@ -0,0 +1,21 @@
+description("Tests whether changes to SVG through native objects and the DOM stay in sync.");
+
+var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", null);
+var rect = svgDoc.createElementNS("http://www.w3.org/2000/svg", "rect");
+rect.setAttribute("x", 100);
+rect.setAttribute("y", 100);
+
+shouldBe("rect.x.baseVal.value", "100");
+shouldBe("rect.getAttribute('x')", "'100'");
+shouldBe("rect.y.baseVal.value", "100");
+shouldBe("rect.getAttribute('y')", "'100'");
+
+rect.x.baseVal.value = 200;
+rect.setAttribute("y", 200);
+
+shouldBe("rect.x.baseVal.value", "200");
+shouldBe("rect.getAttribute('x')", "'200'");
+shouldBe("rect.y.baseVal.value", "200");
+shouldBe("rect.getAttribute('y')", "'200'");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/svg/custom/svg-xml-dom-sync-expected.txt b/LayoutTests/svg/custom/svg-xml-dom-sync-expected.txt
new file mode 100644 (file)
index 0000000..080f11a
--- /dev/null
@@ -0,0 +1,17 @@
+Tests whether changes to SVG through native objects and the DOM stay in sync.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.x.baseVal.value is 100
+PASS rect.getAttribute('x') is '100'
+PASS rect.y.baseVal.value is 100
+PASS rect.getAttribute('y') is '100'
+PASS rect.x.baseVal.value is 200
+PASS rect.getAttribute('x') is '200'
+PASS rect.y.baseVal.value is 200
+PASS rect.getAttribute('y') is '200'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/custom/svg-xml-dom-sync.html b/LayoutTests/svg/custom/svg-xml-dom-sync.html
new file mode 100644 (file)
index 0000000..97d15e1
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../LayoutTests/fast/js/resources/js-test-style.css">
+<script src="../../../LayoutTests/fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/svg-xml-dom-sync.js"></script> 
+<script src="../../../LayoutTests/fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index ac93e93..6cb198d 100644 (file)
@@ -1,3 +1,252 @@
+2008-07-01  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed by Antti & Eric.
+
+        Fixes: http://bugs.webkit.org/show_bug.cgi?id=17779 (SVG 1.1 Errata demands "SVG JavaScript Liveness" support)
+
+        SVG Errata states: "All SVG DOM objects that directly correspond to an
+        attribute, e.g. the SVGAnimatedLength 'ry' in an SVGRectElement, are live. This
+        means that any changes made to the attribute are immediately reflected in the
+        corresponding SVG DOM object." (see linked URL on bug report)
+
+        Until now only XML -> SVG DOM changes took affect, aka. changing the 'rx' attribute of a <rect>
+        element resuted in changes when accessing 'rx' through SVG DOM (rx.baseVal.value).
+
+        Add a new synchronization layer to handle SVG DOM -> XML changes.
+
+        Global macro change #1: ANIMATED_PROPERTY_FORWARD_DECLARATIONS contains the class name where it's defined as first parameter.
+        Global macro change #2: Add ANIMATED_PROPERTY_START_DECLARATIONS to all direct base-classes.
+        Global macro change #3: Rename ANIMATED_PROPERTY_DEFINITIONS to ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED for refcounted types (ie. SVGTransformList*).
+
+        Added test: svg/custom/svg-xml-dom-sync.html
+        Fixed test: svg/hixie/dynamic/005-broken.xml (renamed to 005.xml)
+
+        * dom/Element.cpp:
+        (WebCore::Element::Element): Initialize the two new bits.
+        (WebCore::Element::attributes): Add hooks to call into SVG attribute synchronization code, wrapped in ENABLE(SVG) blocks.
+        (WebCore::Element::getAttribute): Ditto.
+        (WebCore::Element::hasAttributes): Ditto.
+        * dom/Element.h: Add two bits: m_synchronizedSVGAttributes/m_synchronizingSVGAttribute, to track synchronization status.
+        (WebCore::Element::updateAnimatedSVGAttribute): New virtual function, handling the synronication, similar to updateStyleAttribute.
+        * dom/NamedAttrMap.h: Make addAttribute/removeAttribute protected, from use within the ANIMATED_* macros.
+        * svg/SVGAElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGAElement::contextElement): Return non-const value.
+        * svg/SVGAltGlyphElement.h:
+        (WebCore::SVGAltGlyphElement::contextElement): Ditto.
+        * svg/SVGAnimateElement.h:
+        (WebCore::SVGAnimateElement::contextElement): Ditto.
+        * svg/SVGAnimateMotionElement.h:
+        (WebCore::SVGAnimateMotionElement::contextElement): Ditto.
+        * svg/SVGAnimateTransformElement.h:
+        (WebCore::SVGAnimateTransformElement::contextElement): Ditto.
+        * svg/SVGAnimatedTemplate.h: Add toString() conversion to all SVGAnimated* classes
+        (WebCore::SVGAnimatedTemplate::toString):
+        (WebCore::SVGAnimatedTemplate::associatedAttributeName):
+        (WebCore::lookupOrCreateWrapper):
+        (WebCore::SVGAnimatedAngle::SVGAnimatedAngle): 
+        (WebCore::SVGAnimatedAngle::toString):
+        (WebCore::SVGAnimatedBoolean::SVGAnimatedBoolean):
+        (WebCore::SVGAnimatedBoolean::toString):
+        (WebCore::SVGAnimatedEnumeration::SVGAnimatedEnumeration):
+        (WebCore::SVGAnimatedEnumeration::toString):
+        (WebCore::SVGAnimatedInteger::SVGAnimatedInteger):
+        (WebCore::SVGAnimatedInteger::toString):
+        (WebCore::SVGAnimatedLength::SVGAnimatedLength):
+        (WebCore::SVGAnimatedLength::toString):
+        (WebCore::SVGAnimatedLengthList::SVGAnimatedLengthList):
+        (WebCore::SVGAnimatedLengthList::toString):
+        (WebCore::SVGAnimatedNumber::SVGAnimatedNumber):
+        (WebCore::SVGAnimatedNumber::toString):
+        (WebCore::SVGAnimatedNumberList::SVGAnimatedNumberList):
+        (WebCore::SVGAnimatedNumberList::toString):
+        (WebCore::SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio):
+        (WebCore::SVGAnimatedPreserveAspectRatio::toString):
+        (WebCore::SVGAnimatedRect::SVGAnimatedRect):
+        (WebCore::SVGAnimatedRect::toString):
+        (WebCore::SVGAnimatedString::SVGAnimatedString):
+        (WebCore::SVGAnimatedString::toString):
+        (WebCore::SVGAnimatedTransformList::SVGAnimatedTransformList):
+        (WebCore::SVGAnimatedTransformList::toString):
+        (WebCore::SVGAnimatedType::SVGAnimatedType):
+        * svg/SVGAnimationElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        * svg/SVGCircleElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGCircleElement::contextElement): Return non-const value.
+        * svg/SVGClipPathElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGClipPathElement::contextElement): Return non-const value.
+        * svg/SVGComponentTransferFunctionElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGComponentTransferFunctionElement.h: Add ANIMATED_PROPERTY_START_DECLARATIONS, as this class is a base class.
+        * svg/SVGCursorElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGCursorElement::SVGCursorElement):
+        * svg/SVGCursorElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS. Add ANIMATED_PROPERTY_START_DECLARATIONS.
+        (WebCore::SVGCursorElement::contextElement): Return non-const value.
+        * svg/SVGDefsElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGDefsElement::contextElement): Return non-const value.
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::updateAnimatedSVGAttribute): Override virtual function from Element, to handle SVG<->XML DOM synchronization.
+        (WebCore::SVGElement::setSynchronizedSVGAttributes):
+        * svg/SVGElement.h: Add helper class "StoredTypeWithDirtyFlag".
+        (StoredTypeWithDirtyFlag::StoredTypeWithDirtyFlag): Tracks a type and a flag indicating that SVG<->XML DOM synchronization has to be done.
+        (StoredTypeWithDirtyFlag::operator=):
+        (StoredTypeWithDirtyFlag::operator==):
+        (StoredTypeWithDirtyFlag::operator!=):
+        (StoredTypeWithDirtyFlag::operator StoredType):
+        (WebCore::SVGElement::invokeSVGPropertySynchronizer): New set of functions taking care of invoking the update handlers.
+        (WebCore::SVGElement::invokeAllSVGPropertySynchronizers): Ditto.
+        (WebCore::SVGElement::addSVGPropertySynchronizer): Ditto.
+        * svg/SVGEllipseElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGEllipseElement::SVGEllipseElement):
+        * svg/SVGEllipseElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGEllipseElement::contextElement): Return non-const value.
+        * svg/SVGExternalResourcesRequired.h: Change contextElement() to return a non-const value.
+        * svg/SVGFEBlendElement.h:
+        (WebCore::SVGFEBlendElement::contextElement): Return non-const value.
+        * svg/SVGFEColorMatrixElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGFEColorMatrixElement.h:
+        (WebCore::SVGFEColorMatrixElement::contextElement): Return non-const value.
+        * svg/SVGFEComponentTransferElement.h:
+        (WebCore::SVGFEComponentTransferElement::contextElement): Return non-const value.
+        * svg/SVGFECompositeElement.h:
+        (WebCore::SVGFECompositeElement::contextElement): Return non-const value.
+        * svg/SVGFEDiffuseLightingElement.h:
+        (WebCore::SVGFEDiffuseLightingElement::contextElement): Return non-const value.
+        * svg/SVGFEDisplacementMapElement.h:
+        (WebCore::SVGFEDisplacementMapElement::contextElement): Return non-const value.
+        * svg/SVGFEFloodElement.h:
+        (WebCore::SVGFEFloodElement::contextElement): Return non-const value.
+        * svg/SVGFEGaussianBlurElement.h:
+        (WebCore::SVGFEGaussianBlurElement::contextElement): Return non-const value.
+        * svg/SVGFEImageElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGFEImageElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGFEImageElement::contextElement): Return non-const value.
+        * svg/SVGFELightElement.h: Add ANIMATED_PROPERTY_START_DECLARATIONS, as this is a base class.
+        * svg/SVGFEMergeElement.h:
+        (WebCore::SVGFEMergeElement::contextElement): Return non-const value.
+        * svg/SVGFEMergeNodeElement.h: Add ANIMATED_PROPERTY_START_DECLARATIONS, as this is a base class.
+        (WebCore::SVGFEMergeNodeElement::contextElement): Return non-const value.
+        * svg/SVGFEOffsetElement.h:
+        (WebCore::SVGFEOffsetElement::contextElement): Return non-const value.
+        * svg/SVGFESpecularLightingElement.h:
+        (WebCore::SVGFESpecularLightingElement::contextElement): Return non-const value.
+        * svg/SVGFETileElement.h:
+        (WebCore::SVGFETileElement::contextElement): Return non-const value.
+        * svg/SVGFETurbulenceElement.h:
+        (WebCore::SVGFETurbulenceElement::contextElement): Return non-const value.
+        * svg/SVGFilterElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGFilterElement::SVGFilterElement):
+        * svg/SVGFilterElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGFilterElement::contextElement): Return non-const value.
+        * svg/SVGFilterPrimitiveStandardAttributes.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
+        * svg/SVGFilterPrimitiveStandardAttributes.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGFilterPrimitiveStandardAttributes::contextElement): Return non-const value.
+        * svg/SVGFitToViewBox.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGFitToViewBox.h: Change contextElement() to return a non-const value.
+        * svg/SVGFontElement.h:
+        (WebCore::SVGFontElement::contextElement): Return non-const value.
+        * svg/SVGForeignObjectElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
+        * svg/SVGForeignObjectElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGForeignObjectElement::contextElement): Return non-const value.
+        * svg/SVGGElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGGElement::contextElement): Return non-const value.
+        * svg/SVGGradientElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGGradientElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        * svg/SVGImageElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change. Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGImageElement::SVGImageElement):
+        * svg/SVGImageElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGImageElement::contextElement): Return non-const value.
+        * svg/SVGLengthList.cpp:
+        (WebCore::SVGLengthList::valueAsString): Add new function converting SVG values to strings.
+        * svg/SVGLengthList.h:
+        * svg/SVGLineElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGLineElement::SVGLineElement):
+        * svg/SVGLineElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGLineElement::contextElement): Return non-const value.
+        * svg/SVGLinearGradientElement.cpp:
+        (WebCore::SVGLinearGradientElement::SVGLinearGradientElement): Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGLinearGradientElement::collectGradientProperties):
+        * svg/SVGLinearGradientElement.h:
+        (WebCore::SVGLinearGradientElement::contextElement): Return non-const value.
+        * svg/SVGMPathElement.h:
+        (WebCore::SVGMPathElement::contextElement): Return non-const value.
+        * svg/SVGMarkerElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change. Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGMarkerElement::SVGMarkerElement):
+        * svg/SVGMarkerElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGMarkerElement::contextElement): Return non-const value.
+        * svg/SVGMaskElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGMaskElement::SVGMaskElement):
+        * svg/SVGMaskElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGMaskElement::contextElement): Return non-const value.
+        * svg/SVGNumberList.cpp:
+        (WebCore::SVGNumberList::valueAsString): Add new function converting SVG values to strings.
+        * svg/SVGNumberList.h:
+        * svg/SVGPathElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGPathElement::contextElement): Return non-const value.
+        * svg/SVGPatternElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change. Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGPatternElement::SVGPatternElement):
+        (WebCore::SVGPatternElement::collectPatternProperties):
+        * svg/SVGPatternElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGPatternElement::contextElement): Return non-const value.
+        * svg/SVGPolyElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGPolyElement::contextElement): Return non-const value.
+        * svg/SVGPreserveAspectRatio.cpp:
+        (WebCore::SVGPreserveAspectRatio::valueAsString): Add new function converting SVG values to strings.
+        * svg/SVGPreserveAspectRatio.h:
+        * svg/SVGRadialGradientElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
+        (WebCore::SVGRadialGradientElement::svgAttributeChanged):
+        (WebCore::SVGRadialGradientElement::collectGradientProperties):
+        * svg/SVGRadialGradientElement.h:
+        (WebCore::SVGRadialGradientElement::contextElement): Return non-const value.
+        * svg/SVGRectElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGRectElement::SVGRectElement):
+        * svg/SVGRectElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGRectElement::contextElement): Return non-const value.
+        * svg/SVGSVGElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGSVGElement::SVGSVGElement):
+        (WebCore::SVGSVGElement::currentView): Pass non-const SVGSVGElement* object to SVGViewSpec.
+        * svg/SVGSVGElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGSVGElement::contextElement): Return non-const value.
+        * svg/SVGScriptElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGScriptElement::contextElement): Return non-const value.
+        * svg/SVGStyledElement.h: Add ANIMATED_PROPERTY_START_DECLARATIONS, as this is a base class.
+        * svg/SVGStyledTransformableElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGStyledTransformableElement.h:
+        * svg/SVGSwitchElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGSwitchElement::contextElement): Return non-const value.
+        * svg/SVGSymbolElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGSymbolElement::contextElement): Return non-const value.
+        * svg/SVGTRefElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGTRefElement::contextElement): Return non-const value.
+        * svg/SVGTSpanElement.h:
+        (WebCore::SVGTSpanElement::contextElement): Return non-const value.
+        * svg/SVGTextContentElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGTextContentElement::SVGTextContentElement):
+        * svg/SVGTextContentElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        * svg/SVGTextElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGTextElement.h:
+        (WebCore::SVGTextElement::contextElement): Return non-const value.
+        * svg/SVGTextPathElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGTextPathElement::SVGTextPathElement):
+        * svg/SVGTextPathElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGTextPathElement::contextElement): Return non-const value.
+        * svg/SVGTextPositioningElement.cpp: Apply ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED change.
+        * svg/SVGTextPositioningElement.h:
+        * svg/SVGTransformList.cpp:
+        (SVGTransformList::valueAsString): Add new function converting SVG values to strings.
+        * svg/SVGTransformList.h:
+        * svg/SVGURIReference.h: Change contextElement() to return a non-const value.
+        * svg/SVGUseElement.cpp: Wrap SVGLength objects in SVGLength() statements.
+        (WebCore::SVGUseElement::SVGUseElement):
+        * svg/SVGUseElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGUseElement::contextElement): Return non-const value.
+        * svg/SVGViewElement.h: Apply global macro change for ANIMATED_PROPERTY_FORWARD_DECLARATIONS.
+        (WebCore::SVGViewElement::contextElement): Return non-const value.
+        * svg/SVGViewSpec.cpp:
+        (WebCore::SVGViewSpec::SVGViewSpec): Pass non-const context element in constructor.
+        (WebCore::SVGViewSpec::contextElement): Return non-const value.
+        * svg/SVGViewSpec.h:
+
 2008-07-01  Alex Mathews  <possessedpenguinbob@gmail.com>
 
         Reviewed by Nikolas Zimmermann.
index 8e96899..c83a7d2 100644 (file)
@@ -99,6 +99,10 @@ Element::Element(const QualifiedName& qName, Document *doc)
     , m_tagName(qName)
     , m_isStyleAttributeValid(true)
     , m_synchronizingStyleAttribute(false)
+#if ENABLE(SVG)
+    , m_areSVGAttributesValid(true)
+    , m_synchronizingSVGAttributes(false)
+#endif
     , m_parsingChildrenFinished(true)
 {
 }
@@ -193,6 +197,12 @@ NamedAttrMap* Element::attributes(bool readonly) const
 {
     if (!m_isStyleAttributeValid)
         updateStyleAttribute();
+
+#if ENABLE(SVG)
+    if (!m_areSVGAttributesValid)
+        updateAnimatedSVGAttribute(0);
+#endif
+
     if (!readonly && !namedAttrMap)
         createAttributeMap();
     return namedAttrMap.get();
@@ -218,6 +228,11 @@ const AtomicString& Element::getAttribute(const QualifiedName& name) const
     if (name == styleAttr && !m_isStyleAttributeValid)
         updateStyleAttribute();
 
+#if ENABLE(SVG)
+    if (!m_areSVGAttributesValid)
+        updateAnimatedSVGAttribute(name.localName().impl());
+#endif
+
     if (namedAttrMap)
         if (Attribute* a = namedAttrMap->getAttributeItem(name))
             return a->value();
@@ -467,7 +482,12 @@ const AtomicString& Element::getAttribute(const String& name) const
     String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
     if (localName == styleAttr.localName() && !m_isStyleAttributeValid)
         updateStyleAttribute();
-    
+
+#if ENABLE(SVG)
+    if (!m_areSVGAttributesValid)
+        updateAnimatedSVGAttribute(name.impl());
+#endif
+
     if (namedAttrMap)
         if (Attribute* a = namedAttrMap->getAttributeItem(localName))
             return a->value();
@@ -577,6 +597,12 @@ bool Element::hasAttributes() const
 {
     if (!m_isStyleAttributeValid)
         updateStyleAttribute();
+
+#if ENABLE(SVG)
+    if (!m_areSVGAttributesValid)
+        updateAnimatedSVGAttribute(0);
+#endif
+
     return namedAttrMap && namedAttrMap->length() > 0;
 }
 
index 904cbf9..67b34ba 100644 (file)
@@ -205,7 +205,11 @@ private:
     virtual void createAttributeMap() const;
 
     virtual void updateStyleAttribute() const {}
-    
+
+#if ENABLE(SVG)
+    virtual void updateAnimatedSVGAttribute(StringImpl* name) const {}
+#endif
+
     void updateFocusAppearanceSoonAfterAttach();
     void cancelFocusAppearanceUpdate();
 
@@ -221,7 +225,13 @@ protected:
     // Element bits.
     mutable bool m_isStyleAttributeValid : 1;
     mutable bool m_synchronizingStyleAttribute : 1;
-    
+
+#if ENABLE(SVG)
+    // These bit is are used by SVGElement subclasses, and it lives here for the same reason as above.
+    mutable bool m_areSVGAttributesValid : 1;
+    mutable bool m_synchronizingSVGAttributes : 1;
+#endif
+
 private:
     bool m_parsingChildrenFinished : 1;
 };
index 1e271db..6781e41 100644 (file)
@@ -89,11 +89,11 @@ public:
     
     bool mapsEquivalent(const NamedAttrMap* otherMap) const;
 
-protected:
     // These functions are internal, and do no error checking.
     void addAttribute(PassRefPtr<Attribute>);
     void removeAttribute(const QualifiedName& name);
 
+protected:
     virtual void clearAttributes();
 
     void detachFromElement();
index a1509fd..d5a85da 100644 (file)
@@ -61,11 +61,11 @@ namespace WebCore {
         virtual bool childShouldCreateRenderer(Node*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGAElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGAElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGAElement, String, String, Target, target)
     };
index 2361049..f132f03 100644 (file)
@@ -48,7 +48,7 @@ namespace WebCore
         SVGGlyphElement* glyphElement() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
     };
 
 } // namespace WebCore
index e583712..ab7e444 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
         virtual ~SVGAnimateElement();
     
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         
         virtual void resetToBaseValue(const String&);
         virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
index ec76348..5fa469f 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
         virtual void parseMappedAttribute(MappedAttribute*);
         
     private:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         
         virtual void resetToBaseValue(const String&);
         virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
index cbc27a8..9b7d05c 100644 (file)
@@ -44,7 +44,7 @@ namespace WebCore {
         virtual void parseMappedAttribute(MappedAttribute*);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         
     private:
         virtual void resetToBaseValue(const String&);
index b30bc69..6396ac9 100644 (file)
 #define SVGAnimatedTemplate_h
 
 #if ENABLE(SVG)
-#include <wtf/RefCounted.h>
 #include "AtomicString.h"
+#include "FloatRect.h"
 #include "Attribute.h"
+#include "SVGAngle.h"
+#include "SVGLength.h"
+#include "SVGLengthList.h"
+#include "SVGNumberList.h"
+#include "SVGTransformList.h"
+#include "SVGPreserveAspectRatio.h"
+
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-    class FloatRect;
-    class SVGAngle;
     class SVGElement;
-    class SVGLength;
-    class SVGLengthList;
-    class SVGNumberList;
-    class SVGPreserveAspectRatio;
-    class SVGTransformList;
-    class String;
-    class QualifiedName;
 
     struct SVGAnimatedTypeWrapperKey {            
         // Empty value
@@ -111,6 +110,8 @@ namespace WebCore {
         virtual BareType animVal() const = 0;
         virtual void setAnimVal(BareType newAnimVal) = 0;
 
+        virtual AtomicString toString() const { ASSERT_NOT_REACHED(); return AtomicString(); }
+
         typedef HashMap<SVGAnimatedTypeWrapperKey, SVGAnimatedTemplate<BareType>*, SVGAnimatedTypeWrapperKeyHash, SVGAnimatedTypeWrapperKeyHashTraits > ElementToWrapperMap;
         typedef typename ElementToWrapperMap::const_iterator ElementToWrapperMapIterator;
 
@@ -119,7 +120,7 @@ namespace WebCore {
             static ElementToWrapperMap* s_wrapperCache = new ElementToWrapperMap;                
             return s_wrapperCache;
         }
-        
+
         static void forgetWrapper(SVGAnimatedTemplate<BareType>* wrapper)
         {
             ElementToWrapperMap* cache = wrapperCache();
@@ -133,7 +134,7 @@ namespace WebCore {
             }
         }
 
-       const QualifiedName& associatedAttributeName() const { return m_associatedAttributeName; }
+        const QualifiedName& associatedAttributeName() const { return m_associatedAttributeName; }
 
     protected:
         SVGAnimatedTemplate(const QualifiedName& attributeName)
@@ -142,34 +143,193 @@ namespace WebCore {
         }
 
     private:
-       const QualifiedName& m_associatedAttributeName;
+        const QualifiedName& m_associatedAttributeName;
     };
 
     template <class Type, class SVGElementSubClass>
-    PassRefPtr<Type> lookupOrCreateWrapper(const SVGElementSubClass* element, const QualifiedName& domAttrName, const AtomicString& attrIdentifier)
+    PassRefPtr<Type> lookupOrCreateWrapper(SVGElementSubClass* element, const QualifiedName& domAttrName,
+                                           const AtomicString& attrIdentifier, void (SVGElement::*synchronizer)())
     {
         SVGAnimatedTypeWrapperKey key(element, attrIdentifier);
         RefPtr<Type> wrapper = static_cast<Type*>(Type::wrapperCache()->get(key));
+
         if (!wrapper) {
             wrapper = Type::create(element, domAttrName);
+            element->addSVGPropertySynchronizer(domAttrName, synchronizer);
             Type::wrapperCache()->set(key, wrapper.get());
         }
+
         return wrapper.release();
     }
 
-    // Common type definitions, to ease IDL generation.
-    typedef SVGAnimatedTemplate<SVGAngle*> SVGAnimatedAngle;
-    typedef SVGAnimatedTemplate<bool> SVGAnimatedBoolean;
-    typedef SVGAnimatedTemplate<int> SVGAnimatedEnumeration;
-    typedef SVGAnimatedTemplate<long> SVGAnimatedInteger;
-    typedef SVGAnimatedTemplate<SVGLength> SVGAnimatedLength;
-    typedef SVGAnimatedTemplate<SVGLengthList*> SVGAnimatedLengthList;
-    typedef SVGAnimatedTemplate<float> SVGAnimatedNumber;
-    typedef SVGAnimatedTemplate<SVGNumberList*> SVGAnimatedNumberList; 
-    typedef SVGAnimatedTemplate<SVGPreserveAspectRatio*> SVGAnimatedPreserveAspectRatio;
-    typedef SVGAnimatedTemplate<FloatRect> SVGAnimatedRect;
-    typedef SVGAnimatedTemplate<String> SVGAnimatedString;
-    typedef SVGAnimatedTemplate<SVGTransformList*> SVGAnimatedTransformList;
+    // Define SVG 1.1 standard animated properties (these SVGAnimated* classes area slo able to convert themselves to strings)
+    // Note: If we'd just specialize the SVGAnimatedTemplate<> we'd have to duplicate a lot of code above. Hence choosing
+    // the solution, to inherit from the SVGAnimatedTemplate<> classes, and implementing the virtual toString() function.
+    class SVGAnimatedAngle : public SVGAnimatedTemplate<SVGAngle*> {
+    public:
+        SVGAnimatedAngle(const QualifiedName& attributeName) : SVGAnimatedTemplate<SVGAngle*>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            if (SVGAngle* angle = baseVal())
+                return angle->valueAsString();
+
+            return nullAtom;
+        }
+    };
+
+    class SVGAnimatedBoolean : public SVGAnimatedTemplate<bool> {
+    public:
+        SVGAnimatedBoolean(const QualifiedName& attributeName) : SVGAnimatedTemplate<bool>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            return baseVal() ? "true" : "false";
+        }
+    };
+
+    class SVGAnimatedEnumeration : public SVGAnimatedTemplate<int> {
+    public:
+        SVGAnimatedEnumeration(const QualifiedName& attributeName) : SVGAnimatedTemplate<int>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            return String::number(baseVal());
+        }
+    };
+
+    class SVGAnimatedInteger : public SVGAnimatedTemplate<long> {
+    public:
+        SVGAnimatedInteger(const QualifiedName& attributeName) : SVGAnimatedTemplate<long>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            return String::number(baseVal());
+        }
+    };
+
+    class SVGAnimatedLength : public SVGAnimatedTemplate<SVGLength> {
+    public:
+        SVGAnimatedLength(const QualifiedName& attributeName) : SVGAnimatedTemplate<SVGLength>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            return baseVal().valueAsString();
+        }
+    };
+
+    class SVGAnimatedLengthList : public SVGAnimatedTemplate<SVGLengthList*> {
+    public:
+        SVGAnimatedLengthList(const QualifiedName& attributeName) : SVGAnimatedTemplate<SVGLengthList*>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            if (SVGLengthList* list = baseVal())
+                return list->valueAsString();
+
+            return nullAtom;
+        }
+    };
+
+    class SVGAnimatedNumber : public SVGAnimatedTemplate<float> {
+    public:
+        SVGAnimatedNumber(const QualifiedName& attributeName) : SVGAnimatedTemplate<float>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            return String::number(baseVal());
+        }
+    };
+
+    class SVGAnimatedNumberList : public SVGAnimatedTemplate<SVGNumberList*> {
+    public:
+        SVGAnimatedNumberList(const QualifiedName& attributeName) : SVGAnimatedTemplate<SVGNumberList*>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            if (SVGNumberList* list = baseVal())
+                return list->valueAsString();
+
+            return nullAtom;
+        }
+    };
+
+    class SVGAnimatedPreserveAspectRatio : public SVGAnimatedTemplate<SVGPreserveAspectRatio*> {
+    public:
+        SVGAnimatedPreserveAspectRatio(const QualifiedName& attributeName) : SVGAnimatedTemplate<SVGPreserveAspectRatio*>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            if (SVGPreserveAspectRatio* ratio = baseVal())
+                return ratio->valueAsString();
+
+            return nullAtom;
+        }
+    };
+
+    class SVGAnimatedRect : public SVGAnimatedTemplate<FloatRect> {
+    public:
+        SVGAnimatedRect(const QualifiedName& attributeName) : SVGAnimatedTemplate<FloatRect>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            FloatRect rect = baseVal();
+            return String::format("%f %f %f %f", rect.x(), rect.y(), rect.width(), rect.height());
+        }
+    };
+
+    class SVGAnimatedString : public SVGAnimatedTemplate<String> {
+    public:
+        SVGAnimatedString(const QualifiedName& attributeName) : SVGAnimatedTemplate<String>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            return baseVal();
+        }
+    };
+
+    class SVGAnimatedTransformList : public SVGAnimatedTemplate<SVGTransformList*> {
+    public:
+        SVGAnimatedTransformList(const QualifiedName& attributeName) : SVGAnimatedTemplate<SVGTransformList*>(attributeName) { }
+
+        virtual AtomicString toString() const
+        {
+            if (SVGTransformList* list = baseVal())
+                return list->valueAsString();
+
+            return nullAtom;
+        }
+    };
+
+    // Helper for ANIMATED_PROPERTY* macros, whose helper classes SVGAnimatedTemplate##UpperProperty.. can't
+    // inherit from SVGAnimatedTemplate<xxx> as they rely on a working toString() implementation. So instead
+    // create a new helper type SVGAnimatedType, which gets specialized for the support datatypes and in turn inherits
+    // from the SVGAnimatedTEmplate<xxx> macros. Looks a bit complicated, but makes sense if you check the macros.
+    template<typename T>
+    class SVGAnimatedType : public SVGAnimatedTemplate<T> {
+    public:
+        SVGAnimatedType(const QualifiedName& attributeName) : SVGAnimatedTemplate<T>(attributeName) { ASSERT_NOT_REACHED(); }
+    };
+
+#define ADD_ANIMATED_TYPE_HELPER(DataType, InheritFromClass) \
+    template<> \
+    class SVGAnimatedType<DataType> : public InheritFromClass { \
+    public: \
+        SVGAnimatedType(const QualifiedName& attributeName) : InheritFromClass(attributeName) { } \
+    };
+
+    ADD_ANIMATED_TYPE_HELPER(SVGAngle*, SVGAnimatedAngle)
+    ADD_ANIMATED_TYPE_HELPER(bool, SVGAnimatedBoolean)
+    ADD_ANIMATED_TYPE_HELPER(int, SVGAnimatedEnumeration)
+    ADD_ANIMATED_TYPE_HELPER(long, SVGAnimatedInteger)
+    ADD_ANIMATED_TYPE_HELPER(SVGLength, SVGAnimatedLength)
+    ADD_ANIMATED_TYPE_HELPER(SVGLengthList*, SVGAnimatedLengthList)
+    ADD_ANIMATED_TYPE_HELPER(float, SVGAnimatedNumber)
+    ADD_ANIMATED_TYPE_HELPER(SVGNumberList*, SVGAnimatedNumberList)
+    ADD_ANIMATED_TYPE_HELPER(SVGPreserveAspectRatio*, SVGAnimatedPreserveAspectRatio)
+    ADD_ANIMATED_TYPE_HELPER(FloatRect, SVGAnimatedRect)
+    ADD_ANIMATED_TYPE_HELPER(String, SVGAnimatedString)
+    ADD_ANIMATED_TYPE_HELPER(SVGTransformList*, SVGAnimatedTransformList)
 }
 
 #endif // ENABLE(SVG)
index 4d42b02..926789f 100644 (file)
@@ -93,8 +93,8 @@ protected:
         virtual void startedActiveInterval();
         virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement);
         virtual void endedActiveInterval();
-        
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+       
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGAnimationElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
 private:
         virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
         virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;
index 2e0e8c8..b41bec5 100644 (file)
@@ -47,11 +47,11 @@ namespace WebCore {
         virtual Path toPathData() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         virtual bool hasRelativeValues() const;
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGCircleElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGCircleElement, SVGLength, SVGLength, Cx, cx)
         ANIMATED_PROPERTY_DECLARATIONS(SVGCircleElement, SVGLength, SVGLength, Cy, cy)
index 845aea6..bce0d6b 100644 (file)
@@ -51,11 +51,10 @@ namespace WebCore {
         virtual SVGResource* canvasResource();
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGClipPathElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
         ANIMATED_PROPERTY_DECLARATIONS(SVGClipPathElement, int, int, ClipPathUnits, clipPathUnits)
 
         RefPtr<SVGResourceClipper> m_clipper;
index e0872a7..3aa6c59 100644 (file)
@@ -48,7 +48,7 @@ SVGComponentTransferFunctionElement::~SVGComponentTransferFunctionElement()
 }
 
 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_REFCOUNTED(SVGComponentTransferFunctionElement, SVGNumberList, NumberList, numberList, TableValues, tableValues, SVGNames::tableValuesAttr, m_tableValues)
 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)
index eadff18..d3d4e32 100644 (file)
@@ -44,6 +44,7 @@ namespace WebCore
         SVGComponentTransferFunction transferFunction() const;
 
     private:
+        ANIMATED_PROPERTY_START_DECLARATIONS(SVGComponentTransferFunctionElement)
         ANIMATED_PROPERTY_DECLARATIONS(SVGComponentTransferFunctionElement, int, int, Type, type)
         ANIMATED_PROPERTY_DECLARATIONS(SVGComponentTransferFunctionElement, SVGNumberList*, RefPtr<SVGNumberList>, TableValues, tableValues)
         ANIMATED_PROPERTY_DECLARATIONS(SVGComponentTransferFunctionElement, float, float, Slope, slope)
index ec1c994..2dad6b8 100644 (file)
@@ -36,8 +36,8 @@ SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document* doc)
     , SVGTests()
     , SVGExternalResourcesRequired()
     , SVGURIReference()
-    , m_x(0, LengthModeWidth)
-    , m_y(0, LengthModeHeight)
+    , m_x(SVGLength(0, LengthModeWidth))
+    , m_y(SVGLength(0, LengthModeHeight))
 {
 }
 
index a646a9a..63996e4 100644 (file)
@@ -51,12 +51,13 @@ namespace WebCore {
         virtual void getSubresourceAttributeStrings(Vector<String>&) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGCursorElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGCursorElement, SVGURIReference, String, Href, href)
 
+        ANIMATED_PROPERTY_START_DECLARATIONS(SVGCursorElement)
         ANIMATED_PROPERTY_DECLARATIONS(SVGCursorElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGCursorElement, SVGLength, SVGLength, Y, y)
 
index 8113a99..85c796d 100644 (file)
@@ -44,10 +44,10 @@ namespace WebCore {
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGDefsElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
     };
 
 } // namespace WebCore
index 5b2be74..2785845 100644 (file)
@@ -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, 2008 Rob Buis <buis@kde.org>
     Copyright (C) 2008 Apple Inc. All rights reserved.
 
@@ -269,6 +269,28 @@ void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls)
     svgAttributeChanged(attr->name());
 }
 
+void SVGElement::updateAnimatedSVGAttribute(StringImpl* name) const
+{
+    if (m_synchronizingSVGAttributes)
+        return;
+
+    m_synchronizingSVGAttributes = true;
+
+    if (name)
+        invokeSVGPropertySynchronizer(name);
+    else {
+        invokeAllSVGPropertySynchronizers();
+        setSynchronizedSVGAttributes(true);
+    }
+
+    m_synchronizingSVGAttributes = false;
+}
+
+void SVGElement::setSynchronizedSVGAttributes(bool value) const
+{
+    m_areSVGAttributesValid = value;
+}
+
 }
 
 #endif // ENABLE(SVG)
index 4360afe..cc7efe3 100644 (file)
 #include "SVGDocumentExtensions.h"
 #include "SVGNames.h"
 
+// Helper class for ANIMATED_PROPERTY* macros
+template<typename StoredType>
+class StoredTypeWithDirtyFlag {
+public:
+    StoredTypeWithDirtyFlag()
+        : value()
+        , dirty(false)
+    {
+    }
+
+    StoredTypeWithDirtyFlag(const StoredType& other)
+        : value(other)
+        , dirty(false)
+    {
+    }
+
+    StoredTypeWithDirtyFlag(const StoredTypeWithDirtyFlag& other)
+        : value(other.value)
+        , dirty(other.dirty)
+    {
+    }
+
+    StoredType& operator=(const StoredType& other)
+    {
+        value = other;
+        dirty = true;
+        return value;
+    }
+
+    StoredTypeWithDirtyFlag& operator=(const StoredTypeWithDirtyFlag& other)
+    {
+        value = other.value;
+        dirty = other.dirty;
+        return (*this);
+    }
+
+    bool operator==(const StoredType& other) const
+    {
+        return value == other.value;
+    }
+
+    bool operator!=(const StoredType& other) const
+    {
+        return !((*this) == other);
+    }
+
+    bool operator==(const StoredTypeWithDirtyFlag& other) const
+    {
+        return dirty == other.dirty && value == other.value;
+    }
+
+    bool operator!=(const StoredTypeWithDirtyFlag& other) const
+    {
+        return !((*this) == other);
+    }
+
+    operator StoredType() const
+    {
+        return value;    
+    }
+
+    StoredType value;
+    bool dirty;
+};
+
 #define ANIMATED_PROPERTY_EMPTY_DECLARATIONS(BareType, NullType, UpperProperty, LowerProperty) \
 public: \
     virtual BareType LowerProperty() const { ASSERT_NOT_REACHED(); return NullType; } \
     virtual void set##UpperProperty(BareType newValue) { ASSERT_NOT_REACHED(); }\
     virtual BareType LowerProperty##BaseValue() const { ASSERT_NOT_REACHED(); return NullType; } \
     virtual void set##UpperProperty##BaseValue(BareType newValue) { ASSERT_NOT_REACHED(); } \
-    virtual void start##UpperProperty() const { ASSERT_NOT_REACHED(); } \
+    virtual void synchronize##UpperProperty() { ASSERT_NOT_REACHED(); } \
+    virtual SVGElement::AnimatedPropertySynchronizer synchronizerFor##UpperProperty() { ASSERT_NOT_REACHED(); return 0; } \
+    virtual void start##UpperProperty() { ASSERT_NOT_REACHED(); } \
     virtual void stop##UpperProperty() { ASSERT_NOT_REACHED(); }
 
-#define ANIMATED_PROPERTY_FORWARD_DECLARATIONS(ForwardClass, BareType, UpperProperty, LowerProperty) \
+#define ANIMATED_PROPERTY_FORWARD_DECLARATIONS(ClassType, ForwardClass, BareType, UpperProperty, LowerProperty) \
 public: \
     virtual BareType LowerProperty() const { return ForwardClass::LowerProperty(); } \
     virtual void set##UpperProperty(BareType newValue) { ForwardClass::set##UpperProperty(newValue); } \
     virtual BareType LowerProperty##BaseValue() const { return ForwardClass::LowerProperty##BaseValue(); } \
     virtual void set##UpperProperty##BaseValue(BareType newValue) { ForwardClass::set##UpperProperty##BaseValue(newValue); } \
-    virtual void start##UpperProperty() const { ForwardClass::start##UpperProperty(); } \
+    virtual void synchronize##UpperProperty() { ForwardClass::synchronize##UpperProperty(); } \
+    virtual SVGElement::AnimatedPropertySynchronizer synchronizerFor##UpperProperty() { return static_cast<SVGElement::AnimatedPropertySynchronizer>(&ClassType::synchronize##UpperProperty); } \
+    virtual void start##UpperProperty() { ForwardClass::start##UpperProperty(); } \
     virtual void stop##UpperProperty() { ForwardClass::stop##UpperProperty(); }
 
 #define ANIMATED_PROPERTY_DECLARATIONS_INTERNAL(ClassType, ClassStorageType, BareType, StorageType, UpperProperty, LowerProperty) \
-class SVGAnimatedTemplate##UpperProperty : public SVGAnimatedTemplate<BareType> { \
+class SVGAnimatedTemplate##UpperProperty \
+: public SVGAnimatedType<BareType> \
+{ \
 public: \
-    static PassRefPtr<SVGAnimatedTemplate##UpperProperty> create(const ClassType* element, const QualifiedName& attributeName) \
+    SVGAnimatedTemplate##UpperProperty(ClassType*, const QualifiedName&); \
+    virtual ~SVGAnimatedTemplate##UpperProperty() { } \
+    static PassRefPtr<SVGAnimatedTemplate##UpperProperty> create(ClassType* element, const QualifiedName& attributeName) \
     { \
         return adoptRef(new SVGAnimatedTemplate##UpperProperty(element, attributeName)); \
     } \
@@ -70,16 +143,46 @@ public: \
     void set##UpperProperty(BareType); \
     BareType LowerProperty##BaseValue() const; \
     void set##UpperProperty##BaseValue(BareType); \
-    PassRefPtr<SVGAnimatedTemplate##UpperProperty> LowerProperty##Animated() const; \
-    void start##UpperProperty() const; \
+    PassRefPtr<SVGAnimatedTemplate##UpperProperty> LowerProperty##Animated(); \
+    void synchronize##UpperProperty(); \
+    SVGElement::AnimatedPropertySynchronizer synchronizerFor##UpperProperty(); \
+    void start##UpperProperty(); \
     void stop##UpperProperty(); \
 \
 private: \
-    StorageType m_##LowerProperty;
+    StoredTypeWithDirtyFlag<StorageType> m_##LowerProperty;
+
+#define ANIMATED_PROPERTY_START_DECLARATIONS(ClassType) \
+public: \
+    virtual void invokeSVGPropertySynchronizer(StringImpl* stringImpl) const \
+    { \
+        if (m_svgPropertyUpdateMap.contains(stringImpl)) { \
+            SVGElement::AnimatedPropertySynchronizer updateMethod = m_svgPropertyUpdateMap.get(stringImpl); \
+            (const_cast<ClassType*>(this)->*updateMethod)(); \
+        } \
+    } \
+\
+    virtual void invokeAllSVGPropertySynchronizers() const \
+    { \
+        HashMap<StringImpl*, SVGElement::AnimatedPropertySynchronizer>::const_iterator it = m_svgPropertyUpdateMap.begin(); \
+        const HashMap<StringImpl*, SVGElement::AnimatedPropertySynchronizer>::const_iterator end = m_svgPropertyUpdateMap.end(); \
+        for (; it != end; ++it) { \
+            SVGElement::AnimatedPropertySynchronizer updateMethod = it->second; \
+            (const_cast<ClassType*>(this)->*updateMethod)(); \
+        } \
+    } \
+\
+    virtual void addSVGPropertySynchronizer(const QualifiedName& attrName, SVGElement::AnimatedPropertySynchronizer method) \
+    { \
+        m_svgPropertyUpdateMap.set(attrName.localName().impl(), method); \
+    } \
+\
+private: \
+    HashMap<StringImpl*, SVGElement::AnimatedPropertySynchronizer> m_svgPropertyUpdateMap;
 
 #define ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassType, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, ContextElement) \
-ClassName::SVGAnimatedTemplate##UpperProperty::SVGAnimatedTemplate##UpperProperty(const ClassType* element, const QualifiedName& attributeName) \
-: SVGAnimatedTemplate<BareType>(attributeName), m_element(const_cast<ClassType*>(element)) { } \
+ClassName::SVGAnimatedTemplate##UpperProperty::SVGAnimatedTemplate##UpperProperty(ClassType* element, const QualifiedName& attributeName) \
+: SVGAnimatedType<BareType>(attributeName), m_element(element) { } \
 \
 BareType ClassName::SVGAnimatedTemplate##UpperProperty::baseVal() const \
 { \
@@ -104,49 +207,74 @@ BareType ClassName::LowerProperty() const \
 void ClassName::set##UpperProperty(BareType newValue) \
 { \
     m_##LowerProperty = newValue; \
+\
+    SVGElement* context = ContextElement; \
+    ASSERT(context); \
+    context->setSynchronizedSVGAttributes(false); \
 } \
 BareType ClassName::LowerProperty##BaseValue() const \
 { \
-    const SVGElement* context = ContextElement; \
+    SVGElement* context = ContextElement; \
     ASSERT(context); \
     SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
-    if (extensions && extensions->hasBaseValue<BareType>(context, AttrName)) \
-         return extensions->baseValue<BareType>(context, AttrName); \
+    if (extensions && extensions->hasBaseValue<BareType>(context, AttrName.localName())) \
+         return extensions->baseValue<BareType>(context, AttrName.localName()); \
     return LowerProperty(); \
 } \
+\
 void ClassName::set##UpperProperty##BaseValue(BareType newValue) \
 { \
-    const SVGElement* context = ContextElement; \
+    SVGElement* context = ContextElement; \
     ASSERT(context); \
     SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
-    if (extensions && extensions->hasBaseValue<BareType>(context, AttrName)) { \
-        extensions->setBaseValue<BareType>(context, AttrName, newValue); \
+    if (extensions && extensions->hasBaseValue<BareType>(context, AttrName.localName())) { \
+        extensions->setBaseValue<BareType>(context, AttrName.localName(), newValue); \
         return; \
     } \
     /* Only update stored property, if not animating */ \
     set##UpperProperty(newValue); \
 } \
 \
-void ClassName::start##UpperProperty() const \
+void ClassName::synchronize##UpperProperty() \
 { \
-    const SVGElement* context = ContextElement; \
+    if (!m_##LowerProperty.dirty) \
+        return; \
+    SVGElement* context = ContextElement; \
+    ASSERT(context); \
+    RefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> animatedClass(LowerProperty##Animated()); \
+    ASSERT(animatedClass); \
+    AtomicString value(animatedClass->toString()); \
+    NamedAttrMap* namedAttrMap = context->attributes(false); \
+    Attribute* old = namedAttrMap->getAttributeItem(AttrName); \
+    if (old && value.isNull()) \
+        namedAttrMap->removeAttribute(old->name()); \
+    else if (!old && !value.isNull()) \
+        namedAttrMap->addAttribute(context->createAttribute(QualifiedName(nullAtom, AttrName.localName(), nullAtom), value)); \
+    else if (old && !value.isNull()) \
+        old->setValue(value); \
+    m_##LowerProperty.dirty = false; \
+} \
+\
+void ClassName::start##UpperProperty() \
+{ \
+    SVGElement* context = ContextElement; \
     ASSERT(context); \
     SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
     if (extensions) { \
-        ASSERT(!extensions->hasBaseValue<BareType>(context, AttrName)); \
-        extensions->setBaseValue<BareType>(context, AttrName, LowerProperty()); \
+        ASSERT(!extensions->hasBaseValue<BareType>(context, AttrName.localName())); \
+        extensions->setBaseValue<BareType>(context, AttrName.localName(), LowerProperty()); \
     } \
 } \
 \
 void ClassName::stop##UpperProperty() \
 { \
-    const SVGElement* context = ContextElement; \
+    SVGElement* context = ContextElement; \
     ASSERT(context); \
     SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
     if (extensions) { \
-        ASSERT(extensions->hasBaseValue<BareType>(context, AttrName)); \
-        set##UpperProperty(extensions->baseValue<BareType>(context, AttrName)); \
-        extensions->removeBaseValue<BareType>(context, AttrName); \
+        ASSERT(extensions->hasBaseValue<BareType>(context, AttrName.localName())); \
+        set##UpperProperty(extensions->baseValue<BareType>(context, AttrName.localName())); \
+        extensions->removeBaseValue<BareType>(context, AttrName.localName()); \
     } \
 }
 
@@ -158,24 +286,44 @@ ANIMATED_PROPERTY_DECLARATIONS_INTERNAL(SVGElement, RefPtr<SVGElement>, BareType
 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.localName(), StorageGetter, contextElement()) \
-PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
+ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, SVGElement, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, const_cast<ClassName*>(this)->contextElement()) \
+PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() \
 { \
-    const SVGElement* context = contextElement(); \
+    SVGElement* context = contextElement(); \
     ASSERT(context); \
-    return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, SVGElement>(context, AttrName, AttrName.localName()); \
+    return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, SVGElement>(context, AttrName, AttrName.localName(), context->synchronizerFor##UpperProperty()); \
+} \
+\
+SVGElement::AnimatedPropertySynchronizer ClassName::synchronizerFor##UpperProperty() \
+{ \
+    ASSERT_NOT_REACHED(); \
+    return 0; \
 }
 
+#define ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED_WITH_CONTEXT(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(ClassName, BareType*, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, static_cast<RefPtr<BareType> >(StorageGetter).get())
+
 #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 \
+ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, const_cast<ClassName*>(this)) \
+PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() \
+{ \
+    return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, ClassName>(this, AttrName, AttrIdentifier, synchronizerFor##UpperProperty()); \
+} \
+\
+SVGElement::AnimatedPropertySynchronizer ClassName::synchronizerFor##UpperProperty() \
 { \
-    return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, ClassName>(this, AttrName, AttrIdentifier); \
+    return static_cast<SVGElement::AnimatedPropertySynchronizer>(&ClassName::synchronize##UpperProperty); \
 }
 
+#define ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED_WITH_CUSTOM_IDENTIFIER(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrIdentifier, StorageGetter) \
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType*, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrIdentifier, static_cast<RefPtr<BareType> >(StorageGetter).get())
+
 #define ANIMATED_PROPERTY_DEFINITIONS(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
 ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrName.localName(), StorageGetter)
 
+#define ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
+ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType*, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrName.localName(), static_cast<RefPtr<BareType> >(StorageGetter).get())
+
 namespace WebCore {
 
     class SVGPreserveAspectRatio;
@@ -229,6 +377,7 @@ namespace WebCore {
         virtual AffineTransform* supplementalTransform() { return 0; }
 
         // Forwarded properties (declared/defined anywhere else in the inheritance structure)
+        typedef void (SVGElement::*AnimatedPropertySynchronizer)();
 
         // -> For SVGURIReference
         ANIMATED_PROPERTY_EMPTY_DECLARATIONS(String, String(), Href, href)
@@ -242,6 +391,13 @@ namespace WebCore {
 
         virtual bool dispatchEvent(PassRefPtr<Event> e, ExceptionCode& ec, bool tempEvent = false);
 
+        virtual void invokeSVGPropertySynchronizer(StringImpl*) const { }
+        virtual void invokeAllSVGPropertySynchronizers() const { }
+        virtual void addSVGPropertySynchronizer(const QualifiedName&, AnimatedPropertySynchronizer) { ASSERT_NOT_REACHED(); }
+
+        virtual void updateAnimatedSVGAttribute(StringImpl*) const;
+        virtual void setSynchronizedSVGAttributes(bool) const;
+
     private:
         void addSVGEventListener(const AtomicString& eventType, const Attribute*);
         virtual bool haveLoadedRequiredResources();
index 0f32ed2..a8d1bc4 100644 (file)
@@ -37,10 +37,10 @@ SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document* doc
     , SVGTests()
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
-    , m_cx(this, LengthModeWidth)
-    , m_cy(this, LengthModeHeight)
-    , m_rx(this, LengthModeWidth)
-    , m_ry(this, LengthModeHeight)
+    , m_cx(SVGLength(this, LengthModeWidth))
+    , m_cy(SVGLength(this, LengthModeHeight))
+    , m_rx(SVGLength(this, LengthModeWidth))
+    , m_ry(SVGLength(this, LengthModeHeight))
 {
 }    
 
index 01e8ef5..473edb6 100644 (file)
@@ -47,11 +47,11 @@ namespace WebCore {
         virtual Path toPathData() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         virtual bool hasRelativeValues() const;
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGEllipseElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
  
         ANIMATED_PROPERTY_DECLARATIONS(SVGEllipseElement, SVGLength, SVGLength, Cx, cx)
         ANIMATED_PROPERTY_DECLARATIONS(SVGEllipseElement, SVGLength, SVGLength, Cy, cy)
index 4078794..ca207b2 100644 (file)
@@ -50,7 +50,7 @@ namespace WebCore {
         bool isKnownAttribute(const QualifiedName&);
 
     protected:
-        virtual const SVGElement* contextElement() const = 0;
+        virtual SVGElement* contextElement() = 0;
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS_WITH_CONTEXT(SVGExternalResourcesRequired, bool, bool, ExternalResourcesRequired, externalResourcesRequired)
index 72185e4..8595c4c 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore
         virtual SVGFEBlend* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEBlendElement, String, String, In1, in1)
index 6d4db8a..284408a 100644 (file)
@@ -45,7 +45,7 @@ SVGFEColorMatrixElement::~SVGFEColorMatrixElement()
 
 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())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGFEColorMatrixElement, SVGNumberList, NumberList, numberList, Values, values, SVGNames::valuesAttr, m_values)
 
 void SVGFEColorMatrixElement::parseMappedAttribute(MappedAttribute* attr)
 {
index bda0553..43fa4bb 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore
         virtual SVGFEColorMatrix* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEColorMatrixElement, String, String, In1, in1)
index 02958b1..f39c4e9 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore
         virtual SVGFEComponentTransfer* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEComponentTransferElement, String, String, In1, in1)
index 841a677..2503c39 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore
         virtual SVGFEComposite* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFECompositeElement, String, String, In1, in1)
index d5e9ede..89b37c7 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
         virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEDiffuseLightingElement, String, String, In1, in1)
index 42dacc1..2e2c1a8 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
         virtual SVGFEDisplacementMap* filterEffect(SVGResourceFilter*) const;
         
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEDisplacementMapElement, String, String, In1, in1)
index af4e982..2a1d254 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore
         virtual SVGFEFlood* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         mutable RefPtr<SVGFEFlood> m_filterEffect;
index 5a04f12..6ff8fe2 100644 (file)
@@ -42,7 +42,7 @@ namespace WebCore
         virtual SVGFEGaussianBlur* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEGaussianBlurElement, String, String, In1, in1)
index 0dfd7fc..f7c646b 100644 (file)
@@ -53,7 +53,7 @@ SVGFEImageElement::~SVGFEImageElement()
         m_cachedImage->removeClient(this);
 }
 
-ANIMATED_PROPERTY_DEFINITIONS(SVGFEImageElement, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio.get())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGFEImageElement, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio)
 
 void SVGFEImageElement::parseMappedAttribute(MappedAttribute* attr)
 {
index 8bf2ac0..f017fe4 100644 (file)
@@ -52,11 +52,11 @@ namespace WebCore {
         virtual SVGFEImage* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFEImageElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFEImageElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
  
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEImageElement, SVGPreserveAspectRatio*, RefPtr<SVGPreserveAspectRatio>, PreserveAspectRatio, preserveAspectRatio)
 
@@ -68,5 +68,3 @@ namespace WebCore {
 
 #endif // ENABLE(SVG)
 #endif
-
-// vim:ts=4:noet
index 439c90e..160de81 100644 (file)
@@ -40,6 +40,7 @@ namespace WebCore
         virtual void parseMappedAttribute(MappedAttribute*);
 
     private:
+        ANIMATED_PROPERTY_START_DECLARATIONS(SVGFELightElement)
         ANIMATED_PROPERTY_DECLARATIONS(SVGFELightElement, float, float, Azimuth, azimuth)
         ANIMATED_PROPERTY_DECLARATIONS(SVGFELightElement, float, float, Elevation, elevation)
         ANIMATED_PROPERTY_DECLARATIONS(SVGFELightElement, float, float, X, x)
index eefedee..162f69e 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore
         virtual SVGFEMerge* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         mutable RefPtr<SVGFEMerge> m_filterEffect;
index c601fde..68ca5f3 100644 (file)
@@ -37,9 +37,10 @@ namespace WebCore
         virtual void parseMappedAttribute(MappedAttribute*);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
+        ANIMATED_PROPERTY_START_DECLARATIONS(SVGFEMergeNodeElement)
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEMergeNodeElement, String, String, In1, in1)
     };
 
index 2cc5197..c91b265 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore
         virtual SVGFEOffset* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFEOffsetElement, String, String, In1, in1)
index aa9fd3e..f326391 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore
         virtual SVGFESpecularLighting* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFESpecularLightingElement, String, String, In1, in1)
index 2287d69..e4031ae 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore
         virtual SVGFETile* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFETileElement, String, String, In1, in1)
index 7df6f5f..1964cf7 100644 (file)
@@ -45,7 +45,7 @@ namespace WebCore
         virtual SVGFETurbulence* filterEffect(SVGResourceFilter*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFETurbulenceElement, float, float, BaseFrequencyX, baseFrequencyX)
index a7dacea..890d912 100644 (file)
@@ -42,10 +42,10 @@ SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document* doc)
     , SVGExternalResourcesRequired()
     , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
     , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
     , m_filterResX(0)
     , m_filterResY(0)
 {
index f2d9773..d892c1a 100644 (file)
@@ -51,11 +51,11 @@ namespace WebCore {
         virtual bool rendererIsNeeded(RenderStyle*) { return false; }
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFilterElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFilterElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
  
         ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, int, int, FilterUnits, filterUnits)
         ANIMATED_PROPERTY_DECLARATIONS(SVGFilterElement, int, int, PrimitiveUnits, primitiveUnits)
@@ -73,5 +73,3 @@ namespace WebCore {
 
 #endif // ENABLE(SVG)
 #endif
-
-// vim:ts=4:noet
index eae0434..4512db8 100644 (file)
@@ -36,10 +36,10 @@ namespace WebCore {
 
 SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document* doc)
     : SVGStyledElement(tagName, doc)
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
 {
     // Spec: If the attribute is not specified, the effect is as if a value of "0%" were specified.
     setXBaseValue(SVGLength(this, LengthModeWidth, "0%"));
index b639282..6259959 100644 (file)
@@ -47,7 +47,7 @@ namespace WebCore {
         void setStandardAttributes(SVGFilterEffect*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGFilterPrimitiveStandardAttributes, SVGLength, SVGLength, X, x)
index 2cf3dd7..013cd07 100644 (file)
@@ -46,7 +46,7 @@ SVGFitToViewBox::~SVGFitToViewBox()
 }
 
 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())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED_WITH_CONTEXT(SVGFitToViewBox, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio)
 
 bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, float& x, float& y, float& w, float& h, bool validate)
 {
index 16ea1c2..bd62fec 100644 (file)
 
 #if ENABLE(SVG)
 #include "SVGElement.h"
+#include "SVGPreserveAspectRatio.h"
 
 namespace WebCore {
 
     class AffineTransform;
-    class SVGPreserveAspectRatio;
 
     class SVGFitToViewBox {
     public:
@@ -44,7 +44,7 @@ namespace WebCore {
         bool isKnownAttribute(const QualifiedName&);
 
     protected:
-        virtual const SVGElement* contextElement() const = 0;
+        virtual SVGElement* contextElement() = 0;
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS_WITH_CONTEXT(SVGFitToViewBox, FloatRect, FloatRect, ViewBox, viewBox)
index 4d0370b..4bf17e6 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore {
         virtual ~SVGFontElement();
 
         virtual bool rendererIsNeeded(RenderStyle*) { return false; }    
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
         void invalidateGlyphCache();
 
index d48a1f8..49fc464 100644 (file)
@@ -39,10 +39,10 @@ SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, D
     , SVGTests()
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
 {
 }
 
index f0c9830..56144d4 100644 (file)
@@ -49,11 +49,11 @@ namespace WebCore {
         virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGForeignObjectElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGForeignObjectElement, SVGURIReference, String, Href, href)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGForeignObjectElement, SVGLength, SVGLength, Y, y)
index 9237ef8..9dfaa21 100644 (file)
@@ -48,10 +48,10 @@ namespace WebCore {
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGGElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
 
     private:
         friend class SVGUseElement;
index 4cd527f..0805a38 100644 (file)
@@ -53,7 +53,7 @@ SVGGradientElement::~SVGGradientElement()
 }
 
 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_REFCOUNTED(SVGGradientElement, SVGTransformList, TransformList, transformList, GradientTransform, gradientTransform, SVGNames::gradientTransformAttr, m_gradientTransform)
 ANIMATED_PROPERTY_DEFINITIONS(SVGGradientElement, int, Enumeration, enumeration, SpreadMethod, spreadMethod, SVGNames::spreadMethodAttr, m_spreadMethod)
 
 void SVGGradientElement::parseMappedAttribute(MappedAttribute* attr)
index 25579d0..ce838c4 100644 (file)
 #define SVGGradientElement_h
 
 #if ENABLE(SVG)
-#include "SVGPaintServerGradient.h"
 #include "SVGExternalResourcesRequired.h"
+#include "SVGPaintServerGradient.h"
 #include "SVGStyledElement.h"
+#include "SVGTransformlist.h"
 #include "SVGURIReference.h"
 
 namespace WebCore {
 
     class SVGGradientElement;
-    class SVGTransformList;
 
     class SVGGradientElement : public SVGStyledElement,
                                public SVGURIReference,
@@ -68,8 +68,8 @@ namespace WebCore {
         mutable RefPtr<SVGPaintServerGradient> m_resource;
  
     protected:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGGradientElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGGradientElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
  
         ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, int, int, SpreadMethod, spreadMethod)
         ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, int, int, GradientUnits, gradientUnits)
index 894f560..dd76aba 100644 (file)
@@ -43,10 +43,10 @@ SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document* doc)
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
     , SVGURIReference()
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
     , m_preserveAspectRatio(SVGPreserveAspectRatio::create())
     , m_imageLoader(this)
 {
@@ -60,7 +60,7 @@ ANIMATED_PROPERTY_DEFINITIONS(SVGImageElement, SVGLength, Length, length, X, 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())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGImageElement, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr, m_preserveAspectRatio)
 
 void SVGImageElement::parseMappedAttribute(MappedAttribute *attr)
 {
index 483d0fd..b30dc3e 100644 (file)
 
 #if ENABLE(SVG)
 #include "SVGExternalResourcesRequired.h"
-#include "SVGLangSpace.h"
 #include "SVGImageLoader.h"
+#include "SVGLangSpace.h"
+#include "SVGPreserveAspectRatio.h"
 #include "SVGStyledTransformableElement.h"
 #include "SVGTests.h"
 #include "SVGURIReference.h"
 
 namespace WebCore {
 
-    class SVGPreserveAspectRatio;
     class SVGLength;
 
     class SVGImageElement : public SVGStyledTransformableElement,
@@ -62,11 +62,11 @@ namespace WebCore {
         virtual bool hasRelativeValues() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGImageElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGImageElement, SVGURIReference, String, Href, href)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGImageElement, SVGLength, SVGLength, Y, y)
index c2d8160..dfff47f 100644 (file)
@@ -59,6 +59,22 @@ void SVGLengthList::parse(const String& value, const SVGStyledElement* context,
     }
 }
 
+String SVGLengthList::valueAsString() const
+{
+    String result;
+
+    ExceptionCode ec = 0;
+    for (unsigned int i = 0; i < numberOfItems(); ++i) {
+        if (i > 0)
+            result += ", ";
+
+        result += getItem(i, ec).valueAsString();
+        ASSERT(ec == 0);
+    }
+
+    return result;
+}
+
 }
 
 #endif // ENABLE(SVG)
index a2c615d..d295a79 100644 (file)
@@ -35,7 +35,9 @@ namespace WebCore {
         virtual ~SVGLengthList();
 
         void parse(const String& value, const SVGStyledElement* context, SVGLengthMode mode);
-        
+        String valueAsString() const;
+
     private:
         SVGLengthList(const QualifiedName&);
     };
index 3b664d1..c006360 100644 (file)
@@ -37,10 +37,10 @@ SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document* doc)
     , SVGTests()
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
-    , m_x1(this, LengthModeWidth)
-    , m_y1(this, LengthModeHeight)
-    , m_x2(this, LengthModeWidth)
-    , m_y2(this, LengthModeHeight)
+    , m_x1(SVGLength(this, LengthModeWidth))
+    , m_y1(SVGLength(this, LengthModeHeight))
+    , m_x2(SVGLength(this, LengthModeWidth))
+    , m_y2(SVGLength(this, LengthModeHeight))
 {
 }
 
index c6dbc08..e6e8329 100644 (file)
@@ -51,11 +51,11 @@ namespace WebCore {
         virtual bool supportsMarkers() const { return true; }
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         virtual bool hasRelativeValues() const;
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGLineElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
  
         ANIMATED_PROPERTY_DECLARATIONS(SVGLineElement, SVGLength, SVGLength, X1, x1)
         ANIMATED_PROPERTY_DECLARATIONS(SVGLineElement, SVGLength, SVGLength, Y1, y1)
index 6cddf07..5b5b1e1 100644 (file)
@@ -38,10 +38,10 @@ namespace WebCore {
 
 SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document* doc)
     : SVGGradientElement(tagName, doc)
-    , m_x1(this, LengthModeWidth)
-    , m_y1(this, LengthModeHeight)
-    , m_x2(this, LengthModeWidth)
-    , m_y2(this, LengthModeHeight)
+    , m_x1(SVGLength(this, LengthModeWidth))
+    , m_y1(SVGLength(this, LengthModeHeight))
+    , m_x2(SVGLength(this, LengthModeWidth))
+    , m_y2(SVGLength(this, LengthModeHeight))
 {
     // Spec: If the attribute is not specified, the effect is as if a value of "100%" were specified.
     setX2BaseValue(SVGLength(this, LengthModeWidth, "100%"));
index 496585e..6153d73 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
         LinearGradientAttributes collectGradientProperties() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGLinearGradientElement, SVGLength, SVGLength, X1, x1)
index 1e84cc7..4f0c71b 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
         SVGPathElement* pathElement();
         
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
     };
 
 } // namespace WebCore
index 3cd1e97..3bd79b2 100644 (file)
@@ -39,10 +39,10 @@ SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document* doc)
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
     , SVGFitToViewBox()
-    , m_refX(this, LengthModeWidth)
-    , m_refY(this, LengthModeHeight)
-    , m_markerWidth(this, LengthModeWidth)
-    , m_markerHeight(this, LengthModeHeight) 
+    , m_refX(SVGLength(this, LengthModeWidth))
+    , m_refY(SVGLength(this, LengthModeHeight))
+    , m_markerWidth(SVGLength(this, LengthModeWidth))
+    , m_markerHeight(SVGLength(this, LengthModeHeight))
     , m_markerUnits(SVG_MARKERUNITS_STROKEWIDTH)
     , m_orientType(0)
     , m_orientAngle(SVGAngle::create())
@@ -62,7 +62,7 @@ ANIMATED_PROPERTY_DEFINITIONS(SVGMarkerElement, int, Enumeration, enumeration, M
 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())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED_WITH_CUSTOM_IDENTIFIER(SVGMarkerElement, SVGAngle, Angle, angle, OrientAngle, orientAngle, SVGNames::orientAttr, "orientAngle", m_orientAngle)
 
 void SVGMarkerElement::parseMappedAttribute(MappedAttribute* attr)
 {
index eda6ea4..26c2747 100644 (file)
@@ -32,9 +32,6 @@
 
 namespace WebCore {
 
-    class Document;
-    class SVGAngle;
-    
     class SVGMarkerElement : public SVGStyledElement,
                              public SVGLangSpace,
                              public SVGExternalResourcesRequired,
@@ -66,12 +63,12 @@ namespace WebCore {
         virtual SVGResource* canvasResource();
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGMarkerElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired) 
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGMarkerElement, SVGFitToViewBox, FloatRect, ViewBox, viewBox)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGMarkerElement, SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGLength, SVGLength, RefX, refX)
         ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGLength, SVGLength, RefY, refY)
index 723fefa..393afb7 100644 (file)
@@ -50,10 +50,10 @@ SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document* doc)
     , SVGExternalResourcesRequired()
     , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
     , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
 {
     // Spec: If the attribute is not specified, the effect is as if a value of "-10%" were specified.
     setXBaseValue(SVGLength(this, LengthModeWidth, "-10%"));
index cd44baf..2a66ac6 100644 (file)
@@ -54,9 +54,9 @@ namespace WebCore {
         std::auto_ptr<ImageBuffer> drawMaskerContent(const FloatRect& targetRect, FloatRect& maskRect) const;
 
     protected:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-            
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGMaskElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGMaskElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+
         ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, int, int, MaskUnits, maskUnits)
         ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, int, int, MaskContentUnits, maskContentUnits)
  
@@ -65,7 +65,7 @@ namespace WebCore {
         ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGLength, SVGLength, Width, width)
         ANIMATED_PROPERTY_DECLARATIONS(SVGMaskElement, SVGLength, SVGLength, Height, height)
 
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         RefPtr<SVGResourceMasker> m_masker;
index 7931eca..be1e895 100644 (file)
@@ -54,6 +54,22 @@ void SVGNumberList::parse(const String& value)
     }
 }
 
+String SVGNumberList::valueAsString() const
+{
+    String result;
+
+    ExceptionCode ec = 0;
+    for (unsigned int i = 0; i < numberOfItems(); ++i) {
+        if (i > 0)
+            result += ", ";
+
+        result += String::number(getItem(i, ec));
+        ASSERT(ec == 0);
+    }
+
+    return result;
+}
+
 }
 
 #endif // ENABLE(SVG)
index cd5957b..6cd43ff 100644 (file)
@@ -37,7 +37,9 @@ namespace WebCore {
         virtual ~SVGNumberList();
 
         void parse(const String& value);
-        
+        String valueAsString() const;
+
     private:
         SVGNumberList(const QualifiedName&);
     };
index 140e8b1..6258fa9 100644 (file)
@@ -101,13 +101,12 @@ namespace WebCore {
         virtual bool supportsMarkers() const { return true; }
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         mutable RefPtr<SVGPathSegList> m_pathSegList;
 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGPathElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
         ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement, float, float, PathLength, pathLength)
     };
 
index dda42d7..350a4a9 100644 (file)
@@ -57,10 +57,10 @@ SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document* doc
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
     , SVGFitToViewBox()
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
     , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
     , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
     , m_patternTransform(SVGTransformList::create(SVGNames::patternTransformAttr))
@@ -77,7 +77,7 @@ ANIMATED_PROPERTY_DEFINITIONS(SVGPatternElement, SVGLength, Length, length, X, 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())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGPatternElement, SVGTransformList, TransformList, transformList, PatternTransform, patternTransform, SVGNames::patternTransformAttr, m_patternTransform)
 
 void SVGPatternElement::parseMappedAttribute(MappedAttribute* attr)
 {
index 6b00a62..18161b2 100644 (file)
 #define SVGPatternElement_h
 
 #if ENABLE(SVG)
-#include "SVGPaintServerPattern.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
 #include "SVGLangSpace.h"
+#include "SVGPaintServerPattern.h"
 #include "SVGStyledElement.h"
 #include "SVGTests.h"
+#include "SVGTransformList.h"
 #include "SVGURIReference.h"
 
-
 namespace WebCore {
 
     struct PatternAttributes;
  
     class SVGLength;
-    class SVGTransformList;
 
     class SVGPatternElement : public SVGStyledElement,
                               public SVGURIReference,
@@ -60,10 +59,10 @@ namespace WebCore {
         virtual SVGResource* canvasResource();
 
     protected:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGPatternElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGPatternElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGPatternElement, SVGFitToViewBox, FloatRect, ViewBox, viewBox)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGPatternElement, SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGLength, SVGLength, Y, y)
@@ -75,7 +74,7 @@ namespace WebCore {
 
         mutable RefPtr<SVGPaintServerPattern> m_resource;
 
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         friend class SVGPaintServerPattern;
index 09ce1df..9fadd7d 100644 (file)
@@ -53,13 +53,13 @@ namespace WebCore {
         virtual bool supportsMarkers() const { return true; }
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         bool m_ignoreAttributeChanges : 1;
         mutable RefPtr<SVGPointList> m_points;
 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGPolyElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
     };
 
 } // namespace WebCore
index 0709b9d..0388939 100644 (file)
@@ -202,6 +202,59 @@ AffineTransform SVGPreserveAspectRatio::getCTM(double logicX, double logicY,
     return temp;
 }
 
+String SVGPreserveAspectRatio::valueAsString() const
+{
+    String result;
+
+    switch ((SVGPreserveAspectRatioType) align()) {
+    default:
+    case SVG_PRESERVEASPECTRATIO_NONE:
+        result = "none";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMINYMIN:
+        result = "xMinYMin";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMIDYMIN:
+        result = "xMidYMin";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMAXYMIN:
+        result = "xMaxYMin";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMINYMID:
+        result = "xMinYMid";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMIDYMID:
+        result = "xMidYMid";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMAXYMID:
+        result = "xMaxYMid";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMINYMAX:
+        result = "xMinYMax";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMIDYMAX:
+        result = "xMidYMax";
+        break;
+    case SVG_PRESERVEASPECTRATIO_XMAXYMAX:
+        result = "xMaxYMax";
+        break;
+    };
+
+    switch ((SVGMeetOrSliceType) meetOrSlice()) {
+    default:
+    case SVG_MEETORSLICE_UNKNOWN:
+        break;
+    case SVG_MEETORSLICE_MEET:
+        result += " meet";
+        break;
+    case SVG_MEETORSLICE_SLICE:
+        result += " slice";
+        break;
+    };
+
+    return result;
+}
+
 }
 
 #endif // ENABLE(SVG)
index a1bed65..0dfe940 100644 (file)
@@ -74,6 +74,7 @@ namespace WebCore {
 
         // Helper
         bool parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate = true);
+        String valueAsString() const;
 
         const QualifiedName& associatedAttributeName() const { return SVGNames::preserveAspectRatioAttr; }
 
index 9ec5eb8..e663a74 100644 (file)
@@ -41,11 +41,11 @@ namespace WebCore {
 
 SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document* doc)
     : SVGGradientElement(tagName, doc)
-    , m_cx(this, LengthModeWidth)
-    , m_cy(this, LengthModeHeight)
-    , m_r(this, LengthModeOther)
-    , m_fx(this, LengthModeWidth)
-    , m_fy(this, LengthModeHeight)
+    , m_cx(SVGLength(this, LengthModeWidth))
+    , m_cy(SVGLength(this, LengthModeHeight))
+    , m_r(SVGLength(this, LengthModeOther))
+    , m_fx(SVGLength(this, LengthModeWidth))
+    , m_fy(SVGLength(this, LengthModeHeight))
 {
     // Spec: If the attribute is not specified, the effect is as if a value of "50%" were specified.
     setCxBaseValue(SVGLength(this, LengthModeWidth, "50%"));
index 7007ea5..d243464 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
         RadialGradientAttributes collectGradientProperties() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGRadialGradientElement, SVGLength, SVGLength, Cx, cx)
index 30aa544..a77ae1b 100644 (file)
@@ -36,12 +36,12 @@ SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document *doc)
     , SVGTests()
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
-    , m_rx(this, LengthModeWidth)
-    , m_ry(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
+    , m_rx(SVGLength(this, LengthModeWidth))
+    , m_ry(SVGLength(this, LengthModeHeight))
 {
 }
 
index 244a6ef..8fbe430 100644 (file)
@@ -47,11 +47,11 @@ namespace WebCore {
         virtual Path toPathData() const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
         virtual bool hasRelativeValues() const;
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGRectElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGRectElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGRectElement, SVGLength, SVGLength, Y, y)
index a36a5ed..410950f 100644 (file)
@@ -61,10 +61,10 @@ SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document* doc)
     , SVGExternalResourcesRequired()
     , SVGFitToViewBox()
     , SVGZoomAndPan()
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
     , m_useCurrentView(false)
     , m_timeContainer(SMILTimeContainer::create(this))
     , m_viewSpec(0)
@@ -184,7 +184,7 @@ void SVGSVGElement::setUseCurrentView(bool currentView)
 SVGViewSpec* SVGSVGElement::currentView() const
 {
     if (!m_viewSpec)
-        m_viewSpec.set(new SVGViewSpec(this));
+        m_viewSpec.set(new SVGViewSpec(const_cast<SVGSVGElement*>(this)));
 
     return m_viewSpec.get();
 }
index 0360c6c..08818b7 100644 (file)
@@ -135,7 +135,7 @@ namespace WebCore
         void inheritViewAttributes(SVGViewElement*);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
         friend class RenderSVGRoot;
         friend class RenderSVGViewportContainer;
@@ -147,9 +147,9 @@ namespace WebCore
     private:
         void addSVGWindowEventListener(const AtomicString& eventType, const Attribute* attr);   
 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSVGElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSVGElement, SVGFitToViewBox, FloatRect, ViewBox, viewBox)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSVGElement, SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Y, y)
index 8ea374a..1a05dd0 100644 (file)
@@ -48,11 +48,12 @@ namespace WebCore
         virtual void getSubresourceAttributeStrings(Vector<String>&) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_START_DECLARATIONS(SVGScriptElement)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGScriptElement, SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGScriptElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
 
         String m_type;
     };
index bef286c..040d1b1 100644 (file)
@@ -71,6 +71,7 @@ namespace WebCore {
         static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
 
     private:
+        ANIMATED_PROPERTY_START_DECLARATIONS(SVGStyledElement)
         ANIMATED_PROPERTY_DECLARATIONS(SVGStyledElement, String, String, ClassName, className)
 
         void updateElementInstance(SVGDocumentExtensions*) const;
index b034028..be78b1d 100644 (file)
@@ -46,7 +46,7 @@ SVGStyledTransformableElement::~SVGStyledTransformableElement()
 {
 }
 
-ANIMATED_PROPERTY_DEFINITIONS(SVGStyledTransformableElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform.get())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGStyledTransformableElement, SVGTransformList, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform)
 
 AffineTransform SVGStyledTransformableElement::getCTM() const
 {
index bfefdce..fd6f29c 100644 (file)
 #if ENABLE(SVG)
 #include "SVGStyledLocatableElement.h"
 #include "SVGTransformable.h"
+#include "SVGTransformList.h"
 
 namespace WebCore {
 
     class AffineTransform;
-    class SVGTransformList;
 
     class SVGStyledTransformableElement : public SVGStyledLocatableElement,
                                           public SVGTransformable {
index 3bfc275..7c442be 100644 (file)
@@ -47,12 +47,12 @@ namespace WebCore
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         mutable bool m_insideRenderSection;
 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSwitchElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
     };
 
 } // namespace WebCore
index eaa0b94..c52fe69 100644 (file)
@@ -46,11 +46,11 @@ namespace WebCore
         virtual bool rendererIsNeeded(RenderStyle*) { return false; }
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
  
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)       
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSymbolElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)       
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSymbolElement, SVGFitToViewBox, FloatRect, ViewBox, viewBox)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGSymbolElement, SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
     };
 
 } // namespace WebCore
index 16ea5c3..0e76974 100644 (file)
@@ -41,10 +41,10 @@ namespace WebCore
         bool childShouldCreateRenderer(Node*) const;
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGTRefElement, SVGURIReference, String, Href, href)
 
         void updateReferencedText();
     };
index f2d0303..78aa8d7 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore
         bool childShouldCreateRenderer(Node*) const;
     
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
     };
 
 } // namespace WebCore
index 059f9d4..05f9c7f 100644 (file)
@@ -46,7 +46,7 @@ SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum
     , SVGTests()
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
-    , m_textLength(this, LengthModeOther)
+    , m_textLength(SVGLength(this, LengthModeOther))
     , m_lengthAdjust(LENGTHADJUST_SPACING)
 {
 }
index b36b098..5591cfe 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
         bool isKnownAttribute(const QualifiedName&);
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGTextContentElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGTextContentElement, SVGLength, SVGLength, TextLength, textLength)
         ANIMATED_PROPERTY_DECLARATIONS(SVGTextContentElement, int, int, LengthAdjust, lengthAdjust)
index d132064..99b3558 100644 (file)
@@ -46,7 +46,7 @@ SVGTextElement::~SVGTextElement()
 {
 }
 
-ANIMATED_PROPERTY_DEFINITIONS(SVGTextElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform.get())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGTextElement, SVGTransformList, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform)
 
 void SVGTextElement::parseMappedAttribute(MappedAttribute* attr)
 {
index 19c5f4b..15b2cbd 100644 (file)
@@ -26,6 +26,7 @@
 #if ENABLE(SVG)
 #include "SVGTextPositioningElement.h"
 #include "SVGTransformable.h"
+#include "SVGTransformList.h"
 
 namespace WebCore {
 
@@ -52,7 +53,7 @@ namespace WebCore {
         virtual void svgAttributeChanged(const QualifiedName&);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS(SVGTextElement, SVGTransformList*, RefPtr<SVGTransformList>, Transform, transform)
index a0e2929..a2471f9 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore {
 SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document* doc)
     : SVGTextContentElement(tagName, doc)
     , SVGURIReference()
-    , m_startOffset(this, LengthModeOther)
+    , m_startOffset(SVGLength(this, LengthModeOther))
     , m_method(SVG_TEXTPATH_METHODTYPE_ALIGN)
     , m_spacing(SVG_TEXTPATH_SPACINGTYPE_EXACT)
 {
index 4db7a94..d1793d7 100644 (file)
@@ -67,10 +67,10 @@ namespace WebCore
         bool childShouldCreateRenderer(Node*) const;
     
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGTextPathElement, SVGURIReference, String, Href, href)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGTextPathElement, SVGLength, SVGLength, StartOffset, startOffset)
         ANIMATED_PROPERTY_DECLARATIONS(SVGTextPathElement, int, int, Method, method)
index 15aed69..eb7265c 100644 (file)
@@ -45,11 +45,11 @@ SVGTextPositioningElement::~SVGTextPositioningElement()
 {
 }
 
-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())
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGTextPositioningElement, SVGLengthList, LengthList, lengthList, X, x, SVGNames::xAttr, m_x)
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGTextPositioningElement, SVGLengthList, LengthList, lengthList, Y, y, SVGNames::yAttr, m_y)
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGTextPositioningElement, SVGLengthList, LengthList, lengthList, Dx, dx, SVGNames::dxAttr, m_dx)
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGTextPositioningElement, SVGLengthList, LengthList, lengthList, Dy, dy, SVGNames::dyAttr, m_dy)
+ANIMATED_PROPERTY_DEFINITIONS_REFCOUNTED(SVGTextPositioningElement, SVGNumberList, NumberList, numberList, Rotate, rotate, SVGNames::rotateAttr, m_rotate)
 
 void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
 {
index 9deb3b6..1bb8a4b 100644 (file)
 #define SVGTextPositioningElement_h
 
 #if ENABLE(SVG)
+#include "SVGLengthList.h"
+#include "SVGNumberList.h"
 #include "SVGTextContentElement.h"
 
 namespace WebCore {
 
-    class SVGLengthList;
-    class SVGNumberList;
-
     class SVGTextPositioningElement : public SVGTextContentElement {
     public:
         SVGTextPositioningElement(const QualifiedName&, Document*);
index 9b75848..9800922 100644 (file)
@@ -82,4 +82,16 @@ SVGTransform SVGTransformList::concatenateForType(SVGTransform::SVGTransformType
     return totalTransform.addToSVGTransform(SVGTransform());
 }
 
+String SVGTransformList::valueAsString() const
+{
+    // TODO: We may want to build a real transform string, instead of concatting to a matrix(...).
+    SVGTransform transform = concatenate();
+    if (transform.type() == SVGTransform::SVG_TRANSFORM_MATRIX) {
+        AffineTransform matrix = transform.matrix();
+        return String::format("matrix(%f %f %f %f %f %f)", matrix.a(), matrix.b(), matrix.c(), matrix.d(), matrix.e(), matrix.f());
+    }
+
+    return String();
+}
+
 #endif // ENABLE(SVG)
index be72f9d..a405c58 100644 (file)
@@ -30,6 +30,8 @@
 
 namespace WebCore {
 
+    class String;
+
     class SVGTransformList : public SVGPODList<SVGTransform> {
     public:
         static PassRefPtr<SVGTransformList> create(const QualifiedName& attributeName) { return adoptRef(new SVGTransformList(attributeName)); }
@@ -41,7 +43,9 @@ namespace WebCore {
         // Internal use only
         SVGTransform concatenate() const;
         SVGTransform concatenateForType(SVGTransform::SVGTransformType) const;
-        
+        String valueAsString() const;
+
     private:
         SVGTransformList(const QualifiedName&);
     };
index 22f2f45..30e1a86 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore {
         static String getTarget(const String& url);
 
     protected:
-        virtual const SVGElement* contextElement() const = 0;
+        virtual SVGElement* contextElement() = 0;
 
     private:
         ANIMATED_PROPERTY_DECLARATIONS_WITH_CONTEXT(SVGURIReference, String, String, Href, href)
index c98fefd..5f7d350 100644 (file)
@@ -58,10 +58,10 @@ SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document* doc)
     , SVGLangSpace()
     , SVGExternalResourcesRequired()
     , SVGURIReference()
-    , m_x(this, LengthModeWidth)
-    , m_y(this, LengthModeHeight)
-    , m_width(this, LengthModeWidth)
-    , m_height(this, LengthModeHeight)
+    , m_x(SVGLength(this, LengthModeWidth))
+    , m_y(SVGLength(this, LengthModeHeight))
+    , m_width(SVGLength(this, LengthModeWidth))
+    , m_height(SVGLength(this, LengthModeHeight))
 {
 }
 
index cf79709..0ba477b 100644 (file)
@@ -68,11 +68,11 @@ namespace WebCore {
         static void removeDisallowedElementsFromSubtree(Node* element);
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGURIReference, String, Href, href)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGUseElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGUseElement, SVGURIReference, String, Href, href)
 
         ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGLength, SVGLength, X, x)
         ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGLength, SVGLength, Y, y)
index 17e0d1d..afc1660 100644 (file)
@@ -47,14 +47,14 @@ namespace WebCore {
         virtual bool rendererIsNeeded(RenderStyle*) { return false; }
 
     protected:
-        virtual const SVGElement* contextElement() const { return this; }
+        virtual SVGElement* contextElement() { return this; }
 
     private:
         mutable RefPtr<SVGStringList> m_viewTarget;
 
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
-        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGViewElement, SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGViewElement, SVGFitToViewBox, FloatRect, ViewBox, viewBox)
+        ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGViewElement, SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
     };
 
 } // namespace WebCore
index d628d70..91cdf7c 100644 (file)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-SVGViewSpec::SVGViewSpec(const SVGSVGElement* contextElement)
+SVGViewSpec::SVGViewSpec(SVGSVGElement* contextElement)
     : SVGFitToViewBox()
     , SVGZoomAndPan()
     , m_transform(SVGTransformList::create(SVGNames::transformAttr))
@@ -76,7 +76,7 @@ SVGElement* SVGViewSpec::viewTarget() const
     return static_cast<SVGElement*>(m_contextElement->ownerDocument()->getElementById(m_viewTargetString));
 }
 
-const SVGElement* SVGViewSpec::contextElement() const
+SVGElement* SVGViewSpec::contextElement()
 {
     return m_contextElement;
 }
index b143634..ee068b1 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
     class SVGViewSpec : public SVGFitToViewBox,
                         public SVGZoomAndPan {
     public:
-        SVGViewSpec(const SVGSVGElement*);
+        SVGViewSpec(SVGSVGElement*);
         virtual ~SVGViewSpec();
 
         bool parseViewSpec(const String&);
@@ -54,11 +54,11 @@ namespace WebCore {
         SVGElement* viewTarget() const;
 
     protected:
-        virtual const SVGElement* contextElement() const;
+        virtual SVGElement* contextElement();
 
     private:
         mutable RefPtr<SVGTransformList> m_transform;
-        const SVGSVGElement* m_contextElement;
+        SVGSVGElement* m_contextElement;
         String m_viewTargetString;
     };