2010-10-30 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Oct 2010 13:23:55 +0000 (13:23 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Oct 2010 13:23:55 +0000 (13:23 +0000)
        Reviewed by Rob Buis.

        Convert SVGAnimatedNumber/SVGAnimatedNumberList to the new SVGAnimatedPropertyTearOff concept
        https://bugs.webkit.org/show_bug.cgi?id=48686

        Convert the next set of primitives to use the new SVG(Animated)PropertyTearOff concept.

        Tests: svg/dom/SVGAnimatedNumber.html
               svg/dom/SVGAnimatedNumberList.html
               svg/dom/SVGNumber.html

        * GNUmakefile.am: Add SVGAnimatedNumber.h / SVGAnimatedNumberList.h to build.
        * WebCore.gypi: Ditto.
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * bindings/scripts/CodeGenerator.pm: Recognize SVGAnimatedNumber/SVGAnimatedNumberList as new style SVG animated properties. Remove SVGNumber from PODType hash.
        * bindings/scripts/CodeGeneratorJS.pm: Remove special SVGNumber handing, it's obsolete now.
        * bindings/scripts/CodeGeneratorObjC.pm: Add special SVGNumber handling, as it's the first of the converted dynamic SVGAnimatedProperty types that's not in WebCore namespace.
        * bindings/scripts/CodeGeneratorV8.pm: Use AvoidInclusionOfType method from CodeGenerator.pm, remove special SVGNumber handling, that's obsolete now.
        * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
        (WebCore::extractFloatValuesFromSVGNumberList): Adapt to SVGNumberList change, which is a plain Vector<float> now.
        * svg/DeprecatedSVGAnimatedPropertyTraits.h: Remove SVGAnimatedNumber/SVGAnimatedNumberList handling.
        * svg/DeprecatedSVGAnimatedTemplate.h: Ditto.
        * svg/SVGAnimatedNumber.h: Added.
        * svg/SVGAnimatedNumber.idl: Enable StrictTypeChecking.
        * svg/SVGAnimatedNumberList.h: Added.
        * svg/SVGAnimatedNumberList.idl: Ditto.
        * svg/SVGComponentTransferFunctionElement.cpp: Switch animated float properties to the new SVGAnimatedNumber(List).
        (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement):
        (WebCore::SVGComponentTransferFunctionElement::parseMappedAttribute):
        (WebCore::SVGComponentTransferFunctionElement::transferFunction):
        * svg/SVGComponentTransferFunctionElement.h:
        * svg/SVGFEColorMatrixElement.cpp: Ditto.
        (WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement):
        (WebCore::SVGFEColorMatrixElement::parseMappedAttribute):
        (WebCore::SVGFEColorMatrixElement::build):
        * svg/SVGFEColorMatrixElement.h:
        * svg/SVGFECompositeElement.h: Ditto.
        * svg/SVGFEConvolveMatrixElement.cpp: Ditto.
        (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
        (WebCore::SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier): Added, replacing char[] hack by a static atomic string.
        (WebCore::SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier): Ditto.
        (WebCore::SVGFEConvolveMatrixElement::parseMappedAttribute):
        (WebCore::SVGFEConvolveMatrixElement::build):
        * svg/SVGFEConvolveMatrixElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGFEDiffuseLightingElement.cpp: Ditto.
        (WebCore::SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier): Remove trailing whitespace.
        (WebCore::SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier): Ditto.
        * svg/SVGFEDiffuseLightingElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGFEDisplacementMapElement.h: Ditto.
        * svg/SVGFEGaussianBlurElement.cpp: Ditto.
        (WebCore::SVGFEGaussianBlurElement::stdDeviationXIdentifier): Remove trailing whitespace.
        (WebCore::SVGFEGaussianBlurElement::stdDeviationYIdentifier): Ditto.
        * svg/SVGFEGaussianBlurElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGFELightElement.h: Ditto.
        * svg/SVGFEMorphologyElement.cpp:
        (WebCore::SVGFEMorphologyElement::radiusXIdentifier): Added, replacing char[] hack by a static atomic string.
        (WebCore::SVGFEMorphologyElement::radiusYIdentifier): Ditto.
        * svg/SVGFEMorphologyElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGFEOffsetElement.h: Ditto.
        * svg/SVGFESpecularLightingElement.cpp:
        (WebCore::SVGFESpecularLightingElement::kernelUnitLengthXIdentifier): Remove trailing whitespace.
        (WebCore::SVGFESpecularLightingElement::kernelUnitLengthYIdentifier): Ditto.
        * svg/SVGFESpecularLightingElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGFETurbulenceElement.cpp:
        (WebCore::SVGFETurbulenceElement::baseFrequencyXIdentifier): Remove trailing whitespace.
        (WebCore::SVGFETurbulenceElement::baseFrequencyYIdentifier): Ditto.
        * svg/SVGFETurbulenceElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGFilterElement.cpp:
        (WebCore::SVGFilterElement::filterResXIdentifier): Remove trailing whitespace.
        (WebCore::SVGFilterElement::filterResYIdentifier): Ditto.
        * svg/SVGLengthList.idl: Remove leftover [SVGListProperty] marker.
        * svg/SVGMarkerElement.cpp:
        (WebCore::SVGMarkerElement::orientTypeIdentifier): Remove trailing whitespace.
        (WebCore::SVGMarkerElement::orientAngleIdentifier): Ditto.
        * svg/SVGNumber.idl: Remove [PODType] marker, add StrictTypeChecking.
        * svg/SVGNumberList.cpp: Convert from SVGPODList<RefPtr<SVGPODListItem<float> > > to plain Vector<float>, just like it has been done for SVGLengthList before.
        (WebCore::SVGNumberList::parse):
        (WebCore::SVGNumberList::valueAsString):
        * svg/SVGNumberList.h:
        (WebCore::SVGNumberList::SVGNumberList):
        * svg/SVGPathElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
        * svg/SVGStopElement.h: Ditto.
        * svg/SVGTextPositioningElement.cpp: Switch animated float properties to the new SVGAnimatedNumber(List).
        (WebCore::SVGTextPositioningElement::SVGTextPositioningElement):
        (WebCore::SVGTextPositioningElement::parseMappedAttribute):
        * svg/SVGTextPositioningElement.h: Ditto.
        * svg/properties/SVGPropertyTraits.h: Add SVGNumberList handling.

2010-10-30  Nikolas Zimmermann  <nzimmermann@rim.com>

        Reviewed by Rob Buis.

        Convert SVGAnimatedNumber/SVGAnimatedNumberList to the new SVGAnimatedPropertyTearOff concept
        https://bugs.webkit.org/show_bug.cgi?id=48686

        Fix invalid tests in svg/dynamic-updates, that relied on a bug in our SVGNumberList implementation. If an item was already
        inserted in a list, and we tried to insert it somewhere else, we didn't remove it from the old list. Now that SVGNumberList
        has been switched to SVGAnimatedListPropertyTearOff, the bug is fixed, and it behaves exactly like SVGLengthList.

        Side effect: svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop.html now works as expected (dynamic update is executed)

        * platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.checksum:
        * platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.png:
        * svg/dom/SVGAnimatedNumber-expected.txt: Added.
        * svg/dom/SVGAnimatedNumber.html: Added.
        * svg/dom/SVGAnimatedNumberList-expected.txt: Added.
        * svg/dom/SVGAnimatedNumberList.html: Added.
        * svg/dom/SVGNumber-expected.txt: Added.
        * svg/dom/SVGNumber.html: Added.
        * svg/dom/script-tests/SVGAnimatedNumber.js: Added.
        * svg/dom/script-tests/SVGAnimatedNumberList.js: Added.
        * svg/dom/script-tests/SVGNumber.js: Added.
        * svg/dynamic-updates/script-tests/SVGFEColorMatrixElement-svgdom-type-prop.js: Test now works in Firefox as well.
        (executeTest): SVGNumber.value only accepts numbers, not strings, now that StrictTypeChecking is enabled.
        * svg/dynamic-updates/script-tests/SVGFEColorMatrixElement-svgdom-values-prop.js: Test now works in Firefox as well.
        (executeTest): Don't call appendItem several times with the same SVGNumber, it will be removed if it was already inserted in a list.
        * svg/dynamic-updates/script-tests/SVGFETurbulenceElement-svgdom-baseFrequency-prop.js:

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

60 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.checksum
LayoutTests/platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.png
LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGAnimatedNumber.html [new file with mode: 0644]
LayoutTests/svg/dom/SVGAnimatedNumberList-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGAnimatedNumberList.html [new file with mode: 0644]
LayoutTests/svg/dom/SVGNumber-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGNumber.html [new file with mode: 0644]
LayoutTests/svg/dom/script-tests/SVGAnimatedNumberList.js [new file with mode: 0644]
LayoutTests/svg/dom/script-tests/SVGNumber.js [new file with mode: 0644]
LayoutTests/svg/dynamic-updates/script-tests/SVGFEColorMatrixElement-svgdom-type-prop.js
LayoutTests/svg/dynamic-updates/script-tests/SVGFEColorMatrixElement-svgdom-values-prop.js
LayoutTests/svg/dynamic-updates/script-tests/SVGFETurbulenceElement-svgdom-baseFrequency-prop.js
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/scripts/CodeGenerator.pm
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bindings/scripts/CodeGeneratorObjC.pm
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
WebCore/svg/DeprecatedSVGAnimatedPropertyTraits.h
WebCore/svg/DeprecatedSVGAnimatedTemplate.h
WebCore/svg/SVGAnimatedNumber.h [new file with mode: 0644]
WebCore/svg/SVGAnimatedNumber.idl
WebCore/svg/SVGAnimatedNumberList.h [new file with mode: 0644]
WebCore/svg/SVGComponentTransferFunctionElement.cpp
WebCore/svg/SVGComponentTransferFunctionElement.h
WebCore/svg/SVGFEColorMatrixElement.cpp
WebCore/svg/SVGFEColorMatrixElement.h
WebCore/svg/SVGFECompositeElement.h
WebCore/svg/SVGFEConvolveMatrixElement.cpp
WebCore/svg/SVGFEConvolveMatrixElement.h
WebCore/svg/SVGFEDiffuseLightingElement.cpp
WebCore/svg/SVGFEDiffuseLightingElement.h
WebCore/svg/SVGFEDisplacementMapElement.h
WebCore/svg/SVGFEGaussianBlurElement.cpp
WebCore/svg/SVGFEGaussianBlurElement.h
WebCore/svg/SVGFELightElement.h
WebCore/svg/SVGFEMorphologyElement.cpp
WebCore/svg/SVGFEMorphologyElement.h
WebCore/svg/SVGFEOffsetElement.h
WebCore/svg/SVGFESpecularLightingElement.cpp
WebCore/svg/SVGFESpecularLightingElement.h
WebCore/svg/SVGFETurbulenceElement.cpp
WebCore/svg/SVGFETurbulenceElement.h
WebCore/svg/SVGFilterElement.cpp
WebCore/svg/SVGMarkerElement.cpp
WebCore/svg/SVGNumber.idl
WebCore/svg/SVGNumberList.cpp
WebCore/svg/SVGNumberList.h
WebCore/svg/SVGPathElement.h
WebCore/svg/SVGStopElement.h
WebCore/svg/SVGTextPositioningElement.cpp
WebCore/svg/SVGTextPositioningElement.h
WebCore/svg/properties/SVGPropertyTraits.h

index b72bb55..43e9444 100644 (file)
@@ -1,5 +1,35 @@
 2010-10-30  Nikolas Zimmermann  <nzimmermann@rim.com>
 
+        Reviewed by Rob Buis.
+
+        Convert SVGAnimatedNumber/SVGAnimatedNumberList to the new SVGAnimatedPropertyTearOff concept
+        https://bugs.webkit.org/show_bug.cgi?id=48686
+
+        Fix invalid tests in svg/dynamic-updates, that relied on a bug in our SVGNumberList implementation. If an item was already
+        inserted in a list, and we tried to insert it somewhere else, we didn't remove it from the old list. Now that SVGNumberList
+        has been switched to SVGAnimatedListPropertyTearOff, the bug is fixed, and it behaves exactly like SVGLengthList.
+
+        Side effect: svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop.html now works as expected (dynamic update is executed)
+
+        * platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.checksum:
+        * platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.png:
+        * svg/dom/SVGAnimatedNumber-expected.txt: Added.
+        * svg/dom/SVGAnimatedNumber.html: Added.
+        * svg/dom/SVGAnimatedNumberList-expected.txt: Added.
+        * svg/dom/SVGAnimatedNumberList.html: Added.
+        * svg/dom/SVGNumber-expected.txt: Added.
+        * svg/dom/SVGNumber.html: Added.
+        * svg/dom/script-tests/SVGAnimatedNumber.js: Added.
+        * svg/dom/script-tests/SVGAnimatedNumberList.js: Added.
+        * svg/dom/script-tests/SVGNumber.js: Added.
+        * svg/dynamic-updates/script-tests/SVGFEColorMatrixElement-svgdom-type-prop.js: Test now works in Firefox as well.
+        (executeTest): SVGNumber.value only accepts numbers, not strings, now that StrictTypeChecking is enabled.
+        * svg/dynamic-updates/script-tests/SVGFEColorMatrixElement-svgdom-values-prop.js: Test now works in Firefox as well.
+        (executeTest): Don't call appendItem several times with the same SVGNumber, it will be removed if it was already inserted in a list.
+        * svg/dynamic-updates/script-tests/SVGFETurbulenceElement-svgdom-baseFrequency-prop.js:
+
+2010-10-30  Nikolas Zimmermann  <nzimmermann@rim.com>
+
         Not reviewed.
 
         Update SVGFEFloodElement mac-leopard baseline, which was forgotten.
index 3358e85..ade2813 100644 (file)
Binary files a/LayoutTests/platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.png and b/LayoutTests/platform/mac-leopard/svg/dynamic-updates/SVGFETurbulenceElement-svgdom-baseFrequency-prop-expected.png differ
diff --git a/LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt b/LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt
new file mode 100644 (file)
index 0000000..d0ad365
--- /dev/null
@@ -0,0 +1,27 @@
+This test checks the SVGAnimatedNumber API - utilizing the surfaceScale property of SVGFESpecularLightingElement
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Check initial surfaceScale value
+PASS feSpecularLightingElement.surfaceScale.toString() is "[object SVGAnimatedNumber]"
+PASS typeof(feSpecularLightingElement.surfaceScale.baseVal) is "number"
+PASS feSpecularLightingElement.surfaceScale.baseVal is 1
+
+Check that integers are static, caching value in a local variable and modifying it, should have no effect
+PASS numRef is 100
+PASS feSpecularLightingElement.surfaceScale.baseVal is 1
+
+Check assigning various valid and invalid values
+PASS feSpecularLightingElement.surfaceScale.baseVal = -1 is -1
+PASS feSpecularLightingElement.surfaceScale.baseVal = 300 is 300
+PASS feSpecularLightingElement.surfaceScale.baseVal = 'aString' threw exception TypeError: Type error.
+PASS feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement threw exception TypeError: Type error.
+
+Check that the surfaceScale value remained 300
+PASS feSpecularLightingElement.surfaceScale.baseVal = 300 is 300
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dom/SVGAnimatedNumber.html b/LayoutTests/svg/dom/SVGAnimatedNumber.html
new file mode 100644 (file)
index 0000000..55f8e59
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGAnimatedNumber.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dom/SVGAnimatedNumberList-expected.txt b/LayoutTests/svg/dom/SVGAnimatedNumberList-expected.txt
new file mode 100644 (file)
index 0000000..beb93bc
--- /dev/null
@@ -0,0 +1,27 @@
+This test checks the SVGAnimatedNumberList API - utilizing the rotate property of SVGTextElement
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Check initial rotate value
+PASS textElement.rotate.toString() is "[object SVGAnimatedNumberList]"
+PASS textElement.rotate.baseVal.toString() is "[object SVGNumberList]"
+PASS textElement.rotate.baseVal.getItem(0).value is 50
+
+Check that number lists are dynamic, caching value in a local variable and modifying it, should take effect
+PASS numRef.getItem(0).value is 100
+PASS textElement.rotate.baseVal.getItem(0).value is 100
+
+Check assigning to baseVal has no effect, as no setter is defined
+PASS textElement.rotate.baseVal = -1 is -1
+PASS textElement.rotate.baseVal = 'aString' is "aString"
+PASS textElement.rotate.baseVal = textElement is textElement
+
+Check that the rotate value remained 100, and the baseVal type has not been changed
+PASS textElement.rotate.baseVal.toString() is "[object SVGNumberList]"
+PASS textElement.rotate.baseVal.getItem(0).value is 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dom/SVGAnimatedNumberList.html b/LayoutTests/svg/dom/SVGAnimatedNumberList.html
new file mode 100644 (file)
index 0000000..24931c4
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGAnimatedNumberList.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dom/SVGNumber-expected.txt b/LayoutTests/svg/dom/SVGNumber-expected.txt
new file mode 100644 (file)
index 0000000..e0eb0d8
--- /dev/null
@@ -0,0 +1,32 @@
+This test checks the SVGNumber API
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Check initial number value
+PASS num.value is 0
+
+Check assigning number
+PASS num.value = 100 is 100
+PASS num.value = -100 is -100
+PASS num.value = 12345678 is 12345678
+PASS num.value = -num.value is -12345678
+
+Check that numbers are static, caching value in a local variable and modifying it, should have no effect
+PASS numRef is 1000
+PASS num.value is -12345678
+
+Check assigning invalid number, number should be null afterwards
+PASS num.value = num threw exception TypeError: Type error.
+PASS num.value = 'aString' threw exception TypeError: Type error.
+PASS num.value = svgElement threw exception TypeError: Type error.
+PASS num.value is -12345678
+PASS num.value = null is null
+
+Check that the number is now null
+PASS num.value is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dom/SVGNumber.html b/LayoutTests/svg/dom/SVGNumber.html
new file mode 100644 (file)
index 0000000..0276c1a
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/SVGNumber.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/dom/script-tests/SVGAnimatedNumberList.js b/LayoutTests/svg/dom/script-tests/SVGAnimatedNumberList.js
new file mode 100644 (file)
index 0000000..bde0544
--- /dev/null
@@ -0,0 +1,30 @@
+description("This test checks the SVGAnimatedNumberList API - utilizing the rotate property of SVGTextElement");
+
+var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
+textElement.setAttribute("rotate", "50");
+
+debug("");
+debug("Check initial rotate value");
+shouldBeEqualToString("textElement.rotate.toString()", "[object SVGAnimatedNumberList]");
+shouldBeEqualToString("textElement.rotate.baseVal.toString()", "[object SVGNumberList]");
+shouldBe("textElement.rotate.baseVal.getItem(0).value", "50");
+
+debug("");
+debug("Check that number lists are dynamic, caching value in a local variable and modifying it, should take effect");
+var numRef = textElement.rotate.baseVal;
+numRef.getItem(0).value = 100;
+shouldBe("numRef.getItem(0).value", "100");
+shouldBe("textElement.rotate.baseVal.getItem(0).value", "100");
+
+debug("");
+debug("Check assigning to baseVal has no effect, as no setter is defined");
+shouldBe("textElement.rotate.baseVal = -1", "-1");
+shouldBeEqualToString("textElement.rotate.baseVal = 'aString'", "aString");
+shouldBe("textElement.rotate.baseVal = textElement", "textElement");
+
+debug("");
+debug("Check that the rotate value remained 100, and the baseVal type has not been changed");
+shouldBeEqualToString("textElement.rotate.baseVal.toString()", "[object SVGNumberList]");
+shouldBe("textElement.rotate.baseVal.getItem(0).value", "100");
+
+successfullyParsed = true;
diff --git a/LayoutTests/svg/dom/script-tests/SVGNumber.js b/LayoutTests/svg/dom/script-tests/SVGNumber.js
new file mode 100644 (file)
index 0000000..2a9883c
--- /dev/null
@@ -0,0 +1,36 @@
+description("This test checks the SVGNumber API");
+
+var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+var num = svgElement.createSVGNumber();
+
+debug("");
+debug("Check initial number value");
+shouldBe("num.value", "0");
+
+debug("");
+debug("Check assigning number");
+shouldBe("num.value = 100", "100");
+shouldBe("num.value = -100", "-100");
+shouldBe("num.value = 12345678", "12345678");
+shouldBe("num.value = -num.value", "-12345678");
+
+debug("");
+debug("Check that numbers are static, caching value in a local variable and modifying it, should have no effect");
+var numRef = num.value;
+numRef = 1000;
+shouldBe("numRef", "1000");
+shouldBe("num.value", "-12345678");
+
+debug("");
+debug("Check assigning invalid number, number should be null afterwards");
+shouldThrow("num.value = num");
+shouldThrow("num.value = 'aString'");
+shouldThrow("num.value = svgElement");
+shouldBe("num.value", "-12345678");
+shouldBeNull("num.value = null");
+
+debug("");
+debug("Check that the number is now null");
+shouldBe("num.value", "0");
+
+successfullyParsed = true;
index 20e2e9b..772d451 100644 (file)
@@ -171,10 +171,10 @@ shouldBeEqualToString("luminanceToAlphaElement.getAttribute('type')", "matrix");
 function executeTest() {
     matrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_MATRIX;
 
-    var matrixArray = new Array("0.33", "0.33", "0.33", "0", "0", "0.33", "0.33", "0.33", "0", "0", "0.33", "0.33", "0.33", "0", "0", "0.33", "0.33", "0.33", "0", "0");
+    var matrixArray = new Array(0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0);
     matrixElement.values.baseVal.clear();
-    var number = rootSVGElement.createSVGNumber();
     for (var i = 0; i < matrixArray.length; ++i) {
+        var number = rootSVGElement.createSVGNumber();
         number.value = matrixArray[i];
         matrixElement.values.baseVal.appendItem(number, i);
     }
@@ -182,6 +182,7 @@ function executeTest() {
     saturateElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_SATURATE;
 
     hueRotateElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_HUEROTATE;
+    var number = rootSVGElement.createSVGNumber();
     number.value = 90;
     hueRotateElement.values.baseVal.appendItem(number, 0);
 
index 2e38c1c..368a4e9 100644 (file)
@@ -181,18 +181,25 @@ shouldBe("Math.round(saturateElement.values.baseVal.getItem(0).value * 1000)", "
 shouldBe("Math.round(hueRotateElement.values.baseVal.getItem(0).value * 1000)", "10000");
 
 function executeTest() {
-    var number = rootSVGElement.createSVGNumber();
+    var number1 = rootSVGElement.createSVGNumber();
+    number1.value = 0.33;
+    matrixElement.values.baseVal.replaceItem(number1, 0);
 
-    number.value = 0.33;
-    matrixElement.values.baseVal.replaceItem(number, 0);
-    matrixElement.values.baseVal.replaceItem(number, 1);
-    matrixElement.values.baseVal.replaceItem(number, 2);
+    var number2 = rootSVGElement.createSVGNumber();
+    number2.value = 0.33;
+    matrixElement.values.baseVal.replaceItem(number2, 1);
 
-    number.value = 0.25;
-    saturateElement.values.baseVal.replaceItem(number, 0);
+    var number3 = rootSVGElement.createSVGNumber();
+    number3.value = 0.33;
+    matrixElement.values.baseVal.replaceItem(number3, 2);
 
-    number.value = 90;
-    hueRotateElement.values.baseVal.replaceItem(number, 0);
+    var number4 = rootSVGElement.createSVGNumber();
+    number4.value = 0.25;
+    saturateElement.values.baseVal.replaceItem(number4, 0);
+
+    var number5 = rootSVGElement.createSVGNumber();
+    number5.value = 90;
+    hueRotateElement.values.baseVal.replaceItem(number5, 0);
 
     shouldBeEqualToString("SVGNumberListToString(matrixElement.values.baseVal)", "0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 ");
     shouldBe("saturateElement.values.baseVal.getItem(0).value", "0.25");
index 7ff1d6d..8e2208a 100644 (file)
@@ -31,7 +31,7 @@ rectElement.setAttribute("height", "200");
 rectElement.setAttribute("filter", "url(#myFilter)");
 rootSVGElement.appendChild(rectElement);
 
-<!-- We should multiply and round the value of baseFrequency otherwise the expected value cannot be precisely represented as a floating point number and the comparison will fail.-->
+// We should multiply and round the value of baseFrequency otherwise the expected value cannot be precisely represented as a floating point number and the comparison will fail.
 shouldBe("Math.round(turbulence.baseFrequencyX.baseVal * 1000)", "70");
 shouldBe("Math.round(turbulence.baseFrequencyY.baseVal * 1000)", "70");
 
index b2e5a69..90a8d70 100644 (file)
@@ -1,3 +1,95 @@
+2010-10-30  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Reviewed by Rob Buis.
+
+        Convert SVGAnimatedNumber/SVGAnimatedNumberList to the new SVGAnimatedPropertyTearOff concept
+        https://bugs.webkit.org/show_bug.cgi?id=48686
+
+        Convert the next set of primitives to use the new SVG(Animated)PropertyTearOff concept.
+
+        Tests: svg/dom/SVGAnimatedNumber.html
+               svg/dom/SVGAnimatedNumberList.html
+               svg/dom/SVGNumber.html
+
+        * GNUmakefile.am: Add SVGAnimatedNumber.h / SVGAnimatedNumberList.h to build.
+        * WebCore.gypi: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * bindings/scripts/CodeGenerator.pm: Recognize SVGAnimatedNumber/SVGAnimatedNumberList as new style SVG animated properties. Remove SVGNumber from PODType hash.
+        * bindings/scripts/CodeGeneratorJS.pm: Remove special SVGNumber handing, it's obsolete now.
+        * bindings/scripts/CodeGeneratorObjC.pm: Add special SVGNumber handling, as it's the first of the converted dynamic SVGAnimatedProperty types that's not in WebCore namespace.
+        * bindings/scripts/CodeGeneratorV8.pm: Use AvoidInclusionOfType method from CodeGenerator.pm, remove special SVGNumber handling, that's obsolete now.
+        * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
+        (WebCore::extractFloatValuesFromSVGNumberList): Adapt to SVGNumberList change, which is a plain Vector<float> now.
+        * svg/DeprecatedSVGAnimatedPropertyTraits.h: Remove SVGAnimatedNumber/SVGAnimatedNumberList handling.
+        * svg/DeprecatedSVGAnimatedTemplate.h: Ditto.
+        * svg/SVGAnimatedNumber.h: Added.
+        * svg/SVGAnimatedNumber.idl: Enable StrictTypeChecking.
+        * svg/SVGAnimatedNumberList.h: Added.
+        * svg/SVGAnimatedNumberList.idl: Ditto.
+        * svg/SVGComponentTransferFunctionElement.cpp: Switch animated float properties to the new SVGAnimatedNumber(List).
+        (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement):
+        (WebCore::SVGComponentTransferFunctionElement::parseMappedAttribute):
+        (WebCore::SVGComponentTransferFunctionElement::transferFunction):
+        * svg/SVGComponentTransferFunctionElement.h:
+        * svg/SVGFEColorMatrixElement.cpp: Ditto.
+        (WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement):
+        (WebCore::SVGFEColorMatrixElement::parseMappedAttribute):
+        (WebCore::SVGFEColorMatrixElement::build):
+        * svg/SVGFEColorMatrixElement.h:
+        * svg/SVGFECompositeElement.h: Ditto.
+        * svg/SVGFEConvolveMatrixElement.cpp: Ditto.
+        (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
+        (WebCore::SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier): Added, replacing char[] hack by a static atomic string.
+        (WebCore::SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier): Ditto.
+        (WebCore::SVGFEConvolveMatrixElement::parseMappedAttribute):
+        (WebCore::SVGFEConvolveMatrixElement::build):
+        * svg/SVGFEConvolveMatrixElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGFEDiffuseLightingElement.cpp: Ditto.
+        (WebCore::SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier): Remove trailing whitespace.
+        (WebCore::SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier): Ditto.
+        * svg/SVGFEDiffuseLightingElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGFEDisplacementMapElement.h: Ditto.
+        * svg/SVGFEGaussianBlurElement.cpp: Ditto.
+        (WebCore::SVGFEGaussianBlurElement::stdDeviationXIdentifier): Remove trailing whitespace.
+        (WebCore::SVGFEGaussianBlurElement::stdDeviationYIdentifier): Ditto.
+        * svg/SVGFEGaussianBlurElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGFELightElement.h: Ditto.
+        * svg/SVGFEMorphologyElement.cpp:
+        (WebCore::SVGFEMorphologyElement::radiusXIdentifier): Added, replacing char[] hack by a static atomic string.
+        (WebCore::SVGFEMorphologyElement::radiusYIdentifier): Ditto.
+        * svg/SVGFEMorphologyElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGFEOffsetElement.h: Ditto.
+        * svg/SVGFESpecularLightingElement.cpp:
+        (WebCore::SVGFESpecularLightingElement::kernelUnitLengthXIdentifier): Remove trailing whitespace.
+        (WebCore::SVGFESpecularLightingElement::kernelUnitLengthYIdentifier): Ditto.
+        * svg/SVGFESpecularLightingElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGFETurbulenceElement.cpp:
+        (WebCore::SVGFETurbulenceElement::baseFrequencyXIdentifier): Remove trailing whitespace.
+        (WebCore::SVGFETurbulenceElement::baseFrequencyYIdentifier): Ditto.
+        * svg/SVGFETurbulenceElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGFilterElement.cpp:
+        (WebCore::SVGFilterElement::filterResXIdentifier): Remove trailing whitespace.
+        (WebCore::SVGFilterElement::filterResYIdentifier): Ditto.
+        * svg/SVGLengthList.idl: Remove leftover [SVGListProperty] marker.
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::orientTypeIdentifier): Remove trailing whitespace.
+        (WebCore::SVGMarkerElement::orientAngleIdentifier): Ditto.
+        * svg/SVGNumber.idl: Remove [PODType] marker, add StrictTypeChecking.
+        * svg/SVGNumberList.cpp: Convert from SVGPODList<RefPtr<SVGPODListItem<float> > > to plain Vector<float>, just like it has been done for SVGLengthList before.
+        (WebCore::SVGNumberList::parse):
+        (WebCore::SVGNumberList::valueAsString):
+        * svg/SVGNumberList.h:
+        (WebCore::SVGNumberList::SVGNumberList):
+        * svg/SVGPathElement.h: Switch animated float properties to the new SVGAnimatedNumber(List).
+        * svg/SVGStopElement.h: Ditto.
+        * svg/SVGTextPositioningElement.cpp: Switch animated float properties to the new SVGAnimatedNumber(List).
+        (WebCore::SVGTextPositioningElement::SVGTextPositioningElement):
+        (WebCore::SVGTextPositioningElement::parseMappedAttribute):
+        * svg/SVGTextPositioningElement.h: Ditto.
+        * svg/properties/SVGPropertyTraits.h: Add SVGNumberList handling.
+
 2010-10-29  Daniel Bates  <dbates@rim.com>
 
         No review, rolling out 70971.
index 3d034dc..f721608 100644 (file)
@@ -3053,6 +3053,8 @@ webcore_sources += \
        WebCore/svg/SVGAnimatedInteger.h \
        WebCore/svg/SVGAnimatedLength.h \
        WebCore/svg/SVGAnimatedLengthList.h \
+       WebCore/svg/SVGAnimatedNumber.h \
+       WebCore/svg/SVGAnimatedNumberList.h \
        WebCore/svg/SVGAnimatedPathData.cpp \
        WebCore/svg/SVGAnimatedPathData.h \
        WebCore/svg/SVGAnimatedPoints.cpp \
index f1f9c12..a0c3d52 100644 (file)
             'svg/SVGAnimatedInteger.h',
             'svg/SVGAnimatedLength.h',
             'svg/SVGAnimatedLengthList.h',
+            'svg/SVGAnimatedNumber.h',
+            'svg/SVGAnimatedNumberList.h',
             'svg/SVGAnimatedPathData.cpp',
             'svg/SVGAnimatedPathData.h',
             'svg/SVGAnimatedPoints.cpp',
index f80493a..34697df 100644 (file)
@@ -2378,6 +2378,8 @@ HEADERS += \
     svg/SVGAnimatedInteger.h \
     svg/SVGAnimatedLength.h \
     svg/SVGAnimatedLengthList.h \
+    svg/SVGAnimatedNumber.h \
+    svg/SVGAnimatedNumberList.h \
     svg/SVGAnimatedPathData.h \
     svg/SVGAnimatedPoints.h \
     svg/SVGAnimatedRect.h \
index e0eb3f9..743228b 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\svg\SVGAnimatedNumber.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\svg\SVGAnimatedNumberList.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\svg\SVGAnimatedPathData.h"\r
                                >\r
                        </File>\r
index ab13482..d62a67f 100644 (file)
                08A484770E5272C500C3FE76 /* ScriptElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A484750E5272C500C3FE76 /* ScriptElement.cpp */; };
                08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; };
                08A48A6E0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */; };
+               08B35B13127B6A7C005314DD /* SVGAnimatedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               08B35B17127B6A88005314DD /* SVGAnimatedNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                08C34AF51179C057002D7456 /* RenderSVGResourceGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C34AF11179C056002D7456 /* RenderSVGResourceGradient.cpp */; };
                08C34AF61179C057002D7456 /* RenderSVGResourceGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C34AF21179C057002D7456 /* RenderSVGResourceGradient.h */; };
                08C34AF71179C057002D7456 /* RenderSVGResourceLinearGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C34AF31179C057002D7456 /* RenderSVGResourceLinearGradient.cpp */; };
                08A484750E5272C500C3FE76 /* ScriptElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptElement.cpp; sourceTree = "<group>"; };
                08A484760E5272C500C3FE76 /* ScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptElement.h; sourceTree = "<group>"; };
                08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGElementInstanceCustom.cpp; sourceTree = "<group>"; };
+               08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedNumber.h; sourceTree = "<group>"; };
+               08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedNumberList.h; sourceTree = "<group>"; };
                08C34AF11179C056002D7456 /* RenderSVGResourceGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceGradient.cpp; sourceTree = "<group>"; };
                08C34AF21179C057002D7456 /* RenderSVGResourceGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceGradient.h; sourceTree = "<group>"; };
                08C34AF31179C057002D7456 /* RenderSVGResourceLinearGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceLinearGradient.cpp; sourceTree = "<group>"; };
                                B22277EA0D00BF1F0071B782 /* SVGAnimatedLength.idl */,
                                089021AC126EF5E90092D5EA /* SVGAnimatedLengthList.h */,
                                B22277EB0D00BF1F0071B782 /* SVGAnimatedLengthList.idl */,
+                               08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */,
                                B22277EC0D00BF1F0071B782 /* SVGAnimatedNumber.idl */,
+                               08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */,
                                B22277ED0D00BF1F0071B782 /* SVGAnimatedNumberList.idl */,
                                B22277EE0D00BF1F0071B782 /* SVGAnimatedPathData.cpp */,
                                B22277EF0D00BF1F0071B782 /* SVGAnimatedPathData.h */,
                                08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */,
                                08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */,
                                0823D159127AD6AC000EBC95 /* SVGAnimatedInteger.h in Headers */,
+                               08B35B13127B6A7C005314DD /* SVGAnimatedNumber.h in Headers */,
+                               08B35B17127B6A88005314DD /* SVGAnimatedNumberList.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index c4f87f0..0ef5a77 100644 (file)
@@ -50,7 +50,7 @@ my %numericTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
 
 my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1);
 
-my %podTypeHash = ("SVGNumber" => 1, "SVGTransform" => 1);
+my %podTypeHash = ("SVGTransform" => 1);
 my %podTypesWithWritablePropertiesHash = ("SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1);
 my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1);
 
@@ -59,6 +59,7 @@ my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType"
 my %svgNewStyleAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
                                    "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" => 1,
                                    "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1,
+                                   "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1,
                                    "SVGAnimatedRect" => 1);
 
 my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
@@ -79,6 +80,8 @@ my %svgNativeType = (
     "SVGAngle" => "SVGPropertyTearOff<SVGAngle>",
     "SVGLength" => "SVGPropertyTearOff<SVGLength>",
     "SVGLengthList" => "SVGListPropertyTearOff<SVGLengthList>",
+    "SVGNumber" => "SVGPropertyTearOff<float>",
+    "SVGNumberList" => "SVGListPropertyTearOff<SVGNumberList>",
     "SVGRect" => "SVGPropertyTearOff<FloatRect>"
 );
 
index 9244bc6..809f79c 100644 (file)
@@ -2455,7 +2455,6 @@ my %nativeType = (
     "SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
     "IDBKey" => "RefPtr<IDBKey>",
     "SVGMatrix" => "AffineTransform",
-    "SVGNumber" => "float",
     "SVGPaintType" => "SVGPaint::SVGPaintType",
     "SVGPreserveAspectRatio" => "SVGPreserveAspectRatio",
     "SVGPoint" => "FloatPoint",
@@ -2528,7 +2527,7 @@ sub JSValueToNative
 
     return "$value.toBoolean(exec)" if $type eq "boolean";
     return "$value.toNumber(exec)" if $type eq "double";
-    return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber";
+    return "$value.toFloat(exec)" if $type eq "float";
     return "$value.toInt32(exec)" if $type eq "long";
     return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short";
     return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long";
index 8351c87..cd85186 100644 (file)
@@ -613,11 +613,6 @@ sub AddIncludesForType
         return;
     }
 
-    if ($type eq "SVGNumber") {
-        $implIncludes{"DOMSVGNumberInternal.h"} = 1;
-        return;
-    }
-
     if ($type =~ /(\w+)(Abs|Rel)$/) {
         $implIncludes{"$1.h"} = 1;
         $implIncludes{"DOM${type}Internal.h"} = 1;
@@ -656,6 +651,16 @@ sub AddIncludesForType
     $implIncludes{"DOM${type}Internal.h"} = 1;
 }
 
+sub GetSVGTypeWithNamespace
+{
+    my $type = shift;
+    my $typeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($type);
+
+    # Special case for DOMSVGNumber
+    $typeWithNamespace =~ s/</\<WebCore::/ unless $type eq "SVGNumber";
+    return $typeWithNamespace;
+}
+
 sub GetSVGPropertyTypes
 {
     my $implType = shift;
@@ -671,12 +676,17 @@ sub GetSVGPropertyTypes
 
     # Append space to avoid compilation errors when using  PassRefPtr<$svgNativeType>
     $svgNativeType = "WebCore::$svgNativeType ";
-    $svgNativeType =~ s/</\<WebCore::/;
+    $svgNativeType =~ s/</\<WebCore::/ if not $svgNativeType =~ /float/;
 
     my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implType);
     if ($svgNativeType =~ /SVGPropertyTearOff/) {
-        $svgPropertyType = "WebCore::$svgWrappedNativeType";
-        $svgPropertyType =~ s/</\<WebCore::/;
+        if ($svgWrappedNativeType eq "float") {
+            # Special case for DOMSVGNumber
+            $svgPropertyType = $svgWrappedNativeType;
+        } else {
+            $svgPropertyType = "WebCore::$svgWrappedNativeType";
+            $svgPropertyType =~ s/</\<WebCore::/;
+        }
     } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
         $svgListPropertyType = "WebCore::$svgWrappedNativeType";
         $svgListPropertyType =~ s/</\<WebCore::/;
@@ -1238,12 +1248,6 @@ sub GenerateImplementation
                 if ($svgPropertyType eq "WebCore::SVGLength" and $attributeName eq "value") {
                     $getterContentHead = "value(0 /* FIXME */";
                 }
-            } else {
-                # Special case for DOMSVGNumber
-                if ($podType and $podType eq "float") {
-                    $getterContentHead = "*IMPL";
-                    $getterContentTail = "";
-                }
             }
 
             my $attributeTypeSansPtr = $attributeType;
@@ -1287,10 +1291,15 @@ sub GenerateImplementation
                 $getterContentHead = "kit($getterContentHead";
                 $getterContentTail .= ")";
             } elsif ($svgPropertyType) {
-                $getterContentHead = "IMPL->propertyReference().$getterContentHead";
+                # Special case for DOMSVGNumber
+                if ($svgPropertyType eq "float") {
+                    # Intentional leave out closing brace, it's already contained in getterContentTail
+                    $getterContentHead = "IMPL->propertyReference(";
+                } else {    
+                    $getterContentHead = "IMPL->propertyReference().$getterContentHead";
+                }
             } elsif ($codeGenerator->IsSVGNewStyleAnimatedType($implClassName) and $codeGenerator->IsSVGTypeNeedingTearOff($idlType)) {
-                my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
-                $idlTypeWithNamespace =~ s/</\<WebCore::/;
+                my $idlTypeWithNamespace = GetSVGTypeWithNamespace($idlType);
                 $getterContentHead = "kit(static_cast<$idlTypeWithNamespace*>($getterContentHead)";
                 $getterContentTail .= ")";
             } elsif (IsProtocolType($idlType) and $idlType ne "EventTarget") {
@@ -1304,9 +1313,7 @@ sub GenerateImplementation
                 $getterContentTail .= "->toString()";                
             } elsif (ConversionNeeded($attribute->signature->type)) {
                 if ($codeGenerator->IsSVGTypeNeedingTearOff($attribute->signature->type) and not $implClassName =~ /List$/) {
-                    my $idlType = $attribute->signature->type;
-                    my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
-                    $idlTypeWithNamespace =~ s/</\<WebCore::/;
+                    my $idlTypeWithNamespace = GetSVGTypeWithNamespace($attribute->signature->type);
                     $getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($getterContentHead";
                     $getterContentTail .= ")))";
                 } else {
@@ -1381,7 +1388,14 @@ sub GenerateImplementation
                     push(@implContent, "    $svgPropertyType& podImpl = IMPL->propertyReference();\n");
                     my $ec = $hasSetterException ? ", ec" : "";
                     push(@implContent, "    $exceptionInit\n") if $hasSetterException;
-                    push(@implContent, "    podImpl.$coreSetterName($arg$ec);\n");
+
+                    # Special case for DOMSVGNumber
+                    if ($svgPropertyType eq "float") {
+                        push(@implContent, "    podImpl = $arg;\n");
+                    } else {
+                        push(@implContent, "    podImpl.$coreSetterName($arg$ec);\n");
+                    }
+
                     if ($hasSetterException) {
                         push(@implContent, "    if (!ec)\n");
                         push(@implContent, "        IMPL->commitChange();\n");
@@ -1393,12 +1407,7 @@ sub GenerateImplementation
                     $getterContentHead = "$getterExpressionPrefix";
                     push(@implContent, "    IMPL->$coreSetterName($arg);\n");
                 } elsif ($podType) {
-                    # Special case for DOMSVGNumber
-                    if ($podType eq "float") {
-                        push(@implContent, "    *IMPL = $arg;\n");
-                    } else {
-                        push(@implContent, "    IMPL->$coreSetterName($arg);\n");
-                    }
+                    push(@implContent, "    IMPL->$coreSetterName($arg);\n");
                 } else {
                     my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute);
                     my $ec = $hasSetterException ? ", ec" : "";
@@ -1533,8 +1542,7 @@ sub GenerateImplementation
                 next if not $codeGenerator->IsSVGTypeNeedingTearOff($idlType) or $implClassName =~ /List$/;
 
                 my $implGetter = GetObjCTypeGetter($paramName, $idlType);
-                my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
-                $idlTypeWithNamespace =~ s/</\<WebCore::/;
+                my $idlTypeWithNamespace = GetSVGTypeWithNamespace($idlType);
 
                 push(@functionContent, "    $idlTypeWithNamespace* ${paramName}Core = $implGetter;\n");
                 push(@functionContent, "    if (!${paramName}Core) {\n");
@@ -1603,9 +1611,7 @@ sub GenerateImplementation
             } else {
                 if (ConversionNeeded($function->signature->type)) {
                     if ($codeGenerator->IsSVGTypeNeedingTearOff($function->signature->type) and not $implClassName =~ /List$/) {
-                        my $idlType = $function->signature->type;
-                        my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
-                        $idlTypeWithNamespace =~ s/</\<WebCore::/;
+                        my $idlTypeWithNamespace = GetSVGTypeWithNamespace($function->signature->type);
                         $content = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($content)))";
                     } elsif ($codeGenerator->IsPodType($function->signature->type)) {
                         $content = "kit($content)";
index 8cbd63d..44140fb 100644 (file)
@@ -130,22 +130,13 @@ sub GenerateModule
     $module = $dataNode->module;
 }
 
-sub AvoidInclusionOfType
-{
-    my $type = shift;
-
-    # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h / SVGMatrix.h do not exist.
-    return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber" or $type eq "SVGMatrix";
-    return 0;
-}
-
 sub AddIncludesForType
 {
     my $type = $codeGenerator->StripModule(shift);
 
     # When we're finished with the one-file-per-class
     # reorganization, we won't need these special cases.
-    if (!$codeGenerator->IsPrimitiveType($type) and !AvoidInclusionOfType($type) and $type ne "Date") {
+    if (!$codeGenerator->IsPrimitiveType($type) and !$codeGenerator->AvoidInclusionOfType($type) and $type ne "Date") {
         # default, include the same named file
         $implIncludes{GetV8HeaderName(${type})} = 1;
 
@@ -478,7 +469,7 @@ sub GetHeaderClassInclude
     if ($className =~ /SVGPathSeg/) {
         $className =~ s/Abs|Rel//;
     }
-    return "" if (AvoidInclusionOfType($className));
+    return "" if ($codeGenerator->AvoidInclusionOfType($className));
     return "DeprecatedSVGAnimatedTemplate.h" if $codeGenerator->IsSVGAnimatedType($className) and !$codeGenerator->IsSVGNewStyleAnimatedType($className); 
     return "${className}.h";
 }
@@ -727,7 +718,7 @@ sub GenerateNormalAttrGetter
         $attrIsPodType = 0;
     }
 
-    my $getterStringUsesImp = $implClassName ne "float";
+    my $getterStringUsesImp = $implClassName ne "SVGNumber";
     my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName);
 
     # Getter
@@ -760,8 +751,12 @@ END
             push(@implContentDecls, <<END);
     $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());
     $svgWrappedNativeType& impInstance = wrapper->propertyReference();
+END
+            if ($getterStringUsesImp) {
+                push(@implContentDecls, <<END);
     $svgWrappedNativeType* imp = &impInstance;
 END
+            }
         }
     } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
         if ($interfaceName eq "DOMWindow") {
@@ -1069,7 +1064,7 @@ END
         push(@implContentDecls, "    ExceptionCode ec = 0;\n");
     }
 
-    if ($implClassName eq "float") {
+    if ($implClassName eq "SVGNumber") {
         push(@implContentDecls, "    *imp = $result;\n");
     } else {
         if ($attribute->signature->type eq "EventListener") {
@@ -2673,7 +2668,6 @@ sub GetNativeTypeForConversions
 
     $type = "FloatPoint" if $type eq "SVGPoint";
     $type = "AffineTransform" if $type eq "SVGMatrix";
-    $type = "float" if $type eq "SVGNumber";
     $type = "V8SVGPODTypeWrapper<$type>" if $dataNode->extendedAttributes->{"PODType"};
     $type = $codeGenerator->GetSVGTypeNeedingTearOff($type) if $codeGenerator->IsSVGTypeNeedingTearOff($type); 
     return $type;
@@ -2978,7 +2972,6 @@ sub GetNativeType
     return "FloatPoint" if $type eq "SVGPoint";
     return "AffineTransform" if $type eq "SVGMatrix";
     return "SVGTransform" if $type eq "SVGTransform";
-    return "float" if $type eq "SVGNumber";
     return "SVGPreserveAspectRatio" if $type eq "SVGPreserveAspectRatio";
     return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType";
     return "DOMTimeStamp" if $type eq "DOMTimeStamp";
@@ -3061,7 +3054,6 @@ sub JSValueToNative
     return "$value" if $type eq "JSObject";
     return "$value->BooleanValue()" if $type eq "boolean";
     return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
-    return "$value->NumberValue()" if $type eq "SVGNumber";
 
     return "toInt32($value${maybeOkParam})" if $type eq "long";
     return "toUInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short";
index 2474a5c..3122912 100644 (file)
@@ -72,21 +72,15 @@ static inline void extractFloatValuesFromSVGLengthList(SVGElement* lengthContext
     }
 }
 
-static inline void extractFloatValuesFromSVGNumberList(SVGNumberList* list, Vector<float>& floatValues, unsigned textContentLength)
+static inline void extractFloatValuesFromSVGNumberList(const SVGNumberList& list, Vector<float>& floatValues, unsigned textContentLength)
 {
-    ASSERT(list);
-
-    unsigned length = list->numberOfItems();
+    unsigned length = list.size();
     if (length > textContentLength)
         length = textContentLength;
     floatValues.reserveCapacity(length);
 
-    ExceptionCode ec = 0;
-    for (unsigned i = 0; i < length; ++i) {
-        float length = list->getItem(i, ec);
-        ASSERT(!ec);
-        floatValues.append(length);
-    }
+    for (unsigned i = 0; i < length; ++i)
+        floatValues.append(list.at(i));
 }
 
 void SVGTextLayoutAttributesBuilder::buildLayoutScope(LayoutScope& scope, RenderObject* renderer, unsigned textContentStart, unsigned textContentLength) const
index ab23bae..464f01a 100644 (file)
@@ -23,7 +23,6 @@
 
 #if ENABLE(SVG)
 #include "PlatformString.h"
-#include "SVGNumberList.h"
 #include "SVGPreserveAspectRatio.h"
 #include "SVGTransformList.h"
 
@@ -32,30 +31,6 @@ namespace WebCore {
 template<typename Type>
 struct DeprecatedSVGAnimatedPropertyTraits : public Noncopyable { };
 
-// SVGAnimatedNumber
-template<>
-struct DeprecatedSVGAnimatedPropertyTraits<float> : public Noncopyable {
-    typedef const float& PassType;
-    typedef float ReturnType;
-    typedef float StoredType;
-
-    static ReturnType null() { return 0.0f; }
-    static ReturnType toReturnType(const StoredType& type) { return type; }
-    static String toString(PassType type) { return String::number(type); }
-};
-
-// SVGAnimatedNumberList
-template<>
-struct DeprecatedSVGAnimatedPropertyTraits<SVGNumberList*> : public Noncopyable {
-    typedef SVGNumberList* PassType;
-    typedef SVGNumberList* ReturnType;
-    typedef RefPtr<SVGNumberList> StoredType;
-
-    static ReturnType null() { return 0; }
-    static ReturnType toReturnType(const StoredType& type) { return type.get(); }
-    static String toString(PassType type) { return type ? type->valueAsString() : String(); }
-};
-
 // SVGAnimatedPreserveAspectRatio
 template<>
 struct DeprecatedSVGAnimatedPropertyTraits<SVGPreserveAspectRatio> : public Noncopyable {
index 939db59..c8e23e4 100644 (file)
@@ -29,7 +29,6 @@
 namespace WebCore {
    
     class SVGElement;
-    class SVGNumberList;
     class SVGPreserveAspectRatio;
     class SVGTransformList;
     class QualifiedName;
@@ -154,8 +153,6 @@ namespace WebCore {
     }
 
     // Common type definitions, to ease IDL generation.
-    typedef DeprecatedSVGAnimatedTemplate<float> SVGAnimatedNumber;
-    typedef DeprecatedSVGAnimatedTemplate<SVGNumberList*> SVGAnimatedNumberList; 
     typedef DeprecatedSVGAnimatedTemplate<SVGPreserveAspectRatio> SVGAnimatedPreserveAspectRatio;
     typedef DeprecatedSVGAnimatedTemplate<String> SVGAnimatedString;
     typedef DeprecatedSVGAnimatedTemplate<SVGTransformList*> SVGAnimatedTransformList;
diff --git a/WebCore/svg/SVGAnimatedNumber.h b/WebCore/svg/SVGAnimatedNumber.h
new file mode 100644 (file)
index 0000000..6897aad
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGAnimatedNumber_h
+#define SVGAnimatedNumber_h
+
+#if ENABLE(SVG)
+#include "SVGAnimatedStaticPropertyTearOff.h"
+
+namespace WebCore {
+
+typedef SVGAnimatedStaticPropertyTearOff<float> SVGAnimatedNumber;
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif
index dea9d96..c3b0419 100644 (file)
@@ -27,8 +27,7 @@
 module svg {
 
     interface [Conditional=SVG] SVGAnimatedNumber {
-                 attribute float baseVal
-                     /*setter raises(DOMException)*/;
+        attribute [StrictTypeChecking] float baseVal;
         readonly attribute float animVal;
     };
 
diff --git a/WebCore/svg/SVGAnimatedNumberList.h b/WebCore/svg/SVGAnimatedNumberList.h
new file mode 100644 (file)
index 0000000..f86b3c2
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGAnimatedNumberList_h
+#define SVGAnimatedNumberList_h
+
+#if ENABLE(SVG)
+#include "SVGAnimatedListPropertyTearOff.h"
+#include "SVGNumberList.h"
+
+namespace WebCore {
+
+typedef SVGAnimatedListPropertyTearOff<SVGNumberList> SVGAnimatedNumberList;
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif
index c1750d7..078b30d 100644 (file)
@@ -33,7 +33,6 @@ namespace WebCore {
 SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document* document)
     : SVGElement(tagName, document)
     , m_type(FECOMPONENTTRANSFER_TYPE_UNKNOWN)
-    , m_tableValues(SVGNumberList::create(SVGNames::tableValuesAttr))
     , m_slope(1)
     , m_amplitude(1)
     , m_exponent(1)
@@ -54,10 +53,12 @@ void SVGComponentTransferFunctionElement::parseMappedAttribute(Attribute* attr)
             setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_LINEAR);
         else if (value == "gamma")
             setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_GAMMA);
-    }
-    else if (attr->name() == SVGNames::tableValuesAttr)
-        tableValuesBaseValue()->parse(value);
-    else if (attr->name() == SVGNames::slopeAttr)
+    } else if (attr->name() == SVGNames::tableValuesAttr) {
+        SVGNumberList newList;
+        newList.parse(value);
+        detachAnimatedTableValuesListWrappers(newList.size());
+        tableValuesBaseValue() = newList;
+    } else if (attr->name() == SVGNames::slopeAttr)
         setSlopeBaseValue(value.toFloat());
     else if (attr->name() == SVGNames::interceptAttr)
         setInterceptBaseValue(value.toFloat());
@@ -105,18 +106,13 @@ void SVGComponentTransferFunctionElement::synchronizeProperty(const QualifiedNam
 ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const
 {
     ComponentTransferFunction func;
-    func.type = (ComponentTransferType) type();
+    func.type = static_cast<ComponentTransferType>(type());
     func.slope = slope();
     func.intercept = intercept();
     func.amplitude = amplitude();
     func.exponent = exponent();
     func.offset = offset();
-    SVGNumberList* numbers = tableValues();
-
-    ExceptionCode ec = 0;
-    unsigned int nr = numbers->numberOfItems();
-    for (unsigned int i = 0; i < nr; i++)
-        func.tableValues.append(numbers->getItem(i, ec));
+    func.tableValues = tableValues();
     return func;
 }
 
index d46668b..e02fc16 100644 (file)
@@ -22,9 +22,9 @@
 #define SVGComponentTransferFunctionElement_h
 
 #if ENABLE(SVG) && ENABLE(FILTERS)
+#include "FEComponentTransfer.h"
 #include "SVGAnimatedPropertyMacros.h"
 #include "SVGNumberList.h"
-#include "FEComponentTransfer.h"
 
 namespace WebCore {
 
@@ -40,12 +40,12 @@ namespace WebCore {
         
     private:
         DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::typeAttr, int, Type, type)
-        DECLARE_ANIMATED_PROPERTY(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, SVGNumberList*, TableValues, tableValues)
-        DECLARE_ANIMATED_PROPERTY(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, float, Slope, slope)
-        DECLARE_ANIMATED_PROPERTY(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, float, Intercept, intercept)
-        DECLARE_ANIMATED_PROPERTY(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, float, Amplitude, amplitude)
-        DECLARE_ANIMATED_PROPERTY(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, float, Exponent, exponent)
-        DECLARE_ANIMATED_PROPERTY(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, float, Offset, offset)
+        DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, SVGNumberList, TableValues, tableValues)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, float, Slope, slope)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, float, Intercept, intercept)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, float, Amplitude, amplitude)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, float, Exponent, exponent)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, float, Offset, offset)
     };
 
 } // namespace WebCore
index 83d112c..eed728d 100644 (file)
@@ -32,7 +32,6 @@ namespace WebCore {
 inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document* document)
     : SVGFilterPrimitiveStandardAttributes(tagName, document)
     , m_type(FECOLORMATRIX_TYPE_UNKNOWN)
-    , m_values(SVGNumberList::create(SVGNames::valuesAttr))
 {
 }
 
@@ -56,9 +55,12 @@ void SVGFEColorMatrixElement::parseMappedAttribute(Attribute* attr)
     }
     else if (attr->name() == SVGNames::inAttr)
         setIn1BaseValue(value);
-    else if (attr->name() == SVGNames::valuesAttr)
-        valuesBaseValue()->parse(value);
-    else
+    else if (attr->name() == SVGNames::valuesAttr) {
+        SVGNumberList newList;
+        newList.parse(value);
+        detachAnimatedValuesListWrappers(newList.size());
+        valuesBaseValue() = newList;
+    } else
         SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
 }
 
@@ -99,7 +101,6 @@ PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter
         return 0;
 
     Vector<float> filterValues;
-    SVGNumberList* numbers = values();
     const ColorMatrixType filterType(static_cast<ColorMatrixType>(type()));
 
     // Use defaults if values is empty (SVG 1.1 15.10).
@@ -119,12 +120,8 @@ PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter
             break;
         }
     } else {
-        size_t size = numbers->numberOfItems();
-        for (size_t i = 0; i < size; i++) {
-            ExceptionCode ec = 0;
-            filterValues.append(numbers->getItem(i, ec));
-        }
-        size = filterValues.size();
+        filterValues = values();
+        unsigned size = filterValues.size();
 
         if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
             || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1)
index 5ec301f..9e26c7f 100644 (file)
@@ -42,7 +42,7 @@ private:
 
     DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::inAttr, String, In1, in1)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEColorMatrixElement, SVGNames::typeAttr, int, Type, type)
-    DECLARE_ANIMATED_PROPERTY(SVGFEColorMatrixElement, SVGNames::valuesAttr, SVGNumberList*, Values, values)
+    DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGFEColorMatrixElement, SVGNames::valuesAttr, SVGNumberList, Values, values)
 };
 
 } // namespace WebCore
index 95443e4..35de97e 100644 (file)
@@ -42,10 +42,10 @@ private:
     DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::inAttr, String, In1, in1)
     DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::in2Attr, String, In2, in2)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::operatorAttr, int, _operator, _operator)
-    DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k1Attr, float, K1, k1)
-    DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k2Attr, float, K2, k2)
-    DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k3Attr, float, K3, k3)
-    DECLARE_ANIMATED_PROPERTY(SVGFECompositeElement, SVGNames::k4Attr, float, K4, k4)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k1Attr, float, K1, k1)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k2Attr, float, K2, k2)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k3Attr, float, K3, k3)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k4Attr, float, K4, k4)
 };
 
 } // namespace WebCore
index d7f14a2..693411e 100644 (file)
 
 namespace WebCore {
 
-char SVGKernelUnitLengthXAttrIdentifier[] = "SVGKernelUnitLengthXAttr";
-char SVGKernelUnitLengthYAttrIdentifier[] = "SVGKernelUnitLengthYAttr";
-
 inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document* document)
     : SVGFilterPrimitiveStandardAttributes(tagName, document)
-    , m_kernelMatrix(SVGNumberList::create(SVGNames::kernelMatrixAttr))
     , m_edgeMode(EDGEMODE_DUPLICATE)
 {
 }
@@ -50,6 +46,18 @@ PassRefPtr<SVGFEConvolveMatrixElement> SVGFEConvolveMatrixElement::create(const
     return adoptRef(new SVGFEConvolveMatrixElement(tagName, document));
 }
 
+const AtomicString& SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGKernelUnitLengthX"));
+    return s_identifier;
+}
+
+const AtomicString& SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGKernelUnitLengthY"));
+    return s_identifier;
+}
+
 void SVGFEConvolveMatrixElement::parseMappedAttribute(Attribute* attr)
 {
     const String& value = attr->value();
@@ -68,9 +76,12 @@ void SVGFEConvolveMatrixElement::parseMappedAttribute(Attribute* attr)
             setEdgeModeBaseValue(EDGEMODE_WRAP);
         else if (value == "none")
             setEdgeModeBaseValue(EDGEMODE_NONE);
-    } else if (attr->name() == SVGNames::kernelMatrixAttr)
-        kernelMatrixBaseValue()->parse(value);
-    else if (attr->name() == SVGNames::divisorAttr)
+    } else if (attr->name() == SVGNames::kernelMatrixAttr) {
+        SVGNumberList newList;
+        newList.parse(value);
+        detachAnimatedKernelMatrixListWrappers(newList.size());
+        kernelMatrixBaseValue() = newList;
+    } else if (attr->name() == SVGNames::divisorAttr)
         setDivisorBaseValue(value.toFloat());
     else if (attr->name() == SVGNames::biasAttr)
         setBiasBaseValue(value.toFloat());
@@ -131,22 +142,16 @@ PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* fil
     if (!input1)
         return 0;
 
-    Vector<float> kernelMatrixValues;
-    SVGNumberList* numbers = kernelMatrix();
-
-    ExceptionCode ec = 0;
-    int numberOfItems = numbers->numberOfItems();
-    for (int i = 0; i < numberOfItems; ++i)
-        kernelMatrixValues.append(numbers->getItem(i, ec));
-
     int orderXValue = orderX();
     int orderYValue = orderY();
     if (!hasAttribute(SVGNames::orderAttr)) {
         orderXValue = 3;
         orderYValue = 3;
     }
+    SVGNumberList& kernelMatrix = this->kernelMatrix();
+    int kernelMatrixSize = kernelMatrix.size();
     // The spec says this is a requirement, and should bail out if fails
-    if (orderXValue * orderYValue != numberOfItems)
+    if (orderXValue * orderYValue != kernelMatrixSize)
         return 0;
 
     int targetXValue = targetX();
@@ -166,8 +171,8 @@ PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* fil
     if (hasAttribute(SVGNames::divisorAttr) && !divisorValue)
         return 0;
     if (!hasAttribute(SVGNames::divisorAttr)) {
-        for (int i = 0; i < numberOfItems; ++i)
-            divisorValue += kernelMatrixValues[i];
+        for (int i = 0; i < kernelMatrixSize; ++i)
+            divisorValue += kernelMatrix.at(i);
         if (!divisorValue)
             divisorValue = 1;
     }
@@ -175,7 +180,7 @@ PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* fil
     RefPtr<FilterEffect> effect = FEConvolveMatrix::create(
                     IntSize(orderXValue, orderYValue), divisorValue,
                     bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),
-                    FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrixValues);
+                    FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrix);
     effect->inputEffects().append(input1);
     return effect.release();
 }
index cb31949..cb9a3f0 100644 (file)
@@ -41,17 +41,20 @@ private:
     virtual void svgAttributeChanged(const QualifiedName&);
     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
 
+    static const AtomicString& kernelUnitLengthXIdentifier();
+    static const AtomicString& kernelUnitLengthYIdentifier();
+
     DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::inAttr, String, In1, in1)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::orderXAttr, long, OrderX, orderX)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::orderYAttr, long, OrderY, orderY)
-    DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, SVGNumberList*, KernelMatrix, kernelMatrix)
-    DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, float, Divisor, divisor)
-    DECLARE_ANIMATED_PROPERTY(SVGFEConvolveMatrixElement, SVGNames::biasAttr, float, Bias, bias)
+    DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, SVGNumberList, KernelMatrix, kernelMatrix)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, float, Divisor, divisor)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::biasAttr, float, Bias, bias)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, long, TargetX, targetX)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, long, TargetY, targetY)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::operatorAttr, int, EdgeMode, edgeMode)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthXIdentifier, float, KernelUnitLengthX, kernelUnitLengthX)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, SVGKernelUnitLengthYIdentifier, float, KernelUnitLengthY, kernelUnitLengthY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, bool, PreserveAlpha, preserveAlpha)
 };
 
index ccdf8a0..6da804f 100644 (file)
@@ -47,13 +47,13 @@ PassRefPtr<SVGFEDiffuseLightingElement> SVGFEDiffuseLightingElement::create(cons
 const AtomicString& SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGKernelUnitLengthX"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 const AtomicString& SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGKernelUnitLengthY"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr)
index b8f56a6..b333f7d 100644 (file)
@@ -47,10 +47,10 @@ private:
     static const AtomicString& kernelUnitLengthYIdentifier();
 
     DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::inAttr, String, In1, in1)
-    DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, float, DiffuseConstant, diffuseConstant)
-    DECLARE_ANIMATED_PROPERTY(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, float, DiffuseConstant, diffuseConstant)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY)
 
     PassRefPtr<LightSource> findLights() const;
 };
index c42783c..8321997 100644 (file)
@@ -43,7 +43,7 @@ private:
     DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::in2Attr, String, In2, in2)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, int, XChannelSelector, xChannelSelector)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, int, YChannelSelector, yChannelSelector)
-    DECLARE_ANIMATED_PROPERTY(SVGFEDisplacementMapElement, SVGNames::scaleAttr, float, Scale, scale)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::scaleAttr, float, Scale, scale)
 };
 
 } // namespace WebCore
index e307a8e..c17c748 100644 (file)
@@ -42,13 +42,13 @@ PassRefPtr<SVGFEGaussianBlurElement> SVGFEGaussianBlurElement::create(const Qual
 const AtomicString& SVGFEGaussianBlurElement::stdDeviationXIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGStdDeviationX"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 const AtomicString& SVGFEGaussianBlurElement::stdDeviationYIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGStdDeviationY"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 void SVGFEGaussianBlurElement::setStdDeviation(float x, float y)
index d1579a5..a4610af 100644 (file)
@@ -45,8 +45,8 @@ private:
     static const AtomicString& stdDeviationYIdentifier();
 
     DECLARE_ANIMATED_PROPERTY(SVGFEGaussianBlurElement, SVGNames::inAttr, String, In1, in1)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), float, StdDeviationX, stdDeviationX)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), float, StdDeviationY, stdDeviationY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), float, StdDeviationX, stdDeviationX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), float, StdDeviationY, stdDeviationY)
 };
 
 } // namespace WebCore
index d594475..986a0dc 100644 (file)
@@ -24,8 +24,8 @@
 
 #if ENABLE(SVG) && ENABLE(FILTERS)
 #include "LightSource.h"
+#include "SVGAnimatedPropertyMacros.h"
 #include "SVGElement.h"
-#include "SVGNames.h"
 
 namespace WebCore {
 
@@ -42,16 +42,16 @@ private:
     virtual void synchronizeProperty(const QualifiedName&);
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::azimuthAttr, float, Azimuth, azimuth)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::elevationAttr, float, Elevation, elevation)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::xAttr, float, X, x)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::yAttr, float, Y, y)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::zAttr, float, Z, z)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtXAttr, float, PointsAtX, pointsAtX)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtYAttr, float, PointsAtY, pointsAtY)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::pointsAtZAttr, float, PointsAtZ, pointsAtZ)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
-    DECLARE_ANIMATED_PROPERTY(SVGFELightElement, SVGNames::limitingConeAngleAttr, float, LimitingConeAngle, limitingConeAngle)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::azimuthAttr, float, Azimuth, azimuth)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::elevationAttr, float, Elevation, elevation)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::xAttr, float, X, x)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::yAttr, float, Y, y)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::zAttr, float, Z, z)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::pointsAtXAttr, float, PointsAtX, pointsAtX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::pointsAtYAttr, float, PointsAtY, pointsAtY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::pointsAtZAttr, float, PointsAtZ, pointsAtZ)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::limitingConeAngleAttr, float, LimitingConeAngle, limitingConeAngle)
 };
 
 } // namespace WebCore
index bfd0c0f..c7954b2 100644 (file)
@@ -28,9 +28,6 @@
 
 namespace WebCore {
 
-char SVGRadiusXAttrIdentifier[] = "SVGRadiusXAttr";
-char SVGRadiusYAttrIdentifier[] = "SVGRadiusYAttr";
-
 inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document* document)
     : SVGFilterPrimitiveStandardAttributes(tagName, document)
     , m__operator(FEMORPHOLOGY_OPERATOR_ERODE)
@@ -42,6 +39,18 @@ PassRefPtr<SVGFEMorphologyElement> SVGFEMorphologyElement::create(const Qualifie
     return adoptRef(new SVGFEMorphologyElement(tagName, document));
 }
 
+const AtomicString& SVGFEMorphologyElement::radiusXIdentifier()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGRadiusX"));
+    return s_identifier;
+}
+
+const AtomicString& SVGFEMorphologyElement::radiusYIdentifier()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGRadiusY"));
+    return s_identifier;
+}
+
 void SVGFEMorphologyElement::setRadius(float x, float y)
 {
     setRadiusXBaseValue(x);
index 671e7f0..39b9333 100644 (file)
@@ -26,9 +26,6 @@
 
 namespace WebCore {
 
-extern char SVGRadiusXAttrIdentifier[];
-extern char SVGRadiusYAttrIdentifier[];
-
 class SVGFEMorphologyElement : public SVGFilterPrimitiveStandardAttributes {
 public:
     static PassRefPtr<SVGFEMorphologyElement> create(const QualifiedName&, Document*);
@@ -48,8 +45,8 @@ private:
 
     DECLARE_ANIMATED_PROPERTY(SVGFEMorphologyElement, SVGNames::inAttr, String, In1, in1)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEMorphologyElement, SVGNames::operatorAttr, int, _operator, _operator)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, SVGRadiusXAttrIdentifier, float, RadiusX, radiusX)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, SVGRadiusYAttrIdentifier, float, RadiusY, radiusY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), float, RadiusX, radiusX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), float, RadiusY, radiusY)
 };
 
 } // namespace WebCore
index 2d522a2..b09b1d0 100644 (file)
@@ -40,8 +40,8 @@ private:
     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
 
     DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::inAttr, String, In1, in1)
-    DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::dxAttr, float, Dx, dx)
-    DECLARE_ANIMATED_PROPERTY(SVGFEOffsetElement, SVGNames::dyAttr, float, Dy, dy)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEOffsetElement, SVGNames::dxAttr, float, Dx, dx)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEOffsetElement, SVGNames::dyAttr, float, Dy, dy)
 };
 
 } // namespace WebCore
index 949b183..548eb15 100644 (file)
@@ -48,13 +48,13 @@ PassRefPtr<SVGFESpecularLightingElement> SVGFESpecularLightingElement::create(co
 const AtomicString& SVGFESpecularLightingElement::kernelUnitLengthXIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGKernelUnitLengthX"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 const AtomicString& SVGFESpecularLightingElement::kernelUnitLengthYIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGKernelUnitLengthY"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 void SVGFESpecularLightingElement::parseMappedAttribute(Attribute* attr)
index 82093eb..24a1c84 100644 (file)
@@ -43,11 +43,11 @@ private:
     static const AtomicString& kernelUnitLengthYIdentifier();
 
     DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::inAttr, String, In1, in1)
-    DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, float, SpecularConstant, specularConstant)
-    DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
-    DECLARE_ANIMATED_PROPERTY(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, float, SpecularConstant, specularConstant)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY)
 
     PassRefPtr<LightSource> findLights() const;
 };
index 7a4d7d4..53b8fb0 100644 (file)
@@ -44,13 +44,13 @@ PassRefPtr<SVGFETurbulenceElement> SVGFETurbulenceElement::create(const Qualifie
 const AtomicString& SVGFETurbulenceElement::baseFrequencyXIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGBaseFrequencyX"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 const AtomicString& SVGFETurbulenceElement::baseFrequencyYIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGBaseFrequencyY"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 void SVGFETurbulenceElement::parseMappedAttribute(Attribute* attr)
index cbe0643..5c41fdd 100644 (file)
@@ -48,10 +48,10 @@ private:
     static const AtomicString& baseFrequencyXIdentifier();
     static const AtomicString& baseFrequencyYIdentifier();
 
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), float, BaseFrequencyX, baseFrequencyX)
-    DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), float, BaseFrequencyY, baseFrequencyY)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), float, BaseFrequencyX, baseFrequencyX)
+    DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), float, BaseFrequencyY, baseFrequencyY)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::numOctavesAttr, long, NumOctaves, numOctaves)
-    DECLARE_ANIMATED_PROPERTY(SVGFETurbulenceElement, SVGNames::seedAttr, float, Seed, seed)
+    DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::seedAttr, float, Seed, seed)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, int, StitchTiles, stitchTiles)
     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::typeAttr, int, Type, type)
 };
index 8c56c46..323dd4c 100644 (file)
@@ -63,13 +63,13 @@ PassRefPtr<SVGFilterElement> SVGFilterElement::create(const QualifiedName& tagNa
 const AtomicString& SVGFilterElement::filterResXIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGFilterResX"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 const AtomicString& SVGFilterElement::filterResYIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGFilterResY"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filterResY)
index ef2b3dd..8b6d41c 100644 (file)
@@ -55,13 +55,13 @@ PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(const QualifiedName& tagNa
 const AtomicString& SVGMarkerElement::orientTypeIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientType"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 const AtomicString& SVGMarkerElement::orientAngleIdentifier()
 {
     DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGOrientAngle"));
-    return s_identifier;    
+    return s_identifier;
 }
 
 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
index 32e9620..83e3b6b 100644 (file)
@@ -22,8 +22,8 @@
 
 module svg {
 
-    interface [Conditional=SVG, PODType=float] SVGNumber {
-        attribute float value;
+    interface [Conditional=SVG] SVGNumber {
+        attribute [StrictTypeChecking] float value;
     };
 
 }
index 96fe55f..a1dc430 100644 (file)
 #include "SVGNumberList.h"
 
 #include "SVGParserUtilities.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
-SVGNumberList::SVGNumberList(const QualifiedName& attributeName)
-    : SVGPODList<float>(attributeName)
-{
-}
-
 void SVGNumberList::parse(const String& value)
 {
-    ExceptionCode ec = 0;
-    clear(ec);
+    clear();
 
-    float number = 0.0f;
-   
+    float number = 0;
     const UChar* ptr = value.characters();
     const UChar* end = ptr + value.length();
+
     // The spec strangely doesn't allow leading whitespace.  We might choose to violate that intentionally. (section 4.1)
     while (ptr < end) {
         if (!parseNumber(ptr, end, number))
             return;
-        appendItem(number, ec);
+        append(number);
     }
 }
 
 String SVGNumberList::valueAsString() const
 {
-    String result;
+    StringBuilder builder;
 
-    ExceptionCode ec = 0;
-    for (unsigned int i = 0; i < numberOfItems(); ++i) {
+    unsigned size = this->size();
+    for (unsigned i = 0; i < size; ++i) {
         if (i > 0)
-            result += ", ";
+            builder.append(", ");
 
-        result += String::number(getItem(i, ec));
-        ASSERT(ec == 0);
+        builder.append(String::number(at(i)));
     }
 
-    return result;
+    return builder.toString();
 }
 
 }
index e64b0b7..abc82da 100644 (file)
 #define SVGNumberList_h
 
 #if ENABLE(SVG)
-#include "SVGList.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-    class SVGNumberList : public SVGPODList<float> {
-    public:
-        static PassRefPtr<SVGNumberList> create(const QualifiedName& attributeName) { return adoptRef(new SVGNumberList(attributeName)); }
+class SVGNumberList : public Vector<float> {
+public:
+    SVGNumberList() { }
 
-        void parse(const String& value);
-        String valueAsString() const;
-
-    private:
-        SVGNumberList(const QualifiedName&);
-    };
+    void parse(const String&);
+    String valueAsString() const;
+};
 
 } // namespace WebCore
 
index f4e2b8a..91d55b1 100644 (file)
@@ -105,7 +105,7 @@ namespace WebCore {
 
         mutable RefPtr<SVGPathSegList> m_pathSegList;
 
-        DECLARE_ANIMATED_PROPERTY(SVGPathElement, SVGNames::pathLengthAttr, float, PathLength, pathLength)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPathElement, SVGNames::pathLengthAttr, float, PathLength, pathLength)
 
         // SVGExternalResourcesRequired
         DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
index 232b97a..8da2655 100644 (file)
@@ -22,7 +22,7 @@
 #define SVGStopElement_h
 
 #if ENABLE(SVG)
-#include "SVGNames.h"
+#include "SVGAnimatedPropertyMacros.h"
 #include "SVGStyledElement.h"
 
 namespace WebCore {
@@ -44,7 +44,7 @@ namespace WebCore {
 
         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
-        DECLARE_ANIMATED_PROPERTY(SVGStopElement, SVGNames::offsetAttr, float, Offset, offset)
+        DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGStopElement, SVGNames::offsetAttr, float, Offset, offset)
     };
 
 } // namespace WebCore
index d64dd1f..dc1f915 100644 (file)
@@ -34,7 +34,6 @@ namespace WebCore {
 
 SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document* document)
     : SVGTextContentElement(tagName, document)
-    , m_rotate(SVGNumberList::create(SVGNames::rotateAttr))
 {
 }
 
@@ -60,9 +59,12 @@ void SVGTextPositioningElement::parseMappedAttribute(Attribute* attr)
         newList.parse(attr->value(), LengthModeHeight);
         detachAnimatedDyListWrappers(newList.size());
         dyBaseValue() = newList;
-    } else if (attr->name() == SVGNames::rotateAttr)
-        rotateBaseValue()->parse(attr->value());
-    else
+    } else if (attr->name() == SVGNames::rotateAttr) {
+        SVGNumberList newList;
+        newList.parse(attr->value());
+        detachAnimatedRotateListWrappers(newList.size());
+        rotateBaseValue() = newList;
+    } else
         SVGTextContentElement::parseMappedAttribute(attr);
 }
 
index 1fb1c3c..e1798de 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
         DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::yAttr, SVGLengthList, Y, y)
         DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::dxAttr, SVGLengthList, Dx, dx)
         DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::dyAttr, SVGLengthList, Dy, dy)
-        DECLARE_ANIMATED_PROPERTY(SVGTextPositioningElement, SVGNames::rotateAttr, SVGNumberList*, Rotate, rotate)
+        DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::rotateAttr, SVGNumberList, Rotate, rotate)
     };
 
 } // namespace WebCore
index 8d82a61..a3d1e7c 100644 (file)
@@ -26,6 +26,7 @@
 #include "SVGAngle.h"
 #include "SVGLength.h"
 #include "SVGLengthList.h"
+#include "SVGNumberList.h"
 #include "SVGPreserveAspectRatio.h"
 #include <wtf/text/StringBuilder.h>
 
@@ -79,6 +80,14 @@ struct SVGPropertyTraits<float> {
 };
 
 template<>
+struct SVGPropertyTraits<SVGNumberList> {
+    typedef float ListItemType;
+
+    static SVGNumberList initialValue() { return SVGNumberList(); }
+    static String toString(const SVGNumberList& type) { return type.valueAsString(); }
+};
+
+template<>
 struct SVGPropertyTraits<SVGPreserveAspectRatio> {
     static SVGPreserveAspectRatio initialValue() { return SVGPreserveAspectRatio(); }
     static String toString(const SVGPreserveAspectRatio& type) { return type.valueAsString(); }