From 300c734d4a81735113dc5cfd69d327715a96b883 Mon Sep 17 00:00:00 2001 From: Ahmad Saleem Date: Thu, 11 May 2023 01:07:06 -0700 Subject: [PATCH] Sync 'SVGAnimatedNumber.idl' with IDL Web-Spec 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 --- .../scripted/SVGAnimatedNumber-expected.txt | 2 +- .../svg/dom/SVGAnimatedNumber-expected.txt | 14 +++++++------- LayoutTests/svg/dom/SVGAnimatedNumber.html | 17 ++++++++--------- Source/WebCore/svg/SVGAnimatedNumber.idl | 8 +++++--- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedNumber-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedNumber-expected.txt index 48e4955e6abdb..a64454c614a7b 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedNumber-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedNumber-expected.txt @@ -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 diff --git a/LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt b/LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt index a66df06215d46..7260c684d38f0 100644 --- a/LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt +++ b/LayoutTests/svg/dom/SVGAnimatedNumber-expected.txt @@ -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 diff --git a/LayoutTests/svg/dom/SVGAnimatedNumber.html b/LayoutTests/svg/dom/SVGAnimatedNumber.html index 1e31de002d0de..d3cd6003fd4aa 100644 --- a/LayoutTests/svg/dom/SVGAnimatedNumber.html +++ b/LayoutTests/svg/dom/SVGAnimatedNumber.html @@ -1,7 +1,7 @@ - +

@@ -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; - diff --git a/Source/WebCore/svg/SVGAnimatedNumber.idl b/Source/WebCore/svg/SVGAnimatedNumber.idl index 0ba214a8a1f4d..be336c7ee51de 100644 --- a/Source/WebCore/svg/SVGAnimatedNumber.idl +++ b/Source/WebCore/svg/SVGAnimatedNumber.idl @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Samuel Weinig - * 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 @@ -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; };