Skip to content

Commit

Permalink
Sync 'SVGAnimatedNumber.idl' with IDL Web-Spec
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=256617

Reviewed by Ryosuke Niwa.

This patch aligns WebKit with Web-Spec [1], Blink / Chromium and Gecko / Firefox.

[1] https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedNumber

This patch removes 'unrestricted' since it is not in web-spec.

* Source/WebCore/svg/SVGAnimatedNumber.idl: As above
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedNumber-expected.txt: Rebaselined
* LayoutTests/svg/dom/SVGAnimatedNumber.html: Rebaselined
* LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt: Rebaselined

Canonical link: https://commits.webkit.org/263954@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed May 11, 2023
1 parent e71ce27 commit 300c734
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

FAIL SVGAnimatedNumber interface - utilizing the surfaceScale property of SVGFESpecularLightingElement assert_throws_js: function "function () { feSpecularLightingElement.surfaceScale.baseVal = 'aString'; }" did not throw
PASS SVGAnimatedNumber interface - utilizing the surfaceScale property of SVGFESpecularLightingElement

14 changes: 7 additions & 7 deletions LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ 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' is 'aString'
PASS feSpecularLightingElement.surfaceScale.baseVal is NaN
PASS feSpecularLightingElement.surfaceScale.baseVal = 'aString' threw exception TypeError: The provided value is non-finite.
PASS feSpecularLightingElement.surfaceScale.baseVal is 300
PASS feSpecularLightingElement.surfaceScale.baseVal = 0 is 0
PASS feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement threw exception TypeError: The provided value is non-finite.
PASS feSpecularLightingElement.surfaceScale.baseVal is 0
PASS feSpecularLightingElement.surfaceScale.baseVal = 0 is 0
PASS feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement is feSpecularLightingElement
PASS feSpecularLightingElement.surfaceScale.baseVal is NaN
PASS feSpecularLightingElement.surfaceScale.baseVal = 300 is 300

Check that the surfaceScale value remained 300
PASS feSpecularLightingElement.surfaceScale.baseVal is 300
Check that the surfaceScale value do not remain 300
PASS feSpecularLightingElement.surfaceScale.baseVal is 0
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
17 changes: 8 additions & 9 deletions LayoutTests/svg/dom/SVGAnimatedNumber.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
Expand Down Expand Up @@ -29,19 +29,18 @@
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = -1", "-1"); // Negative values are allowed from SVG DOM, but should lead to an error when rendering (disable the filter)
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = 300", "300");
// ECMA-262, 9.3, "ToNumber"
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = 'aString'", "'aString'");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal", "NaN");
shouldThrow("feSpecularLightingElement.surfaceScale.baseVal = 'aString'", "'TypeError: The provided value is non-finite'");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal", "300");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = 0", "0");
shouldThrow("feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement", "'TypeError: The provided value is non-finite'");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal", "0");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = 0", "0");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement", "feSpecularLightingElement");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal", "NaN");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal = 300", "300");

debug("");
debug("Check that the surfaceScale value remained 300");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal", "300");
debug("Check that the surfaceScale value do not remain 300");
shouldBe("feSpecularLightingElement.surfaceScale.baseVal", "0");

successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
8 changes: 5 additions & 3 deletions Source/WebCore/svg/SVGAnimatedNumber.idl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Samuel Weinig <[email protected]>
* Copyright (C) 2006 Apple Inc. All rights reserved.
* Copyright (C) 2006-2023 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -24,11 +24,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedNumber

[
SkipVTableValidation,
Exposed=Window
] interface SVGAnimatedNumber {
attribute unrestricted float baseVal;
readonly attribute unrestricted float animVal;
attribute float baseVal;
readonly attribute float animVal;
};

0 comments on commit 300c734

Please sign in to comment.