Title: [251474] trunk
Revision
251474
Author
simon.fra...@apple.com
Date
2019-10-22 20:51:33 -0700 (Tue, 22 Oct 2019)

Log Message

wpt/css/css-images/gradient/color-stops-parsing.html fails
https://bugs.webkit.org/show_bug.cgi?id=200211

Reviewed by Dean Jackson.
LayoutTests/imported/w3c:

New result.

* web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt:

Source/WebCore:

CSS gradients allow a single color stop to have multiple positions. In this case
we need to copy the color from the first to subsequent stops.

Tested by web-platform-tests/css/css-images/gradient/color-stops-parsing.html
and imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html.

* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::gradientWithStylesResolved): Copy colors to subsequent stops.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeGradientColorStops): Fix the parsing of
stops with multiple positions.

LayoutTests:

Mark the conic gradient test as skipped, then passing on Mojave+.

* TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (251473 => 251474)


--- trunk/LayoutTests/ChangeLog	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/LayoutTests/ChangeLog	2019-10-23 03:51:33 UTC (rev 251474)
@@ -1,3 +1,15 @@
+2019-10-22  Simon Fraser  <simon.fra...@apple.com>
+
+        wpt/css/css-images/gradient/color-stops-parsing.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=200211
+
+        Reviewed by Dean Jackson.
+
+        Mark the conic gradient test as skipped, then passing on Mojave+.
+
+        * TestExpectations:
+        * platform/mac/TestExpectations:
+
 2019-10-22  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Implement support for new ARIA roles: code, strong, emphasis, generic

Modified: trunk/LayoutTests/TestExpectations (251473 => 251474)


--- trunk/LayoutTests/TestExpectations	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/LayoutTests/TestExpectations	2019-10-23 03:51:33 UTC (rev 251474)
@@ -3644,6 +3644,7 @@
 fast/gradients/conic-gradient-extended-stops.html [ Skip ]
 fast/gradients/conic-gradient.html [ Skip ]
 fast/gradients/conic-two-hints.html [ Skip ]
+imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html [ ImageOnlyFailure ]
 
 webkit.org/b/187773 http/tests/webAPIStatistics [ Skip ]
 
@@ -3881,4 +3882,3 @@
 webkit.org/b/200207 imported/w3c/web-platform-tests/css/css-images/css-image-fallbacks-and-annotations.html [ ImageOnlyFailure ]
 webkit.org/b/200208 imported/w3c/web-platform-tests/css/css-images/gradients-with-transparent.html [ ImageOnlyFailure ]
 webkit.org/b/200209 imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-radial.html [ ImageOnlyFailure ]
-webkit.org/b/202813 imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (251473 => 251474)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-23 03:51:33 UTC (rev 251474)
@@ -1,3 +1,14 @@
+2019-10-22  Simon Fraser  <simon.fra...@apple.com>
+
+        wpt/css/css-images/gradient/color-stops-parsing.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=200211
+
+        Reviewed by Dean Jackson.
+        
+        New result.
+
+        * web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt:
+
 2019-10-22  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         [SVG2] Remove the 'viewTarget' property of SVGViewElement

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt (251473 => 251474)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt	2019-10-23 03:51:33 UTC (rev 251474)
@@ -6,7 +6,7 @@
 PASS linear-gradient(black, invalid) [ unparsable ] 
 PASS linear-gradient(black, , white) [ unparsable ] 
 PASS linear-gradient(black, white, 75%) [ unparsable ] 
-FAIL linear-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS linear-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS linear-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS linear-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS linear-gradient(,black, white) [ unparsable ] 
@@ -32,7 +32,7 @@
 PASS repeating-linear-gradient(black, invalid) [ unparsable ] 
 PASS repeating-linear-gradient(black, , white) [ unparsable ] 
 PASS repeating-linear-gradient(black, white, 75%) [ unparsable ] 
-FAIL repeating-linear-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS repeating-linear-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS repeating-linear-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS repeating-linear-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS repeating-linear-gradient(,black, white) [ unparsable ] 
@@ -58,7 +58,7 @@
 PASS radial-gradient(black, invalid) [ unparsable ] 
 PASS radial-gradient(black, , white) [ unparsable ] 
 PASS radial-gradient(black, white, 75%) [ unparsable ] 
-FAIL radial-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS radial-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS radial-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS radial-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS radial-gradient(,black, white) [ unparsable ] 
@@ -84,7 +84,7 @@
 PASS repeating-radial-gradient(black, invalid) [ unparsable ] 
 PASS repeating-radial-gradient(black, , white) [ unparsable ] 
 PASS repeating-radial-gradient(black, white, 75%) [ unparsable ] 
-FAIL repeating-radial-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS repeating-radial-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS repeating-radial-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS repeating-radial-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS repeating-radial-gradient(,black, white) [ unparsable ] 
@@ -110,7 +110,7 @@
 PASS conic-gradient(black, invalid) [ unparsable ] 
 PASS conic-gradient(black, , white) [ unparsable ] 
 PASS conic-gradient(black, white, 75%) [ unparsable ] 
-FAIL conic-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS conic-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS conic-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS conic-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS conic-gradient(,black, white) [ unparsable ] 
@@ -136,7 +136,7 @@
 PASS repeating-conic-gradient(black, invalid) [ unparsable ] 
 PASS repeating-conic-gradient(black, , white) [ unparsable ] 
 PASS repeating-conic-gradient(black, white, 75%) [ unparsable ] 
-FAIL repeating-conic-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS repeating-conic-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS repeating-conic-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS repeating-conic-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS repeating-conic-gradient(,black, white) [ unparsable ] 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (251473 => 251474)


--- trunk/LayoutTests/platform/mac/TestExpectations	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2019-10-23 03:51:33 UTC (rev 251474)
@@ -1729,6 +1729,7 @@
 [ Mojave+ ] fast/gradients/conic-gradient-extended-stops.html [ Pass ]
 [ Mojave+ ] fast/gradients/conic-gradient.html [ Pass ]
 [ Mojave+ ] fast/gradients/conic-two-hints.html [ Pass ]
+[ Mojave+ ] imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html [ Pass ]
 
 # Dark Mode is Mojave and later.
 [ Mojave+ ] css-dark-mode [ Pass ]
@@ -2023,4 +2024,4 @@
 
 webkit.org/b/198867 [ Mojave+ ] webgl/many-contexts.html [ Skip ]
 
-webkit.org/b/203171 inspector/layers/layers-for-node.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/203171 inspector/layers/layers-for-node.html [ Pass Failure ]

Modified: trunk/LayoutTests/platform/mac-highsierra/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt (251473 => 251474)


--- trunk/LayoutTests/platform/mac-highsierra/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/LayoutTests/platform/mac-highsierra/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt	2019-10-23 03:51:33 UTC (rev 251474)
@@ -6,7 +6,7 @@
 PASS linear-gradient(black, invalid) [ unparsable ] 
 PASS linear-gradient(black, , white) [ unparsable ] 
 PASS linear-gradient(black, white, 75%) [ unparsable ] 
-FAIL linear-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS linear-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS linear-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS linear-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS linear-gradient(,black, white) [ unparsable ] 
@@ -32,7 +32,7 @@
 PASS repeating-linear-gradient(black, invalid) [ unparsable ] 
 PASS repeating-linear-gradient(black, , white) [ unparsable ] 
 PASS repeating-linear-gradient(black, white, 75%) [ unparsable ] 
-FAIL repeating-linear-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS repeating-linear-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS repeating-linear-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS repeating-linear-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS repeating-linear-gradient(,black, white) [ unparsable ] 
@@ -58,7 +58,7 @@
 PASS radial-gradient(black, invalid) [ unparsable ] 
 PASS radial-gradient(black, , white) [ unparsable ] 
 PASS radial-gradient(black, white, 75%) [ unparsable ] 
-FAIL radial-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS radial-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS radial-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS radial-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS radial-gradient(,black, white) [ unparsable ] 
@@ -84,7 +84,7 @@
 PASS repeating-radial-gradient(black, invalid) [ unparsable ] 
 PASS repeating-radial-gradient(black, , white) [ unparsable ] 
 PASS repeating-radial-gradient(black, white, 75%) [ unparsable ] 
-FAIL repeating-radial-gradient(black, 25% 50%, white) [ unparsable ] assert_equals: expected false but got true
+PASS repeating-radial-gradient(black, 25% 50%, white) [ unparsable ] 
 PASS repeating-radial-gradient(black, 25%, 50%, white) [ unparsable ] 
 PASS repeating-radial-gradient(black 10% 25% 50%, white) [ unparsable ] 
 PASS repeating-radial-gradient(,black, white) [ unparsable ] 

Modified: trunk/Source/WebCore/ChangeLog (251473 => 251474)


--- trunk/Source/WebCore/ChangeLog	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/Source/WebCore/ChangeLog	2019-10-23 03:51:33 UTC (rev 251474)
@@ -1,3 +1,22 @@
+2019-10-22  Simon Fraser  <simon.fra...@apple.com>
+
+        wpt/css/css-images/gradient/color-stops-parsing.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=200211
+
+        Reviewed by Dean Jackson.
+
+        CSS gradients allow a single color stop to have multiple positions. In this case
+        we need to copy the color from the first to subsequent stops.
+
+        Tested by web-platform-tests/css/css-images/gradient/color-stops-parsing.html
+        and imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html.
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientValue::gradientWithStylesResolved): Copy colors to subsequent stops.
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops): Fix the parsing of
+        stops with multiple positions.
+
 2019-10-22  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Implement support for new ARIA roles: code, strong, emphasis, generic

Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (251473 => 251474)


--- trunk/Source/WebCore/css/CSSGradientValue.cpp	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp	2019-10-23 03:51:33 UTC (rev 251474)
@@ -107,7 +107,7 @@
 {
     bool colorIsDerivedFromElement = false;
     for (auto& stop : m_stops) {
-        if (!stop.isMidpoint && styleResolver.colorFromPrimitiveValueIsDerivedFromElement(*stop.m_color)) {
+        if (!stop.isMidpoint && stop.m_color && styleResolver.colorFromPrimitiveValueIsDerivedFromElement(*stop.m_color)) {
             stop.m_colorIsDerivedFromElement = true;
             colorIsDerivedFromElement = true;
             break;
@@ -114,9 +114,18 @@
         }
     }
     auto result = colorIsDerivedFromElement ? clone(*this) : makeRef(*this);
-    for (auto& stop : result->m_stops) {
-        if (!stop.isMidpoint)
+    for (size_t i = 0; i < result->m_stops.size(); ++i) {
+        auto& stop = result->m_stops[i];
+        if (stop.isMidpoint)
+            continue;
+        if (stop.m_color)
             stop.m_resolvedColor = styleResolver.colorFromPrimitiveValue(*stop.m_color);
+        else if (i) {
+            auto& previousStop = result->m_stops[i - 1];
+            ASSERT(previousStop.m_color);
+            stop.m_color = previousStop.m_color;
+            stop.m_resolvedColor = previousStop.m_resolvedColor;
+        }
     }
     return result;
 }

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (251473 => 251474)


--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2019-10-23 03:27:49 UTC (rev 251473)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2019-10-23 03:51:33 UTC (rev 251474)
@@ -1072,9 +1072,12 @@
         
         if (!stop.m_color && !stop.m_position)
             return false;
+
         gradient.addStop(stop);
-        
-        // See if there is a second color hint, which is optional.
+
+        if (!stop.m_color || !stop.m_position)
+            continue;
+
         CSSGradientColorStop secondStop;
         if (isConicGradient)
             secondStop.m_position = consumeAngleOrPercent(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Forbid);
@@ -1081,10 +1084,8 @@
         else
             secondStop.m_position = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll);
         
-        if (secondStop.m_position) {
-            secondStop.m_color = stop.m_color;
+        if (secondStop.m_position)
             gradient.addStop(secondStop);
-        }
         
     } while (consumeCommaIncludingWhitespace(range));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to