Commit da45942e authored by zimmermann@webkit.org's avatar zimmermann@webkit.org
Browse files

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

        Reviewed by Dirk Schulze.

        Convert SVGAngle to the new SVGPropertyTearOff concept, reimplement it properly
        https://bugs.webkit.org/show_bug.cgi?id=48179

        Rewrite SVGAngle to use the new SVGPropertyTearOff concept, and consume much less memory.
        Down from two floats, one string and an ushort to one float and one ushort. Synchronize value/valueInSpecifiedUnits/valueAsString on demand.

        Adding an extensive SVGAngle test, that required to implement 'StrictTypeChecking' for attribute setters (was only implemented in V8/JSC for function cals so far).

        Test: svg/dom/SVGAngle.html

        * GNUmakefile.am: Add SVGAnimatedAngle.h to build.
        * WebCore.gypi: Ditto.
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * bindings/scripts/CodeGenerator.pm: Split IsPrimitiveType in IsPrimitiveType and IsNumericType.
        * bindings/scripts/CodeGeneratorJS.pm: Implement 'StrictTypeChecking' for setters and recognize SVGAngle as new SVGPropertyTearOff type.
        * bindings/scripts/CodeGeneratorObjC.pm: Ditto.
        * bindings/scripts/CodeGeneratorV8.pm: Ditto.
        * svg/DeprecatedSVGAnimatedPropertyTraits.h: Remove SVGAngle handling.
        * svg/DeprecatedSVGAnimatedTemplate.h: Remove SVGAnimatedAngle handling.
        * svg/SVGAngle.cpp: Rewrite, to consume less memory and to operate more efficient.
        * svg/SVGAngle.h: Ditto.
        * svg/SVGAngle.idl: Add 'StrictTypeChecking' to the value/valueInSpecifiedUnits methods.
        * svg/SVGAnimatedAngle.h: Added.
        * svg/SVGAnimatedAngle.idl: Mark as [SVGAnimatedProperty].
        * svg/SVGMarkerElement.cpp:
        (WebCore::SVGMarkerElement::parseMappedAttribute): SVGAngle::setValueAsString() now takes an ExceptionCode parameter.
        * svg/SVGMarkerElement.h: s/ANIMATED_PROPERTY/ANIMATED_PROPERTY_NEW/ for the SVGAngle type.
        * svg/SVGNumber.idl: Remove exception setter exceptions, which aren't needed. As we're now generating exception handlers in the bindings, it would lead to compile errors.
        * svg/SVGPoint.idl: Ditto.
        * svg/SVGRect.idl: Ditto.
        * svg/SVGSVGElement.idl: Remove obsolete [SVGLiveProperty] flag.
2010-10-23  Nikolas Zimmermann  <nzimmermann@rim.com>

        Reviewed by Dirk Schulze.

        Convert SVGAngle to the new SVGPropertyTearOff concept, reimplement it properly
        https://bugs.webkit.org/show_bug.cgi?id=48179

        Add an extensive SVGAngle test, checking all getter/setters & methods, with valid and invalid arguments.
        The test exposes bugs in Opera & FireFox, we now pass them all.

        * svg/dom/SVGAngle-expected.txt: Added.
        * svg/dom/SVGAngle.html: Added.
        * svg/dom/script-tests/SVGAngle.js: Added.
        * svg/dom/svg-element-attribute-js-null-expected.txt:
        * svg/dom/svg-element-attribute-js-null.xhtml: Update incorrect test, setting valueAsString to null, should not result in "0deg" but "0".


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 20be8493
2010-10-23 Nikolas Zimmermann <nzimmermann@rim.com>
Reviewed by Dirk Schulze.
Convert SVGAngle to the new SVGPropertyTearOff concept, reimplement it properly
https://bugs.webkit.org/show_bug.cgi?id=48179
Add an extensive SVGAngle test, checking all getter/setters & methods, with valid and invalid arguments.
The test exposes bugs in Opera & FireFox, we now pass them all.
* svg/dom/SVGAngle-expected.txt: Added.
* svg/dom/SVGAngle.html: Added.
* svg/dom/script-tests/SVGAngle.js: Added.
* svg/dom/svg-element-attribute-js-null-expected.txt:
* svg/dom/svg-element-attribute-js-null.xhtml: Update incorrect test, setting valueAsString to null, should not result in "0deg" but "0".
2010-10-23 Dimitri Glazkov <dglazkov@chromium.org>
 
[Chromium/DRT] Unbreak build by removing duplicate test expectations.
This test checks the SVGAngle API
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Check initial angle values
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
Check invalid arguments for 'convertToSpecifiedUnits'
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNKNOWN) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.convertToSpecifiedUnits(-1) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.convertToSpecifiedUnits(5) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Check valid arguments for 'convertToSpecifiedUnits', that should only modify the 'valueAsString'
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD) is undefined.
PASS angle.valueAsString is "0rad"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_RAD
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_GRAD) is undefined.
PASS angle.valueAsString is "0grad"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_GRAD
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG) is undefined.
PASS angle.valueAsString is "0deg"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED) is undefined.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Check invalid arguments for 'newValueSpecifiedUnits'
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNKNOWN, 50) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.newValueSpecifiedUnits(-1, 50) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.newValueSpecifiedUnits(5, 50) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Check valid arguments for 'newValueSpecifiedUnits', that should only modify the 'valueAsString'
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, parseFloat(Math.PI.toFixed(5))) is undefined.
PASS angle.valueAsString is "3.14159rad"
PASS angle.value.toFixed(1) is "180.0"
PASS angle.valueInSpecifiedUnits.toFixed(5) is Math.PI.toFixed(5)
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_RAD
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_GRAD, 400) is undefined.
PASS angle.valueAsString is "400grad"
PASS angle.value.toFixed(1) is "360.0"
PASS angle.valueInSpecifiedUnits is 400
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_GRAD
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 360) is undefined.
PASS angle.valueAsString is "360deg"
PASS angle.value is 360
PASS angle.valueInSpecifiedUnits is 360
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED, 180) is undefined.
PASS angle.valueAsString is "180"
PASS angle.value is 180
PASS angle.valueInSpecifiedUnits is 180
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Reset to initial angle state
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED, 0) is undefined.
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Check setting invalid 'valueAsString' arguments
PASS angle.valueAsString = '10px' threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.valueAsString = '10x' threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.valueAsString = '5graD' threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.valueAsString = '5Rad' threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.valueAsString = ',5 rad' threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Check setting invalid 'valueInSpecifiedUnits' arguments
PASS angle.valueInSpecifiedUnits = 'test' threw exception TypeError: Type error.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.valueInSpecifiedUnits = angle threw exception TypeError: Type error.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Check setting invalid 'value' arguments
PASS angle.value = 'test' threw exception TypeError: Type error.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS angle.value = angle threw exception TypeError: Type error.
PASS angle.valueAsString is "0"
PASS angle.value is 0
PASS angle.valueInSpecifiedUnits is 0
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
Reset to angle in degree units
PASS angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 0) is undefined.
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
Check setting valid 'value' arguments, assure that 'valueInSpecifiedUnits' and 'valueAsString' are synchronized
PASS angle.value = 50 is 50
PASS angle.valueInSpecifiedUnits is 50
PASS angle.valueAsString is "50deg"
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
Try modifiying the readonly 'unitType', needs to fail
PASS angle.unitType = SVGAngle.SVG_ANGLETTYE_RAD is undefined.
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
Check setting valid 'valueInSpecifiedUnits' arguments, assure that 'value' and 'valueAsString' are synchronized
PASS angle.valueInSpecifiedUnits = 100 is 100
PASS angle.value is 100
PASS angle.valueAsString is "100deg"
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
Check setting valid 'valueAsString' arguments, assure that 'value' and 'valueInSpecifiedUnits' are synchronized
PASS angle.valueAsString = '200grad' is "200grad"
PASS angle.valueInSpecifiedUnits is 200
PASS angle.value.toFixed(1) is "180.0"
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_GRAD
Now convert the GRAD value into a RAD value, and assure that all properties have been synchronized
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD) is undefined.
PASS angle.value.toFixed(1) is "180.0"
PASS angle.valueInSpecifiedUnits.toFixed(5) is "3.14159"
PASS angle.valueAsString is "3.14159rad"
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_RAD
Now try converting the RAD value into an unknown value, that should fail and throw
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNKNOWN) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS angle.value.toFixed(1) is "180.0"
PASS angle.valueInSpecifiedUnits.toFixed(5) is "3.14159"
PASS angle.valueAsString is "3.14159rad"
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_RAD
Now convert the RAD value into a DEG value, and assure that all properties have been synchronized
PASS angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG) is undefined.
PASS angle.value.toFixed(1) is "180.0"
PASS angle.valueInSpecifiedUnits.toFixed(1) is "180.0"
PASS angle.valueAsString is "180deg"
PASS angle.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS successfullyParsed is true
TEST COMPLETE
<!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/SVGAngle.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
description("This test checks the SVGAngle API");
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var angle = svgElement.createSVGAngle();
debug("");
debug("Check initial angle values");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
// Spec: Raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
debug("");
debug("Check invalid arguments for 'convertToSpecifiedUnits'");
shouldThrow("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNKNOWN)");
shouldThrow("angle.convertToSpecifiedUnits(-1)");
shouldThrow("angle.convertToSpecifiedUnits(5)");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
debug("");
debug("Check valid arguments for 'convertToSpecifiedUnits', that should only modify the 'valueAsString'");
shouldBeUndefined("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD)");
shouldBeEqualToString("angle.valueAsString", "0rad");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_RAD");
shouldBeUndefined("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_GRAD)");
shouldBeEqualToString("angle.valueAsString", "0grad");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_GRAD");
shouldBeUndefined("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG)");
shouldBeEqualToString("angle.valueAsString", "0deg");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
shouldBeUndefined("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED)");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
// Spec: Raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
debug("");
debug("Check invalid arguments for 'newValueSpecifiedUnits'");
shouldThrow("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNKNOWN, 50)");
shouldThrow("angle.newValueSpecifiedUnits(-1, 50)");
shouldThrow("angle.newValueSpecifiedUnits(5, 50)");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
debug("");
debug("Check valid arguments for 'newValueSpecifiedUnits', that should only modify the 'valueAsString'");
shouldBeUndefined("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, parseFloat(Math.PI.toFixed(5)))");
shouldBeEqualToString("angle.valueAsString", Math.PI.toFixed(5) + "rad");
shouldBeEqualToString("angle.value.toFixed(1)", "180.0");
shouldBe("angle.valueInSpecifiedUnits.toFixed(5)", "Math.PI.toFixed(5)");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_RAD");
shouldBeUndefined("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_GRAD, 400)");
shouldBeEqualToString("angle.valueAsString", "400grad");
shouldBeEqualToString("angle.value.toFixed(1)", "360.0");
shouldBe("angle.valueInSpecifiedUnits", "400");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_GRAD");
shouldBeUndefined("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 360)");
shouldBeEqualToString("angle.valueAsString", "360deg");
shouldBe("angle.value", "360");
shouldBe("angle.valueInSpecifiedUnits", "360");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
shouldBeUndefined("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED, 180)");
shouldBeEqualToString("angle.valueAsString", "180");
shouldBe("angle.value", "180");
shouldBe("angle.valueInSpecifiedUnits", "180");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
debug("");
debug("Reset to initial angle state");
shouldBeUndefined("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED, 0)");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
// Spec: Raised if the assigned string cannot be parsed as a valid <angle>.
debug("");
debug("Check setting invalid 'valueAsString' arguments");
shouldThrow("angle.valueAsString = '10px'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldThrow("angle.valueAsString = '10x'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldThrow("angle.valueAsString = '5graD'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldThrow("angle.valueAsString = '5Rad'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldThrow("angle.valueAsString = ',5 rad'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
debug("");
debug("Check setting invalid 'valueInSpecifiedUnits' arguments");
shouldThrow("angle.valueInSpecifiedUnits = 'test'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldThrow("angle.valueInSpecifiedUnits = angle");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
debug("");
debug("Check setting invalid 'value' arguments");
shouldThrow("angle.value = 'test'");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
shouldThrow("angle.value = angle");
shouldBeEqualToString("angle.valueAsString", "0");
shouldBe("angle.value", "0");
shouldBe("angle.valueInSpecifiedUnits", "0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
debug("");
debug("Reset to angle in degree units");
shouldBeUndefined("angle.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 0)");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
debug("");
debug("Check setting valid 'value' arguments, assure that 'valueInSpecifiedUnits' and 'valueAsString' are synchronized");
shouldBe("angle.value = 50", "50");
shouldBe("angle.valueInSpecifiedUnits", "50");
shouldBeEqualToString("angle.valueAsString", "50deg");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
debug("");
debug("Try modifiying the readonly 'unitType', needs to fail");
shouldBeUndefined("angle.unitType = SVGAngle.SVG_ANGLETTYE_RAD");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
debug("");
debug("Check setting valid 'valueInSpecifiedUnits' arguments, assure that 'value' and 'valueAsString' are synchronized");
shouldBe("angle.valueInSpecifiedUnits = 100", "100");
shouldBe("angle.value", "100");
shouldBeEqualToString("angle.valueAsString", "100deg");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
debug("");
debug("Check setting valid 'valueAsString' arguments, assure that 'value' and 'valueInSpecifiedUnits' are synchronized");
shouldBeEqualToString("angle.valueAsString = '200grad'", "200grad");
shouldBe("angle.valueInSpecifiedUnits", "200");
shouldBeEqualToString("angle.value.toFixed(1)", "180.0");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_GRAD");
debug("");
debug("Now convert the GRAD value into a RAD value, and assure that all properties have been synchronized");
shouldBeUndefined("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD)");
shouldBeEqualToString("angle.value.toFixed(1)", "180.0");
shouldBeEqualToString("angle.valueInSpecifiedUnits.toFixed(5)", Math.PI.toFixed(5));
shouldBeEqualToString("angle.valueAsString", Math.PI.toFixed(5) + "rad");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_RAD");
debug("");
debug("Now try converting the RAD value into an unknown value, that should fail and throw");
shouldThrow("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_UNKNOWN)");
shouldBeEqualToString("angle.value.toFixed(1)", "180.0");
shouldBeEqualToString("angle.valueInSpecifiedUnits.toFixed(5)", Math.PI.toFixed(5));
shouldBeEqualToString("angle.valueAsString", Math.PI.toFixed(5) + "rad");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_RAD");
debug("");
debug("Now convert the RAD value into a DEG value, and assure that all properties have been synchronized");
shouldBeUndefined("angle.convertToSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG)");
shouldBeEqualToString("angle.value.toFixed(1)", "180.0");
shouldBeEqualToString("angle.valueInSpecifiedUnits.toFixed(1)", "180.0");
shouldBeEqualToString("angle.valueAsString", "180deg");
shouldBe("angle.unitType", "SVGAngle.SVG_ANGLETYPE_DEG");
successfullyParsed = true;
......@@ -3,7 +3,7 @@ This test setting various attributes of a SVG elements to JavaScript null.
TEST SUCCEEDED: The value was the empty string. [tested SVGElement.id]
TEST SUCCEEDED: The value was the empty string. [tested SVGElement.xmlbase]
TEST SUCCEEDED: The value was the string '0deg'. [tested SVGAngle.valueAsString]
TEST SUCCEEDED: The value was the string '0'. [tested SVGAngle.valueAsString]
TEST SUCCEEDED: The value was the string '0'. [tested SVGLength.valueAsString]
......
......@@ -60,7 +60,7 @@
type: 'SVGAngle',
elementToUse: svg.createSVGAngle(),
attributes: [
{name: 'valueAsString', expectedNull: '0deg'}
{name: 'valueAsString', expectedNull: '0'}
]
},
{
......
2010-10-23 Nikolas Zimmermann <nzimmermann@rim.com>
Reviewed by Dirk Schulze.
Convert SVGAngle to the new SVGPropertyTearOff concept, reimplement it properly
https://bugs.webkit.org/show_bug.cgi?id=48179
Rewrite SVGAngle to use the new SVGPropertyTearOff concept, and consume much less memory.
Down from two floats, one string and an ushort to one float and one ushort. Synchronize value/valueInSpecifiedUnits/valueAsString on demand.
Adding an extensive SVGAngle test, that required to implement 'StrictTypeChecking' for attribute setters (was only implemented in V8/JSC for function cals so far).
Test: svg/dom/SVGAngle.html
* GNUmakefile.am: Add SVGAnimatedAngle.h to build.
* WebCore.gypi: Ditto.
* WebCore.pro: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/scripts/CodeGenerator.pm: Split IsPrimitiveType in IsPrimitiveType and IsNumericType.
* bindings/scripts/CodeGeneratorJS.pm: Implement 'StrictTypeChecking' for setters and recognize SVGAngle as new SVGPropertyTearOff type.
* bindings/scripts/CodeGeneratorObjC.pm: Ditto.
* bindings/scripts/CodeGeneratorV8.pm: Ditto.
* svg/DeprecatedSVGAnimatedPropertyTraits.h: Remove SVGAngle handling.
* svg/DeprecatedSVGAnimatedTemplate.h: Remove SVGAnimatedAngle handling.
* svg/SVGAngle.cpp: Rewrite, to consume less memory and to operate more efficient.
* svg/SVGAngle.h: Ditto.
* svg/SVGAngle.idl: Add 'StrictTypeChecking' to the value/valueInSpecifiedUnits methods.
* svg/SVGAnimatedAngle.h: Added.
* svg/SVGAnimatedAngle.idl: Mark as [SVGAnimatedProperty].
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::parseMappedAttribute): SVGAngle::setValueAsString() now takes an ExceptionCode parameter.
* svg/SVGMarkerElement.h: s/ANIMATED_PROPERTY/ANIMATED_PROPERTY_NEW/ for the SVGAngle type.
* svg/SVGNumber.idl: Remove exception setter exceptions, which aren't needed. As we're now generating exception handlers in the bindings, it would lead to compile errors.
* svg/SVGPoint.idl: Ditto.
* svg/SVGRect.idl: Ditto.
* svg/SVGSVGElement.idl: Remove obsolete [SVGLiveProperty] flag.
2010-10-23 Daniel Bates <dbates@rim.com>
 
Reviewed by Adam Barth.
......@@ -3028,6 +3028,7 @@ webcore_sources += \
WebCore/svg/SVGAngle.h \
WebCore/svg/SVGAnimateColorElement.cpp \
WebCore/svg/SVGAnimateColorElement.h \
WebCore/svg/SVGAnimatedAngle.h \
WebCore/svg/SVGAnimatedLength.h \
WebCore/svg/SVGAnimatedLengthList.h \
WebCore/svg/SVGAnimatedPathData.cpp \
......
......@@ -3958,6 +3958,7 @@
'svg/SVGAnimateMotionElement.h',
'svg/SVGAnimateTransformElement.cpp',
'svg/SVGAnimateTransformElement.h',
'svg/SVGAnimatedAngle.h',
'svg/SVGAnimatedLength.h',
'svg/SVGAnimatedLengthList.h',
'svg/SVGAnimatedPathData.cpp',
......
......@@ -2358,6 +2358,7 @@ HEADERS += \
svg/SVGAltGlyphElement.h \
svg/SVGAngle.h \
svg/SVGAnimateColorElement.h \
svg/SVGAnimatedAngle.h \
svg/SVGAnimatedLength.h \
svg/SVGAnimatedLengthList.h \
svg/SVGAnimatedPathData.h \
......
......@@ -61170,6 +61170,10 @@
RelativePath="..\svg\SVGAnimateColorElement.h"
>
</File>
<File
RelativePath="..\svg\SVGAnimatedAngle.h"
>
</File>
<File
RelativePath="..\svg\SVGAnimatedLength.h"
>
......@@ -156,6 +156,7 @@
08735FB910E91232006D6FAD /* SVGMarkerLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 08735FB710E91232006D6FAD /* SVGMarkerLayoutInfo.h */; };
08744BAA0EDB7D86004C9E63 /* WMLOnEventElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */; };
08744BAE0EDB7D92004C9E63 /* WMLOnEventElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */; };
087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */ = {isa = PBXBuildFile; fileRef = 087B84951272CEC700A14417 /* SVGAnimatedAngle.h */; settings = {ATTRIBUTES = (Private, ); }; };
087D97BF10FB8D7700C00874 /* JSSVGPODListCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 087D97BE10FB8D7700C00874 /* JSSVGPODListCustom.h */; };
087FFA0F0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */; };
087FFA100EFF3ED3009DBD88 /* WMLInsertedLegendElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */; };
......@@ -6155,6 +6156,7 @@
08735FB710E91232006D6FAD /* SVGMarkerLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerLayoutInfo.h; sourceTree = "<group>"; };
08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLOnEventElement.cpp; sourceTree = "<group>"; };
08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLOnEventElement.h; sourceTree = "<group>"; };
087B84951272CEC700A14417 /* SVGAnimatedAngle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedAngle.h; sourceTree = "<group>"; };
087D97BE10FB8D7700C00874 /* JSSVGPODListCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGPODListCustom.h; sourceTree = "<group>"; };
087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLInsertedLegendElement.cpp; sourceTree = "<group>"; };
087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLInsertedLegendElement.h; sourceTree = "<group>"; };
......@@ -15941,6 +15943,7 @@
B22277E30D00BF1F0071B782 /* SVGAnimateColorElement.cpp */,
B22277E40D00BF1F0071B782 /* SVGAnimateColorElement.h */,
B22277E50D00BF1F0071B782 /* SVGAnimateColorElement.idl */,
087B84951272CEC700A14417 /* SVGAnimatedAngle.h */,
B22277E60D00BF1F0071B782 /* SVGAnimatedAngle.idl */,
B22277E70D00BF1F0071B782 /* SVGAnimatedBoolean.idl */,
B22277E80D00BF1F0071B782 /* SVGAnimatedEnumeration.idl */,
......@@ -21151,6 +21154,7 @@
089021A9126EF5DE0092D5EA /* SVGAnimatedLength.h in Headers */,
089021AD126EF5E90092D5EA /* SVGAnimatedLengthList.h in Headers */,
8AB4BC77126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h in Headers */,
087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -5,6 +5,7 @@
# Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
# Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
# 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
......@@ -42,20 +43,22 @@ my $codeGenerator = 0;
my $verbose = 0;
my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
"unsigned int" => 1, "unsigned short" => 1,
"unsigned long" => 1, "unsigned long long" => 1,
"float" => 1, "double" => 1,
"boolean" => 1, "void" => 1,
"Date" => 1);
my %numericTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
"unsigned int" => 1, "unsigned short" => 1,
"unsigned long" => 1, "unsigned long long" => 1,
"float" => 1, "double" => 1);
my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1);
my %podTypeHash = ("SVGNumber" => 1, "SVGTransform" => 1);
my %podTypesWithWritablePropertiesHash = ("SVGAngle" => 1, "SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1, "SVGRect" => 1);
my %podTypesWithWritablePropertiesHash = ("SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1, "SVGRect" => 1);
my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1);
my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType" => 1);
my %svgNewStyleAnimatedTypeHash = ("SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1);
my %svgTypeNeedingTearOffHash = ("SVGLength" => 1, "SVGAngle" => 1);
my %svgNewStyleAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1);
my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
"SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" => 1,
......@@ -283,6 +286,8 @@ sub ParseInterface
}
# Helpers for all CodeGenerator***.pm modules
# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
sub IsPodType
{
my $object = shift;
......@@ -302,12 +307,22 @@ sub IsPodTypeWithWriteableProperties
return 0;
}
sub IsNumericType