Title: [290571] trunk
Revision
290571
Author
grao...@webkit.org
Date
2022-02-27 14:15:50 -0800 (Sun, 27 Feb 2022)

Log Message

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

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

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

Source/WebCore:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290570 => 290571)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 21:19:37 UTC (rev 290570)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 22:15:50 UTC (rev 290571)
@@ -1,5 +1,15 @@
 2022-02-27  Antoine Quint  <grao...@webkit.org>
 
+        [svg] flood-opacity should be clamped to the [0,1] range
+        https://bugs.webkit.org/show_bug.cgi?id=237253
+
+        Reviewed by Dean Jackson.
+
+        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
+
+2022-02-27  Antoine Quint  <grao...@webkit.org>
+
         [svg] stroke-opacity should be clamped to the [0,1] range
         https://bugs.webkit.org/show_bug.cgi?id=237254
 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2022-02-27 21:19:37 UTC (rev 290570)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2022-02-27 22:15:50 UTC (rev 290571)
@@ -209,7 +209,7 @@
 PASS flood-color supports animating as color of hsla()
 PASS flood-opacity (type: opacity) has testAccumulation function
 PASS flood-opacity: [0, 1] number
-FAIL flood-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS flood-opacity: [0, 1] number (clamped)
 PASS font-stretch (type: percentage) has testAccumulation function
 PASS font-stretch: percentage
 PASS font-style (type: discrete) has testAccumulation function

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2022-02-27 21:19:37 UTC (rev 290570)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2022-02-27 22:15:50 UTC (rev 290571)
@@ -209,7 +209,7 @@
 PASS flood-color supports animating as color of hsla()
 PASS flood-opacity (type: opacity) has testAddition function
 PASS flood-opacity: [0, 1] number
-FAIL flood-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS flood-opacity: [0, 1] number (clamped)
 PASS font-stretch (type: percentage) has testAddition function
 PASS font-stretch: percentage
 PASS font-style (type: discrete) has testAddition function

Modified: trunk/Source/WebCore/ChangeLog (290570 => 290571)


--- trunk/Source/WebCore/ChangeLog	2022-02-27 21:19:37 UTC (rev 290570)
+++ trunk/Source/WebCore/ChangeLog	2022-02-27 22:15:50 UTC (rev 290571)
@@ -1,5 +1,15 @@
 2022-02-27  Antoine Quint  <grao...@webkit.org>
 
+        [svg] flood-opacity should be clamped to the [0,1] range
+        https://bugs.webkit.org/show_bug.cgi?id=237253
+
+        Reviewed by Dean Jackson.
+
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::setFloodOpacity):
+
+2022-02-27  Antoine Quint  <grao...@webkit.org>
+
         [svg] stroke-opacity should be clamped to the [0,1] range
         https://bugs.webkit.org/show_bug.cgi?id=237254
 

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyle.h (290570 => 290571)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 21:19:37 UTC (rev 290570)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 22:15:50 UTC (rev 290571)
@@ -367,8 +367,9 @@
 
 inline void SVGRenderStyle::setFloodOpacity(float opacity)
 {
-    if (!(m_miscData->floodOpacity == opacity))
-        m_miscData.access().floodOpacity = opacity;
+    auto clampedOpacity = clampTo<float>(opacity, 0.f, 1.f);
+    if (!(m_miscData->floodOpacity == clampedOpacity))
+        m_miscData.access().floodOpacity = clampedOpacity;
 }
 
 inline void SVGRenderStyle::setFloodColor(const Color& color)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to