Title: [235999] trunk
Revision
235999
Author
[email protected]
Date
2018-09-13 17:25:14 -0700 (Thu, 13 Sep 2018)

Log Message

Fix color stop blending in conic gradients for stops past 1
https://bugs.webkit.org/show_bug.cgi?id=189532
<rdar://problem/44158221>

Reviewed by Simon Fraser.

Source/WebCore:

Calculation was wrong, fixed it, and wrote a test that failed
without the change, and passes with it.

Test: fast/gradients/conic-repeating-last-stop.html

* css/CSSGradientValue.cpp:
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):

LayoutTests:

Tests that last stop in the gradient is correct.

* fast/gradients/conic-repeating-last-stop-expected.html: Added.
* fast/gradients/conic-repeating-last-stop.html: Added.
* platform/ios-12/TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235998 => 235999)


--- trunk/LayoutTests/ChangeLog	2018-09-14 00:08:35 UTC (rev 235998)
+++ trunk/LayoutTests/ChangeLog	2018-09-14 00:25:14 UTC (rev 235999)
@@ -1,3 +1,18 @@
+2018-09-13  Megan Gardner  <[email protected]>
+
+        Fix color stop blending in conic gradients for stops past 1
+        https://bugs.webkit.org/show_bug.cgi?id=189532
+        <rdar://problem/44158221>
+
+        Reviewed by Simon Fraser.
+
+        Tests that last stop in the gradient is correct.
+
+        * fast/gradients/conic-repeating-last-stop-expected.html: Added.
+        * fast/gradients/conic-repeating-last-stop.html: Added.
+        * platform/ios-12/TestExpectations:
+        * platform/mac/TestExpectations:
+
 2018-09-13  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r235954.

Modified: trunk/LayoutTests/TestExpectations (235998 => 235999)


--- trunk/LayoutTests/TestExpectations	2018-09-14 00:08:35 UTC (rev 235998)
+++ trunk/LayoutTests/TestExpectations	2018-09-14 00:25:14 UTC (rev 235999)
@@ -2243,6 +2243,7 @@
 fast/gradients/conic-center-outside-box.html [ Skip ]
 fast/gradients/conic-extended-stops.html [ Skip ]
 fast/gradients/conic-from-angle.html [ Skip ]
+fast/gradients/conic-repeating-last-stop.html [ Skip ]
 
 webkit.org/b/187773 http/tests/webAPIStatistics [ Skip ]
 

Added: trunk/LayoutTests/fast/gradients/conic-repeating-last-stop-expected.html (0 => 235999)


--- trunk/LayoutTests/fast/gradients/conic-repeating-last-stop-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/gradients/conic-repeating-last-stop-expected.html	2018-09-14 00:25:14 UTC (rev 235999)
@@ -0,0 +1,18 @@
+<html>
+<head>
+    <style>
+        div {
+            width: 200px;
+            height: 200px;
+        }
+
+        #box1 {
+            background-color: yellow;
+        }
+        
+    </style>
+</head>
+<body>
+    <div id="box1"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/gradients/conic-repeating-last-stop.html (0 => 235999)


--- trunk/LayoutTests/fast/gradients/conic-repeating-last-stop.html	                        (rev 0)
+++ trunk/LayoutTests/fast/gradients/conic-repeating-last-stop.html	2018-09-14 00:25:14 UTC (rev 235999)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<style>
+svg {
+    width: 800px;
+    display: none;
+}
+
+.container {
+    width: 200px;
+    height: 200px;
+    overflow: hidden;
+}
+
+#test {
+    width: 200px;
+    height: 200px;
+    background-image: repeating-conic-gradient(gold, orange 20deg);
+    filter: url(#posterize);
+    transform: scale(20);
+    transform-origin: 45% top;
+}
+</style>
+</head>
+
+<body>
+<svg viewBox="0 0 700 100">
+<defs>
+    <filter id="posterize" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox">
+        <feComponentTransfer>
+            <feFuncR type="discrete" tableValues="0 1"/>
+            <feFuncG type="discrete" tableValues="0 1"/>
+            <feFuncB type="discrete" tableValues="0 1"/>
+        </feComponentTransfer>
+    </filter>
+</defs>
+</svg>
+
+<div class="container">
+    <div id="test"></div>
+</div>
+</html>

Modified: trunk/LayoutTests/platform/ios-12/TestExpectations (235998 => 235999)


--- trunk/LayoutTests/platform/ios-12/TestExpectations	2018-09-14 00:08:35 UTC (rev 235998)
+++ trunk/LayoutTests/platform/ios-12/TestExpectations	2018-09-14 00:25:14 UTC (rev 235999)
@@ -32,4 +32,5 @@
 fast/gradients/conic-off-center.html [ Pass ]
 fast/gradients/conic-center-outside-box.html [ Pass ]
 fast/gradients/conic-extended-stops.html [ Pass ]
-fast/gradients/conic-from-angle.html [ Pass ]
\ No newline at end of file
+fast/gradients/conic-from-angle.html [ Pass ]
+fast/gradients/conic-repeating-last-stop.html [ Pass ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (235998 => 235999)


--- trunk/LayoutTests/platform/mac/TestExpectations	2018-09-14 00:08:35 UTC (rev 235998)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2018-09-14 00:25:14 UTC (rev 235999)
@@ -1764,3 +1764,6 @@
 [ Mojave+ ] fast/gradients/conic-center-outside-box.html [ Pass ]
 [ Mojave+ ] fast/gradients/conic-extended-stops.html [ Pass ]
 [ Mojave+ ] fast/gradients/conic-from-angle.html [ Pass ]
+[ Mojave+ ] fast/gradients/conic-repeating-last-stop.html [ Pass ]
+
+

Modified: trunk/Source/WebCore/ChangeLog (235998 => 235999)


--- trunk/Source/WebCore/ChangeLog	2018-09-14 00:08:35 UTC (rev 235998)
+++ trunk/Source/WebCore/ChangeLog	2018-09-14 00:25:14 UTC (rev 235999)
@@ -1,3 +1,19 @@
+2018-09-13  Megan Gardner  <[email protected]>
+
+        Fix color stop blending in conic gradients for stops past 1
+        https://bugs.webkit.org/show_bug.cgi?id=189532
+        <rdar://problem/44158221>
+
+        Reviewed by Simon Fraser.
+
+        Calculation was wrong, fixed it, and wrote a test that failed
+        without the change, and passes with it.
+
+        Test: fast/gradients/conic-repeating-last-stop.html
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
+
 2018-09-13  Chris Dumez  <[email protected]>
 
         Regression(PSON): setting window.opener to null allows process swapping in cases that are not web-compatible

Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (235998 => 235999)


--- trunk/Source/WebCore/css/CSSGradientValue.cpp	2018-09-14 00:08:35 UTC (rev 235998)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp	2018-09-14 00:25:14 UTC (rev 235999)
@@ -280,7 +280,7 @@
                 float prevOffset = stops[lastOneOrLessIndex].offset;
                 float nextOffset = stops[lastOneOrLessIndex + 1].offset;
                 
-                float interStopProportion = 1 / (nextOffset - prevOffset);
+                float interStopProportion = (1 - prevOffset) / (nextOffset - prevOffset);
                 // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication.
                 Color blendedColor = blend(stops[lastOneOrLessIndex].color, stops[lastOneOrLessIndex + 1].color, interStopProportion);
                 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to