wpt/css/css-images/gradient/color-stops-parsing.html fails
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2019 03:51:33 +0000 (03:51 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2019 03:51:33 +0000 (03:51 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251474 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt
LayoutTests/platform/mac-highsierra/imported/w3c/web-platform-tests/css/css-images/gradient/color-stops-parsing-expected.txt
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

index bb87cad..a2dc207 100644 (file)
@@ -1,3 +1,15 @@
+2019-10-22  Simon Fraser  <simon.fraser@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  <jdiggs@igalia.com>
 
         AX: Implement support for new ARIA roles: code, strong, emphasis, generic
index 6b1ef73..b99104f 100644 (file)
@@ -3644,6 +3644,7 @@ fast/gradients/conic-gradient-alpha.html [ Skip ]
 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-fal
 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 ]
index 35b64c6..41ec1bd 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-22  Simon Fraser  <simon.fraser@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  <sabouhallawa@apple.com>
 
         [SVG2] Remove the 'viewTarget' property of SVGViewElement
index 2ebec3e..417c40c 100644 (file)
@@ -6,7 +6,7 @@ PASS linear-gradient(black, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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 ] 
index 7149731..ce391b6 100644 (file)
@@ -6,7 +6,7 @@ PASS linear-gradient(black, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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, 25%) [ unparsable ]
 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 ] 
index 07384d1..ddb2805 100644 (file)
@@ -1729,6 +1729,7 @@ webkit.org/b/187393 imported/w3c/web-platform-tests/2dcontext/imagebitmap/create
 [ 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/202598 imported/w3c/web-platform-tests/2dcontext/line-styles/2d.lin
 
 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 ]
index 56a15a4..d42468d 100644 (file)
@@ -1,3 +1,22 @@
+2019-10-22  Simon Fraser  <simon.fraser@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  <jdiggs@igalia.com>
 
         AX: Implement support for new ARIA roles: code, strong, emphasis, generic
index 5e3f4e7..73298cd 100644 (file)
@@ -107,16 +107,25 @@ Ref<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(const StyleRe
 {
     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;
         }
     }
     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;
 }
index 18153a4..f1699e7 100644 (file)
@@ -1072,19 +1072,20 @@ static bool consumeGradientColorStops(CSSParserTokenRange& range, CSSParserMode
         
         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);
         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));