Title: [290570] trunk
Revision
290570
Author
[email protected]
Date
2022-02-27 13:19:37 -0800 (Sun, 27 Feb 2022)

Log Message

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

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::setStrokeOpacity):

Modified Paths

Diff

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


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 20:55:52 UTC (rev 290569)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 21:19:37 UTC (rev 290570)
@@ -1,5 +1,15 @@
 2022-02-27  Antoine Quint  <[email protected]>
 
+        [svg] stroke-opacity should be clamped to the [0,1] range
+        https://bugs.webkit.org/show_bug.cgi?id=237254
+
+        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] stop-opacity should be clamped to the [0,1] range
         https://bugs.webkit.org/show_bug.cgi?id=237255
 

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


--- 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)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt	2022-02-27 21:19:37 UTC (rev 290570)
@@ -132,7 +132,7 @@
 PASS stroke-miterlimit: positive number
 PASS stroke-opacity (type: opacity) has testAccumulation function
 PASS stroke-opacity: [0, 1] number
-FAIL stroke-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS stroke-opacity: [0, 1] number (clamped)
 PASS table-layout (type: discrete) has testAccumulation function
 PASS table-layout: "fixed" onto "auto"
 PASS table-layout: "auto" onto "fixed"

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


--- 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)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt	2022-02-27 21:19:37 UTC (rev 290570)
@@ -132,7 +132,7 @@
 PASS stroke-miterlimit: positive number
 PASS stroke-opacity (type: opacity) has testAddition function
 PASS stroke-opacity: [0, 1] number
-FAIL stroke-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS stroke-opacity: [0, 1] number (clamped)
 PASS table-layout (type: discrete) has testAddition function
 PASS table-layout: "fixed" onto "auto"
 PASS table-layout: "auto" onto "fixed"

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


--- trunk/Source/WebCore/ChangeLog	2022-02-27 20:55:52 UTC (rev 290569)
+++ trunk/Source/WebCore/ChangeLog	2022-02-27 21:19:37 UTC (rev 290570)
@@ -1,5 +1,15 @@
 2022-02-27  Antoine Quint  <[email protected]>
 
+        [svg] stroke-opacity should be clamped to the [0,1] range
+        https://bugs.webkit.org/show_bug.cgi?id=237254
+
+        Reviewed by Dean Jackson.
+
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::setStrokeOpacity):
+
+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
 

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


--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 20:55:52 UTC (rev 290569)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 21:19:37 UTC (rev 290570)
@@ -309,8 +309,9 @@
 
 inline void SVGRenderStyle::setStrokeOpacity(float opacity)
 {
-    if (!(m_strokeData->opacity == opacity))
-        m_strokeData.access().opacity = opacity;
+    auto clampedOpacity = clampTo<float>(opacity, 0.f, 1.f);
+    if (!(m_strokeData->opacity == clampedOpacity))
+        m_strokeData.access().opacity = clampedOpacity;
 }
 
 inline void SVGRenderStyle::setStrokePaint(SVGPaintType type, const Color& color, const String& uri, bool applyToRegularStyle, bool applyToVisitedLinkStyle)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to