Title: [290568] trunk
Revision
290568
Author
[email protected]
Date
2022-02-27 12:31:57 -0800 (Sun, 27 Feb 2022)

Log Message

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

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

Modified Paths

Diff

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


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 19:54:26 UTC (rev 290567)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 20:31:57 UTC (rev 290568)
@@ -1,3 +1,13 @@
+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
+
+        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  Tim Nguyen  <[email protected]>
 
         Force -webkit-user-modify used style to readonly for inert nodes

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2022-02-27 19:54:26 UTC (rev 290567)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2022-02-27 20:31:57 UTC (rev 290568)
@@ -171,7 +171,7 @@
 PASS empty-cells: "show" onto "hide"
 PASS fill-opacity (type: opacity) has testAccumulation function
 PASS fill-opacity: [0, 1] number
-FAIL fill-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS fill-opacity: [0, 1] number (clamped)
 PASS filter (type: filterList) has testAccumulation function
 FAIL filter: same ordered filter functions assert_equals: The value should be blur(30px) brightness(0) at 0ms expected "blur(30px) brightness(0)" but got "blur(30px) brightness(0.4)"
 PASS filter: mismatched ordered filter functions

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2022-02-27 19:54:26 UTC (rev 290567)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2022-02-27 20:31:57 UTC (rev 290568)
@@ -171,7 +171,7 @@
 PASS empty-cells: "show" onto "hide"
 PASS fill-opacity (type: opacity) has testAddition function
 PASS fill-opacity: [0, 1] number
-FAIL fill-opacity: [0, 1] number (clamped) assert_equals: The value should be 1 at 0ms expected "1" but got "1.1"
+PASS fill-opacity: [0, 1] number (clamped)
 PASS filter (type: filterList) has testAddition function
 FAIL filter: blur on blur assert_equals: The value should be blur(10px) blur(20px) at 0ms expected "blur(10px) blur(20px)" but got "blur(30px)"
 FAIL filter: different filter functions assert_equals: The value should be blur(10px) brightness(0.8) at 0ms expected "blur(10px) brightness(0.8)" but got "brightness(0.8)"

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


--- trunk/Source/WebCore/ChangeLog	2022-02-27 19:54:26 UTC (rev 290567)
+++ trunk/Source/WebCore/ChangeLog	2022-02-27 20:31:57 UTC (rev 290568)
@@ -1,3 +1,13 @@
+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
+
+        Reviewed by Dean Jackson.
+
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::setFillOpacity):
+
 2022-02-27  Chris Dumez  <[email protected]>
 
         Simplify SerializedScriptValue construction

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


--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 19:54:26 UTC (rev 290567)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2022-02-27 20:31:57 UTC (rev 290568)
@@ -282,8 +282,9 @@
 
 inline void SVGRenderStyle::setFillOpacity(float opacity)
 {
-    if (!(m_fillData->opacity == opacity))
-        m_fillData.access().opacity = opacity;
+    auto clampedOpacity = clampTo<float>(opacity, 0.f, 1.f);
+    if (!(m_fillData->opacity == clampedOpacity))
+        m_fillData.access().opacity = clampedOpacity;
 }
 
 inline void SVGRenderStyle::setFillPaint(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