Title: [290569] trunk
Revision
290569
Author
[email protected]
Date
2022-02-27 12:55:52 -0800 (Sun, 27 Feb 2022)

Log Message

[svg] stop-opacity should be clamped to the [0,1] range
https://bugs.webkit.org/show_bug.cgi?id=237255

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

* web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:

Source/WebCore:

* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::setStopOpacity):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290568 => 290569)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 20:31:57 UTC (rev 290568)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 20:55:52 UTC (rev 290569)
@@ -1,5 +1,15 @@
 2022-02-27  Antoine Quint  <[email protected]>
 
+        [svg] stop-opacity should be clamped to the [0,1] range
+        https://bugs.webkit.org/show_bug.cgi?id=237255
+
+        Reviewed by Dean Jackson.
+
+        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:
+
+2022-02-27  Antoine Quint  <[email protected]>
+
         [svg] fill-opacity should be clamped to the [0,1] range
         https://bugs.webkit.org/show_bug.cgi?id=237252
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt (290568 => 290569)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt	2022-02-27 20:31:57 UTC (rev 290568)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt	2022-02-27 20:55:52 UTC (rev 290569)
@@ -122,7 +122,7 @@
 PASS stop-color supports animating as color of hsla()
 PASS stop-opacity (type: opacity) has testAccumulation function
 PASS stop-opacity: [0, 1] number
-FAIL stop-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS stop-opacity: [0, 1] number (clamped)
 PASS stroke-dasharray (type: dasharray) has testAccumulation function
 PASS stroke-dasharray: dasharray
 PASS stroke-dasharray (type: discrete) has testAccumulation function

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt (290568 => 290569)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt	2022-02-27 20:31:57 UTC (rev 290568)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt	2022-02-27 20:55:52 UTC (rev 290569)
@@ -122,7 +122,7 @@
 PASS stop-color supports animating as color of hsla()
 PASS stop-opacity (type: opacity) has testAddition function
 PASS stop-opacity: [0, 1] number
-FAIL stop-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS stop-opacity: [0, 1] number (clamped)
 PASS stroke-dasharray (type: dasharray) has testAddition function
 PASS stroke-dasharray: dasharray
 PASS stroke-dasharray (type: discrete) has testAddition function

Modified: trunk/Source/WebCore/ChangeLog (290568 => 290569)


--- trunk/Source/WebCore/ChangeLog	2022-02-27 20:31:57 UTC (rev 290568)
+++ trunk/Source/WebCore/ChangeLog	2022-02-27 20:55:52 UTC (rev 290569)
@@ -1,5 +1,15 @@
 2022-02-27  Antoine Quint  <[email protected]>
 
+        [svg] stop-opacity should be clamped to the [0,1] range
+        https://bugs.webkit.org/show_bug.cgi?id=237255
+
+        Reviewed by Dean Jackson.
+
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::setStopOpacity):
+
+2022-02-27  Antoine Quint  <[email protected]>
+
         [svg] fill-opacity should be clamped to the [0,1] range
         https://bugs.webkit.org/show_bug.cgi?id=237252
 

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyle.h (290568 => 290569)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 20:31:57 UTC (rev 290568)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 20:55:52 UTC (rev 290569)
@@ -353,8 +353,9 @@
 
 inline void SVGRenderStyle::setStopOpacity(float opacity)
 {
-    if (!(m_stopData->opacity == opacity))
-        m_stopData.access().opacity = opacity;
+    auto clampedOpacity = clampTo<float>(opacity, 0.f, 1.f);
+    if (!(m_stopData->opacity == clampedOpacity))
+        m_stopData.access().opacity = clampedOpacity;
 }
 
 inline void SVGRenderStyle::setStopColor(const Color& color)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to